amazon_spapi/client_apis/
feeds_api.rs

1use crate::{apis, client::SpapiClient, models};
2use anyhow::Result;
3
4impl SpapiClient {
5    /// Cancels the feed that you specify. Only feeds with `processingStatus=IN_QUEUE` can be cancelled. Cancelled feeds are returned in subsequent calls to the [`getFeed`](https://developer-docs.amazon.com/sp-api/reference/getfeed) and [`getFeeds`](https://developer-docs.amazon.com/sp-api/reference/getfeeds) operations.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 15 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have 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).
6    pub async fn cancel_feed(&self, feed_id: &str) -> Result<()> {
7        let configuration = self.create_configuration().await?;
8        let guard = self
9            .limiter()
10            .wait("/feeds/2021-06-30/cancel_feed", 2.0, 15)
11            .await?;
12        let res = apis::feeds_api::cancel_feed(&configuration, feed_id).await?;
13        guard.mark_response().await;
14        Ok(res)
15    }
16
17    /// Creates a feed. Upload the contents of the feed document before calling this operation.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0083 | 15 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have 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).  The rate limit for the [`JSON_LISTINGS_FEED`](https://developer-docs.amazon.com/sp-api/docs/listings-feed-type-values#listings-feed) feed type differs from the rate limit for the [`createFeed`](https://developer-docs.amazon.com/sp-api/reference/createfeed) operation. For more information, refer to the [Building Listings Management Workflows Guide](https://developer-docs.amazon.com/sp-api/docs/building-listings-management-workflows-guide#should-i-submit-in-bulk-using-the-json_listings_feed-or-individually-with-the-listings-items-api).
18    pub async fn create_feed(
19        &self,
20        body: models::feeds_2021_06_30::CreateFeedSpecification,
21    ) -> Result<models::feeds_2021_06_30::CreateFeedResponse> {
22        let configuration = self.create_configuration().await?;
23        let guard = self
24            .limiter()
25            .wait("/feeds/2021-06-30/create_feed", 0.0083, 15)
26            .await?;
27        let res = apis::feeds_api::create_feed(&configuration, body).await?;
28        guard.mark_response().await;
29        Ok(res)
30    }
31
32    /// Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading the feed document contents. It also returns a `feedDocumentId` value that you can pass in with a subsequent call to the [`createFeed`](https://developer-docs.amazon.com/sp-api/reference/createfeed) operation.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 15 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have 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).
33    pub async fn create_feed_document(
34        &self,
35        body: models::feeds_2021_06_30::CreateFeedDocumentSpecification,
36    ) -> Result<models::feeds_2021_06_30::CreateFeedDocumentResponse> {
37        let configuration = self.create_configuration().await?;
38        let guard = self
39            .limiter()
40            .wait("/feeds/2021-06-30/create_feed_document", 0.5, 15)
41            .await?;
42        let res = apis::feeds_api::create_feed_document(&configuration, body).await?;
43        guard.mark_response().await;
44        Ok(res)
45    }
46
47    /// Returns feed details (including the `resultDocumentId`, if available) for the feed that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 15 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have 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).
48    pub async fn get_feed(&self, feed_id: &str) -> Result<models::feeds_2021_06_30::Feed> {
49        let configuration = self.create_configuration().await?;
50        let guard = self
51            .limiter()
52            .wait("/feeds/2021-06-30/get_feed", 2.0, 15)
53            .await?;
54        let res = apis::feeds_api::get_feed(&configuration, feed_id).await?;
55        guard.mark_response().await;
56        Ok(res)
57    }
58
59    /// Returns the information required for retrieving a feed document's contents.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have 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).
60    pub async fn get_feed_document(
61        &self,
62        feed_document_id: &str,
63    ) -> Result<models::feeds_2021_06_30::FeedDocument> {
64        let configuration = self.create_configuration().await?;
65        let guard = self
66            .limiter()
67            .wait("/feeds/2021-06-30/get_feed_document", 0.0222, 10)
68            .await?;
69        let res = apis::feeds_api::get_feed_document(&configuration, feed_document_id).await?;
70        guard.mark_response().await;
71        Ok(res)
72    }
73
74    /// Returns feed details for the feeds that match the filters that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have 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).
75    pub async fn get_feeds(
76        &self,
77        feed_types: Option<Vec<String>>,
78        marketplace_ids: Option<Vec<String>>,
79        page_size: Option<i32>,
80        processing_statuses: Option<Vec<String>>,
81        created_since: Option<String>,
82        created_until: Option<String>,
83        next_token: Option<&str>,
84    ) -> Result<models::feeds_2021_06_30::GetFeedsResponse> {
85        let configuration = self.create_configuration().await?;
86        let guard = self
87            .limiter()
88            .wait("/feeds/2021-06-30/get_feeds", 0.0222, 10)
89            .await?;
90        let res = apis::feeds_api::get_feeds(
91            &configuration,
92            feed_types,
93            marketplace_ids,
94            page_size,
95            processing_statuses,
96            created_since,
97            created_until,
98            next_token,
99        )
100        .await?;
101        guard.mark_response().await;
102        Ok(res)
103    }
104}