From a97263e8076d782cd30c966bacffb9d73923462a Mon Sep 17 00:00:00 2001 From: Dread <42398281+D7EAD@users.noreply.github.com> Date: Wed, 24 Nov 2021 21:47:05 -0500 Subject: [PATCH] Rollback v1.1 --- vs/CoinGecko/gecko.h | 76 ++++++++++++++++++++++---------------------- vs/CoinGecko/web.h | 24 ++++---------- 2 files changed, 45 insertions(+), 55 deletions(-) diff --git a/vs/CoinGecko/gecko.h b/vs/CoinGecko/gecko.h index e127a93..954a455 100644 --- a/vs/CoinGecko/gecko.h +++ b/vs/CoinGecko/gecko.h @@ -29,58 +29,58 @@ namespace gecko { // Purpose: main class used to access all function classes // Status: functional - ping() untested class api : private web { - public: - // object for user to access the CoinGecko API 'simple' functions. - simpleFunctions simple; + public: + // object for user to access the CoinGecko API 'simple' functions. + simpleFunctions simple; - // ... 'coins' functions ... - coinsFunctions coins; + // ... 'coins' functions ... + coinsFunctions coins; - // ... 'contract' functions ... - contractFunctions contract; + // ... 'contract' functions ... + contractFunctions contract; - // ... 'exchanges' functions ... - exchangesFunctions exchanges; + // ... 'exchanges' functions ... + exchangesFunctions exchanges; - // ... 'finance' functions ... - financeFunctions finance; + // ... 'finance' functions ... + financeFunctions finance; - // ... 'indexes' functions ... - indexesFunctions indexes; + // ... 'indexes' functions ... + indexesFunctions indexes; - // ... 'derivatives' functions ... - derivativesFunctions derivatives; + // ... 'derivatives' functions ... + derivativesFunctions derivatives; - // ... 'status_updates' functions ... - status_updatesFunctions status_updates; + // ... 'status_updates' functions ... + status_updatesFunctions status_updates; - // ... 'events' functions ... - eventsFunctions events; + // ... 'events' functions ... + eventsFunctions events; - // ... 'exchanges_rates' functions ... - exchange_ratesFunctions exchange_rates; + // ... 'exchanges_rates' functions ... + exchange_ratesFunctions exchange_rates; - // ... 'trending' functions ... - trendingFunctions trending; + // ... 'trending' functions ... + trendingFunctions trending; - // ... 'global' functions ... - globalFunctions global; + // ... 'global' functions ... + globalFunctions global; - // ... 'asset_platforms' functions ... - assetPlatformsFunctions asset_platforms; + // ... 'asset_platforms' functions ... + assetPlatformsFunctions asset_platforms; - // ... 'companies' functions ... - companiesFunctions companies; + // ... 'companies' functions ... + companiesFunctions companies; - // ... 'categories' functions ... - categoriesFunctions categories; + // ... 'categories' functions ... + categoriesFunctions categories; - // Action: checks status of CoinGecko API - // Returns: true/false (online/offline) - // Refer: https://www.coingecko.com/api/documentations/v3 - // Example: - // if (ping()) { ... } else { ... } - // Notes: should be checked before using any API functions - DllExport bool ping(); // just one function for 'ping', might as well put it in api. + // Action: checks status of CoinGecko API + // Returns: true/false (online/offline) + // Refer: https://www.coingecko.com/api/documentations/v3 + // Example: + // if (ping()) { ... } else { ... } + // Notes: should be checked before using any API functions + DllExport bool ping(); // just one function for 'ping', might as well put it in api. }; } \ No newline at end of file diff --git a/vs/CoinGecko/web.h b/vs/CoinGecko/web.h index dec7ba0..7d0b9fc 100644 --- a/vs/CoinGecko/web.h +++ b/vs/CoinGecko/web.h @@ -6,7 +6,6 @@ #include #include #include -#include // reminds you of MS' __in and __in_opt, huh? ;) #define OPTIONAL @@ -17,25 +16,16 @@ namespace gecko { // Purpose: class interface used internally(privately) by *functions class methods to send requests to the CoinGecko endpoint. class web { public: - // class that is returned to the user by *functions class methods so they don't have to deal with the whole CPR object -- unless they want - class response { - public: - response( - std::string _text, - std::string _response_code, - std::string _url, - cpr::Response _cURL_Object - ) : text(_text), response_code(_response_code), url(_url), cURL_Object(_cURL_Object), json(nlohmann::json::parse(_text)) {} - - std::string text; - std::string response_code; - std::string url; - cpr::Response cURL_Object; - nlohmann::json json; + // struct that is returned to the user by *functions class methods so they don't have to deal with the whole CPR object -- unless they want + typedef struct response { + std::string text; + std::string response_code; + std::string url; + cpr::Response cURL_Object; }; // function for sending GET request to API at 'this->endpoint+endpointPath' with optional parameters. - cpr::Response request ( + cpr::Response request( REQUIRED std::string endpointPath, OPTIONAL cpr::Parameters* parameters );