sindri_openapi/apis/
proofs_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 [`proof_delete`]
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum ProofDeleteError {
20    Status404(models::ProofDoesNotExistResponse),
21    Status500(models::SindriInternalErrorResponse),
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`proof_detail`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum ProofDetailError {
29    Status404(models::ProofDoesNotExistResponse),
30    Status500(models::SindriInternalErrorResponse),
31    Status501(models::ComingSoonResponse),
32    UnknownValue(serde_json::Value),
33}
34
35/// Delete a specific proof.
36pub async fn proof_delete(
37    configuration: &configuration::Configuration,
38    proof_id: &str,
39) -> Result<models::ActionResponse, Error<ProofDeleteError>> {
40    // add a prefix to parameters to efficiently prevent name collisions
41    let p_proof_id = proof_id;
42
43    let uri_str = format!(
44        "{}/api/v1/proof/{proof_id}/delete",
45        configuration.base_path,
46        proof_id = crate::apis::urlencode(p_proof_id)
47    );
48    let mut req_builder = configuration
49        .client
50        .request(reqwest::Method::DELETE, &uri_str);
51
52    if let Some(ref user_agent) = configuration.user_agent {
53        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
54    }
55    if let Some(ref token) = configuration.bearer_access_token {
56        req_builder = req_builder.bearer_auth(token.to_owned());
57    };
58    if let Some(ref token) = configuration.bearer_access_token {
59        req_builder = req_builder.bearer_auth(token.to_owned());
60    };
61
62    let req = req_builder.build()?;
63    let resp = configuration.client.execute(req).await?;
64
65    let status = resp.status();
66
67    if !status.is_client_error() && !status.is_server_error() {
68        let content = resp.text().await?;
69        serde_json::from_str(&content).map_err(Error::from)
70    } else {
71        let content = resp.text().await?;
72        let entity: Option<ProofDeleteError> = serde_json::from_str(&content).ok();
73        Err(Error::ResponseError(ResponseContent {
74            status,
75            content,
76            entity,
77        }))
78    }
79}
80
81/// Get info for a specific proof.
82pub async fn proof_detail(
83    configuration: &configuration::Configuration,
84    proof_id: &str,
85    include_proof: Option<bool>,
86    include_public: Option<bool>,
87    include_smart_contract_calldata: Option<bool>,
88    include_verification_key: Option<bool>,
89) -> Result<models::ProofInfoResponse, Error<ProofDetailError>> {
90    // add a prefix to parameters to efficiently prevent name collisions
91    let p_proof_id = proof_id;
92    let p_include_proof = include_proof;
93    let p_include_public = include_public;
94    let p_include_smart_contract_calldata = include_smart_contract_calldata;
95    let p_include_verification_key = include_verification_key;
96
97    let uri_str = format!(
98        "{}/api/v1/proof/{proof_id}/detail",
99        configuration.base_path,
100        proof_id = crate::apis::urlencode(p_proof_id)
101    );
102    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
103
104    if let Some(ref param_value) = p_include_proof {
105        req_builder = req_builder.query(&[("include_proof", &param_value.to_string())]);
106    }
107    if let Some(ref param_value) = p_include_public {
108        req_builder = req_builder.query(&[("include_public", &param_value.to_string())]);
109    }
110    if let Some(ref param_value) = p_include_smart_contract_calldata {
111        req_builder =
112            req_builder.query(&[("include_smart_contract_calldata", &param_value.to_string())]);
113    }
114    if let Some(ref param_value) = p_include_verification_key {
115        req_builder = req_builder.query(&[("include_verification_key", &param_value.to_string())]);
116    }
117    if let Some(ref user_agent) = configuration.user_agent {
118        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
119    }
120    if let Some(ref token) = configuration.bearer_access_token {
121        req_builder = req_builder.bearer_auth(token.to_owned());
122    };
123    if let Some(ref token) = configuration.bearer_access_token {
124        req_builder = req_builder.bearer_auth(token.to_owned());
125    };
126
127    let req = req_builder.build()?;
128    let resp = configuration.client.execute(req).await?;
129
130    let status = resp.status();
131
132    if !status.is_client_error() && !status.is_server_error() {
133        let content = resp.text().await?;
134        serde_json::from_str(&content).map_err(Error::from)
135    } else {
136        let content = resp.text().await?;
137        let entity: Option<ProofDetailError> = serde_json::from_str(&content).ok();
138        Err(Error::ResponseError(ResponseContent {
139            status,
140            content,
141            entity,
142        }))
143    }
144}