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