diff --git a/src/api/paths.cpp b/src/api/paths.cpp index cb142eaa..59e0e508 100644 --- a/src/api/paths.cpp +++ b/src/api/paths.cpp @@ -4,6 +4,9 @@ /** * Blocks **/ + +const char* Ark::Client::API::Paths::Blocks::base() { return "/api/v2/blocks"; } + std::string Ark::Client::API::Paths::Blocks::get(Host& newHost, const char *const blockId) { char url[128] = {}; @@ -43,9 +46,9 @@ std::pair Ark::Client::API::Paths::Blocks::search( char uri[96] = { }; snprintf(uri, sizeof(uri), "%s%s/search?limit=%d&page=%d", newHost.toString().c_str(), Ark::Client::API::Paths::Blocks::base(), limit, page); std::string parameterBuffer; - int count = 0; + auto count = 0ul; for (const auto& p : bodyParameters) { - count++; + ++count; parameterBuffer += p.first + '=' + p.second; if (bodyParameters.size() > 1 && count < bodyParameters.size()) { parameterBuffer += '&'; @@ -59,6 +62,9 @@ std::pair Ark::Client::API::Paths::Blocks::search( /** * Delegates **/ + +const char* Ark::Client::API::Paths::Delegates::base() { return "/api/v2/delegates"; } + std::string Ark::Client::API::Paths::Delegates::get(Host& newHost, const char *const identifier) { char url[128] = {}; @@ -107,8 +113,11 @@ std::string Ark::Client::API::Paths::Delegates::voters( /******/ /** - * Delegates + * Node **/ + +const char* Ark::Client::API::Paths::Node::base() { return "/api/v2/node"; } + std::string Ark::Client::API::Paths::Node::configuration(Host& newHost) { char url[128] = {}; @@ -139,6 +148,9 @@ std::string Ark::Client::API::Paths::Node::syncing(Host& newHost) /** * Peers **/ + +const char* Ark::Client::API::Paths::Peers::base() { return "/api/v2/peers"; } + std::string Ark::Client::API::Paths::Peers::get(Host& newHost, const char *const ip) { char url[128] = {}; @@ -163,6 +175,9 @@ std::string Ark::Client::API::Paths::Peers::all( /** * Transactions **/ + +const char* Ark::Client::API::Paths::Transactions::base() { return "/api/v2/transactions"; } + std::string Ark::Client::API::Paths::Transactions::getUnconfirmed( Host& newHost, const char *const identifier @@ -228,9 +243,9 @@ std::pair Ark::Client::API::Paths::Transactions::searc char uri[96] = { }; snprintf(uri, sizeof(uri), "%s%s/search?limit=%d&page=%d", newHost.toString().c_str(), Ark::Client::API::Paths::Transactions::base(), limit, page); std::string parameterBuffer; - int count = 0; + auto count = 0ul; for (const auto& p : bodyParameters) { - count++; + ++count; parameterBuffer += p.first + '=' + p.second; if (bodyParameters.size() > 1 && count < bodyParameters.size()) { parameterBuffer += '&'; @@ -244,6 +259,9 @@ std::pair Ark::Client::API::Paths::Transactions::searc /** * Votes **/ + +const char* Ark::Client::API::Paths::Votes::base() { return "/api/v2/votes"; } + std::string Ark::Client::API::Paths::Votes::get(Host& newHost, const char *const identifier) { char url[128] = { }; @@ -268,6 +286,9 @@ std::string Ark::Client::API::Paths::Votes::all( /** * Wallets **/ + +const char* Ark::Client::API::Paths::Wallets::base() { return "/api/v2/wallets"; } + std::string Ark::Client::API::Paths::Wallets::get( Host& newHost, const char *const identifier @@ -364,9 +385,9 @@ std::pair Ark::Client::API::Paths::Wallets::search( char uri[96] = { }; snprintf(uri, sizeof(uri), "%s%s/search?limit=%d&page=%d", newHost.toString().c_str(), Ark::Client::API::Paths::Wallets::base(), limit, page); std::string parameterBuffer; - int count = 0; + auto count = 0ul; for (const auto& p : bodyParameters) { - count++; + ++count; parameterBuffer += p.first + '=' + p.second; if (bodyParameters.size() > 1 && count < bodyParameters.size()) { parameterBuffer += '&'; diff --git a/src/include/cpp-client/api/paths.h b/src/include/cpp-client/api/paths.h index fcbc31c2..aefd56c2 100644 --- a/src/include/cpp-client/api/paths.h +++ b/src/include/cpp-client/api/paths.h @@ -23,7 +23,7 @@ namespace Paths { namespace Blocks { - static const char* base() { return "/api/v2/blocks"; }; + extern const char* base(); /***/ extern std::string get(Host& newHost, const char *const blockId); /***/ @@ -39,7 +39,7 @@ namespace Blocks namespace Delegates { - static const char* base() { return "/api/v2/delegates"; }; + extern const char* base(); /***/ extern std::string get(Host& newHost, const char *const identifier); /***/ @@ -55,7 +55,7 @@ namespace Delegates namespace Node { - static const char* base() { return "/api/v2/node"; }; + extern const char* base(); /***/ extern std::string configuration(Host& newHost); /***/ @@ -69,7 +69,7 @@ namespace Node namespace Peers { - static const char* base() { return "/api/v2/peers"; }; + extern const char* base(); /***/ extern std::string get(Host& newHost, const char *const ip); /***/ @@ -81,7 +81,7 @@ namespace Peers namespace Transactions { - static const char* base() { return "/api/v2/transactions"; }; + extern const char* base(); /***/ extern std::string getUnconfirmed(Host& newHost, const char *const identifier); /***/ @@ -101,7 +101,7 @@ namespace Transactions namespace Votes { - static const char* base() { return "/api/v2/votes"; }; + extern const char* base(); /***/ extern std::string get(Host& newHost, const char *const identifier); /***/ @@ -113,7 +113,7 @@ namespace Votes namespace Wallets { - static const char* base() { return "/api/v2/wallets"; }; + extern const char* base(); /***/ extern std::string get(Host& newHost, const char *const identifier); /***/