From f0a43e3ba65ad112418212e4cc3d71d9436f897d Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Thu, 15 May 2025 14:01:36 +0700 Subject: [PATCH] update contact payload for developer docs --- swagger/definitions/index.yml | 9 +- .../definitions/resource/contact_inbox.yml | 27 +++ .../resource/contact_list_item.yml | 61 +++++++ swagger/definitions/resource/contact_meta.yml | 8 + .../resource/contacts_list_response.yml | 10 ++ .../application/contacts/list_create.yml | 2 +- swagger/swagger.json | 158 +++++++++++++++++- 7 files changed, 269 insertions(+), 6 deletions(-) create mode 100644 swagger/definitions/resource/contact_inbox.yml create mode 100644 swagger/definitions/resource/contact_list_item.yml create mode 100644 swagger/definitions/resource/contact_meta.yml create mode 100644 swagger/definitions/resource/contacts_list_response.yml diff --git a/swagger/definitions/index.yml b/swagger/definitions/index.yml index eaa96c9b6..e2bdfc955 100644 --- a/swagger/definitions/index.yml +++ b/swagger/definitions/index.yml @@ -173,7 +173,6 @@ contact_list: description: 'array of contacts' items: allOf: - - $ref: '#/components/schemas/generic_id' - $ref: '#/components/schemas/contact' contact_conversations: type: array @@ -210,3 +209,11 @@ conversation_meta: $ref: ./resource/conversation_meta.yml conversation_messages: $ref: ./resource/conversation_messages.yml +contact_meta: + $ref: ./resource/contact_meta.yml +contact_inbox: + $ref: ./resource/contact_inbox.yml +contact_list_item: + $ref: ./resource/contact_list_item.yml +contacts_list_response: + $ref: ./resource/contacts_list_response.yml diff --git a/swagger/definitions/resource/contact_inbox.yml b/swagger/definitions/resource/contact_inbox.yml new file mode 100644 index 000000000..34fd374f2 --- /dev/null +++ b/swagger/definitions/resource/contact_inbox.yml @@ -0,0 +1,27 @@ +type: object +properties: + source_id: + type: string + description: Source identifier for the contact inbox + inbox: + type: object + properties: + id: + type: integer + description: ID of the inbox + avatar_url: + type: string + description: URL for the inbox avatar + channel_id: + type: integer + description: ID of the channel + name: + type: string + description: Name of the inbox + channel_type: + type: string + description: Type of channel + provider: + type: string + description: Provider of the inbox + nullable: true \ No newline at end of file diff --git a/swagger/definitions/resource/contact_list_item.yml b/swagger/definitions/resource/contact_list_item.yml new file mode 100644 index 000000000..7765b2265 --- /dev/null +++ b/swagger/definitions/resource/contact_list_item.yml @@ -0,0 +1,61 @@ +type: object +properties: + additional_attributes: + type: object + description: The object containing additional attributes related to the contact + properties: + city: + type: string + description: City of the contact + country: + type: string + description: Country of the contact + country_code: + type: string + description: Country code of the contact + created_at_ip: + type: string + description: IP address when the contact was created + availability_status: + type: string + description: Availability status of the contact + enum: ["online", "offline"] + email: + type: string + description: The email address of the contact + nullable: true + id: + type: integer + description: The ID of the contact + name: + type: string + description: The name of the contact + phone_number: + type: string + description: The phone number of the contact + nullable: true + blocked: + type: boolean + description: Whether the contact is blocked + identifier: + type: string + description: The identifier of the contact + nullable: true + thumbnail: + type: string + description: The thumbnail of the contact + custom_attributes: + type: object + description: The custom attributes of the contact + last_activity_at: + type: integer + description: Timestamp of last activity + nullable: true + created_at: + type: integer + description: Timestamp when contact was created + contact_inboxes: + type: array + description: List of inboxes associated with this contact + items: + $ref: '#/components/schemas/contact_inbox' \ No newline at end of file diff --git a/swagger/definitions/resource/contact_meta.yml b/swagger/definitions/resource/contact_meta.yml new file mode 100644 index 000000000..f7139b9d2 --- /dev/null +++ b/swagger/definitions/resource/contact_meta.yml @@ -0,0 +1,8 @@ +type: object +properties: + count: + type: integer + description: Total number of contacts + current_page: + type: string + description: Current page number \ No newline at end of file diff --git a/swagger/definitions/resource/contacts_list_response.yml b/swagger/definitions/resource/contacts_list_response.yml new file mode 100644 index 000000000..75a63b5c3 --- /dev/null +++ b/swagger/definitions/resource/contacts_list_response.yml @@ -0,0 +1,10 @@ +type: object +properties: + meta: + $ref: '#/components/schemas/contact_meta' + description: Metadata about the contact list response + payload: + type: array + items: + $ref: '#/components/schemas/contact_list_item' + description: List of contacts \ No newline at end of file diff --git a/swagger/paths/application/contacts/list_create.yml b/swagger/paths/application/contacts/list_create.yml index 505fd8200..eb5754a15 100644 --- a/swagger/paths/application/contacts/list_create.yml +++ b/swagger/paths/application/contacts/list_create.yml @@ -16,7 +16,7 @@ get: content: application/json: schema: - $ref: '#/components/schemas/contact_list' + $ref: '#/components/schemas/contacts_list_response' '400': description: Bad Request Error content: diff --git a/swagger/swagger.json b/swagger/swagger.json index d7932a717..315e8c0ab 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -2560,7 +2560,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/contact_list" + "$ref": "#/components/schemas/contacts_list_response" } } } @@ -10195,9 +10195,6 @@ "description": "array of contacts", "items": { "allOf": [ - { - "$ref": "#/components/schemas/generic_id" - }, { "$ref": "#/components/schemas/contact" } @@ -10859,6 +10856,159 @@ "description": "List of messages in the conversation" } } + }, + "contact_meta": { + "type": "object", + "properties": { + "count": { + "type": "integer", + "description": "Total number of contacts" + }, + "current_page": { + "type": "string", + "description": "Current page number" + } + } + }, + "contact_inbox": { + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Source identifier for the contact inbox" + }, + "inbox": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "ID of the inbox" + }, + "avatar_url": { + "type": "string", + "description": "URL for the inbox avatar" + }, + "channel_id": { + "type": "integer", + "description": "ID of the channel" + }, + "name": { + "type": "string", + "description": "Name of the inbox" + }, + "channel_type": { + "type": "string", + "description": "Type of channel" + }, + "provider": { + "type": "string", + "description": "Provider of the inbox", + "nullable": true + } + } + } + } + }, + "contact_list_item": { + "type": "object", + "properties": { + "additional_attributes": { + "type": "object", + "description": "The object containing additional attributes related to the contact", + "properties": { + "city": { + "type": "string", + "description": "City of the contact" + }, + "country": { + "type": "string", + "description": "Country of the contact" + }, + "country_code": { + "type": "string", + "description": "Country code of the contact" + }, + "created_at_ip": { + "type": "string", + "description": "IP address when the contact was created" + } + } + }, + "availability_status": { + "type": "string", + "description": "Availability status of the contact", + "enum": [ + "online", + "offline" + ] + }, + "email": { + "type": "string", + "description": "The email address of the contact", + "nullable": true + }, + "id": { + "type": "integer", + "description": "The ID of the contact" + }, + "name": { + "type": "string", + "description": "The name of the contact" + }, + "phone_number": { + "type": "string", + "description": "The phone number of the contact", + "nullable": true + }, + "blocked": { + "type": "boolean", + "description": "Whether the contact is blocked" + }, + "identifier": { + "type": "string", + "description": "The identifier of the contact", + "nullable": true + }, + "thumbnail": { + "type": "string", + "description": "The thumbnail of the contact" + }, + "custom_attributes": { + "type": "object", + "description": "The custom attributes of the contact" + }, + "last_activity_at": { + "type": "integer", + "description": "Timestamp of last activity", + "nullable": true + }, + "created_at": { + "type": "integer", + "description": "Timestamp when contact was created" + }, + "contact_inboxes": { + "type": "array", + "description": "List of inboxes associated with this contact", + "items": { + "$ref": "#/components/schemas/contact_inbox" + } + } + } + }, + "contacts_list_response": { + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/contact_meta" + }, + "payload": { + "type": "array", + "items": { + "$ref": "#/components/schemas/contact_list_item" + }, + "description": "List of contacts" + } + } } }, "parameters": {