pub struct ApiResponse<T> {
pub data: T,
pub pagination: Option<PaginationInfo>,
pub cursor_pagination: Option<CursorPaginationInfo>,
pub time: Timestamp,
pub req_id: Option<String>,
}Expand description
Success response envelope for single objects
Fields§
§data: T§pagination: Option<PaginationInfo>§cursor_pagination: Option<CursorPaginationInfo>§time: Timestamp§req_id: Option<String>Implementations§
Source§impl<T> ApiResponse<T>
impl<T> ApiResponse<T>
Sourcepub fn with_pagination(
data: T,
offset: usize,
limit: usize,
total: usize,
) -> Self
pub fn with_pagination( data: T, offset: usize, limit: usize, total: usize, ) -> Self
Create a response with offset-based pagination info (deprecated)
Sourcepub fn with_cursor_pagination(
data: T,
next_cursor: Option<String>,
has_more: bool,
) -> Self
pub fn with_cursor_pagination( data: T, next_cursor: Option<String>, has_more: bool, ) -> Self
Create a response with cursor-based pagination
Sourcepub fn with_req_id(self, req_id: String) -> Self
pub fn with_req_id(self, req_id: String) -> Self
Add request ID to response
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>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