Struct Authentication

Source
pub struct Authentication {
    pub token: String,
    pub user_id: User,
}
Expand description

racal::Queryable’s RequiredApiState.

With authentication

Fields§

§token: String

The secret authentication token

§user_id: User

The user that the authentication token is for

Implementations§

Source§

impl Authentication

Source

pub fn to_header(&self) -> (&'static str, String)

Turns the authentication into the header that it generates

Trait Implementations§

Source§

impl ApiClient<Authentication> for AuthenticatedResonite

Available on crate feature http_client only.
Source§

fn state(&self) -> &Authentication

Gets the API state
Source§

fn client(&self) -> &Client

Gets the actual reqwest client
Source§

fn before_request<'life0, 'async_trait>( &'life0 self, req: RequestBuilder, ) -> Pin<Box<dyn Future<Output = Result<RequestBuilder, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

A way to modify the request right before sending it Read more
Source§

fn handle_response<'life0, 'async_trait, ReturnType, FromState, QueryableType>( &'life0 self, queryable: QueryableType, response: Response, ) -> Pin<Box<dyn Future<Output = Result<ReturnType, ApiError>> + Send + 'async_trait>>
where 'life0: 'async_trait, ReturnType: DeserializeOwned + 'async_trait, FromState: FromApiState<State> + 'async_trait, QueryableType: Queryable<FromState, ReturnType> + Send + Sync + 'async_trait, Self: Sync + 'async_trait,

A way to modify the request after it’s been received Read more
Source§

fn query<'life0, 'async_trait, ReturnType, FromState, QueryableType>( &'life0 self, queryable: QueryableType, ) -> Pin<Box<dyn Future<Output = Result<ReturnType, ApiError>> + Send + 'async_trait>>
where 'life0: 'async_trait, ReturnType: DeserializeOwned + 'async_trait, FromState: FromApiState<State> + 'async_trait, QueryableType: Queryable<FromState, ReturnType> + Send + Sync + 'async_trait, Self: Sync + 'async_trait,

Creates a query
Source§

fn build_request<ReturnType, FromState, QueryableType>( http: &Client, api_state: &FromState, queryable: &QueryableType, ) -> Result<RequestBuilder, ApiError>
where ReturnType: DeserializeOwned, FromState: FromApiState<State>, QueryableType: Queryable<FromState, ReturnType> + Send + Sync,

Builds the base request Read more
Source§

impl BorshDeserialize for Authentication

Source§

fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>

Source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
Source§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
Source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

Source§

impl BorshSerialize for Authentication

Source§

fn serialize<__W: Write>(&self, writer: &mut __W) -> Result<(), Error>

Source§

impl Clone for Authentication

Source§

fn clone(&self) -> Authentication

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 Authentication

Source§

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

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

impl<'de> Deserialize<'de> for Authentication

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 From<UserSession> for Authentication

Source§

fn from(value: UserSession) -> Self

Converts to this type from the input type.
Source§

impl FromApiState<Authentication> for Authentication

Source§

fn from_state(state: &Self) -> &Self

Gets the wanted state (Self) from the current ApiState, by borrowing if possible
Source§

impl FromApiState<Authentication> for NoAuthentication

Source§

fn from_state(_: &Authentication) -> &Self

Gets the wanted state (Self) from the current ApiState, by borrowing if possible
Source§

impl Hash for Authentication

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Authentication

Source§

fn eq(&self, other: &Authentication) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Queryable<Authentication, ()> for ExtendUserSession

Source§

fn url(&self, _: &Authentication) -> String

The URL of the request
Source§

fn method(&self, _: &Authentication) -> RequestMethod

The method to use for the request Read more
Source§

fn deserialize(&self, _data: &[u8]) -> Result<()>

Deserializes the API response into the struct, by default using serde_json. Read more
Source§

fn body(&self, _state: &RequiredApiState) -> Option<Result<Vec<u8>, Error>>

Creates a JSON body for the request Read more
Source§

impl Queryable<Authentication, Message> for Message

Send a message

Source§

fn url(&self, _: &Authentication) -> String

The URL of the request
Source§

fn body(&self, _state: &Authentication) -> Option<Result<Vec<u8>>>

Creates a JSON body for the request Read more
Source§

fn method(&self, _state: &Authentication) -> RequestMethod

The method to use for the request Read more
Source§

fn deserialize(&self, data: &[u8]) -> Result<ResponseType, Error>

Deserializes the API response into the struct, by default using serde_json. Read more
Source§

impl Queryable<Authentication, Vec<Contact>> for Contacts

Source§

fn url(&self, auth: &Authentication) -> String

The URL of the request
Source§

fn method(&self, _state: &RequiredApiState) -> RequestMethod

The method to use for the request Read more
Source§

fn body(&self, _state: &RequiredApiState) -> Option<Result<Vec<u8>, Error>>

Creates a JSON body for the request Read more
Source§

fn deserialize(&self, data: &[u8]) -> Result<ResponseType, Error>

Deserializes the API response into the struct, by default using serde_json. Read more
Source§

impl Queryable<Authentication, Vec<Message>> for Messages

Source§

fn url(&self, auth: &Authentication) -> String

The URL of the request
Source§

fn method(&self, _state: &RequiredApiState) -> RequestMethod

The method to use for the request Read more
Source§

fn body(&self, _state: &RequiredApiState) -> Option<Result<Vec<u8>, Error>>

Creates a JSON body for the request Read more
Source§

fn deserialize(&self, data: &[u8]) -> Result<ResponseType, Error>

Deserializes the API response into the struct, by default using serde_json. Read more
Source§

impl Serialize for Authentication

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

impl Eq for Authentication

Source§

impl StructuralPartialEq for Authentication

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> 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<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
Source§

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

Source§

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

Source§

impl<T> MaybeSendSync for T