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.15
5 *
6 * The version of the OpenAPI document: v1.17.22
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 [`team_settings`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum TeamSettingsError {
246    Status404(models::TeamDoesNotExistResponse),
247    Status500(models::SindriInternalErrorResponse),
248    Status422(models::ValidationErrorResponse),
249    UnknownValue(serde_json::Value),
250}
251
252/// struct for typed errors of method [`user_login`]
253#[derive(Debug, Clone, Serialize, Deserialize)]
254#[serde(untagged)]
255pub enum UserLoginError {
256    Status403(models::SessionAuthErrorResponse),
257    Status401(models::SessionAuthErrorResponse),
258    UnknownValue(serde_json::Value),
259}
260
261/// struct for typed errors of method [`user_logout`]
262#[derive(Debug, Clone, Serialize, Deserialize)]
263#[serde(untagged)]
264pub enum UserLogoutError {
265    UnknownValue(serde_json::Value),
266}
267
268/// struct for typed errors of method [`user_me`]
269#[derive(Debug, Clone, Serialize, Deserialize)]
270#[serde(untagged)]
271pub enum UserMeError {
272    UnknownValue(serde_json::Value),
273}
274
275/// Obtain circuit file(s).
276pub async fn circuit_download(
277    configuration: &configuration::Configuration,
278    circuit_id: &str,
279    path: Option<&str>,
280) -> Result<reqwest::Response, Error<CircuitDownloadError>> {
281    // add a prefix to parameters to efficiently prevent name collisions
282    let p_circuit_id = circuit_id;
283    let p_path = path;
284
285    let uri_str = format!(
286        "{}/api/v1/circuit/{circuit_id}/download",
287        configuration.base_path,
288        circuit_id = crate::apis::urlencode(p_circuit_id)
289    );
290    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
291
292    if let Some(ref param_value) = p_path {
293        req_builder = req_builder.query(&[("path", &param_value.to_string())]);
294    }
295    if let Some(ref user_agent) = configuration.user_agent {
296        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
297    }
298    if let Some(ref token) = configuration.bearer_access_token {
299        req_builder = req_builder.bearer_auth(token.to_owned());
300    };
301    if let Some(ref token) = configuration.bearer_access_token {
302        req_builder = req_builder.bearer_auth(token.to_owned());
303    };
304
305    let req = req_builder.build()?;
306    let resp = configuration.client.execute(req).await?;
307
308    let status = resp.status();
309
310    if !status.is_client_error() && !status.is_server_error() {
311        Ok(resp)
312    } else {
313        let content = resp.text().await?;
314        let entity: Option<CircuitDownloadError> = serde_json::from_str(&content).ok();
315        Err(Error::ResponseError(ResponseContent {
316            status,
317            content,
318            entity,
319        }))
320    }
321}
322
323/// List all proofs for a circuit.
324pub async fn circuit_proofs_paginated(
325    configuration: &configuration::Configuration,
326    circuit_id: &str,
327    limit: Option<i32>,
328    offset: Option<i32>,
329) -> Result<models::PagedProofInfoResponse, Error<CircuitProofsPaginatedError>> {
330    // add a prefix to parameters to efficiently prevent name collisions
331    let p_circuit_id = circuit_id;
332    let p_limit = limit;
333    let p_offset = offset;
334
335    let uri_str = format!(
336        "{}/api/v1/circuit/{circuit_id}/proofs/paginated",
337        configuration.base_path,
338        circuit_id = crate::apis::urlencode(p_circuit_id)
339    );
340    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
341
342    if let Some(ref param_value) = p_limit {
343        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
344    }
345    if let Some(ref param_value) = p_offset {
346        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
347    }
348    if let Some(ref user_agent) = configuration.user_agent {
349        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
350    }
351    if let Some(ref token) = configuration.bearer_access_token {
352        req_builder = req_builder.bearer_auth(token.to_owned());
353    };
354    if let Some(ref token) = configuration.bearer_access_token {
355        req_builder = req_builder.bearer_auth(token.to_owned());
356    };
357
358    let req = req_builder.build()?;
359    let resp = configuration.client.execute(req).await?;
360
361    let status = resp.status();
362
363    if !status.is_client_error() && !status.is_server_error() {
364        let content = resp.text().await?;
365        serde_json::from_str(&content).map_err(Error::from)
366    } else {
367        let content = resp.text().await?;
368        let entity: Option<CircuitProofsPaginatedError> = serde_json::from_str(&content).ok();
369        Err(Error::ResponseError(ResponseContent {
370            status,
371            content,
372            entity,
373        }))
374    }
375}
376
377/// Get smart contract verifier for existing circuit
378pub async fn circuit_smart_contract_verifier(
379    configuration: &configuration::Configuration,
380    circuit_id: &str,
381) -> Result<models::SmartContractVerifierResponse, Error<CircuitSmartContractVerifierError>> {
382    // add a prefix to parameters to efficiently prevent name collisions
383    let p_circuit_id = circuit_id;
384
385    let uri_str = format!(
386        "{}/api/v1/circuit/{circuit_id}/smart_contract_verifier",
387        configuration.base_path,
388        circuit_id = crate::apis::urlencode(p_circuit_id)
389    );
390    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
391
392    if let Some(ref user_agent) = configuration.user_agent {
393        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
394    }
395    if let Some(ref token) = configuration.bearer_access_token {
396        req_builder = req_builder.bearer_auth(token.to_owned());
397    };
398    if let Some(ref token) = configuration.bearer_access_token {
399        req_builder = req_builder.bearer_auth(token.to_owned());
400    };
401
402    let req = req_builder.build()?;
403    let resp = configuration.client.execute(req).await?;
404
405    let status = resp.status();
406
407    if !status.is_client_error() && !status.is_server_error() {
408        let content = resp.text().await?;
409        serde_json::from_str(&content).map_err(Error::from)
410    } else {
411        let content = resp.text().await?;
412        let entity: Option<CircuitSmartContractVerifierError> = serde_json::from_str(&content).ok();
413        Err(Error::ResponseError(ResponseContent {
414            status,
415            content,
416            entity,
417        }))
418    }
419}
420
421/// Get status for a specific circuit.
422pub async fn circuit_status(
423    configuration: &configuration::Configuration,
424    circuit_id: &str,
425) -> Result<models::CircuitStatusResponse, Error<CircuitStatusError>> {
426    // add a prefix to parameters to efficiently prevent name collisions
427    let p_circuit_id = circuit_id;
428
429    let uri_str = format!(
430        "{}/api/v1/circuit/{circuit_id}/status",
431        configuration.base_path,
432        circuit_id = crate::apis::urlencode(p_circuit_id)
433    );
434    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
435
436    if let Some(ref user_agent) = configuration.user_agent {
437        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
438    }
439    if let Some(ref token) = configuration.bearer_access_token {
440        req_builder = req_builder.bearer_auth(token.to_owned());
441    };
442    if let Some(ref token) = configuration.bearer_access_token {
443        req_builder = req_builder.bearer_auth(token.to_owned());
444    };
445
446    let req = req_builder.build()?;
447    let resp = configuration.client.execute(req).await?;
448
449    let status = resp.status();
450
451    if !status.is_client_error() && !status.is_server_error() {
452        let content = resp.text().await?;
453        serde_json::from_str(&content).map_err(Error::from)
454    } else {
455        let content = resp.text().await?;
456        let entity: Option<CircuitStatusError> = serde_json::from_str(&content).ok();
457        Err(Error::ResponseError(ResponseContent {
458            status,
459            content,
460            entity,
461        }))
462    }
463}
464
465/// Change user password. Requires user authentication.
466pub async fn password_change_with_jwt_auth(
467    configuration: &configuration::Configuration,
468    password_change_input: models::PasswordChangeInput,
469) -> Result<models::ActionResponse, Error<PasswordChangeWithJwtAuthError>> {
470    // add a prefix to parameters to efficiently prevent name collisions
471    let p_password_change_input = password_change_input;
472
473    let uri_str = format!("{}/api/v1/password/change", configuration.base_path);
474    let mut req_builder = configuration
475        .client
476        .request(reqwest::Method::POST, &uri_str);
477
478    if let Some(ref user_agent) = configuration.user_agent {
479        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
480    }
481    if let Some(ref token) = configuration.bearer_access_token {
482        req_builder = req_builder.bearer_auth(token.to_owned());
483    };
484    req_builder = req_builder.json(&p_password_change_input);
485
486    let req = req_builder.build()?;
487    let resp = configuration.client.execute(req).await?;
488
489    let status = resp.status();
490
491    if !status.is_client_error() && !status.is_server_error() {
492        let content = resp.text().await?;
493        serde_json::from_str(&content).map_err(Error::from)
494    } else {
495        let content = resp.text().await?;
496        let entity: Option<PasswordChangeWithJwtAuthError> = serde_json::from_str(&content).ok();
497        Err(Error::ResponseError(ResponseContent {
498            status,
499            content,
500            entity,
501        }))
502    }
503}
504
505/// List all circuits for a project.
506pub async fn project_circuits(
507    configuration: &configuration::Configuration,
508    project_id: &str,
509) -> Result<Vec<models::CircuitInfoResponse>, Error<ProjectCircuitsError>> {
510    // add a prefix to parameters to efficiently prevent name collisions
511    let p_project_id = project_id;
512
513    let uri_str = format!(
514        "{}/api/v1/project/{project_id}/circuits",
515        configuration.base_path,
516        project_id = crate::apis::urlencode(p_project_id)
517    );
518    let mut req_builder = configuration.client.request(reqwest::Method::GET, &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 token) = configuration.bearer_access_token {
524        req_builder = req_builder.bearer_auth(token.to_owned());
525    };
526    if let Some(ref token) = configuration.bearer_access_token {
527        req_builder = req_builder.bearer_auth(token.to_owned());
528    };
529
530    let req = req_builder.build()?;
531    let resp = configuration.client.execute(req).await?;
532
533    let status = resp.status();
534
535    if !status.is_client_error() && !status.is_server_error() {
536        let content = resp.text().await?;
537        serde_json::from_str(&content).map_err(Error::from)
538    } else {
539        let content = resp.text().await?;
540        let entity: Option<ProjectCircuitsError> = serde_json::from_str(&content).ok();
541        Err(Error::ResponseError(ResponseContent {
542            status,
543            content,
544            entity,
545        }))
546    }
547}
548
549/// List all circuits for a project.
550pub async fn project_circuits_paginated(
551    configuration: &configuration::Configuration,
552    project_id: &str,
553    limit: Option<i32>,
554    offset: Option<i32>,
555) -> Result<models::PagedCircuitInfoResponse, Error<ProjectCircuitsPaginatedError>> {
556    // add a prefix to parameters to efficiently prevent name collisions
557    let p_project_id = project_id;
558    let p_limit = limit;
559    let p_offset = offset;
560
561    let uri_str = format!(
562        "{}/api/v1/project/{project_id}/circuits/paginated",
563        configuration.base_path,
564        project_id = crate::apis::urlencode(p_project_id)
565    );
566    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
567
568    if let Some(ref param_value) = p_limit {
569        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
570    }
571    if let Some(ref param_value) = p_offset {
572        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
573    }
574    if let Some(ref user_agent) = configuration.user_agent {
575        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
576    }
577    if let Some(ref token) = configuration.bearer_access_token {
578        req_builder = req_builder.bearer_auth(token.to_owned());
579    };
580    if let Some(ref token) = configuration.bearer_access_token {
581        req_builder = req_builder.bearer_auth(token.to_owned());
582    };
583
584    let req = req_builder.build()?;
585    let resp = configuration.client.execute(req).await?;
586
587    let status = resp.status();
588
589    if !status.is_client_error() && !status.is_server_error() {
590        let content = resp.text().await?;
591        serde_json::from_str(&content).map_err(Error::from)
592    } else {
593        let content = resp.text().await?;
594        let entity: Option<ProjectCircuitsPaginatedError> = serde_json::from_str(&content).ok();
595        Err(Error::ResponseError(ResponseContent {
596            status,
597            content,
598            entity,
599        }))
600    }
601}
602
603/// Delete a project.
604pub async fn project_delete(
605    configuration: &configuration::Configuration,
606    project_id: &str,
607) -> Result<models::ActionResponse, Error<ProjectDeleteError>> {
608    // add a prefix to parameters to efficiently prevent name collisions
609    let p_project_id = project_id;
610
611    let uri_str = format!(
612        "{}/api/v1/project/{project_id}/delete",
613        configuration.base_path,
614        project_id = crate::apis::urlencode(p_project_id)
615    );
616    let mut req_builder = configuration
617        .client
618        .request(reqwest::Method::DELETE, &uri_str);
619
620    if let Some(ref user_agent) = configuration.user_agent {
621        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
622    }
623    if let Some(ref token) = configuration.bearer_access_token {
624        req_builder = req_builder.bearer_auth(token.to_owned());
625    };
626    if let Some(ref token) = configuration.bearer_access_token {
627        req_builder = req_builder.bearer_auth(token.to_owned());
628    };
629
630    let req = req_builder.build()?;
631    let resp = configuration.client.execute(req).await?;
632
633    let status = resp.status();
634
635    if !status.is_client_error() && !status.is_server_error() {
636        let content = resp.text().await?;
637        serde_json::from_str(&content).map_err(Error::from)
638    } else {
639        let content = resp.text().await?;
640        let entity: Option<ProjectDeleteError> = serde_json::from_str(&content).ok();
641        Err(Error::ResponseError(ResponseContent {
642            status,
643            content,
644            entity,
645        }))
646    }
647}
648
649/// Get info for a project.
650pub async fn project_detail(
651    configuration: &configuration::Configuration,
652    project_id: &str,
653) -> Result<models::ProjectInfoResponse, Error<ProjectDetailError>> {
654    // add a prefix to parameters to efficiently prevent name collisions
655    let p_project_id = project_id;
656
657    let uri_str = format!(
658        "{}/api/v1/project/{project_id}/detail",
659        configuration.base_path,
660        project_id = crate::apis::urlencode(p_project_id)
661    );
662    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
663
664    if let Some(ref user_agent) = configuration.user_agent {
665        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
666    }
667    if let Some(ref token) = configuration.bearer_access_token {
668        req_builder = req_builder.bearer_auth(token.to_owned());
669    };
670    if let Some(ref token) = configuration.bearer_access_token {
671        req_builder = req_builder.bearer_auth(token.to_owned());
672    };
673
674    let req = req_builder.build()?;
675    let resp = configuration.client.execute(req).await?;
676
677    let status = resp.status();
678
679    if !status.is_client_error() && !status.is_server_error() {
680        let content = resp.text().await?;
681        serde_json::from_str(&content).map_err(Error::from)
682    } else {
683        let content = resp.text().await?;
684        let entity: Option<ProjectDetailError> = serde_json::from_str(&content).ok();
685        Err(Error::ResponseError(ResponseContent {
686            status,
687            content,
688            entity,
689        }))
690    }
691}
692
693/// List all projects meeting filter criteria.
694pub async fn project_list(
695    configuration: &configuration::Configuration,
696    project_list_input: models::ProjectListInput,
697) -> Result<Vec<models::ProjectInfoResponse>, Error<ProjectListError>> {
698    // add a prefix to parameters to efficiently prevent name collisions
699    let p_project_list_input = project_list_input;
700
701    let uri_str = format!("{}/api/v1/project/list", configuration.base_path);
702    let mut req_builder = configuration
703        .client
704        .request(reqwest::Method::POST, &uri_str);
705
706    if let Some(ref user_agent) = configuration.user_agent {
707        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
708    }
709    if let Some(ref token) = configuration.bearer_access_token {
710        req_builder = req_builder.bearer_auth(token.to_owned());
711    };
712    if let Some(ref token) = configuration.bearer_access_token {
713        req_builder = req_builder.bearer_auth(token.to_owned());
714    };
715    req_builder = req_builder.json(&p_project_list_input);
716
717    let req = req_builder.build()?;
718    let resp = configuration.client.execute(req).await?;
719
720    let status = resp.status();
721
722    if !status.is_client_error() && !status.is_server_error() {
723        let content = resp.text().await?;
724        serde_json::from_str(&content).map_err(Error::from)
725    } else {
726        let content = resp.text().await?;
727        let entity: Option<ProjectListError> = serde_json::from_str(&content).ok();
728        Err(Error::ResponseError(ResponseContent {
729            status,
730            content,
731            entity,
732        }))
733    }
734}
735
736/// List all projects meeting filter criteria.
737pub async fn project_list_paginated(
738    configuration: &configuration::Configuration,
739    project_list_input: models::ProjectListInput,
740    limit: Option<i32>,
741    offset: Option<i32>,
742) -> Result<models::PagedProjectInfoResponse, Error<ProjectListPaginatedError>> {
743    // add a prefix to parameters to efficiently prevent name collisions
744    let p_project_list_input = project_list_input;
745    let p_limit = limit;
746    let p_offset = offset;
747
748    let uri_str = format!("{}/api/v1/project/list/paginated", configuration.base_path);
749    let mut req_builder = configuration
750        .client
751        .request(reqwest::Method::POST, &uri_str);
752
753    if let Some(ref param_value) = p_limit {
754        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
755    }
756    if let Some(ref param_value) = p_offset {
757        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
758    }
759    if let Some(ref user_agent) = configuration.user_agent {
760        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
761    }
762    if let Some(ref token) = configuration.bearer_access_token {
763        req_builder = req_builder.bearer_auth(token.to_owned());
764    };
765    if let Some(ref token) = configuration.bearer_access_token {
766        req_builder = req_builder.bearer_auth(token.to_owned());
767    };
768    req_builder = req_builder.json(&p_project_list_input);
769
770    let req = req_builder.build()?;
771    let resp = configuration.client.execute(req).await?;
772
773    let status = resp.status();
774
775    if !status.is_client_error() && !status.is_server_error() {
776        let content = resp.text().await?;
777        serde_json::from_str(&content).map_err(Error::from)
778    } else {
779        let content = resp.text().await?;
780        let entity: Option<ProjectListPaginatedError> = serde_json::from_str(&content).ok();
781        Err(Error::ResponseError(ResponseContent {
782            status,
783            content,
784            entity,
785        }))
786    }
787}
788
789/// Get all proofs for a project.
790pub async fn project_proofs(
791    configuration: &configuration::Configuration,
792    project_id: &str,
793) -> Result<Vec<models::ProofInfoResponse>, Error<ProjectProofsError>> {
794    // add a prefix to parameters to efficiently prevent name collisions
795    let p_project_id = project_id;
796
797    let uri_str = format!(
798        "{}/api/v1/project/{project_id}/proofs",
799        configuration.base_path,
800        project_id = crate::apis::urlencode(p_project_id)
801    );
802    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
803
804    if let Some(ref user_agent) = configuration.user_agent {
805        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
806    }
807    if let Some(ref token) = configuration.bearer_access_token {
808        req_builder = req_builder.bearer_auth(token.to_owned());
809    };
810    if let Some(ref token) = configuration.bearer_access_token {
811        req_builder = req_builder.bearer_auth(token.to_owned());
812    };
813
814    let req = req_builder.build()?;
815    let resp = configuration.client.execute(req).await?;
816
817    let status = resp.status();
818
819    if !status.is_client_error() && !status.is_server_error() {
820        let content = resp.text().await?;
821        serde_json::from_str(&content).map_err(Error::from)
822    } else {
823        let content = resp.text().await?;
824        let entity: Option<ProjectProofsError> = serde_json::from_str(&content).ok();
825        Err(Error::ResponseError(ResponseContent {
826            status,
827            content,
828            entity,
829        }))
830    }
831}
832
833/// Get all proofs for a project.
834pub async fn project_proofs_paginated(
835    configuration: &configuration::Configuration,
836    project_id: &str,
837    limit: Option<i32>,
838    offset: Option<i32>,
839) -> Result<models::PagedProofInfoResponse, Error<ProjectProofsPaginatedError>> {
840    // add a prefix to parameters to efficiently prevent name collisions
841    let p_project_id = project_id;
842    let p_limit = limit;
843    let p_offset = offset;
844
845    let uri_str = format!(
846        "{}/api/v1/project/{project_id}/proofs/paginated",
847        configuration.base_path,
848        project_id = crate::apis::urlencode(p_project_id)
849    );
850    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
851
852    if let Some(ref param_value) = p_limit {
853        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
854    }
855    if let Some(ref param_value) = p_offset {
856        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
857    }
858    if let Some(ref user_agent) = configuration.user_agent {
859        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
860    }
861    if let Some(ref token) = configuration.bearer_access_token {
862        req_builder = req_builder.bearer_auth(token.to_owned());
863    };
864    if let Some(ref token) = configuration.bearer_access_token {
865        req_builder = req_builder.bearer_auth(token.to_owned());
866    };
867
868    let req = req_builder.build()?;
869    let resp = configuration.client.execute(req).await?;
870
871    let status = resp.status();
872
873    if !status.is_client_error() && !status.is_server_error() {
874        let content = resp.text().await?;
875        serde_json::from_str(&content).map_err(Error::from)
876    } else {
877        let content = resp.text().await?;
878        let entity: Option<ProjectProofsPaginatedError> = serde_json::from_str(&content).ok();
879        Err(Error::ResponseError(ResponseContent {
880            status,
881            content,
882            entity,
883        }))
884    }
885}
886
887/// Update project settings.
888pub async fn project_settings(
889    configuration: &configuration::Configuration,
890    project_name: &str,
891    project_settings_input: models::ProjectSettingsInput,
892) -> Result<models::ProjectInfoResponse, Error<ProjectSettingsError>> {
893    // add a prefix to parameters to efficiently prevent name collisions
894    let p_project_name = project_name;
895    let p_project_settings_input = project_settings_input;
896
897    let uri_str = format!(
898        "{}/api/v1/project/{project_name}/settings",
899        configuration.base_path,
900        project_name = crate::apis::urlencode(p_project_name)
901    );
902    let mut req_builder = configuration
903        .client
904        .request(reqwest::Method::POST, &uri_str);
905
906    if let Some(ref user_agent) = configuration.user_agent {
907        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
908    }
909    if let Some(ref token) = configuration.bearer_access_token {
910        req_builder = req_builder.bearer_auth(token.to_owned());
911    };
912    if let Some(ref token) = configuration.bearer_access_token {
913        req_builder = req_builder.bearer_auth(token.to_owned());
914    };
915    req_builder = req_builder.json(&p_project_settings_input);
916
917    let req = req_builder.build()?;
918    let resp = configuration.client.execute(req).await?;
919
920    let status = resp.status();
921
922    if !status.is_client_error() && !status.is_server_error() {
923        let content = resp.text().await?;
924        serde_json::from_str(&content).map_err(Error::from)
925    } else {
926        let content = resp.text().await?;
927        let entity: Option<ProjectSettingsError> = serde_json::from_str(&content).ok();
928        Err(Error::ResponseError(ResponseContent {
929            status,
930            content,
931            entity,
932        }))
933    }
934}
935
936/// Get histogram data for a team's proofs.
937pub async fn proof_histogram(
938    configuration: &configuration::Configuration,
939    proof_histogram_input: models::ProofHistogramInput,
940) -> Result<models::ProofHistogramResponse, Error<ProofHistogramError>> {
941    // add a prefix to parameters to efficiently prevent name collisions
942    let p_proof_histogram_input = proof_histogram_input;
943
944    let uri_str = format!("{}/api/v1/proof/histogram", configuration.base_path);
945    let mut req_builder = configuration
946        .client
947        .request(reqwest::Method::POST, &uri_str);
948
949    if let Some(ref user_agent) = configuration.user_agent {
950        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
951    }
952    if let Some(ref token) = configuration.bearer_access_token {
953        req_builder = req_builder.bearer_auth(token.to_owned());
954    };
955    if let Some(ref token) = configuration.bearer_access_token {
956        req_builder = req_builder.bearer_auth(token.to_owned());
957    };
958    req_builder = req_builder.json(&p_proof_histogram_input);
959
960    let req = req_builder.build()?;
961    let resp = configuration.client.execute(req).await?;
962
963    let status = resp.status();
964
965    if !status.is_client_error() && !status.is_server_error() {
966        let content = resp.text().await?;
967        serde_json::from_str(&content).map_err(Error::from)
968    } else {
969        let content = resp.text().await?;
970        let entity: Option<ProofHistogramError> = serde_json::from_str(&content).ok();
971        Err(Error::ResponseError(ResponseContent {
972            status,
973            content,
974            entity,
975        }))
976    }
977}
978
979/// List proofs for the requesting team.
980pub async fn proof_list(
981    configuration: &configuration::Configuration,
982    proof_list_input: models::ProofListInput,
983) -> Result<Vec<models::ProofInfoResponse>, Error<ProofListError>> {
984    // add a prefix to parameters to efficiently prevent name collisions
985    let p_proof_list_input = proof_list_input;
986
987    let uri_str = format!("{}/api/v1/proof/list", configuration.base_path);
988    let mut req_builder = configuration
989        .client
990        .request(reqwest::Method::POST, &uri_str);
991
992    if let Some(ref user_agent) = configuration.user_agent {
993        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
994    }
995    if let Some(ref token) = configuration.bearer_access_token {
996        req_builder = req_builder.bearer_auth(token.to_owned());
997    };
998    if let Some(ref token) = configuration.bearer_access_token {
999        req_builder = req_builder.bearer_auth(token.to_owned());
1000    };
1001    req_builder = req_builder.json(&p_proof_list_input);
1002
1003    let req = req_builder.build()?;
1004    let resp = configuration.client.execute(req).await?;
1005
1006    let status = resp.status();
1007
1008    if !status.is_client_error() && !status.is_server_error() {
1009        let content = resp.text().await?;
1010        serde_json::from_str(&content).map_err(Error::from)
1011    } else {
1012        let content = resp.text().await?;
1013        let entity: Option<ProofListError> = serde_json::from_str(&content).ok();
1014        Err(Error::ResponseError(ResponseContent {
1015            status,
1016            content,
1017            entity,
1018        }))
1019    }
1020}
1021
1022/// List proofs for the requesting team.
1023pub async fn proof_list_paginated(
1024    configuration: &configuration::Configuration,
1025    proof_list_input: models::ProofListInput,
1026    limit: Option<i32>,
1027    offset: Option<i32>,
1028) -> Result<models::PagedProofInfoResponse, Error<ProofListPaginatedError>> {
1029    // add a prefix to parameters to efficiently prevent name collisions
1030    let p_proof_list_input = proof_list_input;
1031    let p_limit = limit;
1032    let p_offset = offset;
1033
1034    let uri_str = format!("{}/api/v1/proof/list/paginated", configuration.base_path);
1035    let mut req_builder = configuration
1036        .client
1037        .request(reqwest::Method::POST, &uri_str);
1038
1039    if let Some(ref param_value) = p_limit {
1040        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
1041    }
1042    if let Some(ref param_value) = p_offset {
1043        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
1044    }
1045    if let Some(ref user_agent) = configuration.user_agent {
1046        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1047    }
1048    if let Some(ref token) = configuration.bearer_access_token {
1049        req_builder = req_builder.bearer_auth(token.to_owned());
1050    };
1051    if let Some(ref token) = configuration.bearer_access_token {
1052        req_builder = req_builder.bearer_auth(token.to_owned());
1053    };
1054    req_builder = req_builder.json(&p_proof_list_input);
1055
1056    let req = req_builder.build()?;
1057    let resp = configuration.client.execute(req).await?;
1058
1059    let status = resp.status();
1060
1061    if !status.is_client_error() && !status.is_server_error() {
1062        let content = resp.text().await?;
1063        serde_json::from_str(&content).map_err(Error::from)
1064    } else {
1065        let content = resp.text().await?;
1066        let entity: Option<ProofListPaginatedError> = serde_json::from_str(&content).ok();
1067        Err(Error::ResponseError(ResponseContent {
1068            status,
1069            content,
1070            entity,
1071        }))
1072    }
1073}
1074
1075/// Get status for a specific proof.
1076pub async fn proof_status(
1077    configuration: &configuration::Configuration,
1078    proof_id: &str,
1079) -> Result<models::ProofStatusResponse, Error<ProofStatusError>> {
1080    // add a prefix to parameters to efficiently prevent name collisions
1081    let p_proof_id = proof_id;
1082
1083    let uri_str = format!(
1084        "{}/api/v1/proof/{proof_id}/status",
1085        configuration.base_path,
1086        proof_id = crate::apis::urlencode(p_proof_id)
1087    );
1088    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1089
1090    if let Some(ref user_agent) = configuration.user_agent {
1091        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1092    }
1093    if let Some(ref token) = configuration.bearer_access_token {
1094        req_builder = req_builder.bearer_auth(token.to_owned());
1095    };
1096    if let Some(ref token) = configuration.bearer_access_token {
1097        req_builder = req_builder.bearer_auth(token.to_owned());
1098    };
1099
1100    let req = req_builder.build()?;
1101    let resp = configuration.client.execute(req).await?;
1102
1103    let status = resp.status();
1104
1105    if !status.is_client_error() && !status.is_server_error() {
1106        let content = resp.text().await?;
1107        serde_json::from_str(&content).map_err(Error::from)
1108    } else {
1109        let content = resp.text().await?;
1110        let entity: Option<ProofStatusError> = serde_json::from_str(&content).ok();
1111        Err(Error::ResponseError(ResponseContent {
1112            status,
1113            content,
1114            entity,
1115        }))
1116    }
1117}
1118
1119/// Return Sindri manifest schema as JSON.
1120pub async fn sindri_manifest_schema(
1121    configuration: &configuration::Configuration,
1122) -> Result<serde_json::Value, Error<SindriManifestSchemaError>> {
1123    let uri_str = format!(
1124        "{}/api/v1/sindri-manifest-schema.json",
1125        configuration.base_path
1126    );
1127    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1128
1129    if let Some(ref user_agent) = configuration.user_agent {
1130        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1131    }
1132
1133    let req = req_builder.build()?;
1134    let resp = configuration.client.execute(req).await?;
1135
1136    let status = resp.status();
1137
1138    if !status.is_client_error() && !status.is_server_error() {
1139        let content = resp.text().await?;
1140        serde_json::from_str(&content).map_err(Error::from)
1141    } else {
1142        let content = resp.text().await?;
1143        let entity: Option<SindriManifestSchemaError> = serde_json::from_str(&content).ok();
1144        Err(Error::ResponseError(ResponseContent {
1145            status,
1146            content,
1147            entity,
1148        }))
1149    }
1150}
1151
1152/// Upload avatar for the team
1153pub async fn team_avatar_upload(
1154    configuration: &configuration::Configuration,
1155    files: Vec<std::path::PathBuf>,
1156) -> Result<models::TeamMeResponse, Error<TeamAvatarUploadError>> {
1157    // add a prefix to parameters to efficiently prevent name collisions
1158    let _p_files = files;
1159
1160    let uri_str = format!("{}/api/v1/team/avatar/upload", configuration.base_path);
1161    let mut req_builder = configuration
1162        .client
1163        .request(reqwest::Method::POST, &uri_str);
1164
1165    if let Some(ref user_agent) = configuration.user_agent {
1166        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1167    }
1168    if let Some(ref token) = configuration.bearer_access_token {
1169        req_builder = req_builder.bearer_auth(token.to_owned());
1170    };
1171    if let Some(ref token) = configuration.bearer_access_token {
1172        req_builder = req_builder.bearer_auth(token.to_owned());
1173    };
1174    let multipart_form = reqwest::multipart::Form::new();
1175    // TODO: support file upload for 'files' parameter
1176    req_builder = req_builder.multipart(multipart_form);
1177
1178    let req = req_builder.build()?;
1179    let resp = configuration.client.execute(req).await?;
1180
1181    let status = resp.status();
1182
1183    if !status.is_client_error() && !status.is_server_error() {
1184        let content = resp.text().await?;
1185        serde_json::from_str(&content).map_err(Error::from)
1186    } else {
1187        let content = resp.text().await?;
1188        let entity: Option<TeamAvatarUploadError> = serde_json::from_str(&content).ok();
1189        Err(Error::ResponseError(ResponseContent {
1190            status,
1191            content,
1192            entity,
1193        }))
1194    }
1195}
1196
1197/// Create a new team
1198pub async fn team_create(
1199    configuration: &configuration::Configuration,
1200    team_create_input: models::TeamCreateInput,
1201    sindri_team_id: Option<&str>,
1202) -> Result<models::TeamDetail, Error<TeamCreateError>> {
1203    // add a prefix to parameters to efficiently prevent name collisions
1204    let p_team_create_input = team_create_input;
1205    let p_sindri_team_id = sindri_team_id;
1206
1207    let uri_str = format!("{}/api/v1/team/create", configuration.base_path);
1208    let mut req_builder = configuration
1209        .client
1210        .request(reqwest::Method::POST, &uri_str);
1211
1212    if let Some(ref user_agent) = configuration.user_agent {
1213        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1214    }
1215    if let Some(param_value) = p_sindri_team_id {
1216        req_builder = req_builder.header("Sindri-Team-Id", param_value.to_string());
1217    }
1218    if let Some(ref token) = configuration.bearer_access_token {
1219        req_builder = req_builder.bearer_auth(token.to_owned());
1220    };
1221    req_builder = req_builder.json(&p_team_create_input);
1222
1223    let req = req_builder.build()?;
1224    let resp = configuration.client.execute(req).await?;
1225
1226    let status = resp.status();
1227
1228    if !status.is_client_error() && !status.is_server_error() {
1229        let content = resp.text().await?;
1230        serde_json::from_str(&content).map_err(Error::from)
1231    } else {
1232        let content = resp.text().await?;
1233        let entity: Option<TeamCreateError> = serde_json::from_str(&content).ok();
1234        Err(Error::ResponseError(ResponseContent {
1235            status,
1236            content,
1237            entity,
1238        }))
1239    }
1240}
1241
1242/// Return details for the specified team
1243pub async fn team_detail(
1244    configuration: &configuration::Configuration,
1245    team_slug: &str,
1246) -> Result<models::TeamDetail, Error<TeamDetailError>> {
1247    // add a prefix to parameters to efficiently prevent name collisions
1248    let p_team_slug = team_slug;
1249
1250    let uri_str = format!(
1251        "{}/api/v1/team/{team_slug}/detail",
1252        configuration.base_path,
1253        team_slug = crate::apis::urlencode(p_team_slug)
1254    );
1255    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1256
1257    if let Some(ref user_agent) = configuration.user_agent {
1258        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1259    }
1260    if let Some(ref token) = configuration.bearer_access_token {
1261        req_builder = req_builder.bearer_auth(token.to_owned());
1262    };
1263    if let Some(ref token) = configuration.bearer_access_token {
1264        req_builder = req_builder.bearer_auth(token.to_owned());
1265    };
1266
1267    let req = req_builder.build()?;
1268    let resp = configuration.client.execute(req).await?;
1269
1270    let status = resp.status();
1271
1272    if !status.is_client_error() && !status.is_server_error() {
1273        let content = resp.text().await?;
1274        serde_json::from_str(&content).map_err(Error::from)
1275    } else {
1276        let content = resp.text().await?;
1277        let entity: Option<TeamDetailError> = serde_json::from_str(&content).ok();
1278        Err(Error::ResponseError(ResponseContent {
1279            status,
1280            content,
1281            entity,
1282        }))
1283    }
1284}
1285
1286/// Invite an email address to join the specified team
1287pub async fn team_invite(
1288    configuration: &configuration::Configuration,
1289    team_invite_input: models::TeamInviteInput,
1290    sindri_team_id: Option<&str>,
1291) -> Result<models::ActionResponse, Error<TeamInviteError>> {
1292    // add a prefix to parameters to efficiently prevent name collisions
1293    let p_team_invite_input = team_invite_input;
1294    let p_sindri_team_id = sindri_team_id;
1295
1296    let uri_str = format!("{}/api/v1/team/invite", configuration.base_path);
1297    let mut req_builder = configuration
1298        .client
1299        .request(reqwest::Method::POST, &uri_str);
1300
1301    if let Some(ref user_agent) = configuration.user_agent {
1302        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1303    }
1304    if let Some(param_value) = p_sindri_team_id {
1305        req_builder = req_builder.header("Sindri-Team-Id", param_value.to_string());
1306    }
1307    if let Some(ref token) = configuration.bearer_access_token {
1308        req_builder = req_builder.bearer_auth(token.to_owned());
1309    };
1310    req_builder = req_builder.json(&p_team_invite_input);
1311
1312    let req = req_builder.build()?;
1313    let resp = configuration.client.execute(req).await?;
1314
1315    let status = resp.status();
1316
1317    if !status.is_client_error() && !status.is_server_error() {
1318        let content = resp.text().await?;
1319        serde_json::from_str(&content).map_err(Error::from)
1320    } else {
1321        let content = resp.text().await?;
1322        let entity: Option<TeamInviteError> = serde_json::from_str(&content).ok();
1323        Err(Error::ResponseError(ResponseContent {
1324            status,
1325            content,
1326            entity,
1327        }))
1328    }
1329}
1330
1331/// Obtain team details for the currently authenticated team
1332pub async fn team_me(
1333    configuration: &configuration::Configuration,
1334) -> Result<models::TeamMeResponse, Error<TeamMeError>> {
1335    let uri_str = format!("{}/api/v1/team/me", configuration.base_path);
1336    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1337
1338    if let Some(ref user_agent) = configuration.user_agent {
1339        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1340    }
1341    if let Some(ref token) = configuration.bearer_access_token {
1342        req_builder = req_builder.bearer_auth(token.to_owned());
1343    };
1344    if let Some(ref token) = configuration.bearer_access_token {
1345        req_builder = req_builder.bearer_auth(token.to_owned());
1346    };
1347
1348    let req = req_builder.build()?;
1349    let resp = configuration.client.execute(req).await?;
1350
1351    let status = resp.status();
1352
1353    if !status.is_client_error() && !status.is_server_error() {
1354        let content = resp.text().await?;
1355        serde_json::from_str(&content).map_err(Error::from)
1356    } else {
1357        let content = resp.text().await?;
1358        let entity: Option<TeamMeError> = serde_json::from_str(&content).ok();
1359        Err(Error::ResponseError(ResponseContent {
1360            status,
1361            content,
1362            entity,
1363        }))
1364    }
1365}
1366
1367/// Return member list for the specified team
1368pub async fn team_members(
1369    configuration: &configuration::Configuration,
1370    team_slug: &str,
1371    sindri_team_id: Option<&str>,
1372) -> Result<models::TeamMembersResponse, Error<TeamMembersError>> {
1373    // add a prefix to parameters to efficiently prevent name collisions
1374    let p_team_slug = team_slug;
1375    let p_sindri_team_id = sindri_team_id;
1376
1377    let uri_str = format!(
1378        "{}/api/v1/team/{team_slug}/members",
1379        configuration.base_path,
1380        team_slug = crate::apis::urlencode(p_team_slug)
1381    );
1382    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1383
1384    if let Some(ref user_agent) = configuration.user_agent {
1385        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1386    }
1387    if let Some(param_value) = p_sindri_team_id {
1388        req_builder = req_builder.header("Sindri-Team-Id", param_value.to_string());
1389    }
1390    if let Some(ref token) = configuration.bearer_access_token {
1391        req_builder = req_builder.bearer_auth(token.to_owned());
1392    };
1393
1394    let req = req_builder.build()?;
1395    let resp = configuration.client.execute(req).await?;
1396
1397    let status = resp.status();
1398
1399    if !status.is_client_error() && !status.is_server_error() {
1400        let content = resp.text().await?;
1401        serde_json::from_str(&content).map_err(Error::from)
1402    } else {
1403        let content = resp.text().await?;
1404        let entity: Option<TeamMembersError> = serde_json::from_str(&content).ok();
1405        Err(Error::ResponseError(ResponseContent {
1406            status,
1407            content,
1408            entity,
1409        }))
1410    }
1411}
1412
1413/// Remove a user from the specified team. Revokes all team API keys if the removed user was the last team member.
1414pub async fn team_remove_member(
1415    configuration: &configuration::Configuration,
1416    team_remove_member_input: models::TeamRemoveMemberInput,
1417    sindri_team_id: Option<&str>,
1418) -> Result<models::ActionResponse, Error<TeamRemoveMemberError>> {
1419    // add a prefix to parameters to efficiently prevent name collisions
1420    let p_team_remove_member_input = team_remove_member_input;
1421    let p_sindri_team_id = sindri_team_id;
1422
1423    let uri_str = format!("{}/api/v1/team/remove-member", configuration.base_path);
1424    let mut req_builder = configuration
1425        .client
1426        .request(reqwest::Method::POST, &uri_str);
1427
1428    if let Some(ref user_agent) = configuration.user_agent {
1429        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1430    }
1431    if let Some(param_value) = p_sindri_team_id {
1432        req_builder = req_builder.header("Sindri-Team-Id", param_value.to_string());
1433    }
1434    if let Some(ref token) = configuration.bearer_access_token {
1435        req_builder = req_builder.bearer_auth(token.to_owned());
1436    };
1437    req_builder = req_builder.json(&p_team_remove_member_input);
1438
1439    let req = req_builder.build()?;
1440    let resp = configuration.client.execute(req).await?;
1441
1442    let status = resp.status();
1443
1444    if !status.is_client_error() && !status.is_server_error() {
1445        let content = resp.text().await?;
1446        serde_json::from_str(&content).map_err(Error::from)
1447    } else {
1448        let content = resp.text().await?;
1449        let entity: Option<TeamRemoveMemberError> = serde_json::from_str(&content).ok();
1450        Err(Error::ResponseError(ResponseContent {
1451            status,
1452            content,
1453            entity,
1454        }))
1455    }
1456}
1457
1458/// Update team settings.
1459pub async fn team_settings(
1460    configuration: &configuration::Configuration,
1461    team_settings_input: models::TeamSettingsInput,
1462) -> Result<models::TeamDetail, Error<TeamSettingsError>> {
1463    // add a prefix to parameters to efficiently prevent name collisions
1464    let p_team_settings_input = team_settings_input;
1465
1466    let uri_str = format!("{}/api/v1/team/settings", configuration.base_path);
1467    let mut req_builder = configuration
1468        .client
1469        .request(reqwest::Method::POST, &uri_str);
1470
1471    if let Some(ref user_agent) = configuration.user_agent {
1472        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1473    }
1474    if let Some(ref token) = configuration.bearer_access_token {
1475        req_builder = req_builder.bearer_auth(token.to_owned());
1476    };
1477    if let Some(ref token) = configuration.bearer_access_token {
1478        req_builder = req_builder.bearer_auth(token.to_owned());
1479    };
1480    req_builder = req_builder.json(&p_team_settings_input);
1481
1482    let req = req_builder.build()?;
1483    let resp = configuration.client.execute(req).await?;
1484
1485    let status = resp.status();
1486
1487    if !status.is_client_error() && !status.is_server_error() {
1488        let content = resp.text().await?;
1489        serde_json::from_str(&content).map_err(Error::from)
1490    } else {
1491        let content = resp.text().await?;
1492        let entity: Option<TeamSettingsError> = serde_json::from_str(&content).ok();
1493        Err(Error::ResponseError(ResponseContent {
1494            status,
1495            content,
1496            entity,
1497        }))
1498    }
1499}
1500
1501/// Login a user.
1502pub async fn user_login(
1503    configuration: &configuration::Configuration,
1504    user_login_input: models::UserLoginInput,
1505) -> Result<models::ActionResponse, Error<UserLoginError>> {
1506    // add a prefix to parameters to efficiently prevent name collisions
1507    let p_user_login_input = user_login_input;
1508
1509    let uri_str = format!("{}/api/v1/user/login", configuration.base_path);
1510    let mut req_builder = configuration
1511        .client
1512        .request(reqwest::Method::POST, &uri_str);
1513
1514    if let Some(ref user_agent) = configuration.user_agent {
1515        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1516    }
1517    req_builder = req_builder.json(&p_user_login_input);
1518
1519    let req = req_builder.build()?;
1520    let resp = configuration.client.execute(req).await?;
1521
1522    let status = resp.status();
1523
1524    if !status.is_client_error() && !status.is_server_error() {
1525        let content = resp.text().await?;
1526        serde_json::from_str(&content).map_err(Error::from)
1527    } else {
1528        let content = resp.text().await?;
1529        let entity: Option<UserLoginError> = serde_json::from_str(&content).ok();
1530        Err(Error::ResponseError(ResponseContent {
1531            status,
1532            content,
1533            entity,
1534        }))
1535    }
1536}
1537
1538/// Logout a user.
1539pub async fn user_logout(
1540    configuration: &configuration::Configuration,
1541) -> Result<models::ActionResponse, Error<UserLogoutError>> {
1542    let uri_str = format!("{}/api/v1/user/logout", configuration.base_path);
1543    let mut req_builder = configuration
1544        .client
1545        .request(reqwest::Method::POST, &uri_str);
1546
1547    if let Some(ref user_agent) = configuration.user_agent {
1548        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1549    }
1550
1551    let req = req_builder.build()?;
1552    let resp = configuration.client.execute(req).await?;
1553
1554    let status = resp.status();
1555
1556    if !status.is_client_error() && !status.is_server_error() {
1557        let content = resp.text().await?;
1558        serde_json::from_str(&content).map_err(Error::from)
1559    } else {
1560        let content = resp.text().await?;
1561        let entity: Option<UserLogoutError> = serde_json::from_str(&content).ok();
1562        Err(Error::ResponseError(ResponseContent {
1563            status,
1564            content,
1565            entity,
1566        }))
1567    }
1568}
1569
1570/// Obtain user details. Requires user authentication.
1571pub async fn user_me(
1572    configuration: &configuration::Configuration,
1573) -> Result<models::UserMeResponse, Error<UserMeError>> {
1574    let uri_str = format!("{}/api/v1/user/me", configuration.base_path);
1575    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1576
1577    if let Some(ref user_agent) = configuration.user_agent {
1578        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1579    }
1580    if let Some(ref token) = configuration.bearer_access_token {
1581        req_builder = req_builder.bearer_auth(token.to_owned());
1582    };
1583
1584    let req = req_builder.build()?;
1585    let resp = configuration.client.execute(req).await?;
1586
1587    let status = resp.status();
1588
1589    if !status.is_client_error() && !status.is_server_error() {
1590        let content = resp.text().await?;
1591        serde_json::from_str(&content).map_err(Error::from)
1592    } else {
1593        let content = resp.text().await?;
1594        let entity: Option<UserMeError> = serde_json::from_str(&content).ok();
1595        Err(Error::ResponseError(ResponseContent {
1596            status,
1597            content,
1598            entity,
1599        }))
1600    }
1601}