Skip to content

Commit

Permalink
Remove limit on list_authorized_users
Browse files Browse the repository at this point in the history
  • Loading branch information
irfanghat committed Nov 18, 2024
1 parent 1d47bbd commit 6bcb509
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
5 changes: 3 additions & 2 deletions librender_cdk/src/authorization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ size_t WriteCallback(void *contents, size_t size, size_t nmemb,
} // namespace

std::vector<OwnerResponse>
AuthorizationManager::list_authorized_users(const std::string &email,
const std::string &limit) {
AuthorizationManager::list_authorized_users(const std::string &email) {
CURL *curl = curl_easy_init();
std::vector<OwnerResponse> ownerResponses;

std::string limit = "100";

if (curl) {
std::string response;
std::string api_url = base_url + "/owners?limit=" + limit;
Expand Down
3 changes: 1 addition & 2 deletions librender_cdk/src/authorization.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class AuthorizationManager {
public:
AuthorizationManager(const std::string &api_key) : api_key_(api_key) {}

std::vector<OwnerResponse> list_authorized_users(const std::string &email,
const std::string &limit);
std::vector<OwnerResponse> list_authorized_users(const std::string &email);

private:
std::string api_key_;
Expand Down
10 changes: 4 additions & 6 deletions librender_cdk/src/debug-build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ int test_create_service() {
// variables.
AuthorizationManager auth_manager(config.api_key);

// Set the owner email and limit (as request parameters).
// Set the owner email (as a request parameter).
std::string email = config.owner_credentials;
std::string limit = "10";

// Get a list of authorized users.
auto authorized_users = auth_manager.list_authorized_users(email, limit);
auto authorized_users = auth_manager.list_authorized_users(email);

// Find the owner with the matching email, <owner credentials>.
std::string owner_id;
Expand Down Expand Up @@ -146,12 +145,11 @@ int test_list_authorized_users() {
// variables.
AuthorizationManager auth_manager(config.api_key);

// Set the owner email and limit (as request parameters).
// Set the owner email (as a request parameter).
std::string email = config.owner_credentials;
std::string limit = "10";

// Get a list of authorized users.
auto authorized_users = auth_manager.list_authorized_users(email, limit);
auto authorized_users = auth_manager.list_authorized_users(email);

// Process the response and print output for debugging.
// if (!authorized_users.empty()) {
Expand Down
7 changes: 3 additions & 4 deletions tests/unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int test_retrieve_authorized_user() {
try {
Config config = load_config();
AuthorizationManager auth_manager(config.api_key);
auth_manager.list_authorized_users(config.owner_credentials, "10");
auth_manager.list_authorized_users(config.owner_credentials);
} catch (const std::exception &e) {
std::cerr << "Error: " << e.what() << "\n";
return 1;
Expand All @@ -24,10 +24,9 @@ int test_create_service() {
}

AuthorizationManager auth_manager(config.api_key);
std::string email = config.owner_credentials;
std::string limit = "10";

auto authorized_users = auth_manager.list_authorized_users(email, limit);
auto authorized_users =
auth_manager.list_authorized_users(config.owner_credentials);

std::string owner_id;

Expand Down

0 comments on commit 6bcb509

Please sign in to comment.