amazon_spapi/apis/
application_2023_11_30.rs

1/*
2 * Selling Partner API for Application Management
3 *
4 * The Selling Partner API for Application Management lets you programmatically update the client secret on registered applications.
5 *
6 * The version of the OpenAPI document: 2023-11-30
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`rotate_application_client_secret`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum RotateApplicationClientSecretError {
22    Status400(models::application_2023_11_30::ErrorList),
23    Status403(models::application_2023_11_30::ErrorList),
24    Status404(models::application_2023_11_30::ErrorList),
25    Status413(models::application_2023_11_30::ErrorList),
26    Status415(models::application_2023_11_30::ErrorList),
27    Status429(models::application_2023_11_30::ErrorList),
28    Status500(models::application_2023_11_30::ErrorList),
29    Status503(models::application_2023_11_30::ErrorList),
30    UnknownValue(serde_json::Value),
31}
32
33
34/// Rotates application client secrets for a developer application. Developers must register a destination queue in the developer console before calling this operation. When this operation is called a new client secret is generated and sent to the developer-registered queue. For more information, refer to [Rotate your application client secret](https://developer-docs.amazon.com/sp-api/v0/docs/application-management-api-v2023-11-30-use-case-guide#tutorial-rotate-your-applications-client-secret).  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 1 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
35pub async fn rotate_application_client_secret(configuration: &configuration::Configuration, ) -> Result<(), Error<RotateApplicationClientSecretError>> {
36
37    let uri_str = format!("{}/applications/2023-11-30/clientSecret", configuration.base_path);
38    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
39
40    if let Some(ref user_agent) = configuration.user_agent {
41        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
42    }
43
44    let req = req_builder.build()?;
45    let resp = configuration.client.execute(req).await?;
46
47    let status = resp.status();
48
49    if !status.is_client_error() && !status.is_server_error() {
50        Ok(())
51    } else {
52        let content = resp.text().await?;
53        let entity: Option<RotateApplicationClientSecretError> = serde_json::from_str(&content).ok();
54        Err(Error::ResponseError(ResponseContent { status, content, entity }))
55    }
56}
57