diff --git a/openapi/api-docs.yaml b/openapi/api-docs.yaml index 1d55bf79a1..7120ce92d9 100644 --- a/openapi/api-docs.yaml +++ b/openapi/api-docs.yaml @@ -9618,8 +9618,26 @@ paths: - Recurring Invoices summary: "List recurring invoices" description: | - Lists invoices with the option to chain multiple query parameters allowing fine grained filtering of the list. + ## GET /api/v1/recurring_invoices + Lists invoices with the option to chain multiple query parameters allowing fine grained filtering of the list. + x-codeSamples: + - lang: php + label: php + source: | + $ninja = new InvoiceNinja("your_token"); + $invoices = $ninja->recurring_invoices->all([ + 'per_page' => 10, + 'page' => 1, + 'sort' => 'number|asc' + ]); + - lang: curl + label: curl + source: | + curl --request GET \ + --url 'https://invoicing.co/api/v1/recurring_invoices?per_page=10&page=1&sort=number&sort_dir=asc' \ + --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \ + --header 'Accept: application/json' operationId: getRecurringInvoices parameters: - $ref: "#/components/parameters/X-API-TOKEN" @@ -9662,6 +9680,38 @@ paths: schema: type: string example: id|desc number|desc balance|asc + - name: number + in: query + description: | + Filters the list by number. + required: false + schema: + type: string + example: ?number=123 + - name: product_key + in: query + description: | + Filters the list by product_key. + required: false + schema: + type: string + example: ?product_key=123 + - name: next_send_between + in: query + description: | + Filters the list by next_send_between. + required: false + schema: + type: string + example: ?next_send_between=2025-01-01|2025-01-31 + - name: frequency_id + in: query + description: | + Filters the list by frequency_id. + required: false + schema: + type: string + example: ?frequency_id=1,2,3 responses: 200: description: "A list of recurring_invoices" @@ -9700,12 +9750,98 @@ paths: tags: - Recurring Invoices summary: "Create recurring invoice" - description: "Adds a Recurring Invoice to the system" + description: | + ## POST /api/v1/recurring_invoices + + Adds a Recurring Invoice to the system operationId: storeRecurringInvoice parameters: - $ref: "#/components/parameters/X-API-TOKEN" - $ref: "#/components/parameters/X-Requested-With" - $ref: "#/components/parameters/include" + x-codeSamples: + - lang: php + label: php + source: | + $ninja = new InvoiceNinja("your_token"); + $invoices = $ninja->recurring_invoices->create([ + 'client_id' => 'AxP7K9nY5z', + 'date' => '2022-01-01', + 'due_date' => '2022-01-31', + 'private_notes' => 'super secret', + 'public_notes' => 'public notes', + 'custom_value1' => 'custom value 1', + 'custom_value2' => 'custom value 2', + 'line_items' => [ + [ + 'quantity' => 1, + 'cost' => 14, + 'product_key' => 'sku_4_u', + 'notes' => 'The actual product description', + 'discount' => 0, + 'is_amount_discount' => true, + 'tax_name1' => '', + 'tax_rate1' => 0, + 'tax_name2' => '', + 'tax_rate2' => 0, + 'tax_name3' => '', + 'tax_rate3' => 0, + 'sort_id' => '0', + 'custom_value1' => 'https://picsum.photos/200', + 'custom_value2' => '94', + 'custom_value3' => 'Alias vel eveniet.', + 'custom_value4' => 'Iusto aut quis qui.', + 'type_id' => '1', + 'tax_id' => '1' + ] + ] + ]); + - lang: curl + label: curl + source: | + curl --request POST \ + --url 'https://invoicing.co/api/v1/recurring_invoices' \ + --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \ + --header 'Accept: application/json' \ + --header 'Content-Type: application/json' \ + --data '{ + "client_id": "AxP7K9nY5z", + "date": "2022-01-01", + "due_date": "2022-01-31", + "private_notes": "super secret", + "public_notes": "public notes", + "custom_value1": "custom value 1", + "custom_value2": "custom value 2", + "line_items": [ + { + "quantity": 1, + "cost": 14, + "product_key": "sku_4_u", + "notes": "The actual product description", + "discount": 0, + "is_amount_discount": true, + "tax_name1": "", + "tax_rate1": 0, + "tax_name2": "", + "tax_rate2": 0, + "tax_name3": "", + "tax_rate3": 0, + "sort_id": "0", + "custom_value1": "https://picsum.photos/200", + "custom_value2": "94", + "custom_value3": "Alias vel eveniet.", + "custom_value4": "Iusto aut quis qui.", + "type_id": "1", + "tax_id": "1" + } + ] + }' + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/RecurringInvoiceRequest" responses: 200: description: "Returns the saved RecurringInvoice object" @@ -11373,6 +11509,8 @@ paths: 'client_id' => 'AxP7K9nY5z', 'date' => '2022-01-01', 'due_date' => '2022-01-31', + 'frequency_id' => '1', + 'remaining_cycles' => '5', 'private_notes' => 'super secret', 'public_notes' => 'public notes', 'custom_value1' => 'custom value 1', @@ -11417,6 +11555,8 @@ paths: "public_notes": "public notes", "custom_value1": "custom value 1", "custom_value2": "custom value 2", + "frequency_id": "1", + "remaining_cycles": "5", "line_items": [ { "quantity": 1, @@ -22311,6 +22451,174 @@ components: type: string example: AS3df3A type: object + RecurringInvoiceRequest: + properties: + user_id: + description: 'The user hashed id' + type: string + example: Opnel5aKBz + assigned_user_id: + description: 'The assigned user hashed id' + type: string + example: Opnel5aKBz + client_id: + description: 'The client hashed id' + type: string + example: Opnel5aKBz + frequency_id: + description: 'The recurring invoice frequency' + type: number + example: '4' + remaining_cycles: + description: 'The number of invoices left to be generated' + type: number + example: '4' + number: + description: 'The recurringinvoice number - is a unique alpha numeric number per invoice per company' + type: string + example: INV_101 + po_number: + description: 'The purchase order associated with this recurring invoice' + type: string + example: PO-1234 + terms: + description: 'The invoice terms' + type: string + example: 'These are invoice terms' + public_notes: + description: 'The public notes of the invoice' + type: string + example: 'These are some public notes' + private_notes: + description: 'The private notes of the invoice' + type: string + example: 'These are some private notes' + footer: + description: 'The invoice footer notes' + type: string + example: '' + custom_value1: + description: 'A custom field value' + type: string + example: '2022-10-01' + custom_value2: + description: 'A custom field value' + type: string + example: 'Something custom' + custom_value3: + description: 'A custom field value' + type: string + example: '' + custom_value4: + description: 'A custom field value' + type: string + example: '' + tax_name1: + description: 'The tax name' + type: string + example: '' + tax_name2: + description: 'The tax name' + type: string + example: '' + tax_rate1: + description: 'The tax rate' + type: number + format: float + example: '10.00' + tax_rate2: + description: 'The tax rate' + type: number + format: float + example: '10.00' + tax_name3: + description: 'The tax name' + type: string + example: '' + tax_rate3: + description: 'The tax rate' + type: number + format: float + example: '10.00' + line_items: + description: 'An array of objects which define the line items of the invoice' + type: object + example: '' + discount: + description: 'The invoice discount, can be an amount or a percentage' + type: number + format: float + example: '10.00' + partial: + description: 'The deposit/partial amount' + type: number + format: float + example: '10.00' + is_amount_discount: + description: 'Flag determining if the discount is an amount or a percentage' + type: boolean + example: true + uses_inclusive_taxes: + description: 'Defines the type of taxes used as either inclusive or exclusive' + type: boolean + example: true + date: + description: 'The Invoice Date' + type: string + format: date + example: '1994-07-30' + partial_due_date: + description: 'The due date for the deposit/partial amount' + type: string + format: date + example: '1994-07-30' + due_date: + description: 'The due date of the invoice' + type: string + format: date + example: '1994-07-30' + custom_surcharge1: + description: 'First Custom Surcharge' + type: number + format: float + example: '10.00' + custom_surcharge2: + description: 'Second Custom Surcharge' + type: number + format: float + example: '10.00' + custom_surcharge3: + description: 'Third Custom Surcharge' + type: number + format: float + example: '10.00' + custom_surcharge4: + description: 'Fourth Custom Surcharge' + type: number + format: float + example: '10.00' + custom_surcharge_tax1: + description: 'Toggles charging taxes on custom surcharge amounts' + type: boolean + example: true + custom_surcharge_tax2: + description: 'Toggles charging taxes on custom surcharge amounts' + type: boolean + example: true + custom_surcharge_tax3: + description: 'Toggles charging taxes on custom surcharge amounts' + type: boolean + example: true + custom_surcharge_tax4: + description: 'Toggles charging taxes on custom surcharge amounts' + type: boolean + example: true + location_id: + description: 'The client location id that this invoice relates to' + type: string + example: Opnel5aKBz + type: object + Product: type: object properties: diff --git a/openapi/components/schemas/recurring_invoice_request.yaml b/openapi/components/schemas/recurring_invoice_request.yaml new file mode 100644 index 0000000000..1b7cae4422 --- /dev/null +++ b/openapi/components/schemas/recurring_invoice_request.yaml @@ -0,0 +1,168 @@ + RecurringInvoiceRequest: + properties: + user_id: + description: 'The user hashed id' + type: string + example: Opnel5aKBz + assigned_user_id: + description: 'The assigned user hashed id' + type: string + example: Opnel5aKBz + client_id: + description: 'The client hashed id' + type: string + example: Opnel5aKBz + frequency_id: + description: 'The recurring invoice frequency' + type: number + example: '4' + remaining_cycles: + description: 'The number of invoices left to be generated' + type: number + example: '4' + number: + description: 'The recurringinvoice number - is a unique alpha numeric number per invoice per company' + type: string + example: INV_101 + po_number: + description: 'The purchase order associated with this recurring invoice' + type: string + example: PO-1234 + terms: + description: 'The invoice terms' + type: string + example: 'These are invoice terms' + public_notes: + description: 'The public notes of the invoice' + type: string + example: 'These are some public notes' + private_notes: + description: 'The private notes of the invoice' + type: string + example: 'These are some private notes' + footer: + description: 'The invoice footer notes' + type: string + example: '' + custom_value1: + description: 'A custom field value' + type: string + example: '2022-10-01' + custom_value2: + description: 'A custom field value' + type: string + example: 'Something custom' + custom_value3: + description: 'A custom field value' + type: string + example: '' + custom_value4: + description: 'A custom field value' + type: string + example: '' + tax_name1: + description: 'The tax name' + type: string + example: '' + tax_name2: + description: 'The tax name' + type: string + example: '' + tax_rate1: + description: 'The tax rate' + type: number + format: float + example: '10.00' + tax_rate2: + description: 'The tax rate' + type: number + format: float + example: '10.00' + tax_name3: + description: 'The tax name' + type: string + example: '' + tax_rate3: + description: 'The tax rate' + type: number + format: float + example: '10.00' + line_items: + description: 'An array of objects which define the line items of the invoice' + type: object + example: '' + discount: + description: 'The invoice discount, can be an amount or a percentage' + type: number + format: float + example: '10.00' + partial: + description: 'The deposit/partial amount' + type: number + format: float + example: '10.00' + is_amount_discount: + description: 'Flag determining if the discount is an amount or a percentage' + type: boolean + example: true + uses_inclusive_taxes: + description: 'Defines the type of taxes used as either inclusive or exclusive' + type: boolean + example: true + date: + description: 'The Invoice Date' + type: string + format: date + example: '1994-07-30' + partial_due_date: + description: 'The due date for the deposit/partial amount' + type: string + format: date + example: '1994-07-30' + due_date: + description: 'The due date of the invoice' + type: string + format: date + example: '1994-07-30' + custom_surcharge1: + description: 'First Custom Surcharge' + type: number + format: float + example: '10.00' + custom_surcharge2: + description: 'Second Custom Surcharge' + type: number + format: float + example: '10.00' + custom_surcharge3: + description: 'Third Custom Surcharge' + type: number + format: float + example: '10.00' + custom_surcharge4: + description: 'Fourth Custom Surcharge' + type: number + format: float + example: '10.00' + custom_surcharge_tax1: + description: 'Toggles charging taxes on custom surcharge amounts' + type: boolean + example: true + custom_surcharge_tax2: + description: 'Toggles charging taxes on custom surcharge amounts' + type: boolean + example: true + custom_surcharge_tax3: + description: 'Toggles charging taxes on custom surcharge amounts' + type: boolean + example: true + custom_surcharge_tax4: + description: 'Toggles charging taxes on custom surcharge amounts' + type: boolean + example: true + location_id: + description: 'The client location id that this invoice relates to' + type: string + example: Opnel5aKBz + type: object + \ No newline at end of file diff --git a/openapi/paths/invoices.yaml b/openapi/paths/invoices.yaml index 2dafb00d4e..7fc0c5373d 100644 --- a/openapi/paths/invoices.yaml +++ b/openapi/paths/invoices.yaml @@ -215,6 +215,8 @@ 'client_id' => 'AxP7K9nY5z', 'date' => '2022-01-01', 'due_date' => '2022-01-31', + 'frequency_id' => '1', + 'remaining_cycles' => '5', 'private_notes' => 'super secret', 'public_notes' => 'public notes', 'custom_value1' => 'custom value 1', @@ -259,6 +261,8 @@ "public_notes": "public notes", "custom_value1": "custom value 1", "custom_value2": "custom value 2", + "frequency_id": "1", + "remaining_cycles": "5", "line_items": [ { "quantity": 1, diff --git a/openapi/paths/recurring_invoices.yaml b/openapi/paths/recurring_invoices.yaml index 857b858d86..267e8d5282 100644 --- a/openapi/paths/recurring_invoices.yaml +++ b/openapi/paths/recurring_invoices.yaml @@ -4,8 +4,26 @@ - Recurring Invoices summary: "List recurring invoices" description: | - Lists invoices with the option to chain multiple query parameters allowing fine grained filtering of the list. + ## GET /api/v1/recurring_invoices + Lists invoices with the option to chain multiple query parameters allowing fine grained filtering of the list. + x-codeSamples: + - lang: php + label: php + source: | + $ninja = new InvoiceNinja("your_token"); + $invoices = $ninja->recurring_invoices->all([ + 'per_page' => 10, + 'page' => 1, + 'sort' => 'number|asc' + ]); + - lang: curl + label: curl + source: | + curl --request GET \ + --url 'https://invoicing.co/api/v1/recurring_invoices?per_page=10&page=1&sort=number&sort_dir=asc' \ + --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \ + --header 'Accept: application/json' operationId: getRecurringInvoices parameters: - $ref: "#/components/parameters/X-API-TOKEN" @@ -48,6 +66,38 @@ schema: type: string example: id|desc number|desc balance|asc + - name: number + in: query + description: | + Filters the list by number. + required: false + schema: + type: string + example: ?number=123 + - name: product_key + in: query + description: | + Filters the list by product_key. + required: false + schema: + type: string + example: ?product_key=123 + - name: next_send_between + in: query + description: | + Filters the list by next_send_between. + required: false + schema: + type: string + example: ?next_send_between=2025-01-01|2025-01-31 + - name: frequency_id + in: query + description: | + Filters the list by frequency_id. + required: false + schema: + type: string + example: ?frequency_id=1,2,3 responses: 200: description: "A list of recurring_invoices" @@ -86,12 +136,98 @@ tags: - Recurring Invoices summary: "Create recurring invoice" - description: "Adds a Recurring Invoice to the system" + description: | + ## POST /api/v1/recurring_invoices + + Adds a Recurring Invoice to the system operationId: storeRecurringInvoice parameters: - $ref: "#/components/parameters/X-API-TOKEN" - $ref: "#/components/parameters/X-Requested-With" - $ref: "#/components/parameters/include" + x-codeSamples: + - lang: php + label: php + source: | + $ninja = new InvoiceNinja("your_token"); + $invoices = $ninja->recurring_invoices->create([ + 'client_id' => 'AxP7K9nY5z', + 'date' => '2022-01-01', + 'due_date' => '2022-01-31', + 'private_notes' => 'super secret', + 'public_notes' => 'public notes', + 'custom_value1' => 'custom value 1', + 'custom_value2' => 'custom value 2', + 'line_items' => [ + [ + 'quantity' => 1, + 'cost' => 14, + 'product_key' => 'sku_4_u', + 'notes' => 'The actual product description', + 'discount' => 0, + 'is_amount_discount' => true, + 'tax_name1' => '', + 'tax_rate1' => 0, + 'tax_name2' => '', + 'tax_rate2' => 0, + 'tax_name3' => '', + 'tax_rate3' => 0, + 'sort_id' => '0', + 'custom_value1' => 'https://picsum.photos/200', + 'custom_value2' => '94', + 'custom_value3' => 'Alias vel eveniet.', + 'custom_value4' => 'Iusto aut quis qui.', + 'type_id' => '1', + 'tax_id' => '1' + ] + ] + ]); + - lang: curl + label: curl + source: | + curl --request POST \ + --url 'https://invoicing.co/api/v1/recurring_invoices' \ + --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \ + --header 'Accept: application/json' \ + --header 'Content-Type: application/json' \ + --data '{ + "client_id": "AxP7K9nY5z", + "date": "2022-01-01", + "due_date": "2022-01-31", + "private_notes": "super secret", + "public_notes": "public notes", + "custom_value1": "custom value 1", + "custom_value2": "custom value 2", + "line_items": [ + { + "quantity": 1, + "cost": 14, + "product_key": "sku_4_u", + "notes": "The actual product description", + "discount": 0, + "is_amount_discount": true, + "tax_name1": "", + "tax_rate1": 0, + "tax_name2": "", + "tax_rate2": 0, + "tax_name3": "", + "tax_rate3": 0, + "sort_id": "0", + "custom_value1": "https://picsum.photos/200", + "custom_value2": "94", + "custom_value3": "Alias vel eveniet.", + "custom_value4": "Iusto aut quis qui.", + "type_id": "1", + "tax_id": "1" + } + ] + }' + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/RecurringInvoiceRequest" responses: 200: description: "Returns the saved RecurringInvoice object"