Skip to content

Commit

Permalink
Rollback v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
D7EAD committed Nov 25, 2021
1 parent fee42d2 commit a97263e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 55 deletions.
76 changes: 38 additions & 38 deletions vs/CoinGecko/gecko.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
};
}
24 changes: 7 additions & 17 deletions vs/CoinGecko/web.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <map>
#include <memory>
#include <cpr/cpr.h>
#include <nlohmann/json.hpp>

// reminds you of MS' __in and __in_opt, huh? ;)
#define OPTIONAL
Expand All @@ -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
);
Expand Down

0 comments on commit a97263e

Please sign in to comment.