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