diff --git a/swagger/definitions/index.yml b/swagger/definitions/index.yml index ef9213d2a..d11ec7988 100644 --- a/swagger/definitions/index.yml +++ b/swagger/definitions/index.yml @@ -168,6 +168,8 @@ contact_conversations: - $ref: '#/definitions/conversation' - $ref: ./resource/extension/contact/conversation.yml - $ref: ./resource/extension/conversation/with_display_id.yml +contact_labels: + $ref: ./resource/extension/contact/labels.yml ## conversation conversation_list: diff --git a/swagger/definitions/resource/extension/contact/labels.yml b/swagger/definitions/resource/extension/contact/labels.yml new file mode 100644 index 000000000..2922d9b4b --- /dev/null +++ b/swagger/definitions/resource/extension/contact/labels.yml @@ -0,0 +1,7 @@ +type: object +properties: + payload: + type: array + description: Array of labels + items: + type: string diff --git a/swagger/index.yml b/swagger/index.yml index 3cf8dd708..41f78dbc4 100644 --- a/swagger/index.yml +++ b/swagger/index.yml @@ -56,6 +56,7 @@ x-tagGroups: - Agents - Canned Responses - Contacts + - Contact Labels - Conversation Assignment - Conversation Labels - Conversations @@ -77,4 +78,4 @@ x-tagGroups: - Messages API - name: Others tags: - - CSAT Survey Page \ No newline at end of file + - CSAT Survey Page diff --git a/swagger/paths/application/contacts/labels/create.yml b/swagger/paths/application/contacts/labels/create.yml new file mode 100644 index 000000000..01821d688 --- /dev/null +++ b/swagger/paths/application/contacts/labels/create.yml @@ -0,0 +1,26 @@ +tags: + - Contact Labels +operationId: contact-add-labels +summary: Add Labels +description: Add labels to a contact. Note that this API would overwrite the existing list of labels associated to the conversation. +parameters: + - name: data + in: body + required: true + schema: + type: object + properties: + labels: + type: array + description: Array of labels (comma-separated strings) + items: + type: string +responses: + 200: + description: Success + schema: + $ref: '#/definitions/contact_labels' + 404: + description: Contact not found + 401: + description: Unauthorized diff --git a/swagger/paths/application/contacts/labels/index.yml b/swagger/paths/application/contacts/labels/index.yml new file mode 100644 index 000000000..ad3c7ff81 --- /dev/null +++ b/swagger/paths/application/contacts/labels/index.yml @@ -0,0 +1,14 @@ +tags: + - Contact Labels +operationId: list-all-labels-of-a-contact +summary: List Labels +description: Lists all the labels of a contact +responses: + 200: + description: Success + schema: + $ref: '#/definitions/contact_labels' + 404: + description: Contact not found + 401: + description: Unauthorized diff --git a/swagger/paths/index.yml b/swagger/paths/index.yml index bad24b218..d58439647 100644 --- a/swagger/paths/index.yml +++ b/swagger/paths/index.yml @@ -121,6 +121,14 @@ - $ref: '#/parameters/message_id' patch: $ref: ./public/inboxes/messages/update.yml +/api/v1/accounts/{account_id}/contacts/{contact_identifier}/labels: + parameters: + - $ref: '#/parameters/account_id' + - $ref: '#/parameters/public_contact_identifier' + get: + $ref: ./application/contacts/labels/index.yml + post: + $ref: ./application/contacts/labels/create.yml # ---------------- end of public api routes-----------# diff --git a/swagger/swagger.json b/swagger/swagger.json index 9c6093fcf..e42a43efe 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -1010,6 +1010,79 @@ } } }, + "/api/v1/accounts/{account_id}/contacts/{contact_identifier}/labels": { + "parameters": [ + { + "$ref": "#/parameters/account_id" + }, + { + "$ref": "#/parameters/public_contact_identifier" + } + ], + "get": { + "tags": [ + "Contact Labels" + ], + "operationId": "list-all-labels-of-a-contact", + "summary": "List Labels", + "description": "Lists all the labels of a contact", + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/contact_labels" + } + }, + "404": { + "description": "Contact not found" + }, + "401": { + "description": "Unauthorized" + } + } + }, + "post": { + "tags": [ + "Contact Labels" + ], + "operationId": "contact-add-labels", + "summary": "Add Labels", + "description": "Add labels to a contact. Note that this API would overwrite the existing list of labels associated to the conversation.", + "parameters": [ + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "description": "Array of labels (comma-separated strings)", + "items": { + "type": "string" + } + } + } + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/contact_labels" + } + }, + "404": { + "description": "Contact not found" + }, + "401": { + "description": "Unauthorized" + } + } + } + }, "/survey/responses/{conversation_uuid}": { "parameters": [ { @@ -6810,6 +6883,18 @@ ] } }, + "contact_labels": { + "type": "object", + "properties": { + "payload": { + "type": "array", + "description": "Array of labels", + "items": { + "type": "string" + } + } + } + }, "conversation_list": { "type": "object", "properties": { @@ -7214,6 +7299,7 @@ "Agents", "Canned Responses", "Contacts", + "Contact Labels", "Conversation Assignment", "Conversation Labels", "Conversations",