sellers_v1_use_raw_api/
sellers_v1_use_raw_api.rs

1use amazon_spapi::apis::sellers_api::get_marketplace_participations;
2use amazon_spapi::client::{SpapiClient, SpapiConfig};
3use anyhow::Result;
4
5#[tokio::main]
6async fn main() -> Result<()> {
7    let spapi_config = SpapiConfig::from_env()?;
8    let spapi_client = SpapiClient::new(spapi_config.clone())?;
9    {
10        // Internally refresh the access token and create a configuration
11        // Configuration must be created for each API call
12        let configuration = spapi_client.create_configuration().await?;
13
14        // Wait for rate limit before making the API call
15        // When _guard is dropped, the rate limiter will mark the api call as having received a response
16        let _guard = spapi_client
17            .limiter()
18            .wait("get_marketplace_participations", 0.016, 15)
19            .await?;
20
21        // Call the API to get marketplace participations
22        let res = get_marketplace_participations(&configuration).await?;
23        
24        println!("Marketplace Participations: {:#?}", res);
25    }
26    Ok(())
27}