Skip to main content

CreateIntent

Struct CreateIntent 

Source
pub struct CreateIntent {
Show 16 fields pub intent: String, pub max_amount: Option<i64>, pub currency: Option<String>, pub context: Option<Value>, pub require_payment_link: Option<bool>, pub sign_in_agent: Option<bool>, pub sign_in_hint: Option<SignInHint>, pub sign_in_link: Option<bool>, pub metadata: Option<HashMap<String, String>>, pub customer: Option<String>, pub country: Option<String>, pub end_user_ip: Option<String>, pub webhook_url: Option<String>, pub input_ttl_seconds: Option<u32>, pub secrets: Option<Vec<String>>, pub shops: Option<Vec<String>>,
}
Expand description

Parameters for POST /intents. Build with CreateIntent::new.

Fields§

§intent: String

What to buy or book, in natural language.

§max_amount: Option<i64>

Spending cap in cents; the intent fails rather than exceed it.

§currency: Option<String>§context: Option<Value>

Structured details: addresses, names, loyalty numbers.

§require_payment_link: Option<bool>

Always return a payment link instead of paying from the balance.

§sign_in_agent: Option<bool>

When the shop wants the payer signed in and asks for a phone number or email and then a code: let the agent sign them in itself, asking for each value in requires_input (true, the default), or never (false). Takes effect only where OpenIntents has agent sign-in on for your key.

§sign_in_hint: Option<SignInHint>

The payer’s phone number or email for signing in, so the agent need not ask for it.

§sign_in_link: Option<bool>

When the shop wants the payer signed in and the agent does not sign them in itself: wait in requires_login with a sign-in link for them (true, the default), or fail with login_required (false).

§metadata: Option<HashMap<String, String>>§customer: Option<String>

A customer of your account to buy for: their balance and browser profile.

§country: Option<String>

The country its browser goes out from (ISO 3166-1 alpha-2, lowercase). Left out, the payer’s last country, one inferred from end_user_ip, or the default is used; see country_source on the intent.

§end_user_ip: Option<String>

The address your end user is browsing from, to infer country from.

§webhook_url: Option<String>

Where this intent’s own events go, signed with the webhook_secret the create response alone carries.

§input_ttl_seconds: Option<u32>

How long a question to the payer may wait for an answer, in seconds.

§secrets: Option<Vec<String>>

Handles (sec_...) of the stored secrets the purchase may use.

§shops: Option<Vec<String>>

The shops (registrable domains) you let the purchase fill secrets on.

Implementations§

Source§

impl CreateIntent

Source

pub fn new(intent: impl Into<String>) -> Self

Source

pub fn max_amount(self, cents: i64) -> Self

Source

pub fn currency(self, currency: impl Into<String>) -> Self

Source

pub fn context(self, context: Value) -> Self

Source

pub fn sign_in_agent(self, yes: bool) -> Self

Source

pub fn sign_in_hint(self, hint: SignInHint) -> Self

Source

pub fn metadata(self, key: impl Into<String>, value: impl Into<String>) -> Self

Source

pub fn customer(self, customer: impl Into<String>) -> Self

Source

pub fn country(self, country: impl Into<String>) -> Self

Source

pub fn end_user_ip(self, ip: impl Into<String>) -> Self

Source

pub fn webhook_url(self, url: impl Into<String>) -> Self

Source

pub fn input_ttl_seconds(self, seconds: u32) -> Self

Source

pub fn secrets<I, S>(self, handles: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Source

pub fn shops<I, S>(self, shops: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Trait Implementations§

Source§

impl Clone for CreateIntent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CreateIntent

Source§

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

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

impl Default for CreateIntent

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Serialize for CreateIntent

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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