Chore: Inbox Members API improvements (#3008)

- New Inbox Member APIs
- Return JSON errors for Platform APIs
This commit is contained in:
Sojan Jose
2021-09-14 11:55:02 +05:30
committed by GitHub
parent ccd0dc39ad
commit 22d1c8baf2
25 changed files with 767 additions and 131 deletions

View File

@@ -20,6 +20,8 @@ message:
$ref: ./resource/message.yml
user:
$ref: ./resource/user.yml
agent:
$ref: ./resource/agent.yml
inbox:
$ref: ./resource/inbox.yml
agent_bot:

View File

@@ -0,0 +1,25 @@
type: object
properties:
id:
type: number
uid:
type: string
name:
type: string
available_name:
type: string
display_name:
type: string
email:
type: string
account_id:
type: number
role:
type: string
enum: ['agent', 'administrator']
confirmed:
type: boolean
custom_attributes:
type: object
description: Available for users who are created through platform APIs and has custom attributes associated.

View File

@@ -0,0 +1,6 @@
in: path
name: inbox_id
schema:
type: integer
required: true
description: The ID of the Inbox

View File

@@ -7,6 +7,9 @@ agent_bot_id:
team_id:
$ref: ./team_id.yml
inbox_id:
$ref: ./inbox_id.yml
hook_id:
$ref: ./hook_id.yml

View File

@@ -0,0 +1,36 @@
tags:
- Inbox
operationId: add-new-agent-to-inbox
summary: Add a New Agent
description: Add a new Agent to Inbox
security:
- userApiKey: []
parameters:
- name: data
in: body
required: true
schema:
type: object
properties:
inbox_id:
type: string
description: The ID of the inbox
required: true
user_ids:
type: array
description: IDs of users to be added to the inbox
required: true
responses:
200:
description: Success
schema:
type: array
description: 'Array of all active agents'
items:
$ref: '#/definitions/agent'
404:
description: Inbox not found
403:
description: Access denied
422:
description: User must exist

View File

@@ -0,0 +1,31 @@
tags:
- Inbox
operationId: delete-agent-in-inbox
summary: Remove an Agent from Inbox
description: Remove an Agent from Inbox
security:
- userApiKey: []
parameters:
- name: data
in: body
required: true
schema:
type: object
properties:
inbox_id:
type: string
description: The ID of the inbox
required: true
user_ids:
type: array
description: IDs of users to be deleted from the inbox
required: true
responses:
200:
description: Success
404:
description: Inbox not found
403:
description: Access denied
422:
description: User must exist

View File

@@ -0,0 +1,21 @@
tags:
- Inbox
operationId: get-inbox-members
summary: List Agents in Inbox
description: Get Details of Agents in an Inbox
security:
- userApiKey: []
parameters:
- $ref: '#/parameters/inbox_id'
responses:
200:
description: Success
schema:
type: array
description: 'Array of all active agents'
items:
$ref: '#/definitions/agent'
404:
description: Inbox not found
403:
description: Access denied

View File

@@ -0,0 +1,36 @@
tags:
- Inbox
operationId: update-agents-in-inbox
summary: Update Agents in Inbox
description: All agents execept the one passed in params will be removed
security:
- userApiKey: []
parameters:
- name: data
in: body
required: true
schema:
type: object
properties:
inbox_id:
type: string
description: The ID of the inbox
required: true
user_ids:
type: array
description: IDs of users to be added to the inbox
required: true
responses:
200:
description: Success
schema:
type: array
description: 'Array of all active agents'
items:
$ref: '#/definitions/agent'
404:
description: Inbox not found
403:
description: Access denied
422:
description: User must exist

View File

@@ -1,7 +1,7 @@
get:
tags:
- Inbox
operationId: GetInboxe
operationId: GetInbox
summary: Get an inbox
description: Get an inbox available in the current account
parameters:

View File

@@ -209,6 +209,18 @@ public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversat
/api/v1/accounts/{account_id}/inboxes/{id}/set_agent_bot:
$ref: ./inboxes/set_agent_bot.yml
# Inbox Members
/api/v1/accounts/{account_id}/inbox_members:
get:
$ref: ./inboxes/inbox_members/show.yml
post:
$ref: ./inboxes/inbox_members/create.yml
patch:
$ref: ./inboxes/inbox_members/update.yml
delete:
$ref: ./inboxes/inbox_members/delete.yml
# Messages
/api/v1/accounts/{account_id}/conversations/{id}/messages:
@@ -273,7 +285,7 @@ public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversat
### Custom Filters goes here
# Teams
# Custom Filters
/api/v1/accounts/{account_id}/custom_filters:
parameters:
- $ref: '#/parameters/account_id'

View File

@@ -1920,7 +1920,7 @@
"tags": [
"Inbox"
],
"operationId": "GetInboxe",
"operationId": "GetInbox",
"summary": "Get an inbox",
"description": "Get an inbox available in the current account",
"parameters": [
@@ -2198,6 +2198,213 @@
}
}
},
"/api/v1/accounts/{account_id}/inbox_members": {
"get": {
"tags": [
"Inbox"
],
"operationId": "get-inbox-members",
"summary": "List Agents in Inbox",
"description": "Get Details of Agents in an Inbox",
"security": [
{
"userApiKey": [
]
}
],
"parameters": [
{
"$ref": "#/parameters/inbox_id"
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"description": "Array of all active agents",
"items": {
"$ref": "#/definitions/agent"
}
}
},
"404": {
"description": "Inbox not found"
},
"403": {
"description": "Access denied"
}
}
},
"post": {
"tags": [
"Inbox"
],
"operationId": "add-new-agent-to-inbox",
"summary": "Add a New Agent",
"description": "Add a new Agent to Inbox",
"security": [
{
"userApiKey": [
]
}
],
"parameters": [
{
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"inbox_id": {
"type": "string",
"description": "The ID of the inbox",
"required": true
},
"user_ids": {
"type": "array",
"description": "IDs of users to be added to the inbox",
"required": true
}
}
}
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"description": "Array of all active agents",
"items": {
"$ref": "#/definitions/agent"
}
}
},
"404": {
"description": "Inbox not found"
},
"403": {
"description": "Access denied"
},
"422": {
"description": "User must exist"
}
}
},
"patch": {
"tags": [
"Inbox"
],
"operationId": "update-agents-in-inbox",
"summary": "Update Agents in Inbox",
"description": "All agents execept the one passed in params will be removed",
"security": [
{
"userApiKey": [
]
}
],
"parameters": [
{
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"inbox_id": {
"type": "string",
"description": "The ID of the inbox",
"required": true
},
"user_ids": {
"type": "array",
"description": "IDs of users to be added to the inbox",
"required": true
}
}
}
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"description": "Array of all active agents",
"items": {
"$ref": "#/definitions/agent"
}
}
},
"404": {
"description": "Inbox not found"
},
"403": {
"description": "Access denied"
},
"422": {
"description": "User must exist"
}
}
},
"delete": {
"tags": [
"Inbox"
],
"operationId": "delete-agent-in-inbox",
"summary": "Remove an Agent from Inbox",
"description": "Remove an Agent from Inbox",
"security": [
{
"userApiKey": [
]
}
],
"parameters": [
{
"name": "data",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"inbox_id": {
"type": "string",
"description": "The ID of the inbox",
"required": true
},
"user_ids": {
"type": "array",
"description": "IDs of users to be deleted from the inbox",
"required": true
}
}
}
}
],
"responses": {
"200": {
"description": "Success"
},
"404": {
"description": "Inbox not found"
},
"403": {
"description": "Access denied"
},
"422": {
"description": "User must exist"
}
}
}
},
"/api/v1/accounts/{account_id}/conversations/{id}/messages": {
"post": {
"tags": [
@@ -3193,6 +3400,46 @@
}
}
},
"agent": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"uid": {
"type": "string"
},
"name": {
"type": "string"
},
"available_name": {
"type": "string"
},
"display_name": {
"type": "string"
},
"email": {
"type": "string"
},
"account_id": {
"type": "number"
},
"role": {
"type": "string",
"enum": [
"agent",
"administrator"
]
},
"confirmed": {
"type": "boolean"
},
"custom_attributes": {
"type": "object",
"description": "Available for users who are created through platform APIs and has custom attributes associated."
}
}
},
"inbox": {
"type": "object",
"properties": {
@@ -4128,6 +4375,15 @@
"required": true,
"description": "The ID of the team to be updated"
},
"inbox_id": {
"in": "path",
"name": "inbox_id",
"schema": {
"type": "integer"
},
"required": true,
"description": "The ID of the Inbox"
},
"hook_id": {
"in": "path",
"name": "hook_id",