sindri_openapi/apis/
internal_api.rs

1/*
2 * Sindri Labs API
3 *
4 *  ## About [Sindri Labs](https://www.sindri.app/)' API simplifies the developer experience to enable fast and scalable zero-knowledge proof generation.  Front-End Dashboard: [https://sindri.app/login](https://sindri.app/login)  ## Documentation The [Sindri Documentation](https://sindri.app/docs) contains everything you need to get started!  ## Sindri Resources The [sindri-resources GitHub repo](https://github.com/Sindri-Labs/sindri-resources) contains contains resources and sample data for the Sindri API.  ## Using this Page This is a standard [OpenAPI (Swagger)](https://swagger.io/specification/) API documentation page. It provides detailed documentation for each endpoint.  This page enables easy prototyping via the \"Try it out\" feature!  Since all Sindri endpoints require a valid API Key, in order to use the \"Try it out\" feature for any endpoint in this documentation you must first obtain an API key. Do this in one of two ways: 1. Enter your username and password in the `/api/apikey/generate` endpoint of the **Authorization** section below. Use the API key returned in the `access` field of the response. 2. Obtain an API key from the Sindri Dashboard team \"Account Settings\".  After obtaining your API key, authorize your page session by entering your API Key in the `SindriAPIKeyBearerAuth` section, reached by clicking \"Authorize\" below.  Proving Backend Version: v1.2.8
5 *
6 * The version of the OpenAPI document: v1.17.12
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use super::{configuration, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{Deserialize, Serialize};
15
16/// struct for typed errors of method [`circuit_download`]
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum CircuitDownloadError {
20    Status404(),
21    Status500(models::SindriInternalErrorResponse),
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`circuit_proofs_paginated`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum CircuitProofsPaginatedError {
29    Status404(models::CircuitDoesNotExistResponse),
30    Status500(models::SindriInternalErrorResponse),
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`circuit_smart_contract_verifier`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum CircuitSmartContractVerifierError {
38    Status404(models::CircuitDoesNotExistResponse),
39    Status409(models::CircuitIsNotReadyResponse),
40    Status500(models::SindriInternalErrorResponse),
41    Status501(models::ComingSoonResponse),
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`circuit_status`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum CircuitStatusError {
49    Status404(models::CircuitDoesNotExistResponse),
50    Status500(models::SindriInternalErrorResponse),
51    UnknownValue(serde_json::Value),
52}
53
54/// struct for typed errors of method [`password_change_with_jwt_auth`]
55#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum PasswordChangeWithJwtAuthError {
58    Status422(models::ValidationErrorResponse),
59    UnknownValue(serde_json::Value),
60}
61
62/// struct for typed errors of method [`project_circuits`]
63#[derive(Debug, Clone, Serialize, Deserialize)]
64#[serde(untagged)]
65pub enum ProjectCircuitsError {
66    Status404(models::ProjectDoesNotExistResponse),
67    Status500(models::SindriInternalErrorResponse),
68    UnknownValue(serde_json::Value),
69}
70
71/// struct for typed errors of method [`project_circuits_paginated`]
72#[derive(Debug, Clone, Serialize, Deserialize)]
73#[serde(untagged)]
74pub enum ProjectCircuitsPaginatedError {
75    Status404(models::ProjectDoesNotExistResponse),
76    Status500(models::SindriInternalErrorResponse),
77    UnknownValue(serde_json::Value),
78}
79
80/// struct for typed errors of method [`project_delete`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum ProjectDeleteError {
84    Status404(models::ProjectDoesNotExistResponse),
85    Status500(models::SindriInternalErrorResponse),
86    UnknownValue(serde_json::Value),
87}
88
89/// struct for typed errors of method [`project_detail`]
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum ProjectDetailError {
93    Status404(models::ProjectDoesNotExistResponse),
94    Status500(models::SindriInternalErrorResponse),
95    UnknownValue(serde_json::Value),
96}
97
98/// struct for typed errors of method [`project_list`]
99#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum ProjectListError {
102    Status500(models::SindriInternalErrorResponse),
103    Status404(models::TeamDoesNotExistResponse),
104    UnknownValue(serde_json::Value),
105}
106
107/// struct for typed errors of method [`project_list_paginated`]
108#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum ProjectListPaginatedError {
111    Status500(models::SindriInternalErrorResponse),
112    Status404(models::TeamDoesNotExistResponse),
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`project_proofs`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum ProjectProofsError {
120    Status404(models::ProjectDoesNotExistResponse),
121    Status500(models::SindriInternalErrorResponse),
122    UnknownValue(serde_json::Value),
123}
124
125/// struct for typed errors of method [`project_proofs_paginated`]
126#[derive(Debug, Clone, Serialize, Deserialize)]
127#[serde(untagged)]
128pub enum ProjectProofsPaginatedError {
129    Status404(models::ProjectDoesNotExistResponse),
130    Status500(models::SindriInternalErrorResponse),
131    UnknownValue(serde_json::Value),
132}
133
134/// struct for typed errors of method [`project_settings`]
135#[derive(Debug, Clone, Serialize, Deserialize)]
136#[serde(untagged)]
137pub enum ProjectSettingsError {
138    Status404(models::ProjectDoesNotExistResponse),
139    Status500(models::SindriInternalErrorResponse),
140    Status422(models::ValidationErrorResponse),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`proof_histogram`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum ProofHistogramError {
148    Status500(models::SindriInternalErrorResponse),
149    UnknownValue(serde_json::Value),
150}
151
152/// struct for typed errors of method [`proof_list`]
153#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum ProofListError {
156    Status500(models::SindriInternalErrorResponse),
157    UnknownValue(serde_json::Value),
158}
159
160/// struct for typed errors of method [`proof_list_paginated`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum ProofListPaginatedError {
164    Status500(models::SindriInternalErrorResponse),
165    UnknownValue(serde_json::Value),
166}
167
168/// struct for typed errors of method [`proof_status`]
169#[derive(Debug, Clone, Serialize, Deserialize)]
170#[serde(untagged)]
171pub enum ProofStatusError {
172    Status404(models::ProofDoesNotExistResponse),
173    Status500(models::SindriInternalErrorResponse),
174    UnknownValue(serde_json::Value),
175}
176
177/// struct for typed errors of method [`sindri_manifest_schema`]
178#[derive(Debug, Clone, Serialize, Deserialize)]
179#[serde(untagged)]
180pub enum SindriManifestSchemaError {
181    UnknownValue(serde_json::Value),
182}
183
184/// struct for typed errors of method [`team_avatar_upload`]
185#[derive(Debug, Clone, Serialize, Deserialize)]
186#[serde(untagged)]
187pub enum TeamAvatarUploadError {
188    Status400(models::SindriInvalidUploadResponse),
189    Status500(models::SindriInternalErrorResponse),
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`team_create`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum TeamCreateError {
197    Status400(models::SindriValueErrorResponse),
198    Status409(models::TeamAlreadyExistsResponse),
199    Status500(models::SindriInternalErrorResponse),
200    UnknownValue(serde_json::Value),
201}
202
203/// struct for typed errors of method [`team_detail`]
204#[derive(Debug, Clone, Serialize, Deserialize)]
205#[serde(untagged)]
206pub enum TeamDetailError {
207    Status404(models::TeamDoesNotExistResponse),
208    UnknownValue(serde_json::Value),
209}
210
211/// struct for typed errors of method [`team_invite`]
212#[derive(Debug, Clone, Serialize, Deserialize)]
213#[serde(untagged)]
214pub enum TeamInviteError {
215    UnknownValue(serde_json::Value),
216}
217
218/// struct for typed errors of method [`team_me`]
219#[derive(Debug, Clone, Serialize, Deserialize)]
220#[serde(untagged)]
221pub enum TeamMeError {
222    UnknownValue(serde_json::Value),
223}
224
225/// struct for typed errors of method [`team_members`]
226#[derive(Debug, Clone, Serialize, Deserialize)]
227#[serde(untagged)]
228pub enum TeamMembersError {
229    Status404(models::TeamDoesNotExistResponse),
230    UnknownValue(serde_json::Value),
231}
232
233/// struct for typed errors of method [`team_remove_member`]
234#[derive(Debug, Clone, Serialize, Deserialize)]
235#[serde(untagged)]
236pub enum TeamRemoveMemberError {
237    Status403(),
238    Status404(),
239    UnknownValue(serde_json::Value),
240}
241
242/// struct for typed errors of method [`user_me_with_jwt_auth`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum UserMeWithJwtAuthError {
246    UnknownValue(serde_json::Value),
247}
248
249/// Obtain circuit file(s).
250pub async fn circuit_download(
251    configuration: &configuration::Configuration,
252    circuit_id: &str,
253    path: Option<&str>,
254) -> Result<reqwest::Response, Error<CircuitDownloadError>> {
255    // add a prefix to parameters to efficiently prevent name collisions
256    let p_circuit_id = circuit_id;
257    let p_path = path;
258
259    let uri_str = format!(
260        "{}/api/v1/circuit/{circuit_id}/download",
261        configuration.base_path,
262        circuit_id = crate::apis::urlencode(p_circuit_id)
263    );
264    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
265
266    if let Some(ref param_value) = p_path {
267        req_builder = req_builder.query(&[("path", &param_value.to_string())]);
268    }
269    if let Some(ref user_agent) = configuration.user_agent {
270        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
271    }
272    if let Some(ref token) = configuration.bearer_access_token {
273        req_builder = req_builder.bearer_auth(token.to_owned());
274    };
275    if let Some(ref token) = configuration.bearer_access_token {
276        req_builder = req_builder.bearer_auth(token.to_owned());
277    };
278
279    let req = req_builder.build()?;
280    let resp = configuration.client.execute(req).await?;
281
282    let status = resp.status();
283
284    if !status.is_client_error() && !status.is_server_error() {
285        Ok(resp)
286    } else {
287        let content = resp.text().await?;
288        let entity: Option<CircuitDownloadError> = serde_json::from_str(&content).ok();
289        Err(Error::ResponseError(ResponseContent {
290            status,
291            content,
292            entity,
293        }))
294    }
295}
296
297/// List all proofs for a circuit.
298pub async fn circuit_proofs_paginated(
299    configuration: &configuration::Configuration,
300    circuit_id: &str,
301    limit: Option<i32>,
302    offset: Option<i32>,
303) -> Result<models::PagedProofInfoResponse, Error<CircuitProofsPaginatedError>> {
304    // add a prefix to parameters to efficiently prevent name collisions
305    let p_circuit_id = circuit_id;
306    let p_limit = limit;
307    let p_offset = offset;
308
309    let uri_str = format!(
310        "{}/api/v1/circuit/{circuit_id}/proofs/paginated",
311        configuration.base_path,
312        circuit_id = crate::apis::urlencode(p_circuit_id)
313    );
314    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
315
316    if let Some(ref param_value) = p_limit {
317        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
318    }
319    if let Some(ref param_value) = p_offset {
320        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
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 token) = configuration.bearer_access_token {
326        req_builder = req_builder.bearer_auth(token.to_owned());
327    };
328    if let Some(ref token) = configuration.bearer_access_token {
329        req_builder = req_builder.bearer_auth(token.to_owned());
330    };
331
332    let req = req_builder.build()?;
333    let resp = configuration.client.execute(req).await?;
334
335    let status = resp.status();
336
337    if !status.is_client_error() && !status.is_server_error() {
338        let content = resp.text().await?;
339        serde_json::from_str(&content).map_err(Error::from)
340    } else {
341        let content = resp.text().await?;
342        let entity: Option<CircuitProofsPaginatedError> = serde_json::from_str(&content).ok();
343        Err(Error::ResponseError(ResponseContent {
344            status,
345            content,
346            entity,
347        }))
348    }
349}
350
351/// Get smart contract verifier for existing circuit
352pub async fn circuit_smart_contract_verifier(
353    configuration: &configuration::Configuration,
354    circuit_id: &str,
355) -> Result<models::SmartContractVerifierResponse, Error<CircuitSmartContractVerifierError>> {
356    // add a prefix to parameters to efficiently prevent name collisions
357    let p_circuit_id = circuit_id;
358
359    let uri_str = format!(
360        "{}/api/v1/circuit/{circuit_id}/smart_contract_verifier",
361        configuration.base_path,
362        circuit_id = crate::apis::urlencode(p_circuit_id)
363    );
364    let mut req_builder = configuration.client.request(reqwest::Method::GET, &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 token) = configuration.bearer_access_token {
370        req_builder = req_builder.bearer_auth(token.to_owned());
371    };
372    if let Some(ref token) = configuration.bearer_access_token {
373        req_builder = req_builder.bearer_auth(token.to_owned());
374    };
375
376    let req = req_builder.build()?;
377    let resp = configuration.client.execute(req).await?;
378
379    let status = resp.status();
380
381    if !status.is_client_error() && !status.is_server_error() {
382        let content = resp.text().await?;
383        serde_json::from_str(&content).map_err(Error::from)
384    } else {
385        let content = resp.text().await?;
386        let entity: Option<CircuitSmartContractVerifierError> = serde_json::from_str(&content).ok();
387        Err(Error::ResponseError(ResponseContent {
388            status,
389            content,
390            entity,
391        }))
392    }
393}
394
395/// Get status for a specific circuit.
396pub async fn circuit_status(
397    configuration: &configuration::Configuration,
398    circuit_id: &str,
399) -> Result<models::CircuitStatusResponse, Error<CircuitStatusError>> {
400    // add a prefix to parameters to efficiently prevent name collisions
401    let p_circuit_id = circuit_id;
402
403    let uri_str = format!(
404        "{}/api/v1/circuit/{circuit_id}/status",
405        configuration.base_path,
406        circuit_id = crate::apis::urlencode(p_circuit_id)
407    );
408    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
409
410    if let Some(ref user_agent) = configuration.user_agent {
411        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
412    }
413    if let Some(ref token) = configuration.bearer_access_token {
414        req_builder = req_builder.bearer_auth(token.to_owned());
415    };
416    if let Some(ref token) = configuration.bearer_access_token {
417        req_builder = req_builder.bearer_auth(token.to_owned());
418    };
419
420    let req = req_builder.build()?;
421    let resp = configuration.client.execute(req).await?;
422
423    let status = resp.status();
424
425    if !status.is_client_error() && !status.is_server_error() {
426        let content = resp.text().await?;
427        serde_json::from_str(&content).map_err(Error::from)
428    } else {
429        let content = resp.text().await?;
430        let entity: Option<CircuitStatusError> = serde_json::from_str(&content).ok();
431        Err(Error::ResponseError(ResponseContent {
432            status,
433            content,
434            entity,
435        }))
436    }
437}
438
439/// Change user password. Requires JWT authentication.
440pub async fn password_change_with_jwt_auth(
441    configuration: &configuration::Configuration,
442    password_change_input: models::PasswordChangeInput,
443) -> Result<models::ActionResponse, Error<PasswordChangeWithJwtAuthError>> {
444    // add a prefix to parameters to efficiently prevent name collisions
445    let p_password_change_input = password_change_input;
446
447    let uri_str = format!("{}/api/v1/password/change", configuration.base_path);
448    let mut req_builder = configuration
449        .client
450        .request(reqwest::Method::POST, &uri_str);
451
452    if let Some(ref user_agent) = configuration.user_agent {
453        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
454    }
455    if let Some(ref token) = configuration.bearer_access_token {
456        req_builder = req_builder.bearer_auth(token.to_owned());
457    };
458    if let Some(ref token) = configuration.bearer_access_token {
459        req_builder = req_builder.bearer_auth(token.to_owned());
460    };
461    req_builder = req_builder.json(&p_password_change_input);
462
463    let req = req_builder.build()?;
464    let resp = configuration.client.execute(req).await?;
465
466    let status = resp.status();
467
468    if !status.is_client_error() && !status.is_server_error() {
469        let content = resp.text().await?;
470        serde_json::from_str(&content).map_err(Error::from)
471    } else {
472        let content = resp.text().await?;
473        let entity: Option<PasswordChangeWithJwtAuthError> = serde_json::from_str(&content).ok();
474        Err(Error::ResponseError(ResponseContent {
475            status,
476            content,
477            entity,
478        }))
479    }
480}
481
482/// List all circuits for a project.
483pub async fn project_circuits(
484    configuration: &configuration::Configuration,
485    project_id: &str,
486) -> Result<Vec<models::CircuitInfoResponse>, Error<ProjectCircuitsError>> {
487    // add a prefix to parameters to efficiently prevent name collisions
488    let p_project_id = project_id;
489
490    let uri_str = format!(
491        "{}/api/v1/project/{project_id}/circuits",
492        configuration.base_path,
493        project_id = crate::apis::urlencode(p_project_id)
494    );
495    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
496
497    if let Some(ref user_agent) = configuration.user_agent {
498        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
499    }
500    if let Some(ref token) = configuration.bearer_access_token {
501        req_builder = req_builder.bearer_auth(token.to_owned());
502    };
503    if let Some(ref token) = configuration.bearer_access_token {
504        req_builder = req_builder.bearer_auth(token.to_owned());
505    };
506
507    let req = req_builder.build()?;
508    let resp = configuration.client.execute(req).await?;
509
510    let status = resp.status();
511
512    if !status.is_client_error() && !status.is_server_error() {
513        let content = resp.text().await?;
514        serde_json::from_str(&content).map_err(Error::from)
515    } else {
516        let content = resp.text().await?;
517        let entity: Option<ProjectCircuitsError> = serde_json::from_str(&content).ok();
518        Err(Error::ResponseError(ResponseContent {
519            status,
520            content,
521            entity,
522        }))
523    }
524}
525
526/// List all circuits for a project.
527pub async fn project_circuits_paginated(
528    configuration: &configuration::Configuration,
529    project_id: &str,
530    limit: Option<i32>,
531    offset: Option<i32>,
532) -> Result<models::PagedCircuitInfoResponse, Error<ProjectCircuitsPaginatedError>> {
533    // add a prefix to parameters to efficiently prevent name collisions
534    let p_project_id = project_id;
535    let p_limit = limit;
536    let p_offset = offset;
537
538    let uri_str = format!(
539        "{}/api/v1/project/{project_id}/circuits/paginated",
540        configuration.base_path,
541        project_id = crate::apis::urlencode(p_project_id)
542    );
543    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
544
545    if let Some(ref param_value) = p_limit {
546        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
547    }
548    if let Some(ref param_value) = p_offset {
549        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
550    }
551    if let Some(ref user_agent) = configuration.user_agent {
552        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
553    }
554    if let Some(ref token) = configuration.bearer_access_token {
555        req_builder = req_builder.bearer_auth(token.to_owned());
556    };
557    if let Some(ref token) = configuration.bearer_access_token {
558        req_builder = req_builder.bearer_auth(token.to_owned());
559    };
560
561    let req = req_builder.build()?;
562    let resp = configuration.client.execute(req).await?;
563
564    let status = resp.status();
565
566    if !status.is_client_error() && !status.is_server_error() {
567        let content = resp.text().await?;
568        serde_json::from_str(&content).map_err(Error::from)
569    } else {
570        let content = resp.text().await?;
571        let entity: Option<ProjectCircuitsPaginatedError> = serde_json::from_str(&content).ok();
572        Err(Error::ResponseError(ResponseContent {
573            status,
574            content,
575            entity,
576        }))
577    }
578}
579
580/// Delete a project.
581pub async fn project_delete(
582    configuration: &configuration::Configuration,
583    project_id: &str,
584) -> Result<models::ActionResponse, Error<ProjectDeleteError>> {
585    // add a prefix to parameters to efficiently prevent name collisions
586    let p_project_id = project_id;
587
588    let uri_str = format!(
589        "{}/api/v1/project/{project_id}/delete",
590        configuration.base_path,
591        project_id = crate::apis::urlencode(p_project_id)
592    );
593    let mut req_builder = configuration
594        .client
595        .request(reqwest::Method::DELETE, &uri_str);
596
597    if let Some(ref user_agent) = configuration.user_agent {
598        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
599    }
600    if let Some(ref token) = configuration.bearer_access_token {
601        req_builder = req_builder.bearer_auth(token.to_owned());
602    };
603    if let Some(ref token) = configuration.bearer_access_token {
604        req_builder = req_builder.bearer_auth(token.to_owned());
605    };
606
607    let req = req_builder.build()?;
608    let resp = configuration.client.execute(req).await?;
609
610    let status = resp.status();
611
612    if !status.is_client_error() && !status.is_server_error() {
613        let content = resp.text().await?;
614        serde_json::from_str(&content).map_err(Error::from)
615    } else {
616        let content = resp.text().await?;
617        let entity: Option<ProjectDeleteError> = serde_json::from_str(&content).ok();
618        Err(Error::ResponseError(ResponseContent {
619            status,
620            content,
621            entity,
622        }))
623    }
624}
625
626/// Get info for a project.
627pub async fn project_detail(
628    configuration: &configuration::Configuration,
629    project_id: &str,
630) -> Result<models::ProjectInfoResponse, Error<ProjectDetailError>> {
631    // add a prefix to parameters to efficiently prevent name collisions
632    let p_project_id = project_id;
633
634    let uri_str = format!(
635        "{}/api/v1/project/{project_id}/detail",
636        configuration.base_path,
637        project_id = crate::apis::urlencode(p_project_id)
638    );
639    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
640
641    if let Some(ref user_agent) = configuration.user_agent {
642        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
643    }
644    if let Some(ref token) = configuration.bearer_access_token {
645        req_builder = req_builder.bearer_auth(token.to_owned());
646    };
647    if let Some(ref token) = configuration.bearer_access_token {
648        req_builder = req_builder.bearer_auth(token.to_owned());
649    };
650
651    let req = req_builder.build()?;
652    let resp = configuration.client.execute(req).await?;
653
654    let status = resp.status();
655
656    if !status.is_client_error() && !status.is_server_error() {
657        let content = resp.text().await?;
658        serde_json::from_str(&content).map_err(Error::from)
659    } else {
660        let content = resp.text().await?;
661        let entity: Option<ProjectDetailError> = serde_json::from_str(&content).ok();
662        Err(Error::ResponseError(ResponseContent {
663            status,
664            content,
665            entity,
666        }))
667    }
668}
669
670/// List all projects meeting filter criteria.
671pub async fn project_list(
672    configuration: &configuration::Configuration,
673    project_list_input: models::ProjectListInput,
674) -> Result<Vec<models::ProjectInfoResponse>, Error<ProjectListError>> {
675    // add a prefix to parameters to efficiently prevent name collisions
676    let p_project_list_input = project_list_input;
677
678    let uri_str = format!("{}/api/v1/project/list", configuration.base_path);
679    let mut req_builder = configuration
680        .client
681        .request(reqwest::Method::POST, &uri_str);
682
683    if let Some(ref user_agent) = configuration.user_agent {
684        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
685    }
686    if let Some(ref token) = configuration.bearer_access_token {
687        req_builder = req_builder.bearer_auth(token.to_owned());
688    };
689    if let Some(ref token) = configuration.bearer_access_token {
690        req_builder = req_builder.bearer_auth(token.to_owned());
691    };
692    req_builder = req_builder.json(&p_project_list_input);
693
694    let req = req_builder.build()?;
695    let resp = configuration.client.execute(req).await?;
696
697    let status = resp.status();
698
699    if !status.is_client_error() && !status.is_server_error() {
700        let content = resp.text().await?;
701        serde_json::from_str(&content).map_err(Error::from)
702    } else {
703        let content = resp.text().await?;
704        let entity: Option<ProjectListError> = serde_json::from_str(&content).ok();
705        Err(Error::ResponseError(ResponseContent {
706            status,
707            content,
708            entity,
709        }))
710    }
711}
712
713/// List all projects meeting filter criteria.
714pub async fn project_list_paginated(
715    configuration: &configuration::Configuration,
716    project_list_input: models::ProjectListInput,
717    limit: Option<i32>,
718    offset: Option<i32>,
719) -> Result<models::PagedProjectInfoResponse, Error<ProjectListPaginatedError>> {
720    // add a prefix to parameters to efficiently prevent name collisions
721    let p_project_list_input = project_list_input;
722    let p_limit = limit;
723    let p_offset = offset;
724
725    let uri_str = format!("{}/api/v1/project/list/paginated", configuration.base_path);
726    let mut req_builder = configuration
727        .client
728        .request(reqwest::Method::POST, &uri_str);
729
730    if let Some(ref param_value) = p_limit {
731        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
732    }
733    if let Some(ref param_value) = p_offset {
734        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
735    }
736    if let Some(ref user_agent) = configuration.user_agent {
737        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
738    }
739    if let Some(ref token) = configuration.bearer_access_token {
740        req_builder = req_builder.bearer_auth(token.to_owned());
741    };
742    if let Some(ref token) = configuration.bearer_access_token {
743        req_builder = req_builder.bearer_auth(token.to_owned());
744    };
745    req_builder = req_builder.json(&p_project_list_input);
746
747    let req = req_builder.build()?;
748    let resp = configuration.client.execute(req).await?;
749
750    let status = resp.status();
751
752    if !status.is_client_error() && !status.is_server_error() {
753        let content = resp.text().await?;
754        serde_json::from_str(&content).map_err(Error::from)
755    } else {
756        let content = resp.text().await?;
757        let entity: Option<ProjectListPaginatedError> = serde_json::from_str(&content).ok();
758        Err(Error::ResponseError(ResponseContent {
759            status,
760            content,
761            entity,
762        }))
763    }
764}
765
766/// Get all proofs for a project.
767pub async fn project_proofs(
768    configuration: &configuration::Configuration,
769    project_id: &str,
770) -> Result<Vec<models::ProofInfoResponse>, Error<ProjectProofsError>> {
771    // add a prefix to parameters to efficiently prevent name collisions
772    let p_project_id = project_id;
773
774    let uri_str = format!(
775        "{}/api/v1/project/{project_id}/proofs",
776        configuration.base_path,
777        project_id = crate::apis::urlencode(p_project_id)
778    );
779    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
780
781    if let Some(ref user_agent) = configuration.user_agent {
782        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
783    }
784    if let Some(ref token) = configuration.bearer_access_token {
785        req_builder = req_builder.bearer_auth(token.to_owned());
786    };
787    if let Some(ref token) = configuration.bearer_access_token {
788        req_builder = req_builder.bearer_auth(token.to_owned());
789    };
790
791    let req = req_builder.build()?;
792    let resp = configuration.client.execute(req).await?;
793
794    let status = resp.status();
795
796    if !status.is_client_error() && !status.is_server_error() {
797        let content = resp.text().await?;
798        serde_json::from_str(&content).map_err(Error::from)
799    } else {
800        let content = resp.text().await?;
801        let entity: Option<ProjectProofsError> = serde_json::from_str(&content).ok();
802        Err(Error::ResponseError(ResponseContent {
803            status,
804            content,
805            entity,
806        }))
807    }
808}
809
810/// Get all proofs for a project.
811pub async fn project_proofs_paginated(
812    configuration: &configuration::Configuration,
813    project_id: &str,
814    limit: Option<i32>,
815    offset: Option<i32>,
816) -> Result<models::PagedProofInfoResponse, Error<ProjectProofsPaginatedError>> {
817    // add a prefix to parameters to efficiently prevent name collisions
818    let p_project_id = project_id;
819    let p_limit = limit;
820    let p_offset = offset;
821
822    let uri_str = format!(
823        "{}/api/v1/project/{project_id}/proofs/paginated",
824        configuration.base_path,
825        project_id = crate::apis::urlencode(p_project_id)
826    );
827    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
828
829    if let Some(ref param_value) = p_limit {
830        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
831    }
832    if let Some(ref param_value) = p_offset {
833        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
834    }
835    if let Some(ref user_agent) = configuration.user_agent {
836        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
837    }
838    if let Some(ref token) = configuration.bearer_access_token {
839        req_builder = req_builder.bearer_auth(token.to_owned());
840    };
841    if let Some(ref token) = configuration.bearer_access_token {
842        req_builder = req_builder.bearer_auth(token.to_owned());
843    };
844
845    let req = req_builder.build()?;
846    let resp = configuration.client.execute(req).await?;
847
848    let status = resp.status();
849
850    if !status.is_client_error() && !status.is_server_error() {
851        let content = resp.text().await?;
852        serde_json::from_str(&content).map_err(Error::from)
853    } else {
854        let content = resp.text().await?;
855        let entity: Option<ProjectProofsPaginatedError> = serde_json::from_str(&content).ok();
856        Err(Error::ResponseError(ResponseContent {
857            status,
858            content,
859            entity,
860        }))
861    }
862}
863
864/// Update project settings.
865pub async fn project_settings(
866    configuration: &configuration::Configuration,
867    project_name: &str,
868    project_settings_input: models::ProjectSettingsInput,
869) -> Result<models::ProjectInfoResponse, Error<ProjectSettingsError>> {
870    // add a prefix to parameters to efficiently prevent name collisions
871    let p_project_name = project_name;
872    let p_project_settings_input = project_settings_input;
873
874    let uri_str = format!(
875        "{}/api/v1/project/{project_name}/settings",
876        configuration.base_path,
877        project_name = crate::apis::urlencode(p_project_name)
878    );
879    let mut req_builder = configuration
880        .client
881        .request(reqwest::Method::POST, &uri_str);
882
883    if let Some(ref user_agent) = configuration.user_agent {
884        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
885    }
886    if let Some(ref token) = configuration.bearer_access_token {
887        req_builder = req_builder.bearer_auth(token.to_owned());
888    };
889    if let Some(ref token) = configuration.bearer_access_token {
890        req_builder = req_builder.bearer_auth(token.to_owned());
891    };
892    req_builder = req_builder.json(&p_project_settings_input);
893
894    let req = req_builder.build()?;
895    let resp = configuration.client.execute(req).await?;
896
897    let status = resp.status();
898
899    if !status.is_client_error() && !status.is_server_error() {
900        let content = resp.text().await?;
901        serde_json::from_str(&content).map_err(Error::from)
902    } else {
903        let content = resp.text().await?;
904        let entity: Option<ProjectSettingsError> = serde_json::from_str(&content).ok();
905        Err(Error::ResponseError(ResponseContent {
906            status,
907            content,
908            entity,
909        }))
910    }
911}
912
913/// Get histogram data for a team's proofs.
914pub async fn proof_histogram(
915    configuration: &configuration::Configuration,
916    proof_histogram_input: models::ProofHistogramInput,
917) -> Result<models::ProofHistogramResponse, Error<ProofHistogramError>> {
918    // add a prefix to parameters to efficiently prevent name collisions
919    let p_proof_histogram_input = proof_histogram_input;
920
921    let uri_str = format!("{}/api/v1/proof/histogram", configuration.base_path);
922    let mut req_builder = configuration
923        .client
924        .request(reqwest::Method::POST, &uri_str);
925
926    if let Some(ref user_agent) = configuration.user_agent {
927        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
928    }
929    if let Some(ref token) = configuration.bearer_access_token {
930        req_builder = req_builder.bearer_auth(token.to_owned());
931    };
932    if let Some(ref token) = configuration.bearer_access_token {
933        req_builder = req_builder.bearer_auth(token.to_owned());
934    };
935    req_builder = req_builder.json(&p_proof_histogram_input);
936
937    let req = req_builder.build()?;
938    let resp = configuration.client.execute(req).await?;
939
940    let status = resp.status();
941
942    if !status.is_client_error() && !status.is_server_error() {
943        let content = resp.text().await?;
944        serde_json::from_str(&content).map_err(Error::from)
945    } else {
946        let content = resp.text().await?;
947        let entity: Option<ProofHistogramError> = serde_json::from_str(&content).ok();
948        Err(Error::ResponseError(ResponseContent {
949            status,
950            content,
951            entity,
952        }))
953    }
954}
955
956/// List proofs for the requesting team.
957pub async fn proof_list(
958    configuration: &configuration::Configuration,
959    proof_list_input: models::ProofListInput,
960) -> Result<Vec<models::ProofInfoResponse>, Error<ProofListError>> {
961    // add a prefix to parameters to efficiently prevent name collisions
962    let p_proof_list_input = proof_list_input;
963
964    let uri_str = format!("{}/api/v1/proof/list", configuration.base_path);
965    let mut req_builder = configuration
966        .client
967        .request(reqwest::Method::POST, &uri_str);
968
969    if let Some(ref user_agent) = configuration.user_agent {
970        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
971    }
972    if let Some(ref token) = configuration.bearer_access_token {
973        req_builder = req_builder.bearer_auth(token.to_owned());
974    };
975    if let Some(ref token) = configuration.bearer_access_token {
976        req_builder = req_builder.bearer_auth(token.to_owned());
977    };
978    req_builder = req_builder.json(&p_proof_list_input);
979
980    let req = req_builder.build()?;
981    let resp = configuration.client.execute(req).await?;
982
983    let status = resp.status();
984
985    if !status.is_client_error() && !status.is_server_error() {
986        let content = resp.text().await?;
987        serde_json::from_str(&content).map_err(Error::from)
988    } else {
989        let content = resp.text().await?;
990        let entity: Option<ProofListError> = serde_json::from_str(&content).ok();
991        Err(Error::ResponseError(ResponseContent {
992            status,
993            content,
994            entity,
995        }))
996    }
997}
998
999/// List proofs for the requesting team.
1000pub async fn proof_list_paginated(
1001    configuration: &configuration::Configuration,
1002    proof_list_input: models::ProofListInput,
1003    limit: Option<i32>,
1004    offset: Option<i32>,
1005) -> Result<models::PagedProofInfoResponse, Error<ProofListPaginatedError>> {
1006    // add a prefix to parameters to efficiently prevent name collisions
1007    let p_proof_list_input = proof_list_input;
1008    let p_limit = limit;
1009    let p_offset = offset;
1010
1011    let uri_str = format!("{}/api/v1/proof/list/paginated", configuration.base_path);
1012    let mut req_builder = configuration
1013        .client
1014        .request(reqwest::Method::POST, &uri_str);
1015
1016    if let Some(ref param_value) = p_limit {
1017        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
1018    }
1019    if let Some(ref param_value) = p_offset {
1020        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
1021    }
1022    if let Some(ref user_agent) = configuration.user_agent {
1023        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1024    }
1025    if let Some(ref token) = configuration.bearer_access_token {
1026        req_builder = req_builder.bearer_auth(token.to_owned());
1027    };
1028    if let Some(ref token) = configuration.bearer_access_token {
1029        req_builder = req_builder.bearer_auth(token.to_owned());
1030    };
1031    req_builder = req_builder.json(&p_proof_list_input);
1032
1033    let req = req_builder.build()?;
1034    let resp = configuration.client.execute(req).await?;
1035
1036    let status = resp.status();
1037
1038    if !status.is_client_error() && !status.is_server_error() {
1039        let content = resp.text().await?;
1040        serde_json::from_str(&content).map_err(Error::from)
1041    } else {
1042        let content = resp.text().await?;
1043        let entity: Option<ProofListPaginatedError> = serde_json::from_str(&content).ok();
1044        Err(Error::ResponseError(ResponseContent {
1045            status,
1046            content,
1047            entity,
1048        }))
1049    }
1050}
1051
1052/// Get status for a specific proof.
1053pub async fn proof_status(
1054    configuration: &configuration::Configuration,
1055    proof_id: &str,
1056) -> Result<models::ProofStatusResponse, Error<ProofStatusError>> {
1057    // add a prefix to parameters to efficiently prevent name collisions
1058    let p_proof_id = proof_id;
1059
1060    let uri_str = format!(
1061        "{}/api/v1/proof/{proof_id}/status",
1062        configuration.base_path,
1063        proof_id = crate::apis::urlencode(p_proof_id)
1064    );
1065    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1066
1067    if let Some(ref user_agent) = configuration.user_agent {
1068        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1069    }
1070    if let Some(ref token) = configuration.bearer_access_token {
1071        req_builder = req_builder.bearer_auth(token.to_owned());
1072    };
1073    if let Some(ref token) = configuration.bearer_access_token {
1074        req_builder = req_builder.bearer_auth(token.to_owned());
1075    };
1076
1077    let req = req_builder.build()?;
1078    let resp = configuration.client.execute(req).await?;
1079
1080    let status = resp.status();
1081
1082    if !status.is_client_error() && !status.is_server_error() {
1083        let content = resp.text().await?;
1084        serde_json::from_str(&content).map_err(Error::from)
1085    } else {
1086        let content = resp.text().await?;
1087        let entity: Option<ProofStatusError> = serde_json::from_str(&content).ok();
1088        Err(Error::ResponseError(ResponseContent {
1089            status,
1090            content,
1091            entity,
1092        }))
1093    }
1094}
1095
1096/// Return Sindri manifest schema as JSON.
1097pub async fn sindri_manifest_schema(
1098    configuration: &configuration::Configuration,
1099) -> Result<serde_json::Value, Error<SindriManifestSchemaError>> {
1100    let uri_str = format!(
1101        "{}/api/v1/sindri-manifest-schema.json",
1102        configuration.base_path
1103    );
1104    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1105
1106    if let Some(ref user_agent) = configuration.user_agent {
1107        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1108    }
1109
1110    let req = req_builder.build()?;
1111    let resp = configuration.client.execute(req).await?;
1112
1113    let status = resp.status();
1114
1115    if !status.is_client_error() && !status.is_server_error() {
1116        let content = resp.text().await?;
1117        serde_json::from_str(&content).map_err(Error::from)
1118    } else {
1119        let content = resp.text().await?;
1120        let entity: Option<SindriManifestSchemaError> = serde_json::from_str(&content).ok();
1121        Err(Error::ResponseError(ResponseContent {
1122            status,
1123            content,
1124            entity,
1125        }))
1126    }
1127}
1128
1129/// Upload avatar for the team
1130pub async fn team_avatar_upload(
1131    configuration: &configuration::Configuration,
1132    files: Vec<std::path::PathBuf>,
1133) -> Result<models::TeamMeResponse, Error<TeamAvatarUploadError>> {
1134    // add a prefix to parameters to efficiently prevent name collisions
1135    let _p_files = files;
1136
1137    let uri_str = format!("{}/api/v1/team/avatar/upload", configuration.base_path);
1138    let mut req_builder = configuration
1139        .client
1140        .request(reqwest::Method::POST, &uri_str);
1141
1142    if let Some(ref user_agent) = configuration.user_agent {
1143        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1144    }
1145    if let Some(ref token) = configuration.bearer_access_token {
1146        req_builder = req_builder.bearer_auth(token.to_owned());
1147    };
1148    if let Some(ref token) = configuration.bearer_access_token {
1149        req_builder = req_builder.bearer_auth(token.to_owned());
1150    };
1151    let multipart_form = reqwest::multipart::Form::new();
1152    // TODO: support file upload for 'files' parameter
1153    req_builder = req_builder.multipart(multipart_form);
1154
1155    let req = req_builder.build()?;
1156    let resp = configuration.client.execute(req).await?;
1157
1158    let status = resp.status();
1159
1160    if !status.is_client_error() && !status.is_server_error() {
1161        let content = resp.text().await?;
1162        serde_json::from_str(&content).map_err(Error::from)
1163    } else {
1164        let content = resp.text().await?;
1165        let entity: Option<TeamAvatarUploadError> = serde_json::from_str(&content).ok();
1166        Err(Error::ResponseError(ResponseContent {
1167            status,
1168            content,
1169            entity,
1170        }))
1171    }
1172}
1173
1174/// Create a new team
1175pub async fn team_create(
1176    configuration: &configuration::Configuration,
1177    team_create_input: models::TeamCreateInput,
1178    sindri_team_id: Option<&str>,
1179) -> Result<models::TeamDetail, Error<TeamCreateError>> {
1180    // add a prefix to parameters to efficiently prevent name collisions
1181    let p_team_create_input = team_create_input;
1182    let p_sindri_team_id = sindri_team_id;
1183
1184    let uri_str = format!("{}/api/v1/team/create", configuration.base_path);
1185    let mut req_builder = configuration
1186        .client
1187        .request(reqwest::Method::POST, &uri_str);
1188
1189    if let Some(ref user_agent) = configuration.user_agent {
1190        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1191    }
1192    if let Some(param_value) = p_sindri_team_id {
1193        req_builder = req_builder.header("Sindri-Team-Id", param_value.to_string());
1194    }
1195    if let Some(ref token) = configuration.bearer_access_token {
1196        req_builder = req_builder.bearer_auth(token.to_owned());
1197    };
1198    req_builder = req_builder.json(&p_team_create_input);
1199
1200    let req = req_builder.build()?;
1201    let resp = configuration.client.execute(req).await?;
1202
1203    let status = resp.status();
1204
1205    if !status.is_client_error() && !status.is_server_error() {
1206        let content = resp.text().await?;
1207        serde_json::from_str(&content).map_err(Error::from)
1208    } else {
1209        let content = resp.text().await?;
1210        let entity: Option<TeamCreateError> = serde_json::from_str(&content).ok();
1211        Err(Error::ResponseError(ResponseContent {
1212            status,
1213            content,
1214            entity,
1215        }))
1216    }
1217}
1218
1219/// Return details for the specified team
1220pub async fn team_detail(
1221    configuration: &configuration::Configuration,
1222    team_slug: &str,
1223) -> Result<models::TeamDetail, Error<TeamDetailError>> {
1224    // add a prefix to parameters to efficiently prevent name collisions
1225    let p_team_slug = team_slug;
1226
1227    let uri_str = format!(
1228        "{}/api/v1/team/{team_slug}/detail",
1229        configuration.base_path,
1230        team_slug = crate::apis::urlencode(p_team_slug)
1231    );
1232    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1233
1234    if let Some(ref user_agent) = configuration.user_agent {
1235        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1236    }
1237    if let Some(ref token) = configuration.bearer_access_token {
1238        req_builder = req_builder.bearer_auth(token.to_owned());
1239    };
1240    if let Some(ref token) = configuration.bearer_access_token {
1241        req_builder = req_builder.bearer_auth(token.to_owned());
1242    };
1243
1244    let req = req_builder.build()?;
1245    let resp = configuration.client.execute(req).await?;
1246
1247    let status = resp.status();
1248
1249    if !status.is_client_error() && !status.is_server_error() {
1250        let content = resp.text().await?;
1251        serde_json::from_str(&content).map_err(Error::from)
1252    } else {
1253        let content = resp.text().await?;
1254        let entity: Option<TeamDetailError> = serde_json::from_str(&content).ok();
1255        Err(Error::ResponseError(ResponseContent {
1256            status,
1257            content,
1258            entity,
1259        }))
1260    }
1261}
1262
1263/// Invite an email address to join the specified team
1264pub async fn team_invite(
1265    configuration: &configuration::Configuration,
1266    team_invite_input: models::TeamInviteInput,
1267    sindri_team_id: Option<&str>,
1268) -> Result<models::ActionResponse, Error<TeamInviteError>> {
1269    // add a prefix to parameters to efficiently prevent name collisions
1270    let p_team_invite_input = team_invite_input;
1271    let p_sindri_team_id = sindri_team_id;
1272
1273    let uri_str = format!("{}/api/v1/team/invite", configuration.base_path);
1274    let mut req_builder = configuration
1275        .client
1276        .request(reqwest::Method::POST, &uri_str);
1277
1278    if let Some(ref user_agent) = configuration.user_agent {
1279        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1280    }
1281    if let Some(param_value) = p_sindri_team_id {
1282        req_builder = req_builder.header("Sindri-Team-Id", param_value.to_string());
1283    }
1284    if let Some(ref token) = configuration.bearer_access_token {
1285        req_builder = req_builder.bearer_auth(token.to_owned());
1286    };
1287    req_builder = req_builder.json(&p_team_invite_input);
1288
1289    let req = req_builder.build()?;
1290    let resp = configuration.client.execute(req).await?;
1291
1292    let status = resp.status();
1293
1294    if !status.is_client_error() && !status.is_server_error() {
1295        let content = resp.text().await?;
1296        serde_json::from_str(&content).map_err(Error::from)
1297    } else {
1298        let content = resp.text().await?;
1299        let entity: Option<TeamInviteError> = serde_json::from_str(&content).ok();
1300        Err(Error::ResponseError(ResponseContent {
1301            status,
1302            content,
1303            entity,
1304        }))
1305    }
1306}
1307
1308/// Obtain team details for the currently authenticated team
1309pub async fn team_me(
1310    configuration: &configuration::Configuration,
1311) -> Result<models::TeamMeResponse, Error<TeamMeError>> {
1312    let uri_str = format!("{}/api/v1/team/me", configuration.base_path);
1313    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1314
1315    if let Some(ref user_agent) = configuration.user_agent {
1316        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1317    }
1318    if let Some(ref token) = configuration.bearer_access_token {
1319        req_builder = req_builder.bearer_auth(token.to_owned());
1320    };
1321    if let Some(ref token) = configuration.bearer_access_token {
1322        req_builder = req_builder.bearer_auth(token.to_owned());
1323    };
1324
1325    let req = req_builder.build()?;
1326    let resp = configuration.client.execute(req).await?;
1327
1328    let status = resp.status();
1329
1330    if !status.is_client_error() && !status.is_server_error() {
1331        let content = resp.text().await?;
1332        serde_json::from_str(&content).map_err(Error::from)
1333    } else {
1334        let content = resp.text().await?;
1335        let entity: Option<TeamMeError> = serde_json::from_str(&content).ok();
1336        Err(Error::ResponseError(ResponseContent {
1337            status,
1338            content,
1339            entity,
1340        }))
1341    }
1342}
1343
1344/// Return member list for the specified team
1345pub async fn team_members(
1346    configuration: &configuration::Configuration,
1347    team_slug: &str,
1348    sindri_team_id: Option<&str>,
1349) -> Result<models::TeamMembersResponse, Error<TeamMembersError>> {
1350    // add a prefix to parameters to efficiently prevent name collisions
1351    let p_team_slug = team_slug;
1352    let p_sindri_team_id = sindri_team_id;
1353
1354    let uri_str = format!(
1355        "{}/api/v1/team/{team_slug}/members",
1356        configuration.base_path,
1357        team_slug = crate::apis::urlencode(p_team_slug)
1358    );
1359    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1360
1361    if let Some(ref user_agent) = configuration.user_agent {
1362        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1363    }
1364    if let Some(param_value) = p_sindri_team_id {
1365        req_builder = req_builder.header("Sindri-Team-Id", param_value.to_string());
1366    }
1367    if let Some(ref token) = configuration.bearer_access_token {
1368        req_builder = req_builder.bearer_auth(token.to_owned());
1369    };
1370
1371    let req = req_builder.build()?;
1372    let resp = configuration.client.execute(req).await?;
1373
1374    let status = resp.status();
1375
1376    if !status.is_client_error() && !status.is_server_error() {
1377        let content = resp.text().await?;
1378        serde_json::from_str(&content).map_err(Error::from)
1379    } else {
1380        let content = resp.text().await?;
1381        let entity: Option<TeamMembersError> = serde_json::from_str(&content).ok();
1382        Err(Error::ResponseError(ResponseContent {
1383            status,
1384            content,
1385            entity,
1386        }))
1387    }
1388}
1389
1390/// Remove a user from the specified team. Revokes all team API keys if the removed user was the last team member.
1391pub async fn team_remove_member(
1392    configuration: &configuration::Configuration,
1393    team_remove_member_input: models::TeamRemoveMemberInput,
1394    sindri_team_id: Option<&str>,
1395) -> Result<models::ActionResponse, Error<TeamRemoveMemberError>> {
1396    // add a prefix to parameters to efficiently prevent name collisions
1397    let p_team_remove_member_input = team_remove_member_input;
1398    let p_sindri_team_id = sindri_team_id;
1399
1400    let uri_str = format!("{}/api/v1/team/remove-member", configuration.base_path);
1401    let mut req_builder = configuration
1402        .client
1403        .request(reqwest::Method::POST, &uri_str);
1404
1405    if let Some(ref user_agent) = configuration.user_agent {
1406        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1407    }
1408    if let Some(param_value) = p_sindri_team_id {
1409        req_builder = req_builder.header("Sindri-Team-Id", param_value.to_string());
1410    }
1411    if let Some(ref token) = configuration.bearer_access_token {
1412        req_builder = req_builder.bearer_auth(token.to_owned());
1413    };
1414    req_builder = req_builder.json(&p_team_remove_member_input);
1415
1416    let req = req_builder.build()?;
1417    let resp = configuration.client.execute(req).await?;
1418
1419    let status = resp.status();
1420
1421    if !status.is_client_error() && !status.is_server_error() {
1422        let content = resp.text().await?;
1423        serde_json::from_str(&content).map_err(Error::from)
1424    } else {
1425        let content = resp.text().await?;
1426        let entity: Option<TeamRemoveMemberError> = serde_json::from_str(&content).ok();
1427        Err(Error::ResponseError(ResponseContent {
1428            status,
1429            content,
1430            entity,
1431        }))
1432    }
1433}
1434
1435/// Obtain user details. Requires JWT authentication.
1436pub async fn user_me_with_jwt_auth(
1437    configuration: &configuration::Configuration,
1438) -> Result<models::UserMeResponse, Error<UserMeWithJwtAuthError>> {
1439    let uri_str = format!("{}/api/v1/user/me", configuration.base_path);
1440    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1441
1442    if let Some(ref user_agent) = configuration.user_agent {
1443        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1444    }
1445    if let Some(ref token) = configuration.bearer_access_token {
1446        req_builder = req_builder.bearer_auth(token.to_owned());
1447    };
1448    if let Some(ref token) = configuration.bearer_access_token {
1449        req_builder = req_builder.bearer_auth(token.to_owned());
1450    };
1451
1452    let req = req_builder.build()?;
1453    let resp = configuration.client.execute(req).await?;
1454
1455    let status = resp.status();
1456
1457    if !status.is_client_error() && !status.is_server_error() {
1458        let content = resp.text().await?;
1459        serde_json::from_str(&content).map_err(Error::from)
1460    } else {
1461        let content = resp.text().await?;
1462        let entity: Option<UserMeWithJwtAuthError> = serde_json::from_str(&content).ok();
1463        Err(Error::ResponseError(ResponseContent {
1464            status,
1465            content,
1466            entity,
1467        }))
1468    }
1469}