Struct CreatePromptRequest

Source
pub struct CreatePromptRequest {
    pub user: String,
    pub body: String,
    pub title: Option<String>,
    pub approve_text: Option<String>,
    pub approve_redirect_url: Option<String>,
    pub reject_text: Option<String>,
    pub reject_redirect_url: Option<String>,
    pub long_poll: Option<bool>,
    pub expires_in: Option<f32>,
    pub metadata: Option<PromptMetadata>,
    pub internal_data: Option<HashMap<String, String>>,
    pub idempotency_key: Option<String>,
}

Fields§

§user: String

The user to send the approval request to. Can be either an email address or a phone number.

§body: String

The body of the approval request to show the user.

§title: Option<String>

The title of an approval request. Defaults to an empty string.

§approve_text: Option<String>

The approve action text. Defaults to ‘Approve’.

§approve_redirect_url: Option<String>

An HTTPS URL to redirect the user to if the prompt is approved. This URL is kept secret until the user is redirected to it.

§reject_text: Option<String>

The reject action text. If not specified the reject button will NOT be rendered, and the user will only see an approve action button.

§reject_redirect_url: Option<String>

An HTTPS URL to redirect the user to if the prompt is rejected. This URL is kept secret until the user is redirected to it.

§long_poll: Option<bool>

If true, the request waits (long-polls) until the user responds to the prompt or more than 10 minutes pass. Defaults to false.

§expires_in: Option<f32>

The number of seconds until this request can no longer be answered.

§metadata: Option<PromptMetadata>§internal_data: Option<HashMap<String, String>>§idempotency_key: Option<String>

Allows calling create_prompt multiple times idempotently, such that a prompt is sent at-most once. This key should contain sufficient randomness. Idempotent requests are stored for 24 hours. After that time, the same key will create a new request.

Implementations§

Trait Implementations§

Source§

impl Debug for CreatePromptRequest

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CreatePromptRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CreatePromptRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,