fix(api_key): fix api key list and update endpoints for v2 (#5980)

This commit is contained in:
Pa1NarK
2024-09-25 16:22:09 +05:30
committed by GitHub
parent dec0a57f76
commit cda690bf39
12 changed files with 214 additions and 47 deletions

View File

@ -183,6 +183,7 @@ Never share your secret api keys. Keep them guarded and secure.
routes::api_keys::api_key_retrieve,
routes::api_keys::api_key_update,
routes::api_keys::api_key_revoke,
routes::api_keys::api_key_list,
// Routes for events
routes::webhook_events::list_initial_webhook_delivery_attempts,

View File

@ -109,6 +109,7 @@ Never share your secret api keys. Keep them guarded and secure.
routes::api_keys::api_key_retrieve,
routes::api_keys::api_key_update,
routes::api_keys::api_key_revoke,
routes::api_keys::api_key_list,
//Routes for customers
routes::customers::customers_create,

View File

@ -163,3 +163,44 @@ pub async fn api_key_revoke() {}
security(("admin_api_key" = []))
)]
pub async fn api_key_revoke() {}
#[cfg(feature = "v1")]
/// API Key - List
///
/// List all the API Keys associated to a merchant account.
#[utoipa::path(
get,
path = "/api_keys/{merchant_id}/list",
params(
("merchant_id" = String, Path, description = "The unique identifier for the merchant account"),
("limit" = Option<i64>, Query, description = "The maximum number of API Keys to include in the response"),
("skip" = Option<i64>, Query, description = "The number of API Keys to skip when retrieving the list of API keys."),
),
responses(
(status = 200, description = "List of API Keys retrieved successfully", body = Vec<RetrieveApiKeyResponse>),
),
tag = "API Key",
operation_id = "List all API Keys associated with a merchant account",
security(("admin_api_key" = []))
)]
pub async fn api_key_list() {}
#[cfg(feature = "v2")]
/// API Key - List
///
/// List all the API Keys associated to a merchant account.
#[utoipa::path(
get,
path = "/v2/api_keys/list",
params(
("limit" = Option<i64>, Query, description = "The maximum number of API Keys to include in the response"),
("skip" = Option<i64>, Query, description = "The number of API Keys to skip when retrieving the list of API keys."),
),
responses(
(status = 200, description = "List of API Keys retrieved successfully", body = Vec<RetrieveApiKeyResponse>),
),
tag = "API Key",
operation_id = "List all API Keys associated with a merchant account",
security(("admin_api_key" = []))
)]
pub async fn api_key_list() {}