Response

Struct Response 

Source
#[non_exhaustive]
pub struct Response<R, D>{ pub data: D, pub pagination: Option<Cursor>, pub request: Option<R>, pub total: Option<i64>, pub other: Option<Map<String, Value>>, }
Available on crate feature helix only.
Expand description

Response retrieved from endpoint. Data is the type in Request::Response

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§data: D

Twitch’s response field for data.

§pagination: Option<Cursor>

A cursor value, to be used in a subsequent request to specify the starting point of the next set of results.

§request: Option<R>

The request that was sent, used for pagination.

§total: Option<i64>

Response would return this many results if fully paginated. Sometimes this is not emmitted or correct for this purpose, in those cases, this value will be None.

§other: Option<Map<String, Value>>

Fields which are not part of the data response, but are returned by the endpoint.

See for example Get Broadcaster Subscriptions which returns this.

Implementations§

Source§

impl Response<GetBroadcasterSubscriptionsRequest, Vec<BroadcasterSubscription>>

Source

pub fn points(&self) -> Result<i64, BroadcasterSubscriptionPointsError>

The current number of subscriber points earned by this broadcaster.

Source§

impl<R, D> Response<R, D>

Source

pub fn get_other<Q, V>(&self, key: &Q) -> Result<Option<V>, Error>
where String: Borrow<Q>, Q: ?Sized + Ord + Eq + Hash, V: DeserializeOwned,

Get a field from the response that is not part of data.

Source§

impl<R, D, T> Response<R, D>
where R: Request, D: IntoIterator<Item = T> + PartialEq + DeserializeOwned,

Source

pub fn first(self) -> Option<T>

Get first result of this response.

Source§

impl<R, D> Response<R, D>
where R: Request<Response = D> + Clone + Paginated + RequestGet + Debug, D: DeserializeOwned + Debug + PartialEq,

Source

pub async fn get_next<'a, C: HttpClient<'a>>( self, client: &'a HelixClient<'a, C>, token: &(impl TwitchToken + ?Sized), ) -> Result<Option<Response<R, D>>, ClientRequestError<<C as HttpClient<'a>>::Error>>

Get the next page in the responses.

Trait Implementations§

Source§

impl<R, D> Debug for Response<R, D>

Source§

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

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

impl<R, D> PartialEq for Response<R, D>

Source§

fn eq(&self, other: &Response<R, D>) -> bool

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

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<R, D> StructuralPartialEq for Response<R, D>

Auto Trait Implementations§

§

impl<R, D> Freeze for Response<R, D>
where D: Freeze, R: Freeze,

§

impl<R, D> RefUnwindSafe for Response<R, D>

§

impl<R, D> Send for Response<R, D>
where D: Send, R: Send,

§

impl<R, D> Sync for Response<R, D>
where D: Sync, R: Sync,

§

impl<R, D> Unpin for Response<R, D>
where D: Unpin, R: Unpin,

§

impl<R, D> UnwindSafe for Response<R, D>
where D: UnwindSafe, R: UnwindSafe,

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> 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> 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, 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> 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> ErasedDestructor for T
where T: 'static,