12#include "lib/ynput/lib/logging/AyonLogger.hpp"
15#include "nlohmann/json_fwd.hpp"
28 AyonApi(
const std::optional<std::string> &logFilePos,
29 const std::string &authKey,
30 const std::string &serverUrl,
31 const std::string &ayonProjectName,
32 const std::string &siteId,
33 std::optional<int> concurrency = std::nullopt);
57 nlohmann::json
GET(
const std::shared_ptr<std::string> endPoint,
58 const std::shared_ptr<httplib::Headers> headers,
59 uint8_t sucsessStatus);
69 nlohmann::json
SPOST(
const std::shared_ptr<std::string> endPoint,
70 const std::shared_ptr<httplib::Headers> headers,
71 nlohmann::json jsonPayload,
72 const std::shared_ptr<uint8_t> sucsessStatus);
81 nlohmann::json
CPOST(
const std::shared_ptr<std::string> endPoint,
82 const std::shared_ptr<httplib::Headers> headers,
83 nlohmann::json jsonPayload,
84 const std::shared_ptr<uint8_t> sucsessStatus);
92 std::pair<std::string, std::string>
resolvePath(
const std::string &uriPath);
98 std::unordered_map<std::string, std::string>
batchResolvePath(std::vector<std::string> &uriPaths);
106 std::pair<std::string, std::string>
getAssetIdent(
const nlohmann::json &uriResolverRespone);
125 std::unordered_map<std::string, std::string>*
134 std::string
rootReplace(
const std::string &rootLessPath);
146 httplib::Headers headers,
147 std::string &Payload,
148 const int &sucsessStatus);
158 httplib::Headers headers,
159 std::string &Payload,
160 const int &sucsessStatus);
Central Ayon api class Class for exposing Ayon server functions to C++ users.
Definition: AyonCppApi.h:23
uint16_t m_regroupSizeForAsyncRequests
Definition: AyonCppApi.h:186
std::string getUrl()
returns the stored AYON server url.
Definition: AyonCppApi.cpp:436
std::string m_uriResolverEndpoint
Definition: AyonCppApi.h:197
std::string serialCorePost(const std::string &endPoint, httplib::Headers headers, std::string &Payload, const int &sucsessStatus)
calls the server in an serial way by sharing the AyonServer pointer
Definition: AyonCppApi.cpp:444
std::string rootReplace(const std::string &rootLessPath)
replaces {root[var]} for ayon:// paths
Definition: AyonCppApi.cpp:111
bool loadEnvVars()
this function loads all needed varible into the class this will allso be called by the constructor
nlohmann::json CPOST(const std::shared_ptr< std::string > endPoint, const std::shared_ptr< httplib::Headers > headers, nlohmann::json jsonPayload, const std::shared_ptr< uint8_t > sucsessStatus)
http post request utilizing the creation of a new httplib client ( Generative Async )
Definition: AyonCppApi.cpp:225
bool m_serverBusy
this bool will be set to true if a 503 is encountered
Definition: AyonCppApi.h:220
std::unordered_map< std::string, std::string > m_siteRoots
Definition: AyonCppApi.h:172
std::string GenerativeCorePost(const std::string &endPoint, httplib::Headers headers, std::string &Payload, const int &sucsessStatus)
calls the server while creating a new client instance to stay async
Definition: AyonCppApi.cpp:488
std::shared_ptr< AyonLogger > m_Log
Definition: AyonCppApi.h:196
uint16_t m_RequestDelayWhenServerBusy
Definition: AyonCppApi.h:215
std::unordered_map< std::string, std::string > * getSiteRoots()
gets the site root overwrites for the current project.
Definition: AyonCppApi.cpp:91
std::pair< std::string, std::string > resolvePath(const std::string &uriPath)
uses the uri resolve endpoint on the AYON server in order to resolve an uri path towards the local pa...
Definition: AyonCppApi.cpp:257
std::mutex m_ConcurentRequestAfterffoMutex
Definition: AyonCppApi.h:201
uint16_t m_GenerativeCorePostMaxLoopIterations
Definition: AyonCppApi.h:204
uint16_t m_connectionTimeOutMax
Definition: AyonCppApi.h:206
std::string m_userName
Definition: AyonCppApi.h:180
std::mutex m_AyonServerMutex
needed for serial resolve operations.
Definition: AyonCppApi.h:225
const int m_num_threads
maximum number off threads that the cpu can handle at the same time.
Definition: AyonCppApi.h:195
uint16_t m_ServerBusyCode
Definition: AyonCppApi.h:214
uint8_t m_maxConcurentRequestAfterffo
Definition: AyonCppApi.h:202
nlohmann::json GET(const std::shared_ptr< std::string > endPoint, const std::shared_ptr< httplib::Headers > headers, uint8_t sucsessStatus)
runns a get command and returns the response body as std::string
Definition: AyonCppApi.cpp:145
std::string m_ayonProjectName
Definition: AyonCppApi.h:176
uint16_t m_minVecSizeForGroupSplitAsyncRequests
Definition: AyonCppApi.h:188
bool m_pathOnlyReselution
Definition: AyonCppApi.h:199
const std::string m_authKey
Definition: AyonCppApi.h:174
std::string convertUriVecToString(const std::vector< std::string > &uriVec)
converts a vector off uris into an string to serve into CorePost funcs
Definition: AyonCppApi.cpp:582
std::unordered_map< std::string, std::string > batchResolvePath(std::vector< std::string > &uriPaths)
resolves a vector off paths against the AYON server in an async way uses auto generated batch request...
Definition: AyonCppApi.cpp:279
nlohmann::json SPOST(const std::shared_ptr< std::string > endPoint, const std::shared_ptr< httplib::Headers > headers, nlohmann::json jsonPayload, const std::shared_ptr< uint8_t > sucsessStatus)
post Request via a shared httplib client ( serial )
Definition: AyonCppApi.cpp:187
std::pair< std::string, std::string > getAssetIdent(const nlohmann::json &uriResolverRespone)
this function takes a ayon path uri response(resolved ayon://path) and returns a pair of assetIdentif...
Definition: AyonCppApi.cpp:406
std::string getKey()
returns the stored apikey.
Definition: AyonCppApi.cpp:429
bool m_batchResolveOptimizeVector
decides if the cpp api removes duplicates from batch request vector default is true
Definition: AyonCppApi.h:212
~AyonApi()
destructor
Definition: AyonCppApi.cpp:86
uint8_t m_maxCallRetrys
Definition: AyonCppApi.h:189
uint8_t m_readTimeOutMax
Definition: AyonCppApi.h:207
std::string m_uriResolverEndpointPathOnlyVar
Definition: AyonCppApi.h:198
std::unique_ptr< httplib::Client > m_AyonServer
Definition: AyonCppApi.h:170
uint16_t m_maxGroupSizeForAsyncRequests
Definition: AyonCppApi.h:187
uint8_t m_minGrpSizeForAsyncRequests
Definition: AyonCppApi.h:185
uint16_t m_retryWaight
Definition: AyonCppApi.h:190
const std::string m_serverUrl
Definition: AyonCppApi.h:175
std::string m_siteId
Definition: AyonCppApi.h:179
std::shared_ptr< AyonLogger > logPointer()
get function for shared AyonLogger pointer used by this class instance
Definition: AyonCppApi.cpp:599