Skip to main content

signer_hub_kit/apis/
default_api.rs

1/*
2 * signer-hub
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 0.3.0
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 [`api_signer_crdt_events_get`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ApiSignerCrdtEventsGetError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`api_signer_crdt_events_post`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum ApiSignerCrdtEventsPostError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`api_signer_crdt_frontiers_get`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ApiSignerCrdtFrontiersGetError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`api_signer_envelopes_check_patch`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum ApiSignerEnvelopesCheckPatchError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`api_signer_envelopes_get`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ApiSignerEnvelopesGetError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`api_signer_envelopes_post`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ApiSignerEnvelopesPostError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`api_signer_events_get`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ApiSignerEventsGetError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`api_signer_get`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum ApiSignerGetError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`api_signer_storage_blob_hash_head`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ApiSignerStorageBlobHashHeadError {
78    Status404(),
79    Status451(),
80    UnknownValue(serde_json::Value),
81}
82
83/// struct for typed errors of method [`api_signer_storage_blob_post`]
84#[derive(Debug, Clone, Serialize, Deserialize)]
85#[serde(untagged)]
86pub enum ApiSignerStorageBlobPostError {
87    UnknownValue(serde_json::Value),
88}
89
90/// struct for typed errors of method [`api_signer_storage_blobs_check_existence_post`]
91#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum ApiSignerStorageBlobsCheckExistencePostError {
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`api_signer_storage_item_post`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum ApiSignerStorageItemPostError {
101    UnknownValue(serde_json::Value),
102}
103
104/// struct for typed errors of method [`api_signer_storage_item_pubkey_hash_delete`]
105#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum ApiSignerStorageItemPubkeyHashDeleteError {
108    UnknownValue(serde_json::Value),
109}
110
111/// struct for typed errors of method [`api_signer_storage_item_pubkey_hash_get`]
112#[derive(Debug, Clone, Serialize, Deserialize)]
113#[serde(untagged)]
114pub enum ApiSignerStorageItemPubkeyHashGetError {
115    UnknownValue(serde_json::Value),
116}
117
118/// struct for typed errors of method [`api_signer_storage_item_pubkey_hash_head`]
119#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum ApiSignerStorageItemPubkeyHashHeadError {
122    Status404(),
123    Status451(),
124    UnknownValue(serde_json::Value),
125}
126
127/// struct for typed errors of method [`api_signer_users_user_key_get`]
128#[derive(Debug, Clone, Serialize, Deserialize)]
129#[serde(untagged)]
130pub enum ApiSignerUsersUserKeyGetError {
131    UnknownValue(serde_json::Value),
132}
133
134
135pub async fn api_signer_crdt_events_get(configuration: &configuration::Configuration, frontiers: Option<&str>) -> Result<models::GetCrdtEventsResponse, Error<ApiSignerCrdtEventsGetError>> {
136    // add a prefix to parameters to efficiently prevent name collisions
137    let p_frontiers = frontiers;
138
139    let uri_str = format!("{}/api/signer/crdt-events", configuration.base_path);
140    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
141
142    if let Some(ref param_value) = p_frontiers {
143        req_builder = req_builder.query(&[("frontiers", &param_value.to_string())]);
144    }
145    if let Some(ref user_agent) = configuration.user_agent {
146        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
147    }
148    if let Some(ref apikey) = configuration.api_key {
149        let key = apikey.key.clone();
150        let value = match apikey.prefix {
151            Some(ref prefix) => format!("{} {}", prefix, key),
152            None => key,
153        };
154        req_builder = req_builder.header("Authorization", value);
155    };
156
157    let req = req_builder.build()?;
158    let resp = configuration.client.execute(req).await?;
159
160    let status = resp.status();
161    let content_type = resp
162        .headers()
163        .get("content-type")
164        .and_then(|v| v.to_str().ok())
165        .unwrap_or("application/octet-stream");
166    let content_type = super::ContentType::from(content_type);
167
168    if !status.is_client_error() && !status.is_server_error() {
169        let content = resp.text().await?;
170        match content_type {
171            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
172            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCrdtEventsResponse`"))),
173            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::GetCrdtEventsResponse`")))),
174        }
175    } else {
176        let content = resp.text().await?;
177        let entity: Option<ApiSignerCrdtEventsGetError> = serde_json::from_str(&content).ok();
178        Err(Error::ResponseError(ResponseContent { status, content, entity }))
179    }
180}
181
182pub async fn api_signer_crdt_events_post(configuration: &configuration::Configuration, post_crdt_events_request: models::PostCrdtEventsRequest) -> Result<models::JsonTextResponse, Error<ApiSignerCrdtEventsPostError>> {
183    // add a prefix to parameters to efficiently prevent name collisions
184    let p_post_crdt_events_request = post_crdt_events_request;
185
186    let uri_str = format!("{}/api/signer/crdt-events", configuration.base_path);
187    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
188
189    if let Some(ref user_agent) = configuration.user_agent {
190        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
191    }
192    if let Some(ref apikey) = configuration.api_key {
193        let key = apikey.key.clone();
194        let value = match apikey.prefix {
195            Some(ref prefix) => format!("{} {}", prefix, key),
196            None => key,
197        };
198        req_builder = req_builder.header("Authorization", value);
199    };
200    req_builder = req_builder.json(&p_post_crdt_events_request);
201
202    let req = req_builder.build()?;
203    let resp = configuration.client.execute(req).await?;
204
205    let status = resp.status();
206    let content_type = resp
207        .headers()
208        .get("content-type")
209        .and_then(|v| v.to_str().ok())
210        .unwrap_or("application/octet-stream");
211    let content_type = super::ContentType::from(content_type);
212
213    if !status.is_client_error() && !status.is_server_error() {
214        let content = resp.text().await?;
215        match content_type {
216            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
217            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsonTextResponse`"))),
218            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::JsonTextResponse`")))),
219        }
220    } else {
221        let content = resp.text().await?;
222        let entity: Option<ApiSignerCrdtEventsPostError> = serde_json::from_str(&content).ok();
223        Err(Error::ResponseError(ResponseContent { status, content, entity }))
224    }
225}
226
227pub async fn api_signer_crdt_frontiers_get(configuration: &configuration::Configuration, ) -> Result<std::collections::HashMap<String, i32>, Error<ApiSignerCrdtFrontiersGetError>> {
228
229    let uri_str = format!("{}/api/signer/crdt-frontiers", configuration.base_path);
230    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
231
232    if let Some(ref user_agent) = configuration.user_agent {
233        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
234    }
235    if let Some(ref apikey) = configuration.api_key {
236        let key = apikey.key.clone();
237        let value = match apikey.prefix {
238            Some(ref prefix) => format!("{} {}", prefix, key),
239            None => key,
240        };
241        req_builder = req_builder.header("Authorization", value);
242    };
243
244    let req = req_builder.build()?;
245    let resp = configuration.client.execute(req).await?;
246
247    let status = resp.status();
248    let content_type = resp
249        .headers()
250        .get("content-type")
251        .and_then(|v| v.to_str().ok())
252        .unwrap_or("application/octet-stream");
253    let content_type = super::ContentType::from(content_type);
254
255    if !status.is_client_error() && !status.is_server_error() {
256        let content = resp.text().await?;
257        match content_type {
258            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
259            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, i32&gt;`"))),
260            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, i32&gt;`")))),
261        }
262    } else {
263        let content = resp.text().await?;
264        let entity: Option<ApiSignerCrdtFrontiersGetError> = serde_json::from_str(&content).ok();
265        Err(Error::ResponseError(ResponseContent { status, content, entity }))
266    }
267}
268
269pub async fn api_signer_envelopes_check_patch(configuration: &configuration::Configuration, ids: Vec<i32>) -> Result<models::JsonTextResponse, Error<ApiSignerEnvelopesCheckPatchError>> {
270    // add a prefix to parameters to efficiently prevent name collisions
271    let p_ids = ids;
272
273    let uri_str = format!("{}/api/signer/envelopes/check", configuration.base_path);
274    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
275
276    req_builder = match "multi" {
277        "multi" => req_builder.query(&p_ids.into_iter().map(|p| ("ids".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
278        _ => req_builder.query(&[("ids", &p_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
279    };
280    if let Some(ref user_agent) = configuration.user_agent {
281        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
282    }
283    if let Some(ref apikey) = configuration.api_key {
284        let key = apikey.key.clone();
285        let value = match apikey.prefix {
286            Some(ref prefix) => format!("{} {}", prefix, key),
287            None => key,
288        };
289        req_builder = req_builder.header("Authorization", value);
290    };
291
292    let req = req_builder.build()?;
293    let resp = configuration.client.execute(req).await?;
294
295    let status = resp.status();
296    let content_type = resp
297        .headers()
298        .get("content-type")
299        .and_then(|v| v.to_str().ok())
300        .unwrap_or("application/octet-stream");
301    let content_type = super::ContentType::from(content_type);
302
303    if !status.is_client_error() && !status.is_server_error() {
304        let content = resp.text().await?;
305        match content_type {
306            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
307            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsonTextResponse`"))),
308            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::JsonTextResponse`")))),
309        }
310    } else {
311        let content = resp.text().await?;
312        let entity: Option<ApiSignerEnvelopesCheckPatchError> = serde_json::from_str(&content).ok();
313        Err(Error::ResponseError(ResponseContent { status, content, entity }))
314    }
315}
316
317pub async fn api_signer_envelopes_get(configuration: &configuration::Configuration, ) -> Result<models::GetEnvelopesResponse, Error<ApiSignerEnvelopesGetError>> {
318
319    let uri_str = format!("{}/api/signer/envelopes", configuration.base_path);
320    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
321
322    if let Some(ref user_agent) = configuration.user_agent {
323        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
324    }
325    if let Some(ref apikey) = configuration.api_key {
326        let key = apikey.key.clone();
327        let value = match apikey.prefix {
328            Some(ref prefix) => format!("{} {}", prefix, key),
329            None => key,
330        };
331        req_builder = req_builder.header("Authorization", value);
332    };
333
334    let req = req_builder.build()?;
335    let resp = configuration.client.execute(req).await?;
336
337    let status = resp.status();
338    let content_type = resp
339        .headers()
340        .get("content-type")
341        .and_then(|v| v.to_str().ok())
342        .unwrap_or("application/octet-stream");
343    let content_type = super::ContentType::from(content_type);
344
345    if !status.is_client_error() && !status.is_server_error() {
346        let content = resp.text().await?;
347        match content_type {
348            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
349            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEnvelopesResponse`"))),
350            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::GetEnvelopesResponse`")))),
351        }
352    } else {
353        let content = resp.text().await?;
354        let entity: Option<ApiSignerEnvelopesGetError> = serde_json::from_str(&content).ok();
355        Err(Error::ResponseError(ResponseContent { status, content, entity }))
356    }
357}
358
359pub async fn api_signer_envelopes_post(configuration: &configuration::Configuration, post_envelopes_request: models::PostEnvelopesRequest) -> Result<models::JsonTextResponse, Error<ApiSignerEnvelopesPostError>> {
360    // add a prefix to parameters to efficiently prevent name collisions
361    let p_post_envelopes_request = post_envelopes_request;
362
363    let uri_str = format!("{}/api/signer/envelopes", configuration.base_path);
364    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
365
366    if let Some(ref user_agent) = configuration.user_agent {
367        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
368    }
369    if let Some(ref apikey) = configuration.api_key {
370        let key = apikey.key.clone();
371        let value = match apikey.prefix {
372            Some(ref prefix) => format!("{} {}", prefix, key),
373            None => key,
374        };
375        req_builder = req_builder.header("Authorization", value);
376    };
377    req_builder = req_builder.json(&p_post_envelopes_request);
378
379    let req = req_builder.build()?;
380    let resp = configuration.client.execute(req).await?;
381
382    let status = resp.status();
383    let content_type = resp
384        .headers()
385        .get("content-type")
386        .and_then(|v| v.to_str().ok())
387        .unwrap_or("application/octet-stream");
388    let content_type = super::ContentType::from(content_type);
389
390    if !status.is_client_error() && !status.is_server_error() {
391        let content = resp.text().await?;
392        match content_type {
393            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
394            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsonTextResponse`"))),
395            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::JsonTextResponse`")))),
396        }
397    } else {
398        let content = resp.text().await?;
399        let entity: Option<ApiSignerEnvelopesPostError> = serde_json::from_str(&content).ok();
400        Err(Error::ResponseError(ResponseContent { status, content, entity }))
401    }
402}
403
404pub async fn api_signer_events_get(configuration: &configuration::Configuration, ) -> Result<Vec<String>, Error<ApiSignerEventsGetError>> {
405
406    let uri_str = format!("{}/api/signer/events", configuration.base_path);
407    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
408
409    if let Some(ref user_agent) = configuration.user_agent {
410        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
411    }
412    if let Some(ref apikey) = configuration.api_key {
413        let key = apikey.key.clone();
414        let value = match apikey.prefix {
415            Some(ref prefix) => format!("{} {}", prefix, key),
416            None => key,
417        };
418        req_builder = req_builder.header("Authorization", value);
419    };
420
421    let req = req_builder.build()?;
422    let resp = configuration.client.execute(req).await?;
423
424    let status = resp.status();
425    let content_type = resp
426        .headers()
427        .get("content-type")
428        .and_then(|v| v.to_str().ok())
429        .unwrap_or("application/octet-stream");
430    let content_type = super::ContentType::from(content_type);
431
432    if !status.is_client_error() && !status.is_server_error() {
433        let content = resp.text().await?;
434        match content_type {
435            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
436            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;String&gt;`"))),
437            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;String&gt;`")))),
438        }
439    } else {
440        let content = resp.text().await?;
441        let entity: Option<ApiSignerEventsGetError> = serde_json::from_str(&content).ok();
442        Err(Error::ResponseError(ResponseContent { status, content, entity }))
443    }
444}
445
446pub async fn api_signer_get(configuration: &configuration::Configuration, ) -> Result<models::GetMetaResponse, Error<ApiSignerGetError>> {
447
448    let uri_str = format!("{}/api/signer", configuration.base_path);
449    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
450
451    if let Some(ref user_agent) = configuration.user_agent {
452        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
453    }
454    if let Some(ref apikey) = configuration.api_key {
455        let key = apikey.key.clone();
456        let value = match apikey.prefix {
457            Some(ref prefix) => format!("{} {}", prefix, key),
458            None => key,
459        };
460        req_builder = req_builder.header("Authorization", value);
461    };
462
463    let req = req_builder.build()?;
464    let resp = configuration.client.execute(req).await?;
465
466    let status = resp.status();
467    let content_type = resp
468        .headers()
469        .get("content-type")
470        .and_then(|v| v.to_str().ok())
471        .unwrap_or("application/octet-stream");
472    let content_type = super::ContentType::from(content_type);
473
474    if !status.is_client_error() && !status.is_server_error() {
475        let content = resp.text().await?;
476        match content_type {
477            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
478            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetMetaResponse`"))),
479            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::GetMetaResponse`")))),
480        }
481    } else {
482        let content = resp.text().await?;
483        let entity: Option<ApiSignerGetError> = serde_json::from_str(&content).ok();
484        Err(Error::ResponseError(ResponseContent { status, content, entity }))
485    }
486}
487
488pub async fn api_signer_storage_blob_hash_head(configuration: &configuration::Configuration, hash: &str) -> Result<(), Error<ApiSignerStorageBlobHashHeadError>> {
489    // add a prefix to parameters to efficiently prevent name collisions
490    let p_hash = hash;
491
492    let uri_str = format!("{}/api/signer/storage/blob/{hash}", configuration.base_path, hash=crate::apis::urlencode(p_hash));
493    let mut req_builder = configuration.client.request(reqwest::Method::HEAD, &uri_str);
494
495    if let Some(ref user_agent) = configuration.user_agent {
496        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
497    }
498
499    let req = req_builder.build()?;
500    let resp = configuration.client.execute(req).await?;
501
502    let status = resp.status();
503
504    if !status.is_client_error() && !status.is_server_error() {
505        Ok(())
506    } else {
507        let content = resp.text().await?;
508        let entity: Option<ApiSignerStorageBlobHashHeadError> = serde_json::from_str(&content).ok();
509        Err(Error::ResponseError(ResponseContent { status, content, entity }))
510    }
511}
512
513pub async fn api_signer_storage_blob_post(configuration: &configuration::Configuration, blob: std::path::PathBuf) -> Result<models::StorageBlobResponse, Error<ApiSignerStorageBlobPostError>> {
514    // add a prefix to parameters to efficiently prevent name collisions
515    let p_blob = blob;
516
517    let uri_str = format!("{}/api/signer/storage/blob", configuration.base_path);
518    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
519
520    if let Some(ref user_agent) = configuration.user_agent {
521        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
522    }
523    if let Some(ref apikey) = configuration.api_key {
524        let key = apikey.key.clone();
525        let value = match apikey.prefix {
526            Some(ref prefix) => format!("{} {}", prefix, key),
527            None => key,
528        };
529        req_builder = req_builder.header("Authorization", value);
530    };
531    let mut multipart_form = reqwest::multipart::Form::new();
532    // TODO: support file upload for 'blob' parameter
533    req_builder = req_builder.multipart(multipart_form);
534
535    let req = req_builder.build()?;
536    let resp = configuration.client.execute(req).await?;
537
538    let status = resp.status();
539    let content_type = resp
540        .headers()
541        .get("content-type")
542        .and_then(|v| v.to_str().ok())
543        .unwrap_or("application/octet-stream");
544    let content_type = super::ContentType::from(content_type);
545
546    if !status.is_client_error() && !status.is_server_error() {
547        let content = resp.text().await?;
548        match content_type {
549            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
550            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StorageBlobResponse`"))),
551            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::StorageBlobResponse`")))),
552        }
553    } else {
554        let content = resp.text().await?;
555        let entity: Option<ApiSignerStorageBlobPostError> = serde_json::from_str(&content).ok();
556        Err(Error::ResponseError(ResponseContent { status, content, entity }))
557    }
558}
559
560pub async fn api_signer_storage_blobs_check_existence_post(configuration: &configuration::Configuration, storage_blobs_check_existence_request: models::StorageBlobsCheckExistenceRequest) -> Result<models::StorageBlobsCheckExistenceResponse, Error<ApiSignerStorageBlobsCheckExistencePostError>> {
561    // add a prefix to parameters to efficiently prevent name collisions
562    let p_storage_blobs_check_existence_request = storage_blobs_check_existence_request;
563
564    let uri_str = format!("{}/api/signer/storage/blobs/check_existence", configuration.base_path);
565    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
566
567    if let Some(ref user_agent) = configuration.user_agent {
568        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
569    }
570    if let Some(ref apikey) = configuration.api_key {
571        let key = apikey.key.clone();
572        let value = match apikey.prefix {
573            Some(ref prefix) => format!("{} {}", prefix, key),
574            None => key,
575        };
576        req_builder = req_builder.header("Authorization", value);
577    };
578    req_builder = req_builder.json(&p_storage_blobs_check_existence_request);
579
580    let req = req_builder.build()?;
581    let resp = configuration.client.execute(req).await?;
582
583    let status = resp.status();
584    let content_type = resp
585        .headers()
586        .get("content-type")
587        .and_then(|v| v.to_str().ok())
588        .unwrap_or("application/octet-stream");
589    let content_type = super::ContentType::from(content_type);
590
591    if !status.is_client_error() && !status.is_server_error() {
592        let content = resp.text().await?;
593        match content_type {
594            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
595            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StorageBlobsCheckExistenceResponse`"))),
596            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::StorageBlobsCheckExistenceResponse`")))),
597        }
598    } else {
599        let content = resp.text().await?;
600        let entity: Option<ApiSignerStorageBlobsCheckExistencePostError> = serde_json::from_str(&content).ok();
601        Err(Error::ResponseError(ResponseContent { status, content, entity }))
602    }
603}
604
605pub async fn api_signer_storage_item_post(configuration: &configuration::Configuration, storage_item_data: models::StorageItemData) -> Result<models::StorageItemResponse, Error<ApiSignerStorageItemPostError>> {
606    // add a prefix to parameters to efficiently prevent name collisions
607    let p_storage_item_data = storage_item_data;
608
609    let uri_str = format!("{}/api/signer/storage/item", configuration.base_path);
610    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
611
612    if let Some(ref user_agent) = configuration.user_agent {
613        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
614    }
615    if let Some(ref apikey) = configuration.api_key {
616        let key = apikey.key.clone();
617        let value = match apikey.prefix {
618            Some(ref prefix) => format!("{} {}", prefix, key),
619            None => key,
620        };
621        req_builder = req_builder.header("Authorization", value);
622    };
623    req_builder = req_builder.json(&p_storage_item_data);
624
625    let req = req_builder.build()?;
626    let resp = configuration.client.execute(req).await?;
627
628    let status = resp.status();
629    let content_type = resp
630        .headers()
631        .get("content-type")
632        .and_then(|v| v.to_str().ok())
633        .unwrap_or("application/octet-stream");
634    let content_type = super::ContentType::from(content_type);
635
636    if !status.is_client_error() && !status.is_server_error() {
637        let content = resp.text().await?;
638        match content_type {
639            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
640            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StorageItemResponse`"))),
641            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::StorageItemResponse`")))),
642        }
643    } else {
644        let content = resp.text().await?;
645        let entity: Option<ApiSignerStorageItemPostError> = serde_json::from_str(&content).ok();
646        Err(Error::ResponseError(ResponseContent { status, content, entity }))
647    }
648}
649
650pub async fn api_signer_storage_item_pubkey_hash_delete(configuration: &configuration::Configuration, pubkey: &str, hash: &str) -> Result<models::JsonTextResponse, Error<ApiSignerStorageItemPubkeyHashDeleteError>> {
651    // add a prefix to parameters to efficiently prevent name collisions
652    let p_pubkey = pubkey;
653    let p_hash = hash;
654
655    let uri_str = format!("{}/api/signer/storage/item/{pubkey}/{hash}", configuration.base_path, pubkey=crate::apis::urlencode(p_pubkey), hash=crate::apis::urlencode(p_hash));
656    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
657
658    if let Some(ref user_agent) = configuration.user_agent {
659        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
660    }
661    if let Some(ref apikey) = configuration.api_key {
662        let key = apikey.key.clone();
663        let value = match apikey.prefix {
664            Some(ref prefix) => format!("{} {}", prefix, key),
665            None => key,
666        };
667        req_builder = req_builder.header("Authorization", value);
668    };
669
670    let req = req_builder.build()?;
671    let resp = configuration.client.execute(req).await?;
672
673    let status = resp.status();
674    let content_type = resp
675        .headers()
676        .get("content-type")
677        .and_then(|v| v.to_str().ok())
678        .unwrap_or("application/octet-stream");
679    let content_type = super::ContentType::from(content_type);
680
681    if !status.is_client_error() && !status.is_server_error() {
682        let content = resp.text().await?;
683        match content_type {
684            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
685            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::JsonTextResponse`"))),
686            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::JsonTextResponse`")))),
687        }
688    } else {
689        let content = resp.text().await?;
690        let entity: Option<ApiSignerStorageItemPubkeyHashDeleteError> = serde_json::from_str(&content).ok();
691        Err(Error::ResponseError(ResponseContent { status, content, entity }))
692    }
693}
694
695pub async fn api_signer_storage_item_pubkey_hash_get(configuration: &configuration::Configuration, pubkey: &str, hash: &str) -> Result<reqwest::Response, Error<ApiSignerStorageItemPubkeyHashGetError>> {
696    // add a prefix to parameters to efficiently prevent name collisions
697    let p_pubkey = pubkey;
698    let p_hash = hash;
699
700    let uri_str = format!("{}/api/signer/storage/item/{pubkey}/{hash}", configuration.base_path, pubkey=crate::apis::urlencode(p_pubkey), hash=crate::apis::urlencode(p_hash));
701    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
702
703    if let Some(ref user_agent) = configuration.user_agent {
704        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
705    }
706
707    let req = req_builder.build()?;
708    let resp = configuration.client.execute(req).await?;
709
710    let status = resp.status();
711
712    if !status.is_client_error() && !status.is_server_error() {
713        Ok(resp)
714    } else {
715        let content = resp.text().await?;
716        let entity: Option<ApiSignerStorageItemPubkeyHashGetError> = serde_json::from_str(&content).ok();
717        Err(Error::ResponseError(ResponseContent { status, content, entity }))
718    }
719}
720
721pub async fn api_signer_storage_item_pubkey_hash_head(configuration: &configuration::Configuration, pubkey: &str, hash: &str) -> Result<(), Error<ApiSignerStorageItemPubkeyHashHeadError>> {
722    // add a prefix to parameters to efficiently prevent name collisions
723    let p_pubkey = pubkey;
724    let p_hash = hash;
725
726    let uri_str = format!("{}/api/signer/storage/item/{pubkey}/{hash}", configuration.base_path, pubkey=crate::apis::urlencode(p_pubkey), hash=crate::apis::urlencode(p_hash));
727    let mut req_builder = configuration.client.request(reqwest::Method::HEAD, &uri_str);
728
729    if let Some(ref user_agent) = configuration.user_agent {
730        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
731    }
732
733    let req = req_builder.build()?;
734    let resp = configuration.client.execute(req).await?;
735
736    let status = resp.status();
737
738    if !status.is_client_error() && !status.is_server_error() {
739        Ok(())
740    } else {
741        let content = resp.text().await?;
742        let entity: Option<ApiSignerStorageItemPubkeyHashHeadError> = serde_json::from_str(&content).ok();
743        Err(Error::ResponseError(ResponseContent { status, content, entity }))
744    }
745}
746
747pub async fn api_signer_users_user_key_get(configuration: &configuration::Configuration, user_key: &str) -> Result<models::OApiSignerSignedOApiSignerUserPublic, Error<ApiSignerUsersUserKeyGetError>> {
748    // add a prefix to parameters to efficiently prevent name collisions
749    let p_user_key = user_key;
750
751    let uri_str = format!("{}/api/signer/users/{user_key}", configuration.base_path, user_key=crate::apis::urlencode(p_user_key));
752    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
753
754    if let Some(ref user_agent) = configuration.user_agent {
755        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
756    }
757
758    let req = req_builder.build()?;
759    let resp = configuration.client.execute(req).await?;
760
761    let status = resp.status();
762    let content_type = resp
763        .headers()
764        .get("content-type")
765        .and_then(|v| v.to_str().ok())
766        .unwrap_or("application/octet-stream");
767    let content_type = super::ContentType::from(content_type);
768
769    if !status.is_client_error() && !status.is_server_error() {
770        let content = resp.text().await?;
771        match content_type {
772            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
773            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OApiSignerSignedOApiSignerUserPublic`"))),
774            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::OApiSignerSignedOApiSignerUserPublic`")))),
775        }
776    } else {
777        let content = resp.text().await?;
778        let entity: Option<ApiSignerUsersUserKeyGetError> = serde_json::from_str(&content).ok();
779        Err(Error::ResponseError(ResponseContent { status, content, entity }))
780    }
781}
782