From fc1fa579e946791595f0541ccfa15f30a20f2bde Mon Sep 17 00:00:00 2001 From: Sony Mathew Date: Mon, 24 Feb 2020 00:51:31 +0530 Subject: [PATCH] Chore: Document Conversation APIs in swagger (#552) * Added the documentation for the conversation APIs - 8 endpoints * Added descriptions for the existing endpoints * Added new resource models and updated some parts of the contact API --- swagger/definitions/index.yml | 37 +- .../request/conversation/create_message.yml | 10 + swagger/definitions/resource/conversation.yml | 2 - .../extension/contact/conversation.yml | 2 +- .../resource/extension/contact/list.yml | 5 - .../extension/conversation/labels.yml | 7 + .../resource/extension/conversation/list.yml | 22 + .../resource/extension/conversation/show.yml | 19 + .../extension/conversation/status_toggle.yml | 14 + .../conversation/with_display_id.yml | 4 + .../extension/message/with_source_sender.yml | 6 + swagger/definitions/resource/message.yml | 16 + swagger/definitions/resource/user.yml | 19 + swagger/paths/contact/conversations.yml | 2 +- swagger/paths/contact/crud.yml | 4 +- swagger/paths/contact/list_create.yml | 6 +- swagger/paths/conversation/assignments.yml | 27 + swagger/paths/conversation/crud.yml | 19 + swagger/paths/conversation/labels.yml | 50 ++ swagger/paths/conversation/list.yml | 17 + swagger/paths/conversation/messages.yml | 26 + swagger/paths/conversation/toggle_status.yml | 19 + .../paths/conversation/update_last_seen.yml | 17 + swagger/paths/index.yml | 16 + swagger/swagger.json | 583 +++++++++++++++++- 25 files changed, 909 insertions(+), 40 deletions(-) create mode 100644 swagger/definitions/request/conversation/create_message.yml delete mode 100644 swagger/definitions/resource/extension/contact/list.yml create mode 100644 swagger/definitions/resource/extension/conversation/labels.yml create mode 100644 swagger/definitions/resource/extension/conversation/list.yml create mode 100644 swagger/definitions/resource/extension/conversation/show.yml create mode 100644 swagger/definitions/resource/extension/conversation/status_toggle.yml create mode 100644 swagger/definitions/resource/extension/conversation/with_display_id.yml create mode 100644 swagger/definitions/resource/extension/message/with_source_sender.yml create mode 100644 swagger/definitions/resource/message.yml create mode 100644 swagger/definitions/resource/user.yml create mode 100644 swagger/paths/conversation/assignments.yml create mode 100644 swagger/paths/conversation/crud.yml create mode 100644 swagger/paths/conversation/labels.yml create mode 100644 swagger/paths/conversation/list.yml create mode 100644 swagger/paths/conversation/messages.yml create mode 100644 swagger/paths/conversation/toggle_status.yml create mode 100644 swagger/paths/conversation/update_last_seen.yml diff --git a/swagger/definitions/index.yml b/swagger/definitions/index.yml index 3ef07961d..e1e78e421 100644 --- a/swagger/definitions/index.yml +++ b/swagger/definitions/index.yml @@ -5,35 +5,68 @@ request_error: $ref: ./error/request.yml # RESOURCE +generic_id: + $ref: ./resource/extension/generic.yml contact: $ref: ./resource/contact.yml conversation: $ref: ./resource/conversation.yml +message: + $ref: ./resource/message.yml +user: + $ref: ./resource/user.yml # RESPONSE + +## contact extended_contact: allOf: - $ref: '#/definitions/contact' - $ref: ./resource/extension/contact/show.yml contact_base: allOf: + - $ref: '#/definitions/generic_id' - $ref: '#/definitions/contact' - - $ref: ./resource/extension/generic.yml contact_list: type: array + description: 'array of contacts' items: allOf: + - $ref: '#/definitions/generic_id' - $ref: '#/definitions/contact' - - $ref: ./resource/extension/generic.yml contact_conversations: type: array + description: 'array of conversations' items: allOf: - $ref: '#/definitions/conversation' - $ref: ./resource/extension/contact/conversation.yml + - $ref: ./resource/extension/conversation/with_display_id.yml + +## conversation +conversation_list: + $ref: ./resource/extension/conversation/list.yml +conversation_show: + $ref: ./resource/extension/conversation/show.yml +conversation_status_toggle: + $ref: ./resource/extension/conversation/status_toggle.yml +conversation_labels: + $ref: ./resource/extension/conversation/labels.yml + +## message +extended_message: + allOf: + - $ref: '#/definitions/generic_id' + - $ref: '#/definitions/message' + - $ref: ./resource/extension/message/with_source_sender.yml # REQUEST + +## contact contact_create: $ref: ./request/contact/create.yml contact_update: $ref: ./request/contact/update.yml +## conversation +conversation_message_create: + $ref: ./request/conversation/create_message.yml diff --git a/swagger/definitions/request/conversation/create_message.yml b/swagger/definitions/request/conversation/create_message.yml new file mode 100644 index 000000000..e307f461b --- /dev/null +++ b/swagger/definitions/request/conversation/create_message.yml @@ -0,0 +1,10 @@ +type: object +properties: + conversation_id: + type: number + message: + type: string + private: + type: boolean + fb_id: + type: number diff --git a/swagger/definitions/resource/conversation.yml b/swagger/definitions/resource/conversation.yml index a6c8f18d6..bb9d008ce 100644 --- a/swagger/definitions/resource/conversation.yml +++ b/swagger/definitions/resource/conversation.yml @@ -1,7 +1,5 @@ type: object properties: - display_id: - type: number messages: type: array items: diff --git a/swagger/definitions/resource/extension/contact/conversation.yml b/swagger/definitions/resource/extension/contact/conversation.yml index e54cb178a..57be12bdc 100644 --- a/swagger/definitions/resource/extension/contact/conversation.yml +++ b/swagger/definitions/resource/extension/contact/conversation.yml @@ -15,4 +15,4 @@ properties: channel: type: string assignee: - type: object + $ref: '#/definitions/user' diff --git a/swagger/definitions/resource/extension/contact/list.yml b/swagger/definitions/resource/extension/contact/list.yml deleted file mode 100644 index 0378da06e..000000000 --- a/swagger/definitions/resource/extension/contact/list.yml +++ /dev/null @@ -1,5 +0,0 @@ -type: object -properties: - allOf: - - $ref: '#/definitions/contact' - - $ref: ./resource/extension/contact.yaml diff --git a/swagger/definitions/resource/extension/conversation/labels.yml b/swagger/definitions/resource/extension/conversation/labels.yml new file mode 100644 index 000000000..d8b181269 --- /dev/null +++ b/swagger/definitions/resource/extension/conversation/labels.yml @@ -0,0 +1,7 @@ +type: object +properties: + payload: + type: array + description: 'array of labels' + items: + type: string diff --git a/swagger/definitions/resource/extension/conversation/list.yml b/swagger/definitions/resource/extension/conversation/list.yml new file mode 100644 index 000000000..b1a17baee --- /dev/null +++ b/swagger/definitions/resource/extension/conversation/list.yml @@ -0,0 +1,22 @@ +type: object +properties: + data: + type: object + properties: + meta: + type: object + properties: + mine_count: + type: number + unassigned_count: + type: number + all_count: + type: number + payload: + type: array + description: 'array of conversations' + items: + allOf: + - $ref: '#/definitions/generic_id' + - $ref: '#/definitions/conversation' + - $ref: '../contact/conversation.yml' diff --git a/swagger/definitions/resource/extension/conversation/show.yml b/swagger/definitions/resource/extension/conversation/show.yml new file mode 100644 index 000000000..15d0007fb --- /dev/null +++ b/swagger/definitions/resource/extension/conversation/show.yml @@ -0,0 +1,19 @@ +type: object +properties: + meta: + type: object + properties: + labels: + type: array + items: + type: string + additional_attributes: + type: object + contact_id: + type: number + payload: + type: array + description: 'array of messages' + items: + allOf: + - $ref: '#/definitions/extended_message' diff --git a/swagger/definitions/resource/extension/conversation/status_toggle.yml b/swagger/definitions/resource/extension/conversation/status_toggle.yml new file mode 100644 index 000000000..f6909c5b3 --- /dev/null +++ b/swagger/definitions/resource/extension/conversation/status_toggle.yml @@ -0,0 +1,14 @@ +type: object +properties: + meta: + type: object + payload: + type: object + properties: + success: + type: boolean + current_status: + type: string + enum: ['open', 'resolved'] + conversation_id: + type: number diff --git a/swagger/definitions/resource/extension/conversation/with_display_id.yml b/swagger/definitions/resource/extension/conversation/with_display_id.yml new file mode 100644 index 000000000..338323ba2 --- /dev/null +++ b/swagger/definitions/resource/extension/conversation/with_display_id.yml @@ -0,0 +1,4 @@ +type: object +properties: + display_id: + type: number diff --git a/swagger/definitions/resource/extension/message/with_source_sender.yml b/swagger/definitions/resource/extension/message/with_source_sender.yml new file mode 100644 index 000000000..14110c348 --- /dev/null +++ b/swagger/definitions/resource/extension/message/with_source_sender.yml @@ -0,0 +1,6 @@ +type: object +properties: + source_id: + type: number + sender: + type: object diff --git a/swagger/definitions/resource/message.yml b/swagger/definitions/resource/message.yml new file mode 100644 index 000000000..7b0d90706 --- /dev/null +++ b/swagger/definitions/resource/message.yml @@ -0,0 +1,16 @@ +type: object +properties: + content: + type: string + inbox_id: + type: number + conversation_id: + type: number + message_type: + type: string + created_at: + type: integer + private: + type: boolean + attachment: + type: object diff --git a/swagger/definitions/resource/user.yml b/swagger/definitions/resource/user.yml new file mode 100644 index 000000000..049e2478e --- /dev/null +++ b/swagger/definitions/resource/user.yml @@ -0,0 +1,19 @@ +type: object +properties: + id: + type: number + uid: + type: string + name: + type: string + email: + type: string + account_id: + type: number + role: + type: string + enum: ['agent', 'administrator'] + confirmed: + type: boolean + nickname: + type: string diff --git a/swagger/paths/contact/conversations.yml b/swagger/paths/contact/conversations.yml index 39279a449..8664a39be 100644 --- a/swagger/paths/contact/conversations.yml +++ b/swagger/paths/contact/conversations.yml @@ -5,7 +5,7 @@ get: - name: id in: path type: number - description: ID of contact + description: id of the contact required: true responses: 200: diff --git a/swagger/paths/contact/crud.yml b/swagger/paths/contact/crud.yml index c15911cb4..f7addbe61 100644 --- a/swagger/paths/contact/crud.yml +++ b/swagger/paths/contact/crud.yml @@ -5,7 +5,7 @@ get: - name: id in: path type: number - description: ID of contact + description: id of the contact required: true responses: 200: @@ -24,7 +24,7 @@ put: - name: id in: path type: number - description: ID of the contact + description: id of the contact required: true - name: data in: body diff --git a/swagger/paths/contact/list_create.yml b/swagger/paths/contact/list_create.yml index 4aad9d7ac..700b510aa 100644 --- a/swagger/paths/contact/list_create.yml +++ b/swagger/paths/contact/list_create.yml @@ -1,7 +1,7 @@ get: tags: [Contact] - description: Listing all contacts with pagination - summary: List contacts + description: Listing all the contacts with pagination + summary: List Contacts parameters: - name: query_hash in: query @@ -18,7 +18,7 @@ get: post: tags: [Contact] - description: Create a contact + description: Create New Contact parameters: - name: data in: body diff --git a/swagger/paths/conversation/assignments.yml b/swagger/paths/conversation/assignments.yml new file mode 100644 index 000000000..6e1e23e6a --- /dev/null +++ b/swagger/paths/conversation/assignments.yml @@ -0,0 +1,27 @@ +post: + tags: [Conversation] + summary: Assign Conversation + description: Assign a conversation to an agent + parameters: + - name: id + in: path + type: number + description: id of the conversation + required: true + - name: data + in: body + required: true + schema: + type: object + properties: + assignee_id: + type: number + responses: + 204: + description: Success + schema: + $ref: '#/definitions/user' + 404: + description: Conversation not found + 403: + description: Access denied diff --git a/swagger/paths/conversation/crud.yml b/swagger/paths/conversation/crud.yml new file mode 100644 index 000000000..26e759600 --- /dev/null +++ b/swagger/paths/conversation/crud.yml @@ -0,0 +1,19 @@ +get: + tags: [Conversation] + summary: Conversation Details + description: Get all details regarding a conversation with all messages in the conversation + parameters: + - name: id + in: path + type: number + description: ID of Conversation + required: true + responses: + 200: + description: Success + schema: + $ref: '#/definitions/conversation_show' + 404: + description: Conversation not found + 403: + description: Access denied diff --git a/swagger/paths/conversation/labels.yml b/swagger/paths/conversation/labels.yml new file mode 100644 index 000000000..20c4c0b42 --- /dev/null +++ b/swagger/paths/conversation/labels.yml @@ -0,0 +1,50 @@ +get: + tags: [Conversation] + summary: List Labels + description: Lists all the labels of a conversation + parameters: + - name: id + in: path + type: number + description: id of the conversation + required: true + responses: + 200: + description: Success + schema: + $ref: '#/definitions/conversation_labels' + 404: + description: Conversation not found + 403: + description: Access denied + +post: + tags: [Conversation] + summary: Add Label + description: Creates a new label and associates it with the conversation + parameters: + - name: id + in: path + type: number + description: id of the conversation + required: true + - name: data + in: body + required: true + schema: + type: object + properties: + labels: + type: array + description: 'array of labels' + properties: + type: string + responses: + 204: + description: Success + schema: + $ref: '#/definitions/conversation_labels' + 404: + description: Conversation not found + 403: + description: Access denied diff --git a/swagger/paths/conversation/list.yml b/swagger/paths/conversation/list.yml new file mode 100644 index 000000000..f119245df --- /dev/null +++ b/swagger/paths/conversation/list.yml @@ -0,0 +1,17 @@ +get: + tags: [Conversation] + description: List all the conversations with pagination + summary: Conversations List + parameters: + - name: query_hash + in: query + type: string + responses: + 200: + description: Success + schema: + $ref: '#/definitions/conversation_list' + 400: + description: Bad Request Error + schema: + $ref: '#/definitions/bad_request_error' diff --git a/swagger/paths/conversation/messages.yml b/swagger/paths/conversation/messages.yml new file mode 100644 index 000000000..33747af55 --- /dev/null +++ b/swagger/paths/conversation/messages.yml @@ -0,0 +1,26 @@ +post: + tags: [Conversation] + summary: Create New Message + description: All the agent replies are created as new messages through this endpoint + parameters: + - name: id + in: path + type: number + description: id of the conversation + required: true + - name: data + in: body + required: true + schema: + $ref: '#/definitions/conversation_message_create' + responses: + 204: + description: Success + schema: + allOf: + - $ref: '#/definitions/generic_id' + - $ref: '#/definitions/message' + 404: + description: Conversation not found + 403: + description: Access denied diff --git a/swagger/paths/conversation/toggle_status.yml b/swagger/paths/conversation/toggle_status.yml new file mode 100644 index 000000000..c6fc5f48d --- /dev/null +++ b/swagger/paths/conversation/toggle_status.yml @@ -0,0 +1,19 @@ +post: + tags: [Conversation] + summary: Toggle Status + description: Toggles the status of the conversation between open and resolved + parameters: + - name: id + in: path + type: number + description: id of the conversation + required: true + responses: + 204: + description: Success + schema: + $ref: '#/definitions/conversation_status_toggle' + 404: + description: Conversation not found + 403: + description: Access denied diff --git a/swagger/paths/conversation/update_last_seen.yml b/swagger/paths/conversation/update_last_seen.yml new file mode 100644 index 000000000..1814a380f --- /dev/null +++ b/swagger/paths/conversation/update_last_seen.yml @@ -0,0 +1,17 @@ +post: + tags: [Conversation] + summary: Update Last Seen + description: Updates the last seen of the conversation so that conversations will have the bubbles in the agents screen + parameters: + - name: id + in: path + type: number + description: id of the conversation + required: true + responses: + 200: + description: Success + 404: + description: Contact not found + 403: + description: Access denied diff --git a/swagger/paths/index.yml b/swagger/paths/index.yml index 54509e2e5..c35912122 100644 --- a/swagger/paths/index.yml +++ b/swagger/paths/index.yml @@ -5,3 +5,19 @@ $ref: ./contact/crud.yml /contacts/{id}/conversations: $ref: ./contact/conversations.yml + +# Conversations +/conversations: + $ref: ./conversation/list.yml +/conversations/{id}: + $ref: ./conversation/crud.yml +/conversations/{id}/toggle_status: + $ref: ./conversation/toggle_status.yml +/conversations/{id}/update_last_seen: + $ref: ./conversation/update_last_seen.yml +/conversations/{id}/labels: + $ref: ./conversation/labels.yml +/conversations/{id}/assignments: + $ref: ./conversation/assignments.yml +/conversations/{id}/messages: + $ref: ./conversation/messages.yml diff --git a/swagger/swagger.json b/swagger/swagger.json index 1228004b3..f34817430 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -21,8 +21,8 @@ "tags": [ "Contact" ], - "description": "Listing all contacts with pagination", - "summary": "List contacts", + "description": "Listing all the contacts with pagination", + "summary": "List Contacts", "parameters": [ { "name": "query_hash", @@ -49,7 +49,7 @@ "tags": [ "Contact" ], - "description": "Create a contact", + "description": "Create New Contact", "parameters": [ { "name": "data", @@ -87,7 +87,7 @@ "name": "id", "in": "path", "type": "number", - "description": "ID of contact", + "description": "id of the contact", "required": true } ], @@ -116,7 +116,7 @@ "name": "id", "in": "path", "type": "number", - "description": "ID of the contact", + "description": "id of the contact", "required": true }, { @@ -155,7 +155,7 @@ "name": "id", "in": "path", "type": "number", - "description": "ID of contact", + "description": "id of the contact", "required": true } ], @@ -174,6 +174,300 @@ } } } + }, + "/conversations": { + "get": { + "tags": [ + "Conversation" + ], + "description": "List all the conversations with pagination", + "summary": "Conversations List", + "parameters": [ + { + "name": "query_hash", + "in": "query", + "type": "string" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/conversation_list" + } + }, + "400": { + "description": "Bad Request Error", + "schema": { + "$ref": "#/definitions/bad_request_error" + } + } + } + } + }, + "/conversations/{id}": { + "get": { + "tags": [ + "Conversation" + ], + "summary": "Conversation Details", + "description": "Get all details regarding a conversation with all messages in the conversation", + "parameters": [ + { + "name": "id", + "in": "path", + "type": "number", + "description": "ID of Conversation", + "required": true + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/conversation_show" + } + }, + "404": { + "description": "Conversation not found" + }, + "403": { + "description": "Access denied" + } + } + } + }, + "/conversations/{id}/toggle_status": { + "post": { + "tags": [ + "Conversation" + ], + "summary": "Toggle Status", + "description": "Toggles the status of the conversation between open and resolved", + "parameters": [ + { + "name": "id", + "in": "path", + "type": "number", + "description": "id of the conversation", + "required": true + } + ], + "responses": { + "204": { + "description": "Success", + "schema": { + "$ref": "#/definitions/conversation_status_toggle" + } + }, + "404": { + "description": "Conversation not found" + }, + "403": { + "description": "Access denied" + } + } + } + }, + "/conversations/{id}/update_last_seen": { + "post": { + "tags": [ + "Conversation" + ], + "summary": "Update Last Seen", + "description": "Updates the last seen of the conversation so that conversations will have the bubbles in the agents screen", + "parameters": [ + { + "name": "id", + "in": "path", + "type": "number", + "description": "id of the conversation", + "required": true + } + ], + "responses": { + "200": { + "description": "Success" + }, + "404": { + "description": "Contact not found" + }, + "403": { + "description": "Access denied" + } + } + } + }, + "/conversations/{id}/labels": { + "get": { + "tags": [ + "Conversation" + ], + "summary": "List Labels", + "description": "Lists all the labels of a conversation", + "parameters": [ + { + "name": "id", + "in": "path", + "type": "number", + "description": "id of the conversation", + "required": true + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/conversation_labels" + } + }, + "404": { + "description": "Conversation not found" + }, + "403": { + "description": "Access denied" + } + } + }, + "post": { + "tags": [ + "Conversation" + ], + "summary": "Add Label", + "description": "Creates a new label and associates it with the conversation", + "parameters": [ + { + "name": "id", + "in": "path", + "type": "number", + "description": "id of the conversation", + "required": true + }, + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "description": "array of labels", + "properties": { + "type": "string" + } + } + } + } + } + ], + "responses": { + "204": { + "description": "Success", + "schema": { + "$ref": "#/definitions/conversation_labels" + } + }, + "404": { + "description": "Conversation not found" + }, + "403": { + "description": "Access denied" + } + } + } + }, + "/conversations/{id}/assignments": { + "post": { + "tags": [ + "Conversation" + ], + "summary": "Assign Conversation", + "description": "Assign a conversation to an agent", + "parameters": [ + { + "name": "id", + "in": "path", + "type": "number", + "description": "id of the conversation", + "required": true + }, + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "assignee_id": { + "type": "number" + } + } + } + } + ], + "responses": { + "204": { + "description": "Success", + "schema": { + "$ref": "#/definitions/user" + } + }, + "404": { + "description": "Conversation not found" + }, + "403": { + "description": "Access denied" + } + } + } + }, + "/conversations/{id}/messages": { + "post": { + "tags": [ + "Conversation" + ], + "summary": "Create New Message", + "description": "All the agent replies are created as new messages through this endpoint", + "parameters": [ + { + "name": "id", + "in": "path", + "type": "number", + "description": "id of the conversation", + "required": true + }, + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/conversation_message_create" + } + } + ], + "responses": { + "204": { + "description": "Success", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/generic_id" + }, + { + "$ref": "#/definitions/message" + } + ] + } + }, + "404": { + "description": "Conversation not found" + }, + "403": { + "description": "Access denied" + } + } + } } }, "definitions": { @@ -206,6 +500,14 @@ } } }, + "generic_id": { + "type": "object", + "properties": { + "id": { + "type": "number" + } + } + }, "contact": { "type": "object", "properties": { @@ -229,9 +531,6 @@ "conversation": { "type": "object", "properties": { - "display_id": { - "type": "number" - }, "messages": { "type": "array", "items": { @@ -262,6 +561,65 @@ } } }, + "message": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "inbox_id": { + "type": "number" + }, + "conversation_id": { + "type": "number" + }, + "message_type": { + "type": "string" + }, + "created_at": { + "type": "integer" + }, + "private": { + "type": "boolean" + }, + "attachment": { + "type": "object" + } + } + }, + "user": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "uid": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "account_id": { + "type": "number" + }, + "role": { + "type": "string", + "enum": [ + "agent", + "administrator" + ] + }, + "confirmed": { + "type": "boolean" + }, + "nickname": { + "type": "string" + } + } + }, "extended_contact": { "allOf": [ { @@ -287,38 +645,30 @@ "contact_base": { "allOf": [ { - "$ref": "#/definitions/contact" + "$ref": "#/definitions/generic_id" }, { - "type": "object", - "properties": { - "id": { - "type": "number" - } - } + "$ref": "#/definitions/contact" } ] }, "contact_list": { "type": "array", + "description": "array of contacts", "items": { "allOf": [ { - "$ref": "#/definitions/contact" + "$ref": "#/definitions/generic_id" }, { - "type": "object", - "properties": { - "id": { - "type": "number" - } - } + "$ref": "#/definitions/contact" } ] } }, "contact_conversations": { "type": "array", + "description": "array of conversations", "items": { "allOf": [ { @@ -348,15 +698,183 @@ } }, "assignee": { - "type": "object" + "$ref": "#/definitions/user" } } } } + }, + { + "type": "object", + "properties": { + "display_id": { + "type": "number" + } + } } ] } }, + "conversation_list": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "meta": { + "type": "object", + "properties": { + "mine_count": { + "type": "number" + }, + "unassigned_count": { + "type": "number" + }, + "all_count": { + "type": "number" + } + } + }, + "payload": { + "type": "array", + "description": "array of conversations", + "items": { + "allOf": [ + { + "$ref": "#/definitions/generic_id" + }, + { + "$ref": "#/definitions/conversation" + }, + { + "type": "object", + "properties": { + "meta": { + "type": "object", + "properties": { + "sender": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "thumbnail": { + "type": "string" + }, + "channel": { + "type": "string" + } + } + }, + "assignee": { + "$ref": "#/definitions/user" + } + } + } + } + } + ] + } + } + } + } + } + }, + "conversation_show": { + "type": "object", + "properties": { + "meta": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "items": { + "type": "string" + } + }, + "additional_attributes": { + "type": "object" + }, + "contact_id": { + "type": "number" + } + } + }, + "payload": { + "type": "array", + "description": "array of messages", + "items": { + "allOf": [ + { + "$ref": "#/definitions/extended_message" + } + ] + } + } + } + }, + "conversation_status_toggle": { + "type": "object", + "properties": { + "meta": { + "type": "object" + }, + "payload": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "current_status": { + "type": "string", + "enum": [ + "open", + "resolved" + ] + }, + "conversation_id": { + "type": "number" + } + } + } + } + }, + "conversation_labels": { + "type": "object", + "properties": { + "payload": { + "type": "array", + "description": "array of labels", + "items": { + "type": "string" + } + } + } + }, + "extended_message": { + "allOf": [ + { + "$ref": "#/definitions/generic_id" + }, + { + "$ref": "#/definitions/message" + }, + { + "type": "object", + "properties": { + "source_id": { + "type": "number" + }, + "sender": { + "type": "object" + } + } + } + ] + }, "contact_create": { "type": "object", "properties": { @@ -381,6 +899,23 @@ "type": "string" } } + }, + "conversation_message_create": { + "type": "object", + "properties": { + "conversation_id": { + "type": "number" + }, + "message": { + "type": "string" + }, + "private": { + "type": "boolean" + }, + "fb_id": { + "type": "number" + } + } } } } \ No newline at end of file