amazon_sp_api/models/kiosk.rs
1use reqwest::{Method, Response};
2use crate::error_handling::Errors;
3use crate::general::Client;
4#[allow(dead_code)]
5
6pub struct Kiosk;
7#[allow(dead_code)]
8pub enum ProcessingStatuses {
9 CANCELLED,
10 DONE,
11 FATAL,
12 InProgress,
13 InQueue,
14}
15#[allow(dead_code)]
16impl ProcessingStatuses {
17 pub fn to_string(&self) -> String {
18 match self {
19 ProcessingStatuses::CANCELLED => "CANCELLED".to_string(),
20 ProcessingStatuses::DONE => "DONE".to_string(),
21 ProcessingStatuses::FATAL => "FATAL".to_string(),
22 ProcessingStatuses::InProgress => "InProgress".to_string(),
23 ProcessingStatuses::InQueue => "InQueue".to_string(),
24 }
25 }
26}
27impl Kiosk {
28 ///Returns details for the Data Kiosk queries that match the specified filters. See the createQuery operation for details about query retention.
29 ///
30 /// Rate (requests per second): 0.0222
31 ///
32 /// Burst: 10
33 ///
34 /// # Parameters
35 ///
36 /// - `processing_statuses` (optional):
37 /// A list of processing statuses used to filter queries.
38 /// Minimum count: 1.
39 /// Type: `Vec<ProcessingStatuses>`.
40 ///
41 /// - `page_size` (optional):
42 /// The maximum number of queries to return in a single call.
43 /// Minimum: 1, Maximum: 100.
44 /// Default: 10.
45 /// Type: `u32`.
46 ///
47 /// - `created_since` (optional):
48 /// The earliest query creation date and time to include in the response, in ISO 8601 date-time format.
49 /// Default: 90 days ago.
50 /// Type: `String`.
51 ///
52 /// - `created_until` (optional):
53 /// The latest query creation date and time to include in the response, in ISO 8601 date-time format.
54 /// Default: the time of the `get_queries` request.
55 /// Type: `String`.
56 ///
57 /// - `pagination_token` (optional):
58 /// A token to fetch a specific page of results when multiple pages are available.
59 /// This token is fetched from the `pagination.nextToken` field in the `GetQueriesResponse` object.
60 /// If absent, the first page of results is returned.
61 /// Type: `String`.
62 ///
63 /// # Responses
64 ///
65 /// - **200 (Success):**
66 /// Returns the fetched queries in a `GetQueriesResponse` object.
67 /// - Headers:
68 /// - `x-amzn-RateLimit-Limit` (`String`): Your rate limit (requests per second) for this operation.
69 /// - `x-amzn-RequestId` (`String`): Unique request reference identifier.
70 async fn get_queries(client: &mut Client, processing_status: Option<Vec<ProcessingStatuses>>, page_size: Option<u64>, created_since: Option<String>, created_until: Option<String>, pagination_token: Option<String> ) -> Result<Response, Errors> {
71 let mut parameters = vec![];
72 if let Some(processing_statuses) = processing_status {
73 parameters.push(("processingStatuses", processing_statuses.iter().map(|b| b.to_string()).collect()))
74 }
75 if let Some(page_size) = page_size {
76 parameters.push(("pageSize", page_size.to_string()))
77 }
78 if let Some(created_since) = created_since {
79 parameters.push(("createdSince", created_since))
80 }
81 if let Some(created_until) = created_until {
82 parameters.push(("createdUntil", created_until))
83 }
84 if let Some(pagination_token) = pagination_token {
85 parameters.push(("paginationToken", pagination_token))
86 }
87
88 client.make_request( "/dataKiosk/2023-11-15/queries", Method::GET, Some(parameters)).await
89 }
90
91
92
93 /// Creates a Data Kiosk query request.
94 ///
95 /// Rate (requests per second): 0.0167
96 ///
97 /// Burst: 15
98 ///
99 /// # Parameters
100 /// - `body`: The body of the request. Type: `CreateQuerySpecification`.
101 ///
102 /// # Responses
103 /// - **202 (Success):** Returns a `CreateQueryResponse` object.
104 async fn create_query(
105 client: &mut Client,
106 body: String,
107 ) -> Result<Response, Errors> {
108 client
109 .make_request("/dataKiosk/2023-11-15/queries", Method::POST, Some([("body", body)]))
110 .await
111 }
112
113
114
115 /// Returns query details for the specified queryId.
116 ///
117 /// Rate (requests per second): 2.0
118 ///
119 /// Burst: 15
120 ///
121 /// # Parameters
122 /// - `query_id`: The query identifier. Type: `String`.
123 ///
124 /// # Responses
125 /// - **200 (Success):** Returns query details in a `Query` object.
126 async fn get_query(client: &mut Client, query_id: String) -> Result<Response, Errors> {
127 let endpoint = format!("/dataKiosk/2023-11-15/queries/{}", query_id);
128
129 client
130 .make_request(&endpoint, Method::GET, None::<Vec<(String, String)>>)
131 .await
132 }
133
134 /// Cancels the query specified by the queryId parameter.
135 ///
136 /// Rate (requests per second): 0.0222
137 ///
138 /// Burst: 10
139 ///
140 /// # Parameters
141 /// - `query_id`: The query identifier. Type: `String`.
142 ///
143 /// # Responses
144 /// - **204 (Success):** Indicates successful cancellation with no content.
145 async fn cancel_query(client: &mut Client, query_id: String) -> Result<Response, Errors> {
146 let endpoint = format!("/dataKiosk/2023-11-15/queries/{}", query_id);
147
148 client
149 .make_request(&endpoint, Method::DELETE, None::<Vec<(String, String)>>)
150 .await
151 }
152
153 /// Returns the information required for retrieving a Data Kiosk document's contents.
154 ///
155 /// Rate (requests per second): 0.0167
156 ///
157 /// Burst: 15
158 ///
159 /// # Parameters
160 /// - `document_id`: The identifier for the Data Kiosk document. Type: `String`.
161 ///
162 /// # Responses
163 /// - **200 (Success):** Returns document details in a `GetDocumentResponse` object.
164 async fn get_document(client: &mut Client, document_id: String) -> Result<Response, Errors> {
165 let endpoint = format!("/dataKiosk/2023-11-15/documents/{}", document_id);
166
167 client
168 .make_request(&endpoint, Method::GET, None::<Vec<(String, String)>>)
169 .await
170 }
171}