You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
532B

  1. #pragma once
  2. #include <string>
  3. #include <jansson.h>
  4. enum RequestMethod {
  5. GET_METHOD,
  6. POST_METHOD,
  7. PUT_METHOD,
  8. DELETE_METHOD,
  9. };
  10. /** Must be called before using this API */
  11. void requestInit();
  12. void requestDestroy();
  13. /** Requests a JSON API URL over HTTP(S), using the data as the query (GET) or the body (POST, etc) */
  14. json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ);
  15. /** Returns the filename, blank if unsuccessful */
  16. bool requestDownload(std::string url, std::string filename, float *progress);