-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re #6798 Workspace tree updated from ConfigDialog on apply
- Loading branch information
1 parent
13db2a6
commit 803cc0b
Showing
4 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#ifndef MANTID_KERNEL_GitHubApiHelper_H_ | ||
#define MANTID_KERNEL_GitHubApiHelper_H_ | ||
|
||
#include "MantidKernel/InternetHelper.h" | ||
|
||
namespace Mantid { | ||
namespace Kernel { | ||
|
||
/** GitHubApiHelper : A helper class for supporting access to the github api | ||
through HTTP and HTTPS, inherits from the InternetHelper. | ||
This class automatically adds the authorization to a read only account. | ||
Copyright © 2016 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge | ||
National Laboratory & European Spallation Source | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class MANTID_KERNEL_DLL GitHubApiHelper : public InternetHelper { | ||
public: | ||
GitHubApiHelper(); | ||
GitHubApiHelper(const Kernel::ProxyInfo &proxy); | ||
virtual ~GitHubApiHelper() = default; | ||
|
||
void reset() override; | ||
bool isAuthenticated(); | ||
|
||
protected: | ||
virtual void processResponseHeaders(const Poco::Net::HTTPResponse &res) override; | ||
virtual int sendRequestAndProcess(Poco::Net::HTTPClientSession &session, | ||
Poco::URI &uri, std::ostream &responseStream) override; | ||
private: | ||
int processAnonymousRequest(const Poco::Net::HTTPResponse &response, | ||
Poco::URI &uri, | ||
std::ostream &responseStream); | ||
void addAuthenticationToken() { | ||
addHeader("Authorization", | ||
"token 8ec7afc857540ee60af78cba1cf7779a6ed0b6b9"); | ||
} | ||
}; | ||
|
||
} // namespace Kernel | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_KERNEL_GitHubApiHelper_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters