From 4ba8363639b329fbdbba72e86749163f99eef4f3 Mon Sep 17 00:00:00 2001 From: Raffi Sarkissian Date: Tue, 14 Jan 2025 14:56:11 -0500 Subject: [PATCH] feat(export invoices): extend GET /invoices by amount and metadata --- openapi.yaml | 24 ++++++++++++++++++++++++ src/resources/invoices.yaml | 26 +++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/openapi.yaml b/openapi.yaml index 1d426cc..814ba8b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1697,6 +1697,22 @@ paths: - $ref: '#/components/parameters/page' - $ref: '#/components/parameters/per_page' - $ref: '#/components/parameters/external_customer_id' + - name: amount_from + in: query + description: Filter invoices of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types. + required: false + explode: true + schema: + type: integer + example: 9000 + - name: amount_to + in: query + description: Filter invoices up to a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types. + required: false + explode: true + schema: + type: integer + example: 100000 - name: issuing_date_from in: query description: Filter invoices starting from a specific date. @@ -1781,6 +1797,14 @@ paths: - credit - one_off - advance_charges + - name: 'metadata[key]' + in: query + description: 'Filter invoices by metadata. Replace `key` with the actual metadata key you want to match, and provide the corresponding value. For example, `metadata[color]=blue`.' + required: false + explode: true + schema: + type: string + example: someValue responses: '200': description: Invoices diff --git a/src/resources/invoices.yaml b/src/resources/invoices.yaml index cfc2a43..9048e55 100644 --- a/src/resources/invoices.yaml +++ b/src/resources/invoices.yaml @@ -34,6 +34,22 @@ get: - $ref: '../parameters/page.yaml' - $ref: '../parameters/per_page.yaml' - $ref: '../parameters/external_customer_id.yaml' + - name: amount_from + in: query + description: Filter invoices of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types. + required: false + explode: true + schema: + type: integer + example: 9000 + - name: amount_to + in: query + description: Filter invoices up to a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types. + required: false + explode: true + schema: + type: integer + example: 100000 - name: issuing_date_from in: query description: Filter invoices starting from a specific date. @@ -118,6 +134,14 @@ get: - credit - one_off - advance_charges + - name: metadata[key] + in: query + description: Filter invoices by metadata. Replace `key` with the actual metadata key you want to match, and provide the corresponding value. For example, `metadata[color]=blue`. + required: false + explode: true + schema: + type: string + example: "someValue" responses: '200': description: Invoices @@ -126,4 +150,4 @@ get: schema: $ref: '../schemas/InvoicesPaginated.yaml' '401': - $ref: '../responses/Unauthorized.yaml' + $ref: '../responses/Unauthorized.yaml' \ No newline at end of file