mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-22 10:07:29 -05:00
* No longer provide multiple HTTP helper functions with the same name * Default to cache not being used * Explicitly use the cache for certain Twitch actions and conditions * Clear caches on shutdown to avoid leaks being reported
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
#pragma once
|
|
#include <httplib.h>
|
|
#include <obs.hpp>
|
|
#include <string>
|
|
#include <chrono>
|
|
|
|
namespace advss {
|
|
|
|
class TwitchToken;
|
|
|
|
struct RequestResult {
|
|
int status = 0;
|
|
OBSData data = nullptr;
|
|
};
|
|
|
|
const char *GetClientID();
|
|
|
|
// These functions can cache the RequestResult for 10s
|
|
|
|
RequestResult SendGetRequest(const TwitchToken &token, const std::string &uri,
|
|
const std::string &path,
|
|
const httplib::Params ¶ms = {},
|
|
bool useCache = false);
|
|
RequestResult SendPostRequest(const TwitchToken &token, const std::string &uri,
|
|
const std::string &path,
|
|
const httplib::Params ¶ms = {},
|
|
const OBSData &data = nullptr,
|
|
bool useCache = false);
|
|
RequestResult SendPutRequest(const TwitchToken &token, const std::string &uri,
|
|
const std::string &path,
|
|
const httplib::Params ¶ms = {},
|
|
const OBSData &data = nullptr,
|
|
bool useCache = false);
|
|
RequestResult SendPatchRequest(const TwitchToken &token, const std::string &uri,
|
|
const std::string &path,
|
|
const httplib::Params ¶ms = {},
|
|
const OBSData &data = nullptr,
|
|
bool useCache = false);
|
|
|
|
// Helper functions to set temp var values
|
|
|
|
void SetJsonTempVars(const std::string &jsonStr,
|
|
std::function<void(const char *, const char *)> setVarFunc);
|
|
void SetJsonTempVars(obs_data_t *data,
|
|
std::function<void(const char *, const char *)> setVarFunc);
|
|
|
|
} // namespace advss
|