aboutsummaryrefslogtreecommitdiff
path: root/backends/networking/curl/curljsonrequest.h
AgeCommit message (Collapse)Author
2019-10-24NETWORKING: Changed PostRequest to accept JSONValueEugene Sandulenko
2016-09-03JANITORIAL: Make GPL headers uniformEugene Sandulenko
2016-08-24CLOUD: Update OneDriveAlexander Tkachev
Added JSON checks. New jsonContainsObject() method added to CurlJsonRequest.
2016-08-24CLOUD: Upload ListDirectory RequestsAlexander Tkachev
Lots of checks to avoid JSON-related segfaults added.
2016-08-24CLOUD: Update BoxListDirectoryByIdRequestAlexander Tkachev
It now uses special CurlJsonRequest static methods to check whether JSON is an object, has a string or integer parameter.
2016-08-24JANITORIAL: Remove spaces at the end of the lineAlexander Tkachev
I knew there were some, but I wanted to fix them once, instead of doing it all the time.
2016-08-24CLOUD: Update CurlJsonRequestAlexander Tkachev
Uses dynamically allocated buffer now.
2016-08-24CLOUD: Fix finishSuccess() warningAlexander Tkachev
2016-08-24CLOUD: Refactor RequestAlexander Tkachev
Added ErrorResponse and ErrorCallback. Each Request now has an ErrorCallback, which should be called instead of usual callback in case of failure.
2016-08-24Fix comment formattingPeter Bozsó
2016-08-24CLOUD: Simplify OneDriveTokenRefresherAlexander Tkachev
It now just extends CurlJsonRequest, not wraps one.
2016-08-24CLOUD: Refactor ConnectionManager/Requests systemAlexander Tkachev
ConnectionManager now storages Request * (not generates ids for it), Requests have control on their RequestState, RequestIdPair is now called Response and storages Request * with some response together. All related classes are changed to use it in more clean and understandable way. Request, RequestState and Response are carefully commented/documented.
2016-08-24CLOUD: Make OneDriveStorage::download() work fineAlexander Tkachev
Well, it takes two API calls instead of one now, but there are no problems with expired token because of it. This commit changes Storage::streamFile() to pass NetworkReadStream * through callback.
2016-08-24CLOUD: Add OneDriveTokenRefresherAlexander Tkachev
OneDriveTokenRefresher is a CurlJsonRequest replacement for OneDriveStorage methods. It behaves very similarly, but checks received JSON before passing it to user. If it contains "error" key, it attempts to refresh the token through OneDriveStorage, and then restarts the original request, so user won't notice that there ever was an error.
2016-08-24CLOUD: Fix CurlJsonRequest to use JsonCallbackAlexander Tkachev
Type safety first.
2016-08-24CLOUD: Change Request::handle()Alexander Tkachev
With new ConnectionManager upgrade Requests indicate that they are finished with RequestInfo.state. No need to use handle() return value anymore.
2016-08-24CLOUD: Add RequestIdPair structAlexander Tkachev
Can be used with Callback<T> (means it's still type safe). It's used to pass not only Request id to user's callback, but also a value user wanted. void *data field is removed from RequestInfo.
2016-08-24CLOUD: Add DownloadRequest stubAlexander Tkachev
It reads the passed NetworkReadStream and prints its contents onto console (for now). It would be writing contents into file. To simplify work with raw NetworkReadStream there is a new CurlRequest. It basically does nothing, but as ConnMan handles transfers only if there is an active Request, you need some Request to get NetworkReadStream working. Thus, there is a CurlRequest, which is active until NetworkReadStream is completely read. CurlRequest also has useful addHeader() and addPostField() methods in order to customize the request easily. Use execute() method to get its NetworkReadStream. DropboxStorage implements streamFile() and download() API methods. As DownloadRequest is incomplete, it is not actually downloading a file, though.
2016-08-24CLOUD: Polish CallbacksAlexander Tkachev
Cleaned up all example code and old callbacks. New Callback classes are introduced in "common/callback.h" and documented.
2016-08-24CLOUD: Add CallbackBridgeAlexander Tkachev
This commit also adds GlobalFunctionCallback, because it was needed in order to replace plain C pointers to functions (which were used in Request) into our object-oriented BaseCallback pointers.
2016-08-24CLOUD: Add object-oriented CallbacksAlexander Tkachev
These callbacks can call object's methods, not some global C functions. DropboxStorage::info2() and DropboxStorage::infoMethodCallback() demonstrate the idea.
2016-08-24CLOUD: Make ConnectionManager singletonAlexander Tkachev
With ConnectionManager singleton one can start their Requests without creating Storage instance. Moreover, Storage instance should contain cloud API, not Requests-related handling and timer starting methods. Thus, these methods were moved into ConnectionManager itself.
2016-08-24CLOUD: Add Dropbox into CloudManager's configsAlexander Tkachev
This commit adds: * ConfMan's new "cloud" domain; * CloudManager's init() method, where it loads keys from "cloud" configs domain; * CurlJsonRequest's addHeader() and addPostField() methods; * temporary Storage's printInfo() method; * DropboxStorage's implementation of printInfo(), which is using access token and user id; * DropboxStorage's loadFromConfig() static method to load access token and user id from configs and create a Storage instance with those; * temporary DropboxStorage's authThroughConsole() static method, which guides user through auth process from the console. So, in CloudManager's init() implementation ScummVM checks that there is "current_storage_type" key in "cloud" domain of configs, and loads corresponding storage if there is such key. If there is no such key, ScummVM offers user to auth with Dropbox. That's done through console, and thus it's temporary (it also requires restarting ScummVM twice and manually editing config.ini file).
2016-08-24CLOUD: Fix CurlJsonRequestAlexander Tkachev
It's using MemoryWriteStreamDynamic instead of String and it prepares raw byte contents of this stream for JSON::parse().
2016-08-24CLOUD: Add CurlJsonRequestAlexander Tkachev
Now we can do REST API request by creating CurlJsonRequest and waiting for it to call our callback. Passed pointer is Common::JSONValue. This commit also does some minor variable renaming fixes.