square_api_client/models/
delete_invoice_parameters.rs

1//! Query parameters for the Delete Invoice API
2
3/// This is a model struct for DeleteInvoiceParameters (query parameters)
4#[derive(Clone, Debug, Default)]
5pub struct DeleteInvoiceParameters {
6    /// The version of the [Invoice] to delete. If you do not know the version, you can call
7    /// [GetInvoice](https://developer.squareup.com/reference/square/invoices-api/get-invoice) or
8    /// [ListInvoices](https://developer.squareup.com/reference/square/invoices-api/list-invoices).
9    pub version: Option<i32>,
10}
11
12impl DeleteInvoiceParameters {
13    pub fn to_query_string(&self) -> String {
14        self.to_string()
15    }
16}
17
18impl From<DeleteInvoiceParameters> for String {
19    fn from(delete_invoice_parameters: DeleteInvoiceParameters) -> Self {
20        delete_invoice_parameters.to_string()
21    }
22}
23
24impl ToString for DeleteInvoiceParameters {
25    fn to_string(&self) -> String {
26        let mut params = Vec::new();
27
28        if let Some(version) = &self.version {
29            params.push(format!("version={}", version));
30        }
31
32        if params.is_empty() {
33            String::new()
34        } else {
35            format!("?{}", params.join("&"))
36        }
37    }
38}