pub struct ApiResponse<T> {
pub code: i32,
pub msg: String,
pub data: Option<T>,
pub aggregated_error: Option<HashMap<String, AggregatedItemError>>,
}Expand description
Generic API response wrapper
Fields§
§code: i32§msg: String§data: Option<T>§aggregated_error: Option<HashMap<String, AggregatedItemError>>Per-item failures for batch operations, keyed by the URI that was sent.
Only present when the operation partially failed (see
CODE_BATCH_OPERATION_NOT_FULLY_COMPLETED). Items that succeeded are
absent from the map, so the successful set is the request’s URIs minus
these keys.
Implementations§
Source§impl ApiResponse<Value>
impl ApiResponse<Value>
Sourcepub fn into_error(self) -> Error
pub fn into_error(self) -> Error
Convert a non-zero response into the most informative error variant.
Folding every failure into Error::Api would discard exactly what
callers need to act on: which items of a batch failed, and the unlock
tokens behind a lock conflict. Endpoints that can return either should
route their errors through here.
Trait Implementations§
Source§impl<T: Debug> Debug for ApiResponse<T>
impl<T: Debug> Debug for ApiResponse<T>
Source§impl<'de, T> Deserialize<'de> for ApiResponse<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for ApiResponse<T>where
T: Deserialize<'de>,
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
Auto Trait Implementations§
impl<T> Freeze for ApiResponse<T>
impl<T> RefUnwindSafe for ApiResponse<T>where
Option<T>: RefUnwindSafe,
impl<T> Send for ApiResponse<T>
impl<T> Sync for ApiResponse<T>
impl<T> Unpin for ApiResponse<T>
impl<T> UnsafeUnpin for ApiResponse<T>where
Option<T>: UnsafeUnpin,
impl<T> UnwindSafe for ApiResponse<T>where
Option<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