clerk_sdk_rust_community/apis/
beta_features_api.rs

1/*
2 * Clerk Backend API
3 *
4 * The Clerk REST Backend API, meant to be accessed by backend servers. Please see https://clerk.com/docs for more information.
5 *
6 * The version of the OpenAPI document: v1
7 * Contact: support@clerk.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`update_instance_auth_config`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum UpdateInstanceAuthConfigError {
22    Status402(crate::models::ClerkErrors),
23    Status422(crate::models::ClerkErrors),
24    UnknownValue(serde_json::Value),
25}
26
27/// struct for typed errors of method [`update_production_instance_domain`]
28#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum UpdateProductionInstanceDomainError {
31    Status400(crate::models::ClerkErrors),
32    Status422(crate::models::ClerkErrors),
33    UnknownValue(serde_json::Value),
34}
35
36
37/// Updates the settings of an instance
38pub async fn update_instance_auth_config(configuration: &configuration::Configuration, update_instance_auth_config_request: Option<crate::models::UpdateInstanceAuthConfigRequest>) -> Result<crate::models::UpdateInstanceAuthConfig200Response, Error<UpdateInstanceAuthConfigError>> {
39    let local_var_configuration = configuration;
40
41    let local_var_client = &local_var_configuration.client;
42
43    let local_var_uri_str = format!("{}/beta_features/instance_settings", local_var_configuration.base_path);
44    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
45
46    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
47        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
48    }
49    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
50        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
51    };
52    local_var_req_builder = local_var_req_builder.json(&update_instance_auth_config_request);
53
54    let local_var_req = local_var_req_builder.build()?;
55    let local_var_resp = local_var_client.execute(local_var_req).await?;
56
57    let local_var_status = local_var_resp.status();
58    let local_var_content = local_var_resp.text().await?;
59
60    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
61        serde_json::from_str(&local_var_content).map_err(Error::from)
62    } else {
63        let local_var_entity: Option<UpdateInstanceAuthConfigError> = serde_json::from_str(&local_var_content).ok();
64        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
65        Err(Error::ResponseError(local_var_error))
66    }
67}
68
69/// Change the domain of a production instance.  Changing the domain requires updating the [DNS records](https://clerk.com/docs/deployments/overview#dns-records) accordingly, deploying new [SSL certificates](https://clerk.com/docs/deployments/overview#deploy), updating your Social Connection's redirect URLs and setting the new keys in your code.  WARNING: Changing your domain will invalidate all current user sessions (i.e. users will be logged out). Also, while your application is being deployed, a small downtime is expected to occur.
70pub async fn update_production_instance_domain(configuration: &configuration::Configuration, update_production_instance_domain_request: Option<crate::models::UpdateProductionInstanceDomainRequest>) -> Result<(), Error<UpdateProductionInstanceDomainError>> {
71    let local_var_configuration = configuration;
72
73    let local_var_client = &local_var_configuration.client;
74
75    let local_var_uri_str = format!("{}/beta_features/domain", local_var_configuration.base_path);
76    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
77
78    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
79        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
80    }
81    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
82        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
83    };
84    local_var_req_builder = local_var_req_builder.json(&update_production_instance_domain_request);
85
86    let local_var_req = local_var_req_builder.build()?;
87    let local_var_resp = local_var_client.execute(local_var_req).await?;
88
89    let local_var_status = local_var_resp.status();
90    let local_var_content = local_var_resp.text().await?;
91
92    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
93        Ok(())
94    } else {
95        let local_var_entity: Option<UpdateProductionInstanceDomainError> = serde_json::from_str(&local_var_content).ok();
96        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
97        Err(Error::ResponseError(local_var_error))
98    }
99}
100