Skip to main content

HostSession

Struct HostSession 

Source
pub struct HostSession {
    pub bot_name: String,
    pub session_id: String,
    pub agent_id: Option<String>,
    pub routine_url: Option<String>,
    pub routine_bearer: Option<String>,
    pub device_token: Option<String>,
    pub product_nick: Option<String>,
}
Expand description

One bot session the host says lives on this machine.

routine_url and routine_bearer are optional and stay in memory. They are not part of a session record on disk.

Fields§

§bot_name: String

Display name the host already shows (Alice, Привет мир).

§session_id: String

Session id the host already assigned. This is the mail session, not the Grok Bot agent id.

§agent_id: Option<String>

Grok Bot agent id for [createAgentAutomation]. Absent means this session does not get a webhook routine.

§routine_url: Option<String>

Routine URL for this session, if the host has one. Not a file.

§routine_bearer: Option<String>

Bearer for that routine POST. Memory only.

§device_token: Option<String>

Device bearer from the host keychain, for a session that already registered. None on the first connect.

§product_nick: Option<String>

Product-session mode: the product nick. With it, device_token is the product session token and every call goes through the product proxy.

Implementations§

Source§

impl HostSession

Source

pub fn new(bot_name: impl Into<String>, session_id: impl Into<String>) -> Self

A session with no routine and no stored device bearer.

Source

pub fn with_product( self, nick: impl Into<String>, token: impl Into<String>, ) -> Self

Product-session mode for this session: log in at the product as nick with an existing product session token.

Source

pub fn with_routine( self, url: impl Into<String>, bearer: Option<String>, ) -> Self

Attaches a routine target. The bearer is kept only as this value.

Source

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

Device bearer the host keychain already holds.

Trait Implementations§

Source§

impl Debug for HostSession

Source§

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

Formats the value using the given formatter. 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> 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, 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