pub struct ApiResponse<T: Default> {
pub data: T,
pub includes: Option<Includes>,
pub meta: Option<ResponseMeta>,
pub errors: Option<Vec<ApiError>>,
pub extra: BTreeMap<String, Value>,
}Expand description
Standard X API v2 response envelope.
Single-item endpoints use ApiResponse<Tweet>, list endpoints use
ApiResponse<Vec<Tweet>>. Serde handles both shapes transparently.
Fields§
§data: TPrimary payload — a single object or a Vec<T> for list endpoints.
includes: Option<Includes>Expanded objects referenced by data when the caller requested
expansions=....
meta: Option<ResponseMeta>Pagination and result-count metadata.
errors: Option<Vec<ApiError>>Partial errors returned alongside a 200 response.
extra: BTreeMap<String, Value>Forward-compatibility bucket — captures unknown top-level fields so a new spec field round-trips through serialize/deserialize unchanged.
Trait Implementations§
Source§impl<T: Clone + Default> Clone for ApiResponse<T>
impl<T: Clone + Default> Clone for ApiResponse<T>
Source§fn clone(&self) -> ApiResponse<T>
fn clone(&self) -> ApiResponse<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Default + Default> Default for ApiResponse<T>
impl<T: Default + Default> Default for ApiResponse<T>
Source§fn default() -> ApiResponse<T>
fn default() -> ApiResponse<T>
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for ApiResponse<T>where
T: Deserialize<'de> + Default,
impl<'de, T> Deserialize<'de> for ApiResponse<T>where
T: Deserialize<'de> + Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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<T> JsonSchema for ApiResponse<T>where
T: JsonSchema + Default,
impl<T> JsonSchema for ApiResponse<T>where
T: JsonSchema + Default,
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreAuto Trait Implementations§
impl<T> Freeze for ApiResponse<T>where
T: Freeze,
impl<T> RefUnwindSafe for ApiResponse<T>where
T: RefUnwindSafe,
impl<T> Send for ApiResponse<T>where
T: Send,
impl<T> Sync for ApiResponse<T>where
T: Sync,
impl<T> Unpin for ApiResponse<T>where
T: Unpin,
impl<T> UnsafeUnpin for ApiResponse<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ApiResponse<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more