Struct SessionData

Source
pub struct SessionData {
Show 16 fields pub user_id: String, pub user_name: String, pub user_shortname: String, pub email: String, pub user_type: String, pub broker: String, pub exchanges: Vec<String>, pub products: Vec<String>, pub order_types: Vec<String>, pub api_key: String, pub access_token: String, pub public_token: String, pub refresh_token: String, pub login_time: String, pub meta: Option<SessionMeta>, pub avatar_url: Option<String>,
}
Expand description

Response from the generate_session API call

Fields§

§user_id: String

The unique, permanent user id registered with the broker and the exchanges

§user_name: String

User’s real name

§user_shortname: String

Shortened version of the user’s real name

§email: String

User’s email

§user_type: String

User’s registered role at the broker. This will be individual for all retail users

§broker: String

The broker ID

§exchanges: Vec<String>

Exchanges enabled for trading on the user’s account

§products: Vec<String>

Margin product types enabled for the user

§order_types: Vec<String>

Order types enabled for the user

§api_key: String

The API key for which the authentication was performed

§access_token: String

The authentication token that’s used with every subsequent request Unless this is invalidated using the API, or invalidated by a master-logout from the Kite Web trading terminal, it’ll expire at 6 AM on the next day (regulatory requirement)

§public_token: String

A token for public session validation where requests may be exposed to the public

§refresh_token: String

A token for getting long standing read permissions. This is only available to certain approved platforms

§login_time: String

User’s last login time

§meta: Option<SessionMeta>

Session metadata containing demat_consent and other user metadata

§avatar_url: Option<String>

Full URL to the user’s avatar (PNG image) if there’s one

Implementations§

Source§

impl SessionData

Source

pub fn is_valid(&self) -> bool

Check if the session has required authentication data

Source

pub fn token(&self) -> &str

Get the access token for API requests

Source

pub fn has_exchange(&self, exchange: &str) -> bool

Check if the user has access to a specific exchange

Source

pub fn has_product(&self, product: &str) -> bool

Check if the user has access to a specific product

Source

pub fn has_order_type(&self, order_type: &str) -> bool

Check if the user has access to a specific order type

Trait Implementations§

Source§

impl Clone for SessionData

Source§

fn clone(&self) -> SessionData

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionData

Source§

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

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

impl<'de> Deserialize<'de> for SessionData

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 SessionData

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> 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: 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: 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> 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 = 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> 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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,