Skip to main content

lago_types/responses/
invoice.rs

1use crate::models::{Invoice, PaginationMeta};
2use serde::{Deserialize, Serialize};
3
4/// Response containing a list of invoices with pagination metadata.
5///
6/// This struct represents the API response for invoice listing requests,
7/// including both the invoice data and pagination information.
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct ListInvoicesResponse {
10    pub invoices: Vec<Invoice>,
11    pub meta: PaginationMeta,
12}
13
14/// Response containing a single invoice.
15///
16/// This struct represents the API response for retrieving a specific
17/// invoice by its identifier.
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct GetInvoiceResponse {
20    pub invoice: Invoice,
21}
22
23/// Response containing a previewed invoice.
24///
25/// This struct represents the API response for the invoice preview endpoint.
26/// The response contains the same Invoice structure as other invoice endpoints.
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct InvoicePreviewResponse {
29    pub invoice: Invoice,
30}
31
32/// Response containing a created invoice.
33///
34/// This struct represents the API response for the create invoice endpoint.
35#[derive(Debug, Clone, Serialize, Deserialize)]
36pub struct CreateInvoiceResponse {
37    pub invoice: Invoice,
38}
39
40/// Response containing an updated invoice.
41///
42/// This struct represents the API response for the update invoice endpoint.
43#[derive(Debug, Clone, Serialize, Deserialize)]
44pub struct UpdateInvoiceResponse {
45    pub invoice: Invoice,
46}
47
48/// Response containing a refreshed invoice.
49///
50/// This struct represents the API response for the refresh invoice endpoint.
51#[derive(Debug, Clone, Serialize, Deserialize)]
52pub struct RefreshInvoiceResponse {
53    pub invoice: Invoice,
54}
55
56/// Response containing a downloaded invoice.
57///
58/// This struct represents the API response for the download invoice endpoint.
59/// The response includes the invoice with a file_url field containing the PDF URL.
60#[derive(Debug, Clone, Serialize, Deserialize)]
61pub struct DownloadInvoiceResponse {
62    pub invoice: Invoice,
63}
64
65/// Response for retrying an invoice finalization.
66///
67/// This struct represents the API response for the retry invoice endpoint.
68#[derive(Debug, Clone, Serialize, Deserialize)]
69pub struct RetryInvoiceResponse {
70    pub invoice: Invoice,
71}
72
73/// Response for retrying an invoice payment.
74///
75/// This struct represents the API response for the retry payment endpoint.
76/// Note: The Lago API returns an empty body (HTTP 200 with no content) for this endpoint.
77#[derive(Debug, Clone, Default, Serialize, Deserialize)]
78pub struct RetryInvoicePaymentResponse {}
79
80/// Response for voiding an invoice.
81///
82/// This struct represents the API response for the void invoice endpoint.
83#[derive(Debug, Clone, Serialize, Deserialize)]
84pub struct VoidInvoiceResponse {
85    pub invoice: Invoice,
86}