From d1ab5ff2aae2c10820040104e437ddbab121a937 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Thu, 7 Jul 2022 12:07:37 +0200 Subject: [PATCH 1/9] improvement: added webhooks registration docs --- models/enums/EventType.yaml | 63 ++++++++++++++ .../requests/ModifyIssuedDocumentRequest.yaml | 2 +- .../RegisterWebhooksChannelRequest.yaml | 12 +++ .../ListWebhooksChannelsResponse.yaml | 12 +++ .../RegisterWebhooksChannelResponse.yaml | 12 +++ .../schemas/WebhooksChannelRegistration.yaml | 9 ++ openapi.yaml | 87 +++++++++++++++++++ 7 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 models/enums/EventType.yaml create mode 100644 models/requests/RegisterWebhooksChannelRequest.yaml create mode 100644 models/responses/ListWebhooksChannelsResponse.yaml create mode 100644 models/responses/RegisterWebhooksChannelResponse.yaml create mode 100644 models/schemas/WebhooksChannelRegistration.yaml diff --git a/models/enums/EventType.yaml b/models/enums/EventType.yaml new file mode 100644 index 00000000..8d73ba25 --- /dev/null +++ b/models/enums/EventType.yaml @@ -0,0 +1,63 @@ +type: string +title: EventType +description: Event type. +enum: + - issued_documents.invoices:create + - issued_documents.invoices:update + - issued_documents.invoices:delete + - issued_documents.quotes:create + - issued_documents.quotes:update + - issued_documents.quotes:delete + - issued_documents.proformas:create + - issued_documents.proformas:update + - issued_documents.proformas:create + - issued_documents.receipts:create + - issued_documents.receipts:update + - issued_documents.receipts:delete + - issued_documents.delivery_notes:create + - issued_documents.delivery_notes:update + - issued_documents.delivery_notes:delete + - issued_documents.credit_notes:create + - issued_documents.credit_notes:update + - issued_documents.credit_notes:delete + - issued_documents.orders:create + - issued_documents.orders:update + - issued_documents.orders:delete + - issued_documents.work_reports:create + - issued_documents.work_reports:update + - issued_documents.work_reports:delete + - issued_documents.supplier_orders:create + - issued_documents.supplier_orders:update + - issued_documents.supplier_orders:delete + - issued_documents.self_invoices:create + - issued_documents.self_invoices:update + - issued_documents.self_invoices:delete + - issued_documents.all:create + - issued_documents.all:update + - issued_documents.all:delete + - received_documents:create + - received_documents:update + - received_documents:delete + - receipts:create + - receipts:update + - receipts:delete + - taxes:create + - taxes:update + - taxes:delete + - cashbook:create + - cashbook:update + - cashbook:delete + - products:create + - products:update + - products:delete + - entities.clients:create + - entities.clients:update + - entities.clients:delete + - entities.suppliers:create + - entities.suppliers:update + - entities.suppliers:delete + - entities.all:create + - entities.all:update + - entities.all:delete + - issued_documents.e_invoices + - received_documents.e_invoices diff --git a/models/requests/ModifyIssuedDocumentRequest.yaml b/models/requests/ModifyIssuedDocumentRequest.yaml index 09596b0e..a5e0c830 100644 --- a/models/requests/ModifyIssuedDocumentRequest.yaml +++ b/models/requests/ModifyIssuedDocumentRequest.yaml @@ -7,4 +7,4 @@ properties: nullable: true options: $ref: ../schemas/IssuedDocumentOptions.yaml - nullable: true \ No newline at end of file + nullable: true diff --git a/models/requests/RegisterWebhooksChannelRequest.yaml b/models/requests/RegisterWebhooksChannelRequest.yaml new file mode 100644 index 00000000..48ea30cd --- /dev/null +++ b/models/requests/RegisterWebhooksChannelRequest.yaml @@ -0,0 +1,12 @@ +title: RegisterWebhooksChannelsRequest +type: object +properties: + data: + allOf: + - $ref: ../schemas/WebhooksChannelRegistration.yaml + - type: object + properties: + event_types: + type: array + items: + $ref: ../enums/EventType.yaml diff --git a/models/responses/ListWebhooksChannelsResponse.yaml b/models/responses/ListWebhooksChannelsResponse.yaml new file mode 100644 index 00000000..90d6a72f --- /dev/null +++ b/models/responses/ListWebhooksChannelsResponse.yaml @@ -0,0 +1,12 @@ +title: ListWebhooksChannelsResponse +type: object +properties: + data: + type: array + items: + allOf: + - $ref: ../schemas/WebhooksChannelRegistration.yaml + - type: object + properties: + event_type: + $ref: ../enums/EventType.yaml diff --git a/models/responses/RegisterWebhooksChannelResponse.yaml b/models/responses/RegisterWebhooksChannelResponse.yaml new file mode 100644 index 00000000..ecd7fbea --- /dev/null +++ b/models/responses/RegisterWebhooksChannelResponse.yaml @@ -0,0 +1,12 @@ +title: RegisterWebhooksChannelResponse +type: object +properties: + data: + type: array + items: + allOf: + - $ref: ../schemas/WebhooksChannelRegistration.yaml + - type: object + properties: + event_type: + $ref: ../enums/EventType.yaml diff --git a/models/schemas/WebhooksChannelRegistration.yaml b/models/schemas/WebhooksChannelRegistration.yaml new file mode 100644 index 00000000..482ebd87 --- /dev/null +++ b/models/schemas/WebhooksChannelRegistration.yaml @@ -0,0 +1,9 @@ +title: WebhooksChannelRegistration +type: object +properties: + id: + type: number + description: Unique identifier + url: + type: string + description: Webhooks callback uri. diff --git a/openapi.yaml b/openapi.yaml index c7432707..19965bc3 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2877,6 +2877,63 @@ paths: security: - OAuth2AuthenticationCodeFlow: - settings:a + /c/{company_id}/channels: + parameters: + - name: company_id + in: path + required: true + schema: + type: integer + example: '12345' + description: The ID of the company. + get: + summary: List Channels + tags: + - Webhooks + responses: + '200': + $ref: '#/components/responses/ListWebhooksChannelsResponse' + operationId: listWebhooksChannels + description: List active webhooks channels. + post: + summary: Register Webhooks Channels + responses: + '200': + $ref: '#/components/responses/RegisterWebhooksChannelsResponse' + operationId: registerWebhooksChannels + requestBody: + content: + application/json: + schema: + $ref: ./models/requests/RegisterWebhooksChannelRequest.yaml + examples: + example-1: + value: + data: + url: http://www.test.com + event_types: + - entities:create + - issued_documents:create + application/xml: + schema: + type: object + properties: {} + description: Register some webhooks channels. + tags: + - Webhooks + delete: + summary: '' + operationId: deleteWebhooksChannels + responses: + '200': + description: OK + description: Delete some webhooks channels + parameters: + - schema: + type: array + in: query + name: ids + description: The IDs of the webhooks channels to delete components: schemas: {} securitySchemes: @@ -8304,5 +8361,35 @@ components: iso: AL fiscal_iso: AL uic: '087' + RegisterWebhooksChannelsResponse: + description: Example response + content: + application/json: + schema: + $ref: ./models/responses/RegisterWebhooksChannelResponse.yaml + examples: + example-1: + value: + data: + id: 12344 + url: www.testurl.com/endpoint + expiration_time: null + event_type: issued_documents:create + ListWebhooksChannelsResponse: + description: Example response + content: + application/json: + schema: + $ref: ./models/responses/ListWebhooksChannelsResponse.yaml + examples: + example-1: + value: + data: + - id: 12345 + url: www.testurl.com/endpoint + event_type: issued_documents:create + - id: 12346 + url: www.testurl.com/endpoint + event_type: issued_documents:update security: - OAuth2AuthenticationCodeFlow: [] From a62ce0939a96ec0f5dfb03c7ee5831022d2897ba Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Tue, 25 Oct 2022 10:22:07 +0200 Subject: [PATCH 2/9] improvement: updated webhooks registration --- models/enums/EventType.yaml | 118 +++++++++--------- .../RegisterWebhooksChannelRequest.yaml | 12 -- .../RegisterWebhooksSubscriptionRequest.yaml | 5 + .../ListWebhooksChannelsResponse.yaml | 12 -- .../ListWebhooksSubscriptionsResponse.yaml | 7 ++ .../RegisterWebhooksChannelResponse.yaml | 12 -- .../RegisterWebhooksSubscriptionResponse.yaml | 5 + .../schemas/WebhooksChannelRegistration.yaml | 9 -- .../WebhooksSubscriptionRegistration.yaml | 16 +++ openapi.yaml | 66 +++++----- 10 files changed, 127 insertions(+), 135 deletions(-) delete mode 100644 models/requests/RegisterWebhooksChannelRequest.yaml create mode 100644 models/requests/RegisterWebhooksSubscriptionRequest.yaml delete mode 100644 models/responses/ListWebhooksChannelsResponse.yaml create mode 100644 models/responses/ListWebhooksSubscriptionsResponse.yaml delete mode 100644 models/responses/RegisterWebhooksChannelResponse.yaml create mode 100644 models/responses/RegisterWebhooksSubscriptionResponse.yaml delete mode 100644 models/schemas/WebhooksChannelRegistration.yaml create mode 100644 models/schemas/WebhooksSubscriptionRegistration.yaml diff --git a/models/enums/EventType.yaml b/models/enums/EventType.yaml index 8d73ba25..71fbf6f3 100644 --- a/models/enums/EventType.yaml +++ b/models/enums/EventType.yaml @@ -2,62 +2,62 @@ type: string title: EventType description: Event type. enum: - - issued_documents.invoices:create - - issued_documents.invoices:update - - issued_documents.invoices:delete - - issued_documents.quotes:create - - issued_documents.quotes:update - - issued_documents.quotes:delete - - issued_documents.proformas:create - - issued_documents.proformas:update - - issued_documents.proformas:create - - issued_documents.receipts:create - - issued_documents.receipts:update - - issued_documents.receipts:delete - - issued_documents.delivery_notes:create - - issued_documents.delivery_notes:update - - issued_documents.delivery_notes:delete - - issued_documents.credit_notes:create - - issued_documents.credit_notes:update - - issued_documents.credit_notes:delete - - issued_documents.orders:create - - issued_documents.orders:update - - issued_documents.orders:delete - - issued_documents.work_reports:create - - issued_documents.work_reports:update - - issued_documents.work_reports:delete - - issued_documents.supplier_orders:create - - issued_documents.supplier_orders:update - - issued_documents.supplier_orders:delete - - issued_documents.self_invoices:create - - issued_documents.self_invoices:update - - issued_documents.self_invoices:delete - - issued_documents.all:create - - issued_documents.all:update - - issued_documents.all:delete - - received_documents:create - - received_documents:update - - received_documents:delete - - receipts:create - - receipts:update - - receipts:delete - - taxes:create - - taxes:update - - taxes:delete - - cashbook:create - - cashbook:update - - cashbook:delete - - products:create - - products:update - - products:delete - - entities.clients:create - - entities.clients:update - - entities.clients:delete - - entities.suppliers:create - - entities.suppliers:update - - entities.suppliers:delete - - entities.all:create - - entities.all:update - - entities.all:delete - - issued_documents.e_invoices - - received_documents.e_invoices + - it.fattureincloud.issued_documents.invoices.create + - it.fattureincloud.issued_documents.invoices.update + - it.fattureincloud.issued_documents.invoices.delete + - it.fattureincloud.issued_documents.quotes.create + - it.fattureincloud.issued_documents.quotes.update + - it.fattureincloud.issued_documents.quotes.delete + - it.fattureincloud.issued_documents.proformas.create + - it.fattureincloud.issued_documents.proformas.update + - it.fattureincloud.issued_documents.proformas.create + - it.fattureincloud.issued_documents.receipts.create + - it.fattureincloud.issued_documents.receipts.update + - it.fattureincloud.issued_documents.receipts.delete + - it.fattureincloud.issued_documents.delivery_notes.create + - it.fattureincloud.issued_documents.delivery_notes.update + - it.fattureincloud.issued_documents.delivery_notes.delete + - it.fattureincloud.issued_documents.credit_notes.create + - it.fattureincloud.issued_documents.credit_notes.update + - it.fattureincloud.issued_documents.credit_notes.delete + - it.fattureincloud.issued_documents.orders.create + - it.fattureincloud.issued_documents.orders.update + - it.fattureincloud.issued_documents.orders.delete + - it.fattureincloud.issued_documents.work_reports.create + - it.fattureincloud.issued_documents.work_reports.update + - it.fattureincloud.issued_documents.work_reports.delete + - it.fattureincloud.issued_documents.supplier_orders.create + - it.fattureincloud.issued_documents.supplier_orders.update + - it.fattureincloud.issued_documents.supplier_orders.delete + - it.fattureincloud.issued_documents.self_invoices.create + - it.fattureincloud.issued_documents.self_invoices.update + - it.fattureincloud.issued_documents.self_invoices.delete + - it.fattureincloud.issued_documents.all.create + - it.fattureincloud.issued_documents.all.update + - it.fattureincloud.issued_documents.all.delete + - it.fattureincloud.received_documents.create + - it.fattureincloud.received_documents.update + - it.fattureincloud.received_documents.delete + - it.fattureincloud.receipts.create + - it.fattureincloud.receipts.update + - it.fattureincloud.receipts.delete + - it.fattureincloud.taxes.create + - it.fattureincloud.taxes.update + - it.fattureincloud.taxes.delete + - it.fattureincloud.cashbook.create + - it.fattureincloud.cashbook.update + - it.fattureincloud.cashbook.delete + - it.fattureincloud.products.create + - it.fattureincloud.products.update + - it.fattureincloud.products.delete + - it.fattureincloud.entities.clients.create + - it.fattureincloud.entities.clients.update + - it.fattureincloud.entities.clients.delete + - it.fattureincloud.entities.suppliers.create + - it.fattureincloud.entities.suppliers.update + - it.fattureincloud.entities.suppliers.delete + - it.fattureincloud.entities.all.create + - it.fattureincloud.entities.all.update + - it.fattureincloud.entities.all.delete + - it.fattureincloud.issued_documents.e_invoices + - it.fattureincloud.received_documents.e_invoices diff --git a/models/requests/RegisterWebhooksChannelRequest.yaml b/models/requests/RegisterWebhooksChannelRequest.yaml deleted file mode 100644 index 48ea30cd..00000000 --- a/models/requests/RegisterWebhooksChannelRequest.yaml +++ /dev/null @@ -1,12 +0,0 @@ -title: RegisterWebhooksChannelsRequest -type: object -properties: - data: - allOf: - - $ref: ../schemas/WebhooksChannelRegistration.yaml - - type: object - properties: - event_types: - type: array - items: - $ref: ../enums/EventType.yaml diff --git a/models/requests/RegisterWebhooksSubscriptionRequest.yaml b/models/requests/RegisterWebhooksSubscriptionRequest.yaml new file mode 100644 index 00000000..d45629b2 --- /dev/null +++ b/models/requests/RegisterWebhooksSubscriptionRequest.yaml @@ -0,0 +1,5 @@ +title: RegisterWebhooksSubscriptionsRequest +type: object +properties: + data: + $ref: ../schemas/WebhooksSubscriptionRegistration.yaml diff --git a/models/responses/ListWebhooksChannelsResponse.yaml b/models/responses/ListWebhooksChannelsResponse.yaml deleted file mode 100644 index 90d6a72f..00000000 --- a/models/responses/ListWebhooksChannelsResponse.yaml +++ /dev/null @@ -1,12 +0,0 @@ -title: ListWebhooksChannelsResponse -type: object -properties: - data: - type: array - items: - allOf: - - $ref: ../schemas/WebhooksChannelRegistration.yaml - - type: object - properties: - event_type: - $ref: ../enums/EventType.yaml diff --git a/models/responses/ListWebhooksSubscriptionsResponse.yaml b/models/responses/ListWebhooksSubscriptionsResponse.yaml new file mode 100644 index 00000000..e67c3dbc --- /dev/null +++ b/models/responses/ListWebhooksSubscriptionsResponse.yaml @@ -0,0 +1,7 @@ +title: ListWebhooksSubscriptionsResponse +type: object +properties: + data: + type: array + items: + $ref: ../schemas/WebhooksSubscriptionRegistration.yaml diff --git a/models/responses/RegisterWebhooksChannelResponse.yaml b/models/responses/RegisterWebhooksChannelResponse.yaml deleted file mode 100644 index ecd7fbea..00000000 --- a/models/responses/RegisterWebhooksChannelResponse.yaml +++ /dev/null @@ -1,12 +0,0 @@ -title: RegisterWebhooksChannelResponse -type: object -properties: - data: - type: array - items: - allOf: - - $ref: ../schemas/WebhooksChannelRegistration.yaml - - type: object - properties: - event_type: - $ref: ../enums/EventType.yaml diff --git a/models/responses/RegisterWebhooksSubscriptionResponse.yaml b/models/responses/RegisterWebhooksSubscriptionResponse.yaml new file mode 100644 index 00000000..4f634007 --- /dev/null +++ b/models/responses/RegisterWebhooksSubscriptionResponse.yaml @@ -0,0 +1,5 @@ +title: RegisterWebhooksSubscriptionResponse +type: object +properties: + data: + $ref: ../schemas/WebhooksSubscriptionRegistration.yaml diff --git a/models/schemas/WebhooksChannelRegistration.yaml b/models/schemas/WebhooksChannelRegistration.yaml deleted file mode 100644 index 482ebd87..00000000 --- a/models/schemas/WebhooksChannelRegistration.yaml +++ /dev/null @@ -1,9 +0,0 @@ -title: WebhooksChannelRegistration -type: object -properties: - id: - type: number - description: Unique identifier - url: - type: string - description: Webhooks callback uri. diff --git a/models/schemas/WebhooksSubscriptionRegistration.yaml b/models/schemas/WebhooksSubscriptionRegistration.yaml new file mode 100644 index 00000000..4b2b2002 --- /dev/null +++ b/models/schemas/WebhooksSubscriptionRegistration.yaml @@ -0,0 +1,16 @@ +title: WebhooksSubscriptionRegistration +type: object +properties: + id: + type: string + description: Unique identifier + sink: + type: string + nullable: true + description: Webhooks callback uri. + types: + type: array + nullable: true + description: Webhooks events types. + items: + $ref: ../enums/EventType.yaml diff --git a/openapi.yaml b/openapi.yaml index 19965bc3..25272a81 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2877,7 +2877,7 @@ paths: security: - OAuth2AuthenticationCodeFlow: - settings:a - /c/{company_id}/channels: + /c/{company_id}/subscriptions: parameters: - name: company_id in: path @@ -2887,53 +2887,54 @@ paths: example: '12345' description: The ID of the company. get: - summary: List Channels + summary: List Subscriptions tags: - Webhooks responses: '200': - $ref: '#/components/responses/ListWebhooksChannelsResponse' - operationId: listWebhooksChannels - description: List active webhooks channels. + $ref: '#/components/responses/ListWebhooksSubscriptionsResponse' + operationId: listWebhooksSubscriptions + description: List active webhooks subscriptions. post: - summary: Register Webhooks Channels + summary: Register Webhooks Subscriptions responses: '200': - $ref: '#/components/responses/RegisterWebhooksChannelsResponse' - operationId: registerWebhooksChannels + $ref: '#/components/responses/RegisterWebhooksSubscriptionsResponse' + operationId: registerWebhooksSubscriptions requestBody: content: application/json: schema: - $ref: ./models/requests/RegisterWebhooksChannelRequest.yaml + $ref: ./models/requests/RegisterWebhooksSubscriptionRequest.yaml examples: example-1: value: data: - url: http://www.test.com - event_types: - - entities:create - - issued_documents:create + sink: http://www.test.com + types: + - it.fattureincloud.entities.create + - it.fattureincloud.issued_documents.create application/xml: schema: type: object properties: {} - description: Register some webhooks channels. + description: '' + description: Register some webhooks Subscriptions. tags: - Webhooks delete: summary: '' - operationId: deleteWebhooksChannels + operationId: deleteWebhooksSubscriptions responses: '200': description: OK - description: Delete some webhooks channels + description: Delete some webhooks subscriptions parameters: - schema: type: array in: query name: ids - description: The IDs of the webhooks channels to delete + description: The IDs of the webhooks subscriptions to delete components: schemas: {} securitySchemes: @@ -8361,35 +8362,38 @@ components: iso: AL fiscal_iso: AL uic: '087' - RegisterWebhooksChannelsResponse: + RegisterWebhooksSubscriptionsResponse: description: Example response content: application/json: schema: - $ref: ./models/responses/RegisterWebhooksChannelResponse.yaml + $ref: ./models/responses/RegisterWebhooksSubscriptionResponse.yaml examples: example-1: value: data: - id: 12344 - url: www.testurl.com/endpoint - expiration_time: null - event_type: issued_documents:create - ListWebhooksChannelsResponse: + sink: http://www.test.com + types: + - it.fattureincloud.entities.create + - it.fattureincloud.issued_documents.create + ListWebhooksSubscriptionsResponse: description: Example response content: application/json: schema: - $ref: ./models/responses/ListWebhooksChannelsResponse.yaml + $ref: ./models/responses/ListWebhooksSubscriptionsResponse.yaml examples: example-1: value: data: - - id: 12345 - url: www.testurl.com/endpoint - event_type: issued_documents:create - - id: 12346 - url: www.testurl.com/endpoint - event_type: issued_documents:update + - id: SUB12345 + sink: www.testurl.com/endpoint + types: + - it.fattureincloud.issued_documents.create + - it.fattureincloud.issued_documents.update + - id: SUB12346 + sink: www.testurl.com/endpoint2 + types: + - it.fattureincloud.issued_documents.delete security: - OAuth2AuthenticationCodeFlow: [] From f84edf78fd62c1fbb3d76c0bc921b80c2f20fb23 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Thu, 6 Apr 2023 09:45:57 +0200 Subject: [PATCH 3/9] ci: fixed merge --- models/schemas/ArchiveDocument.yaml | 3 +-- models/schemas/F24.yaml | 3 +-- models/schemas/IssuedDocument.yaml | 20 ++++++++----------- .../schemas/IssuedDocumentPreCreateInfo.yaml | 1 - models/schemas/ReceivedDocument.yaml | 8 +++++--- openapi.yaml | 2 ++ 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/models/schemas/ArchiveDocument.yaml b/models/schemas/ArchiveDocument.yaml index 5fa7ef9d..81a11427 100644 --- a/models/schemas/ArchiveDocument.yaml +++ b/models/schemas/ArchiveDocument.yaml @@ -17,8 +17,7 @@ properties: attachment_url: type: string description: >- - [Temporary] - [Read Only] + [Temporary] [Read Only] Absolute url of the attached file. Authomatically set if a valid attachment token is passed via POST /archive or PUT /archive/{documentId}. diff --git a/models/schemas/F24.yaml b/models/schemas/F24.yaml index e54c0ea2..992dced6 100644 --- a/models/schemas/F24.yaml +++ b/models/schemas/F24.yaml @@ -25,8 +25,7 @@ properties: attachment_url: type: string description: >- - [Temporary] - [Read Only] + [Temporary] [Read Only] Absolute url of the attached file. Authomatically set if a valid attachment token is passed via POST /taxes or PUT /taxes/{documentId}. diff --git a/models/schemas/IssuedDocument.yaml b/models/schemas/IssuedDocument.yaml index 9ab15f0b..ddd36f10 100644 --- a/models/schemas/IssuedDocument.yaml +++ b/models/schemas/IssuedDocument.yaml @@ -447,33 +447,29 @@ properties: format: date url: type: string - description: >- - [Temporary] - [Read Only] + description: |- + [Temporary] [Read Only] Public url of the document PDF file. nullable: true dn_url: type: string - description: >- - [Temporary] - [Read Only] + description: |- + [Temporary] [Read Only] Public url of the attached delivery note PDF file. nullable: true ai_url: type: string - description: >- - [Temporary] - [Read Only] + description: |- + [Temporary] [Read Only] Public url of the accompanying invoice PDF file. nullable: true attachment_url: type: string description: >- - [Temporary] - [Read Only] + [Temporary] [Read Only] Public url of the attached file. Authomatically set if a valid attachment token is passed via POST /issued_documents or PUT @@ -532,4 +528,4 @@ properties: nullable: true updated_at: type: string - nullable: true \ No newline at end of file + nullable: true diff --git a/models/schemas/IssuedDocumentPreCreateInfo.yaml b/models/schemas/IssuedDocumentPreCreateInfo.yaml index f25fcce5..aa93fcf6 100644 --- a/models/schemas/IssuedDocumentPreCreateInfo.yaml +++ b/models/schemas/IssuedDocumentPreCreateInfo.yaml @@ -130,4 +130,3 @@ properties: items: $ref: ./Language.yaml nullable: true - diff --git a/models/schemas/ReceivedDocument.yaml b/models/schemas/ReceivedDocument.yaml index e73a0946..bf264e6c 100644 --- a/models/schemas/ReceivedDocument.yaml +++ b/models/schemas/ReceivedDocument.yaml @@ -114,7 +114,7 @@ properties: description: |- [Temporary] [Read Only] - + Public url of the attached file. Authomatically set if a valid attachment token is passed via POST /received_documents or PUT /received_documents/{documentId}. @@ -125,13 +125,15 @@ properties: description: |- [Temporary] [Read Only] - + Attachment preview url. readOnly: true nullable: true auto_calculate: type: boolean - description: If set to false total items amount and total payments amount can be different. + description: >- + If set to false total items amount and total payments amount can be + different. nullable: true attachment_token: type: string diff --git a/openapi.yaml b/openapi.yaml index 9df72814..35036a09 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2971,6 +2971,8 @@ paths: in: query name: e_invoice description: New document e_invoice. + parameters: + - $ref: '#/components/parameters/company_id' /c/{company_id}/emails: parameters: - $ref: '#/components/parameters/company_id' From 1cab7c2ad3135271bba287e07dca5ff9256d3882 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Thu, 6 Apr 2023 12:41:02 +0200 Subject: [PATCH 4/9] models: updated webhoks subscriptions models --- .../CreateWebhooksSubscriptionRequest.yaml | 5 + .../ModifyWebhooksSubscriptionRequest.yaml | 5 + .../RegisterWebhooksSubscriptionRequest.yaml | 5 - .../CreateWebhooksSubscriptionResponse.yaml | 10 ++ .../GetWebhooksSubscriptionResponse.yaml | 5 + .../ListWebhooksSubscriptionsResponse.yaml | 2 +- .../ModifyWebhooksSubscriptionResponse.yaml | 10 ++ .../RegisterWebhooksSubscriptionResponse.yaml | 5 - ...tration.yaml => WebhooksSubscription.yaml} | 2 +- openapi.yaml | 100 ++++++++++++++---- 10 files changed, 117 insertions(+), 32 deletions(-) create mode 100644 models/requests/CreateWebhooksSubscriptionRequest.yaml create mode 100644 models/requests/ModifyWebhooksSubscriptionRequest.yaml delete mode 100644 models/requests/RegisterWebhooksSubscriptionRequest.yaml create mode 100644 models/responses/CreateWebhooksSubscriptionResponse.yaml create mode 100644 models/responses/GetWebhooksSubscriptionResponse.yaml create mode 100644 models/responses/ModifyWebhooksSubscriptionResponse.yaml delete mode 100644 models/responses/RegisterWebhooksSubscriptionResponse.yaml rename models/schemas/{WebhooksSubscriptionRegistration.yaml => WebhooksSubscription.yaml} (88%) diff --git a/models/requests/CreateWebhooksSubscriptionRequest.yaml b/models/requests/CreateWebhooksSubscriptionRequest.yaml new file mode 100644 index 00000000..aaf6b648 --- /dev/null +++ b/models/requests/CreateWebhooksSubscriptionRequest.yaml @@ -0,0 +1,5 @@ +title: CreateWebhooksSubscriptionRequest +type: object +properties: + data: + $ref: ../schemas/WebhooksSubscription.yaml diff --git a/models/requests/ModifyWebhooksSubscriptionRequest.yaml b/models/requests/ModifyWebhooksSubscriptionRequest.yaml new file mode 100644 index 00000000..c455e7df --- /dev/null +++ b/models/requests/ModifyWebhooksSubscriptionRequest.yaml @@ -0,0 +1,5 @@ +title: ModifyWebhooksSubscriptionRequest +type: object +properties: + data: + $ref: ../schemas/WebhooksSubscription.yaml diff --git a/models/requests/RegisterWebhooksSubscriptionRequest.yaml b/models/requests/RegisterWebhooksSubscriptionRequest.yaml deleted file mode 100644 index d45629b2..00000000 --- a/models/requests/RegisterWebhooksSubscriptionRequest.yaml +++ /dev/null @@ -1,5 +0,0 @@ -title: RegisterWebhooksSubscriptionsRequest -type: object -properties: - data: - $ref: ../schemas/WebhooksSubscriptionRegistration.yaml diff --git a/models/responses/CreateWebhooksSubscriptionResponse.yaml b/models/responses/CreateWebhooksSubscriptionResponse.yaml new file mode 100644 index 00000000..929175a4 --- /dev/null +++ b/models/responses/CreateWebhooksSubscriptionResponse.yaml @@ -0,0 +1,10 @@ +type: object +properties: + data: + $ref: ../schemas/WebhooksSubscription.yaml + warnings: + type: array + nullable: true + description: Webhooks registration warnings + items: + type: string diff --git a/models/responses/GetWebhooksSubscriptionResponse.yaml b/models/responses/GetWebhooksSubscriptionResponse.yaml new file mode 100644 index 00000000..c05b6990 --- /dev/null +++ b/models/responses/GetWebhooksSubscriptionResponse.yaml @@ -0,0 +1,5 @@ +title: GetWebhooksSubscriptionResponse +type: object +properties: + data: + $ref: ../schemas/WebhooksSubscription.yaml diff --git a/models/responses/ListWebhooksSubscriptionsResponse.yaml b/models/responses/ListWebhooksSubscriptionsResponse.yaml index e67c3dbc..f4e26554 100644 --- a/models/responses/ListWebhooksSubscriptionsResponse.yaml +++ b/models/responses/ListWebhooksSubscriptionsResponse.yaml @@ -4,4 +4,4 @@ properties: data: type: array items: - $ref: ../schemas/WebhooksSubscriptionRegistration.yaml + $ref: ../schemas/WebhooksSubscription.yaml diff --git a/models/responses/ModifyWebhooksSubscriptionResponse.yaml b/models/responses/ModifyWebhooksSubscriptionResponse.yaml new file mode 100644 index 00000000..929175a4 --- /dev/null +++ b/models/responses/ModifyWebhooksSubscriptionResponse.yaml @@ -0,0 +1,10 @@ +type: object +properties: + data: + $ref: ../schemas/WebhooksSubscription.yaml + warnings: + type: array + nullable: true + description: Webhooks registration warnings + items: + type: string diff --git a/models/responses/RegisterWebhooksSubscriptionResponse.yaml b/models/responses/RegisterWebhooksSubscriptionResponse.yaml deleted file mode 100644 index 4f634007..00000000 --- a/models/responses/RegisterWebhooksSubscriptionResponse.yaml +++ /dev/null @@ -1,5 +0,0 @@ -title: RegisterWebhooksSubscriptionResponse -type: object -properties: - data: - $ref: ../schemas/WebhooksSubscriptionRegistration.yaml diff --git a/models/schemas/WebhooksSubscriptionRegistration.yaml b/models/schemas/WebhooksSubscription.yaml similarity index 88% rename from models/schemas/WebhooksSubscriptionRegistration.yaml rename to models/schemas/WebhooksSubscription.yaml index 4b2b2002..9db956ca 100644 --- a/models/schemas/WebhooksSubscriptionRegistration.yaml +++ b/models/schemas/WebhooksSubscription.yaml @@ -1,4 +1,4 @@ -title: WebhooksSubscriptionRegistration +title: WebhooksSubscription type: object properties: id: diff --git a/openapi.yaml b/openapi.yaml index 35036a09..27b94682 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2989,7 +2989,7 @@ paths: - OAuth2AuthenticationCodeFlow: [] /c/{company_id}/subscriptions: get: - summary: List Subscriptions + summary: List Webhooks Subscriptions tags: - Webhooks responses: @@ -2998,16 +2998,16 @@ paths: operationId: listWebhooksSubscriptions description: List active webhooks subscriptions. post: - summary: Register Webhooks Subscriptions + summary: Create a Webhook Subscription responses: '200': - $ref: '#/components/responses/RegisterWebhooksSubscriptionsResponse' - operationId: registerWebhooksSubscriptions + $ref: '#/components/responses/CreateWebhooksSubscriptionResponse' + operationId: CreateWebhooksSubscription requestBody: content: application/json: schema: - $ref: ./models/requests/RegisterWebhooksSubscriptionRequest.yaml + $ref: ./models/requests/CreateWebhooksSubscriptionRequest.yaml examples: example-1: value: @@ -3016,27 +3016,46 @@ paths: types: - it.fattureincloud.entities.create - it.fattureincloud.issued_documents.create - application/xml: - schema: - type: object - properties: {} description: '' description: Register some webhooks Subscriptions. tags: - Webhooks + /c/{company_id}/subscriptions/{subscription_id}: + parameters: + - $ref: '#/components/parameters/company_id' + - $ref: '#/components/parameters/subscription_id' + get: + summary: Get Webhooks Subscription + tags: + - Webhooks + responses: + '200': + $ref: '#/components/responses/GetWebhooksSubscriptionResponse' + operationId: getWebhooksSubscription + description: Get a webhooks subscription. + put: + summary: Modify Webhooks Subscription + tags: + - Webhooks + responses: + '200': + $ref: '#/components/responses/ModifyWebhooksSubscriptionResponse' + operationId: modifyWebhooksSubscription + description: Edit a webhooks subscription. + requestBody: + content: + application/json: + schema: + $ref: ./models/requests/ModifyWebhooksSubscriptionRequest.yaml delete: - summary: '' - operationId: deleteWebhooksSubscriptions + summary: Delete Webhooks Subscription + tags: + - Webhooks responses: '200': description: OK - description: Delete some webhooks subscriptions - parameters: - - schema: - type: array - in: query - name: ids - description: The IDs of the webhooks subscriptions to delete + operationId: deleteWebhooksSubscription + description: Delete a webhooks subscription. components: schemas: {} securitySchemes: @@ -3213,6 +3232,13 @@ components: schema: type: boolean description: Include the attachment to the XML e-invoice. + subscription_id: + name: subscription_id + in: path + required: true + schema: + type: integer + description: The ID of the subscription. responses: GetUserInfoResponse: description: '' @@ -8773,12 +8799,12 @@ components: prev_page_url: null to: 2 total: 2 - RegisterWebhooksSubscriptionsResponse: + CreateWebhooksSubscriptionResponse: description: Example response content: application/json: schema: - $ref: ./models/responses/RegisterWebhooksSubscriptionResponse.yaml + $ref: ./models/responses/CreateWebhooksSubscriptionResponse.yaml examples: example-1: value: @@ -8787,6 +8813,9 @@ components: types: - it.fattureincloud.entities.create - it.fattureincloud.issued_documents.create + warnings: >- + The 'it.fattureincloud.entities.clients.delete' event is + already registered for this application ListWebhooksSubscriptionsResponse: description: Example response content: @@ -8806,5 +8835,36 @@ components: sink: www.testurl.com/endpoint2 types: - it.fattureincloud.issued_documents.delete + GetWebhooksSubscriptionResponse: + description: Example response + content: + application/json: + schema: + $ref: ./models/responses/GetWebhooksSubscriptionResponse.yaml + examples: + Example 1: + value: + data: + id: SUB12345 + sink: http://www.test.com + types: + - it.fattureincloud.issued_documents.invoices.create + ModifyWebhooksSubscriptionResponse: + description: Example response + content: + application/json: + schema: + $ref: ./models/responses/ModifyWebhooksSubscriptionResponse.yaml + examples: + Example 1: + value: + data: + sink: http://www.test.com + types: + - it.fattureincloud.entities.create + - it.fattureincloud.issued_documents.create + warnings: >- + The 'it.fattureincloud.entities.clients.delete' event is + already registered for this application security: - OAuth2AuthenticationCodeFlow: [] From b6c250615fd87a5e6a95873a311066432f7ca9c7 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Thu, 6 Apr 2023 12:48:29 +0200 Subject: [PATCH 5/9] improvements: webhooks examples improvements --- models/responses/CreateWebhooksSubscriptionResponse.yaml | 1 + models/responses/ModifyWebhooksSubscriptionResponse.yaml | 1 + openapi.yaml | 9 +++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/models/responses/CreateWebhooksSubscriptionResponse.yaml b/models/responses/CreateWebhooksSubscriptionResponse.yaml index 929175a4..6841bc11 100644 --- a/models/responses/CreateWebhooksSubscriptionResponse.yaml +++ b/models/responses/CreateWebhooksSubscriptionResponse.yaml @@ -1,3 +1,4 @@ +title: CreateWebhooksSubscriptionResponse type: object properties: data: diff --git a/models/responses/ModifyWebhooksSubscriptionResponse.yaml b/models/responses/ModifyWebhooksSubscriptionResponse.yaml index 929175a4..10d76e13 100644 --- a/models/responses/ModifyWebhooksSubscriptionResponse.yaml +++ b/models/responses/ModifyWebhooksSubscriptionResponse.yaml @@ -1,3 +1,4 @@ +title: CreateWebhooksSubscriptionRequest type: object properties: data: diff --git a/openapi.yaml b/openapi.yaml index 27b94682..4d3b94fa 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -8827,12 +8827,12 @@ components: value: data: - id: SUB12345 - sink: www.testurl.com/endpoint + sink: https://www.testurl.com/endpoint types: - it.fattureincloud.issued_documents.create - it.fattureincloud.issued_documents.update - id: SUB12346 - sink: www.testurl.com/endpoint2 + sink: https://www.testurl.com/endpoint2 types: - it.fattureincloud.issued_documents.delete GetWebhooksSubscriptionResponse: @@ -8845,8 +8845,8 @@ components: Example 1: value: data: - id: SUB12345 - sink: http://www.test.com + id: SUB123 + sink: https://test.url types: - it.fattureincloud.issued_documents.invoices.create ModifyWebhooksSubscriptionResponse: @@ -8859,6 +8859,7 @@ components: Example 1: value: data: + id: SUB12345 sink: http://www.test.com types: - it.fattureincloud.entities.create From 2902b5345f1c5dd41e66c72ab1142053b5ee6672 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Thu, 6 Apr 2023 14:35:23 +0200 Subject: [PATCH 6/9] fix: fixed webhooks endpoint path params --- openapi.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openapi.yaml b/openapi.yaml index 4d3b94fa..cbbf93b5 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -3020,6 +3020,8 @@ paths: description: Register some webhooks Subscriptions. tags: - Webhooks + parameters: + - $ref: '#/components/parameters/company_id' /c/{company_id}/subscriptions/{subscription_id}: parameters: - $ref: '#/components/parameters/company_id' From 91e47fabb14925580edc16e772697e8e40527dba Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Tue, 18 Apr 2023 09:33:31 +0200 Subject: [PATCH 7/9] model: added verified field to webhooks sub --- models/schemas/WebhooksSubscription.yaml | 4 ++++ openapi.yaml | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/models/schemas/WebhooksSubscription.yaml b/models/schemas/WebhooksSubscription.yaml index 9db956ca..848eaed6 100644 --- a/models/schemas/WebhooksSubscription.yaml +++ b/models/schemas/WebhooksSubscription.yaml @@ -8,6 +8,10 @@ properties: type: string nullable: true description: Webhooks callback uri. + verified: + type: boolean + nullable: true + description: '[Read Only] True if the webhooks subscription has been verified.' types: type: array nullable: true diff --git a/openapi.yaml b/openapi.yaml index cbbf93b5..6a9819b2 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -8811,7 +8811,9 @@ components: example-1: value: data: + id: SUB123 sink: http://www.test.com + verified: true types: - it.fattureincloud.entities.create - it.fattureincloud.issued_documents.create @@ -8830,11 +8832,13 @@ components: data: - id: SUB12345 sink: https://www.testurl.com/endpoint + verified: true types: - it.fattureincloud.issued_documents.create - it.fattureincloud.issued_documents.update - id: SUB12346 sink: https://www.testurl.com/endpoint2 + verified: true types: - it.fattureincloud.issued_documents.delete GetWebhooksSubscriptionResponse: @@ -8849,6 +8853,7 @@ components: data: id: SUB123 sink: https://test.url + verified: true types: - it.fattureincloud.issued_documents.invoices.create ModifyWebhooksSubscriptionResponse: @@ -8863,6 +8868,7 @@ components: data: id: SUB12345 sink: http://www.test.com + verified: true types: - it.fattureincloud.entities.create - it.fattureincloud.issued_documents.create From 543c86745ad0220f9a427241a805b4010aa3e13e Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Tue, 18 Apr 2023 10:27:11 +0200 Subject: [PATCH 8/9] model: webhooks subscription id nullable --- models/schemas/WebhooksSubscription.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/models/schemas/WebhooksSubscription.yaml b/models/schemas/WebhooksSubscription.yaml index 848eaed6..a50f3423 100644 --- a/models/schemas/WebhooksSubscription.yaml +++ b/models/schemas/WebhooksSubscription.yaml @@ -3,6 +3,7 @@ type: object properties: id: type: string + nullable: true description: Unique identifier sink: type: string From f1a628baf381a4a45e84a471bf3bb3ad453fe859 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Tue, 18 Apr 2023 10:27:58 +0200 Subject: [PATCH 9/9] fix: subscription id type changed to string --- openapi.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openapi.yaml b/openapi.yaml index 6a9819b2..a2437e81 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -3239,7 +3239,8 @@ components: in: path required: true schema: - type: integer + type: string + example: SUB123 description: The ID of the subscription. responses: GetUserInfoResponse: