Struct kittycad::hidden::Hidden

source ·
pub struct Hidden {
    pub client: Client,
}

Fields§

§client: Client

Implementations§

source§

impl Hidden

source

pub async fn auth_email<'a>( &'a self, body: &EmailAuthenticationForm ) -> Result<VerificationTokenResponse, Error>

Create an email verification request for a user.

async fn example_hidden_auth_email() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    let result: kittycad::types::VerificationTokenResponse = client
        .hidden()
        .auth_email(&kittycad::types::EmailAuthenticationForm {
            callback_url: Some("https://example.com/foo/bar".to_string()),
            email: "email@example.com".to_string(),
        })
        .await?;
    println!("{:?}", result);
    Ok(())
}
source

pub async fn auth_email_callback<'a>( &'a self, callback_url: Option<String>, email: &'a str, token: &'a str ) -> Result<(), Error>

Listen for callbacks for email verification for users.

Parameters:

  • callback_url: Option<String>: The URL to redirect back to after we have authenticated.
  • email: &'astr: The user’s email. (required)
  • token: &'astr: The verification token. (required)
async fn example_hidden_auth_email_callback() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .hidden()
        .auth_email_callback(
            Some("https://example.com/foo/bar".to_string()),
            "email@example.com",
            "some-string",
        )
        .await?;
    Ok(())
}
source

pub async fn get_auth_saml<'a>( &'a self, callback_url: Option<String>, provider_id: Uuid ) -> Result<(), Error>

Get a redirect straight to the SAML IdP.

The UI uses this to avoid having to ask the API anything about the IdP. It already knows the SAML IdP ID from the path, so it can just link to this path and rely on the API to redirect to the actual IdP.

Parameters:

  • callback_url: Option<String>: The URL to redirect back to after we have authenticated.
  • provider_id: uuid::Uuid: The ID of the identity provider. (required)
use std::str::FromStr;
async fn example_hidden_get_auth_saml() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .hidden()
        .get_auth_saml(
            Some("https://example.com/foo/bar".to_string()),
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
        )
        .await?;
    Ok(())
}
source

pub async fn post_auth_saml<'a>( &'a self, provider_id: Uuid, body: &Bytes ) -> Result<(), Error>

Authenticate a user via SAML

Parameters:

  • provider_id: uuid::Uuid: The ID of the identity provider. (required)
use std::str::FromStr;
async fn example_hidden_post_auth_saml() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client
        .hidden()
        .post_auth_saml(
            uuid::Uuid::from_str("d9797f8d-9ad6-4e08-90d7-2ec17e13471c")?,
            &bytes::Bytes::from("some-string"),
        )
        .await?;
    Ok(())
}
source

pub async fn logout<'a>(&'a self) -> Result<(), Error>

This endpoint removes the session cookie for a user.

This is used in logout scenarios.

async fn example_hidden_logout() -> anyhow::Result<()> {
    let client = kittycad::Client::new_from_env();
    client.hidden().logout().await?;
    Ok(())
}

Trait Implementations§

source§

impl Clone for Hidden

source§

fn clone(&self) -> Hidden

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Hidden

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Hidden

§

impl !RefUnwindSafe for Hidden

§

impl Send for Hidden

§

impl Sync for Hidden

§

impl Unpin for Hidden

§

impl !UnwindSafe for Hidden

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> IntoResult<T> for T

§

type Err = Infallible

source§

fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more