Skip to main content

sure_client_rs/models/
mod.rs

1pub mod account;
2pub mod auth;
3pub mod category;
4pub mod chat;
5pub mod merchant;
6pub mod sync;
7pub mod transaction;
8pub mod usage;
9pub mod valuation;
10
11use serde::{Deserialize, Serialize};
12
13/// Pagination information for paginated responses
14#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
15#[cfg_attr(feature = "strict", serde(deny_unknown_fields))]
16pub struct Pagination {
17    /// Current page number (1-based)
18    pub page: u32,
19    /// Number of items per page
20    pub per_page: u32,
21    /// Total number of items across all pages
22    pub total_count: u32,
23    /// Total number of pages
24    pub total_pages: u32,
25}
26
27/// Generic paginated response wrapper
28#[derive(Debug, Clone, Serialize, Deserialize)]
29#[cfg_attr(feature = "strict", serde(deny_unknown_fields))]
30pub struct PaginatedResponse<T> {
31    /// The items in this page
32    #[serde(flatten)]
33    pub items: T,
34    /// Pagination metadata
35    pub pagination: Pagination,
36}
37
38/// Response for successful deletion operations
39#[derive(Debug, Clone, Serialize, Deserialize)]
40#[cfg_attr(feature = "strict", serde(deny_unknown_fields))]
41pub struct DeleteResponse {
42    /// Confirmation message
43    pub message: String,
44}
45
46/// Error response from the API
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[cfg_attr(feature = "strict", serde(deny_unknown_fields))]
49pub struct ErrorResponse {
50    /// Error type/code
51    pub error: String,
52    /// Optional error message
53    #[serde(default, skip_serializing_if = "Option::is_none")]
54    pub message: Option<String>,
55    /// Optional error details (can be array or object)
56    #[serde(default, skip_serializing_if = "Option::is_none")]
57    pub details: Option<serde_json::Value>,
58}