amazon_spapi/apis/
aplus_content_2020_11_01.rs

1/*
2 * Selling Partner API for A+ Content Management
3 *
4 * Use the A+ Content API to build applications that help selling partners add rich marketing content to their Amazon product detail pages. Selling partners can use A+ content to share their brand and product story, which helps buyers make informed purchasing decisions. Selling partners use content modules to add images and text.
5 *
6 * The version of the OpenAPI document: 2020-11-01
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 [`create_content_document`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateContentDocumentError {
22    Status400(models::aplus_content_2020_11_01::ErrorList),
23    Status401(models::aplus_content_2020_11_01::ErrorList),
24    Status403(models::aplus_content_2020_11_01::ErrorList),
25    Status404(models::aplus_content_2020_11_01::ErrorList),
26    Status429(models::aplus_content_2020_11_01::ErrorList),
27    Status500(models::aplus_content_2020_11_01::ErrorList),
28    Status503(models::aplus_content_2020_11_01::ErrorList),
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_content_document`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetContentDocumentError {
36    Status400(models::aplus_content_2020_11_01::ErrorList),
37    Status401(models::aplus_content_2020_11_01::ErrorList),
38    Status403(models::aplus_content_2020_11_01::ErrorList),
39    Status404(models::aplus_content_2020_11_01::ErrorList),
40    Status410(models::aplus_content_2020_11_01::ErrorList),
41    Status429(models::aplus_content_2020_11_01::ErrorList),
42    Status500(models::aplus_content_2020_11_01::ErrorList),
43    Status503(models::aplus_content_2020_11_01::ErrorList),
44    UnknownValue(serde_json::Value),
45}
46
47/// struct for typed errors of method [`list_content_document_asin_relations`]
48#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum ListContentDocumentAsinRelationsError {
51    Status400(models::aplus_content_2020_11_01::ErrorList),
52    Status401(models::aplus_content_2020_11_01::ErrorList),
53    Status403(models::aplus_content_2020_11_01::ErrorList),
54    Status404(models::aplus_content_2020_11_01::ErrorList),
55    Status410(models::aplus_content_2020_11_01::ErrorList),
56    Status429(models::aplus_content_2020_11_01::ErrorList),
57    Status500(models::aplus_content_2020_11_01::ErrorList),
58    Status503(models::aplus_content_2020_11_01::ErrorList),
59    UnknownValue(serde_json::Value),
60}
61
62/// struct for typed errors of method [`post_content_document_approval_submission`]
63#[derive(Debug, Clone, Serialize, Deserialize)]
64#[serde(untagged)]
65pub enum PostContentDocumentApprovalSubmissionError {
66    Status400(models::aplus_content_2020_11_01::ErrorList),
67    Status401(models::aplus_content_2020_11_01::ErrorList),
68    Status403(models::aplus_content_2020_11_01::ErrorList),
69    Status404(models::aplus_content_2020_11_01::ErrorList),
70    Status410(models::aplus_content_2020_11_01::ErrorList),
71    Status429(models::aplus_content_2020_11_01::ErrorList),
72    Status500(models::aplus_content_2020_11_01::ErrorList),
73    Status503(models::aplus_content_2020_11_01::ErrorList),
74    UnknownValue(serde_json::Value),
75}
76
77/// struct for typed errors of method [`post_content_document_asin_relations`]
78#[derive(Debug, Clone, Serialize, Deserialize)]
79#[serde(untagged)]
80pub enum PostContentDocumentAsinRelationsError {
81    Status400(models::aplus_content_2020_11_01::ErrorList),
82    Status401(models::aplus_content_2020_11_01::ErrorList),
83    Status403(models::aplus_content_2020_11_01::ErrorList),
84    Status404(models::aplus_content_2020_11_01::ErrorList),
85    Status410(models::aplus_content_2020_11_01::ErrorList),
86    Status429(models::aplus_content_2020_11_01::ErrorList),
87    Status500(models::aplus_content_2020_11_01::ErrorList),
88    Status503(models::aplus_content_2020_11_01::ErrorList),
89    UnknownValue(serde_json::Value),
90}
91
92/// struct for typed errors of method [`post_content_document_suspend_submission`]
93#[derive(Debug, Clone, Serialize, Deserialize)]
94#[serde(untagged)]
95pub enum PostContentDocumentSuspendSubmissionError {
96    Status400(models::aplus_content_2020_11_01::ErrorList),
97    Status401(models::aplus_content_2020_11_01::ErrorList),
98    Status403(models::aplus_content_2020_11_01::ErrorList),
99    Status404(models::aplus_content_2020_11_01::ErrorList),
100    Status410(models::aplus_content_2020_11_01::ErrorList),
101    Status429(models::aplus_content_2020_11_01::ErrorList),
102    Status500(models::aplus_content_2020_11_01::ErrorList),
103    Status503(models::aplus_content_2020_11_01::ErrorList),
104    UnknownValue(serde_json::Value),
105}
106
107/// struct for typed errors of method [`search_content_documents`]
108#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum SearchContentDocumentsError {
111    Status400(models::aplus_content_2020_11_01::ErrorList),
112    Status401(models::aplus_content_2020_11_01::ErrorList),
113    Status403(models::aplus_content_2020_11_01::ErrorList),
114    Status404(models::aplus_content_2020_11_01::ErrorList),
115    Status410(models::aplus_content_2020_11_01::ErrorList),
116    Status429(models::aplus_content_2020_11_01::ErrorList),
117    Status500(models::aplus_content_2020_11_01::ErrorList),
118    Status503(models::aplus_content_2020_11_01::ErrorList),
119    UnknownValue(serde_json::Value),
120}
121
122/// struct for typed errors of method [`search_content_publish_records`]
123#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum SearchContentPublishRecordsError {
126    Status400(models::aplus_content_2020_11_01::ErrorList),
127    Status401(models::aplus_content_2020_11_01::ErrorList),
128    Status403(models::aplus_content_2020_11_01::ErrorList),
129    Status404(models::aplus_content_2020_11_01::ErrorList),
130    Status429(models::aplus_content_2020_11_01::ErrorList),
131    Status500(models::aplus_content_2020_11_01::ErrorList),
132    Status503(models::aplus_content_2020_11_01::ErrorList),
133    UnknownValue(serde_json::Value),
134}
135
136/// struct for typed errors of method [`update_content_document`]
137#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum UpdateContentDocumentError {
140    Status400(models::aplus_content_2020_11_01::ErrorList),
141    Status401(models::aplus_content_2020_11_01::ErrorList),
142    Status403(models::aplus_content_2020_11_01::ErrorList),
143    Status404(models::aplus_content_2020_11_01::ErrorList),
144    Status410(models::aplus_content_2020_11_01::ErrorList),
145    Status429(models::aplus_content_2020_11_01::ErrorList),
146    Status500(models::aplus_content_2020_11_01::ErrorList),
147    Status503(models::aplus_content_2020_11_01::ErrorList),
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`validate_content_document_asin_relations`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum ValidateContentDocumentAsinRelationsError {
155    Status400(models::aplus_content_2020_11_01::ErrorList),
156    Status401(models::aplus_content_2020_11_01::ErrorList),
157    Status403(models::aplus_content_2020_11_01::ErrorList),
158    Status404(models::aplus_content_2020_11_01::ErrorList),
159    Status429(models::aplus_content_2020_11_01::ErrorList),
160    Status500(models::aplus_content_2020_11_01::ErrorList),
161    Status503(models::aplus_content_2020_11_01::ErrorList),
162    UnknownValue(serde_json::Value),
163}
164
165
166/// Creates a new A+ Content document.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 10 | 10 |  The `x-amzn-RateLimit-Limit` response header contains the usage plan rate limits for the operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
167pub async fn create_content_document(configuration: &configuration::Configuration, marketplace_id: &str, post_content_document_request: models::aplus_content_2020_11_01::PostContentDocumentRequest) -> Result<models::aplus_content_2020_11_01::PostContentDocumentResponse, Error<CreateContentDocumentError>> {
168    // add a prefix to parameters to efficiently prevent name collisions
169    let p_marketplace_id = marketplace_id;
170    let p_post_content_document_request = post_content_document_request;
171
172    let uri_str = format!("{}/aplus/2020-11-01/contentDocuments", configuration.base_path);
173    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
174
175    req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
176    if let Some(ref user_agent) = configuration.user_agent {
177        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
178    }
179    req_builder = req_builder.json(&p_post_content_document_request);
180
181    let req = req_builder.build()?;
182    let resp = configuration.client.execute(req).await?;
183
184    let status = resp.status();
185    let content_type = resp
186        .headers()
187        .get("content-type")
188        .and_then(|v| v.to_str().ok())
189        .unwrap_or("application/octet-stream");
190    let content_type = super::ContentType::from(content_type);
191
192    if !status.is_client_error() && !status.is_server_error() {
193        let content = resp.text().await?;
194        match content_type {
195            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
196            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::aplus_content_2020_11_01::PostContentDocumentResponse`"))),
197            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::aplus_content_2020_11_01::PostContentDocumentResponse`")))),
198        }
199    } else {
200        let content = resp.text().await?;
201        let entity: Option<CreateContentDocumentError> = serde_json::from_str(&content).ok();
202        Err(Error::ResponseError(ResponseContent { status, content, entity }))
203    }
204}
205
206/// Returns an A+ Content document, if available.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 10 | 10 |  The `x-amzn-RateLimit-Limit` response header contains the usage plan rate limits for the operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
207pub async fn get_content_document(configuration: &configuration::Configuration, content_reference_key: &str, marketplace_id: &str, included_data_set: Vec<String>) -> Result<models::aplus_content_2020_11_01::GetContentDocumentResponse, Error<GetContentDocumentError>> {
208    // add a prefix to parameters to efficiently prevent name collisions
209    let p_content_reference_key = content_reference_key;
210    let p_marketplace_id = marketplace_id;
211    let p_included_data_set = included_data_set;
212
213    let uri_str = format!("{}/aplus/2020-11-01/contentDocuments/{contentReferenceKey}", configuration.base_path, contentReferenceKey=crate::apis::urlencode(p_content_reference_key));
214    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
215
216    req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
217    req_builder = match "csv" {
218        "multi" => req_builder.query(&p_included_data_set.into_iter().map(|p| ("includedDataSet".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
219        _ => req_builder.query(&[("includedDataSet", &p_included_data_set.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
220    };
221    if let Some(ref user_agent) = configuration.user_agent {
222        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
223    }
224
225    let req = req_builder.build()?;
226    let resp = configuration.client.execute(req).await?;
227
228    let status = resp.status();
229    let content_type = resp
230        .headers()
231        .get("content-type")
232        .and_then(|v| v.to_str().ok())
233        .unwrap_or("application/octet-stream");
234    let content_type = super::ContentType::from(content_type);
235
236    if !status.is_client_error() && !status.is_server_error() {
237        let content = resp.text().await?;
238        match content_type {
239            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
240            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::aplus_content_2020_11_01::GetContentDocumentResponse`"))),
241            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::aplus_content_2020_11_01::GetContentDocumentResponse`")))),
242        }
243    } else {
244        let content = resp.text().await?;
245        let entity: Option<GetContentDocumentError> = serde_json::from_str(&content).ok();
246        Err(Error::ResponseError(ResponseContent { status, content, entity }))
247    }
248}
249
250/// Returns a list of ASINs that are related to the specified A+ Content document, if available. If you don't include the `asinSet` parameter, this operation returns all ASINs related to the content document.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 10 | 10 |  The `x-amzn-RateLimit-Limit` response header contains the usage plan rate limits for the operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
251pub async fn list_content_document_asin_relations(configuration: &configuration::Configuration, content_reference_key: &str, marketplace_id: &str, included_data_set: Option<Vec<String>>, asin_set: Option<Vec<String>>, page_token: Option<&str>) -> Result<models::aplus_content_2020_11_01::ListContentDocumentAsinRelationsResponse, Error<ListContentDocumentAsinRelationsError>> {
252    // add a prefix to parameters to efficiently prevent name collisions
253    let p_content_reference_key = content_reference_key;
254    let p_marketplace_id = marketplace_id;
255    let p_included_data_set = included_data_set;
256    let p_asin_set = asin_set;
257    let p_page_token = page_token;
258
259    let uri_str = format!("{}/aplus/2020-11-01/contentDocuments/{contentReferenceKey}/asins", configuration.base_path, contentReferenceKey=crate::apis::urlencode(p_content_reference_key));
260    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
261
262    req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
263    if let Some(ref param_value) = p_included_data_set {
264        req_builder = match "csv" {
265            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("includedDataSet".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
266            _ => req_builder.query(&[("includedDataSet", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
267        };
268    }
269    if let Some(ref param_value) = p_asin_set {
270        req_builder = match "csv" {
271            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("asinSet".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
272            _ => req_builder.query(&[("asinSet", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
273        };
274    }
275    if let Some(ref param_value) = p_page_token {
276        req_builder = req_builder.query(&[("pageToken", &param_value.to_string())]);
277    }
278    if let Some(ref user_agent) = configuration.user_agent {
279        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
280    }
281
282    let req = req_builder.build()?;
283    let resp = configuration.client.execute(req).await?;
284
285    let status = resp.status();
286    let content_type = resp
287        .headers()
288        .get("content-type")
289        .and_then(|v| v.to_str().ok())
290        .unwrap_or("application/octet-stream");
291    let content_type = super::ContentType::from(content_type);
292
293    if !status.is_client_error() && !status.is_server_error() {
294        let content = resp.text().await?;
295        match content_type {
296            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
297            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::aplus_content_2020_11_01::ListContentDocumentAsinRelationsResponse`"))),
298            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::aplus_content_2020_11_01::ListContentDocumentAsinRelationsResponse`")))),
299        }
300    } else {
301        let content = resp.text().await?;
302        let entity: Option<ListContentDocumentAsinRelationsError> = serde_json::from_str(&content).ok();
303        Err(Error::ResponseError(ResponseContent { status, content, entity }))
304    }
305}
306
307/// Submits an A+ Content document for review, approval, and publishing.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 10 | 10 |  The `x-amzn-RateLimit-Limit` response header contains the usage plan rate limits for the operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
308pub async fn post_content_document_approval_submission(configuration: &configuration::Configuration, content_reference_key: &str, marketplace_id: &str) -> Result<models::aplus_content_2020_11_01::PostContentDocumentApprovalSubmissionResponse, Error<PostContentDocumentApprovalSubmissionError>> {
309    // add a prefix to parameters to efficiently prevent name collisions
310    let p_content_reference_key = content_reference_key;
311    let p_marketplace_id = marketplace_id;
312
313    let uri_str = format!("{}/aplus/2020-11-01/contentDocuments/{contentReferenceKey}/approvalSubmissions", configuration.base_path, contentReferenceKey=crate::apis::urlencode(p_content_reference_key));
314    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
315
316    req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
317    if let Some(ref user_agent) = configuration.user_agent {
318        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
319    }
320
321    let req = req_builder.build()?;
322    let resp = configuration.client.execute(req).await?;
323
324    let status = resp.status();
325    let content_type = resp
326        .headers()
327        .get("content-type")
328        .and_then(|v| v.to_str().ok())
329        .unwrap_or("application/octet-stream");
330    let content_type = super::ContentType::from(content_type);
331
332    if !status.is_client_error() && !status.is_server_error() {
333        let content = resp.text().await?;
334        match content_type {
335            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
336            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::aplus_content_2020_11_01::PostContentDocumentApprovalSubmissionResponse`"))),
337            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::aplus_content_2020_11_01::PostContentDocumentApprovalSubmissionResponse`")))),
338        }
339    } else {
340        let content = resp.text().await?;
341        let entity: Option<PostContentDocumentApprovalSubmissionError> = serde_json::from_str(&content).ok();
342        Err(Error::ResponseError(ResponseContent { status, content, entity }))
343    }
344}
345
346/// Replaces all ASINs related to the specified A+ Content document, if available. This operation can add or remove ASINs, depending on the current set of related ASINs. Removing an ASIN will suspend the content document from that ASIN.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 10 | 10 |  The `x-amzn-RateLimit-Limit` response header contains the usage plan rate limits for the operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
347pub async fn post_content_document_asin_relations(configuration: &configuration::Configuration, content_reference_key: &str, marketplace_id: &str, post_content_document_asin_relations_request: models::aplus_content_2020_11_01::PostContentDocumentAsinRelationsRequest) -> Result<models::aplus_content_2020_11_01::PostContentDocumentAsinRelationsResponse, Error<PostContentDocumentAsinRelationsError>> {
348    // add a prefix to parameters to efficiently prevent name collisions
349    let p_content_reference_key = content_reference_key;
350    let p_marketplace_id = marketplace_id;
351    let p_post_content_document_asin_relations_request = post_content_document_asin_relations_request;
352
353    let uri_str = format!("{}/aplus/2020-11-01/contentDocuments/{contentReferenceKey}/asins", configuration.base_path, contentReferenceKey=crate::apis::urlencode(p_content_reference_key));
354    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
355
356    req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
357    if let Some(ref user_agent) = configuration.user_agent {
358        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
359    }
360    req_builder = req_builder.json(&p_post_content_document_asin_relations_request);
361
362    let req = req_builder.build()?;
363    let resp = configuration.client.execute(req).await?;
364
365    let status = resp.status();
366    let content_type = resp
367        .headers()
368        .get("content-type")
369        .and_then(|v| v.to_str().ok())
370        .unwrap_or("application/octet-stream");
371    let content_type = super::ContentType::from(content_type);
372
373    if !status.is_client_error() && !status.is_server_error() {
374        let content = resp.text().await?;
375        match content_type {
376            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
377            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::aplus_content_2020_11_01::PostContentDocumentAsinRelationsResponse`"))),
378            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::aplus_content_2020_11_01::PostContentDocumentAsinRelationsResponse`")))),
379        }
380    } else {
381        let content = resp.text().await?;
382        let entity: Option<PostContentDocumentAsinRelationsError> = serde_json::from_str(&content).ok();
383        Err(Error::ResponseError(ResponseContent { status, content, entity }))
384    }
385}
386
387/// Submits a request to suspend visible A+ Content. This doesn't delete the content document or the ASIN relations.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 10 | 10 |  The `x-amzn-RateLimit-Limit` response header contains the usage plan rate limits for the operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
388pub async fn post_content_document_suspend_submission(configuration: &configuration::Configuration, content_reference_key: &str, marketplace_id: &str) -> Result<models::aplus_content_2020_11_01::PostContentDocumentSuspendSubmissionResponse, Error<PostContentDocumentSuspendSubmissionError>> {
389    // add a prefix to parameters to efficiently prevent name collisions
390    let p_content_reference_key = content_reference_key;
391    let p_marketplace_id = marketplace_id;
392
393    let uri_str = format!("{}/aplus/2020-11-01/contentDocuments/{contentReferenceKey}/suspendSubmissions", configuration.base_path, contentReferenceKey=crate::apis::urlencode(p_content_reference_key));
394    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
395
396    req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
397    if let Some(ref user_agent) = configuration.user_agent {
398        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
399    }
400
401    let req = req_builder.build()?;
402    let resp = configuration.client.execute(req).await?;
403
404    let status = resp.status();
405    let content_type = resp
406        .headers()
407        .get("content-type")
408        .and_then(|v| v.to_str().ok())
409        .unwrap_or("application/octet-stream");
410    let content_type = super::ContentType::from(content_type);
411
412    if !status.is_client_error() && !status.is_server_error() {
413        let content = resp.text().await?;
414        match content_type {
415            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
416            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::aplus_content_2020_11_01::PostContentDocumentSuspendSubmissionResponse`"))),
417            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::aplus_content_2020_11_01::PostContentDocumentSuspendSubmissionResponse`")))),
418        }
419    } else {
420        let content = resp.text().await?;
421        let entity: Option<PostContentDocumentSuspendSubmissionError> = serde_json::from_str(&content).ok();
422        Err(Error::ResponseError(ResponseContent { status, content, entity }))
423    }
424}
425
426/// Returns a list of all A+ Content documents, including metadata, that are assigned to a selling partner. To get the actual contents of the A+ Content documents, call the `getContentDocument` operation.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 10 | 10 |  The `x-amzn-RateLimit-Limit` response header contains the usage plan rate limits for the operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
427pub async fn search_content_documents(configuration: &configuration::Configuration, marketplace_id: &str, page_token: Option<&str>) -> Result<models::aplus_content_2020_11_01::SearchContentDocumentsResponse, Error<SearchContentDocumentsError>> {
428    // add a prefix to parameters to efficiently prevent name collisions
429    let p_marketplace_id = marketplace_id;
430    let p_page_token = page_token;
431
432    let uri_str = format!("{}/aplus/2020-11-01/contentDocuments", configuration.base_path);
433    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
434
435    req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
436    if let Some(ref param_value) = p_page_token {
437        req_builder = req_builder.query(&[("pageToken", &param_value.to_string())]);
438    }
439    if let Some(ref user_agent) = configuration.user_agent {
440        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
441    }
442
443    let req = req_builder.build()?;
444    let resp = configuration.client.execute(req).await?;
445
446    let status = resp.status();
447    let content_type = resp
448        .headers()
449        .get("content-type")
450        .and_then(|v| v.to_str().ok())
451        .unwrap_or("application/octet-stream");
452    let content_type = super::ContentType::from(content_type);
453
454    if !status.is_client_error() && !status.is_server_error() {
455        let content = resp.text().await?;
456        match content_type {
457            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
458            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::aplus_content_2020_11_01::SearchContentDocumentsResponse`"))),
459            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::aplus_content_2020_11_01::SearchContentDocumentsResponse`")))),
460        }
461    } else {
462        let content = resp.text().await?;
463        let entity: Option<SearchContentDocumentsError> = serde_json::from_str(&content).ok();
464        Err(Error::ResponseError(ResponseContent { status, content, entity }))
465    }
466}
467
468/// Searches for A+ Content publishing records, if available.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 10 | 10 |  The `x-amzn-RateLimit-Limit` response header contains the usage plan rate limits for the operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
469pub async fn search_content_publish_records(configuration: &configuration::Configuration, marketplace_id: &str, asin: &str, page_token: Option<&str>) -> Result<models::aplus_content_2020_11_01::SearchContentPublishRecordsResponse, Error<SearchContentPublishRecordsError>> {
470    // add a prefix to parameters to efficiently prevent name collisions
471    let p_marketplace_id = marketplace_id;
472    let p_asin = asin;
473    let p_page_token = page_token;
474
475    let uri_str = format!("{}/aplus/2020-11-01/contentPublishRecords", configuration.base_path);
476    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
477
478    req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
479    req_builder = req_builder.query(&[("asin", &p_asin.to_string())]);
480    if let Some(ref param_value) = p_page_token {
481        req_builder = req_builder.query(&[("pageToken", &param_value.to_string())]);
482    }
483    if let Some(ref user_agent) = configuration.user_agent {
484        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
485    }
486
487    let req = req_builder.build()?;
488    let resp = configuration.client.execute(req).await?;
489
490    let status = resp.status();
491    let content_type = resp
492        .headers()
493        .get("content-type")
494        .and_then(|v| v.to_str().ok())
495        .unwrap_or("application/octet-stream");
496    let content_type = super::ContentType::from(content_type);
497
498    if !status.is_client_error() && !status.is_server_error() {
499        let content = resp.text().await?;
500        match content_type {
501            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
502            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::aplus_content_2020_11_01::SearchContentPublishRecordsResponse`"))),
503            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::aplus_content_2020_11_01::SearchContentPublishRecordsResponse`")))),
504        }
505    } else {
506        let content = resp.text().await?;
507        let entity: Option<SearchContentPublishRecordsError> = serde_json::from_str(&content).ok();
508        Err(Error::ResponseError(ResponseContent { status, content, entity }))
509    }
510}
511
512/// Updates an existing A+ Content document.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 10 | 10 |  The `x-amzn-RateLimit-Limit` response header contains the usage plan rate limits for the operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
513pub async fn update_content_document(configuration: &configuration::Configuration, content_reference_key: &str, marketplace_id: &str, post_content_document_request: models::aplus_content_2020_11_01::PostContentDocumentRequest) -> Result<models::aplus_content_2020_11_01::PostContentDocumentResponse, Error<UpdateContentDocumentError>> {
514    // add a prefix to parameters to efficiently prevent name collisions
515    let p_content_reference_key = content_reference_key;
516    let p_marketplace_id = marketplace_id;
517    let p_post_content_document_request = post_content_document_request;
518
519    let uri_str = format!("{}/aplus/2020-11-01/contentDocuments/{contentReferenceKey}", configuration.base_path, contentReferenceKey=crate::apis::urlencode(p_content_reference_key));
520    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
521
522    req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
523    if let Some(ref user_agent) = configuration.user_agent {
524        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
525    }
526    req_builder = req_builder.json(&p_post_content_document_request);
527
528    let req = req_builder.build()?;
529    let resp = configuration.client.execute(req).await?;
530
531    let status = resp.status();
532    let content_type = resp
533        .headers()
534        .get("content-type")
535        .and_then(|v| v.to_str().ok())
536        .unwrap_or("application/octet-stream");
537    let content_type = super::ContentType::from(content_type);
538
539    if !status.is_client_error() && !status.is_server_error() {
540        let content = resp.text().await?;
541        match content_type {
542            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
543            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::aplus_content_2020_11_01::PostContentDocumentResponse`"))),
544            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::aplus_content_2020_11_01::PostContentDocumentResponse`")))),
545        }
546    } else {
547        let content = resp.text().await?;
548        let entity: Option<UpdateContentDocumentError> = serde_json::from_str(&content).ok();
549        Err(Error::ResponseError(ResponseContent { status, content, entity }))
550    }
551}
552
553/// Checks if the A+ Content document is valid for use on a set of ASINs.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 10 | 10 |  The `x-amzn-RateLimit-Limit` response header contains the usage plan rate limits for the operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
554pub async fn validate_content_document_asin_relations(configuration: &configuration::Configuration, marketplace_id: &str, post_content_document_request: models::aplus_content_2020_11_01::PostContentDocumentRequest, asin_set: Option<Vec<String>>) -> Result<models::aplus_content_2020_11_01::ValidateContentDocumentAsinRelationsResponse, Error<ValidateContentDocumentAsinRelationsError>> {
555    // add a prefix to parameters to efficiently prevent name collisions
556    let p_marketplace_id = marketplace_id;
557    let p_post_content_document_request = post_content_document_request;
558    let p_asin_set = asin_set;
559
560    let uri_str = format!("{}/aplus/2020-11-01/contentAsinValidations", configuration.base_path);
561    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
562
563    req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
564    if let Some(ref param_value) = p_asin_set {
565        req_builder = match "csv" {
566            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("asinSet".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
567            _ => req_builder.query(&[("asinSet", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
568        };
569    }
570    if let Some(ref user_agent) = configuration.user_agent {
571        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
572    }
573    req_builder = req_builder.json(&p_post_content_document_request);
574
575    let req = req_builder.build()?;
576    let resp = configuration.client.execute(req).await?;
577
578    let status = resp.status();
579    let content_type = resp
580        .headers()
581        .get("content-type")
582        .and_then(|v| v.to_str().ok())
583        .unwrap_or("application/octet-stream");
584    let content_type = super::ContentType::from(content_type);
585
586    if !status.is_client_error() && !status.is_server_error() {
587        let content = resp.text().await?;
588        match content_type {
589            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
590            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::aplus_content_2020_11_01::ValidateContentDocumentAsinRelationsResponse`"))),
591            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::aplus_content_2020_11_01::ValidateContentDocumentAsinRelationsResponse`")))),
592        }
593    } else {
594        let content = resp.text().await?;
595        let entity: Option<ValidateContentDocumentAsinRelationsError> = serde_json::from_str(&content).ok();
596        Err(Error::ResponseError(ResponseContent { status, content, entity }))
597    }
598}
599