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.

request.hpp 654B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include <string>
  3. #include <jansson.h>
  4. namespace rack {
  5. enum RequestMethod {
  6. METHOD_GET,
  7. METHOD_POST,
  8. METHOD_PUT,
  9. METHOD_DELETE,
  10. };
  11. /** Requests a JSON API URL over HTTP(S), using the data as the query (GET) or the body (POST, etc) */
  12. json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ);
  13. /** Returns the filename, blank if unsuccessful */
  14. bool requestDownload(std::string url, std::string filename, float *progress);
  15. /** URL-encodes `s` */
  16. std::string requestEscape(std::string s);
  17. /** Computes the SHA256 of the file at `filename` */
  18. std::string requestSHA256File(std::string filename);
  19. } // namespace rack