diff options
Diffstat (limited to 'src/web_service/web_backend.h')
| -rw-r--r-- | src/web_service/web_backend.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/web_service/web_backend.h b/src/web_service/web_backend.h index d17100398..a63c75d13 100644 --- a/src/web_service/web_backend.h +++ b/src/web_service/web_backend.h | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <functional> | ||
| 8 | #include <future> | ||
| 7 | #include <string> | 9 | #include <string> |
| 8 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 9 | 11 | ||
| @@ -20,4 +22,18 @@ namespace WebService { | |||
| 20 | void PostJson(const std::string& url, const std::string& data, bool allow_anonymous, | 22 | void PostJson(const std::string& url, const std::string& data, bool allow_anonymous, |
| 21 | const std::string& username = {}, const std::string& token = {}); | 23 | const std::string& username = {}, const std::string& token = {}); |
| 22 | 24 | ||
| 25 | /** | ||
| 26 | * Gets JSON from services.citra-emu.org. | ||
| 27 | * @param func A function that gets exectued when the json as a string is received | ||
| 28 | * @param url URL of the services.citra-emu.org endpoint to post data to. | ||
| 29 | * @param allow_anonymous If true, allow anonymous unauthenticated requests. | ||
| 30 | * @param username Citra username to use for authentication. | ||
| 31 | * @param token Citra token to use for authentication. | ||
| 32 | * @return future that holds the return value T of the func | ||
| 33 | */ | ||
| 34 | template <typename T> | ||
| 35 | std::future<T> GetJson(std::function<T(const std::string&)> func, const std::string& url, | ||
| 36 | bool allow_anonymous, const std::string& username = {}, | ||
| 37 | const std::string& token = {}); | ||
| 38 | |||
| 23 | } // namespace WebService | 39 | } // namespace WebService |