pub struct PaginatedApiResponse<T> {
pub success: bool,
pub data: Vec<T>,
pub meta: PaginationResponse,
pub error: Option<String>,
}Expand description
Paginated API response with success flag, data array, and metadata at top level This is the preferred response format for list endpoints
Fields§
§success: bool§data: Vec<T>§meta: PaginationResponse§error: Option<String>Implementations§
Source§impl<T> PaginatedApiResponse<T>
impl<T> PaginatedApiResponse<T>
Sourcepub fn ok_with_info(data: Vec<T>, info: &PaginationInfo) -> Self
pub fn ok_with_info(data: Vec<T>, info: &PaginationInfo) -> Self
A successful response carrying the repository’s pagination info — the cursor fields surface only when the repository produced them.
Sourcepub fn ok(data: Vec<T>, total: u64, page: u32, limit: u32) -> Self
pub fn ok(data: Vec<T>, total: u64, page: u32, limit: u32) -> Self
Create a successful paginated response
Sourcepub fn from_paginated(resp: PaginatedResponse<T>) -> Self
pub fn from_paginated(resp: PaginatedResponse<T>) -> Self
Create from a PaginatedResponse
Trait Implementations§
Source§impl<T: Debug> Debug for PaginatedApiResponse<T>
impl<T: Debug> Debug for PaginatedApiResponse<T>
Auto Trait Implementations§
impl<T> Freeze for PaginatedApiResponse<T>
impl<T> RefUnwindSafe for PaginatedApiResponse<T>where
Vec<T>: RefUnwindSafe,
impl<T> Send for PaginatedApiResponse<T>
impl<T> Sync for PaginatedApiResponse<T>
impl<T> Unpin for PaginatedApiResponse<T>
impl<T> UnsafeUnpin for PaginatedApiResponse<T>where
Vec<T>: UnsafeUnpin,
impl<T> UnwindSafe for PaginatedApiResponse<T>where
Vec<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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more