chore: Add swagger docs for Canned Responses (#4295)

fixes: #3962
This commit is contained in:
Sojan Jose 2022-03-26 00:43:44 +05:30 committed by GitHub
parent 971755b845
commit e0f29b9d81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 328 additions and 3 deletions

View file

@ -52,8 +52,8 @@ Rails.application.routes.draw do
post :reauthorize_page post :reauthorize_page
end end
end end
resources :canned_responses, except: [:show, :edit, :new] resources :canned_responses, only: [:index, :create, :update, :destroy]
resources :automation_rules, except: [:edit] do resources :automation_rules, only: [:index, :create, :show, :update, :destroy] do
post :clone post :clone
end end
resources :campaigns, only: [:index, :create, :show, :update, :destroy] resources :campaigns, only: [:index, :create, :show, :update, :destroy]
@ -145,7 +145,7 @@ Rails.application.routes.draw do
resource :authorization, only: [:create] resource :authorization, only: [:create]
end end
resources :webhooks, except: [:show] resources :webhooks, only: [:index, :create, :update, :destroy]
namespace :integrations do namespace :integrations do
resources :apps, only: [:index, :show] resources :apps, only: [:index, :show]
resources :hooks, only: [:create, :update, :destroy] resources :hooks, only: [:create, :update, :destroy]

View file

@ -12,6 +12,8 @@ request_error:
generic_id: generic_id:
$ref: ./resource/extension/generic.yml $ref: ./resource/extension/generic.yml
canned_response:
$ref: ./resource/canned_response.yml
contact: contact:
$ref: ./resource/contact.yml $ref: ./resource/contact.yml
conversation: conversation:
@ -64,6 +66,9 @@ agent_bot_create_update_payload:
user_create_update_payload: user_create_update_payload:
$ref: ./request/user/create_update_payload.yml $ref: ./request/user/create_update_payload.yml
canned_response_create_update_payload:
$ref: ./request/canned_response/create_update_payload.yml
## contact ## contact
contact_create: contact_create:
$ref: ./request/contact/create.yml $ref: ./request/contact/create.yml

View file

@ -0,0 +1,8 @@
type: object
properties:
content:
type: string
description: Message content for canned response
short_code:
type: string
description: Short Code for quick access of the canned response

View file

@ -0,0 +1,14 @@
type: object
properties:
id:
type: integer
description: ID of the canned response
content:
type: string
description: Message content for canned response
short_code:
type: string
description: Short Code for quick access of the canned response
account_id:
type: integer
description: Account Id

View file

@ -54,6 +54,7 @@ x-tagGroups:
tags: tags:
- Account AgentBots - Account AgentBots
- Agent - Agent
- Canned Response
- Contact - Contact
- Conversation - Conversation
- Conversation Assignment - Conversation Assignment

View file

@ -0,0 +1,21 @@
tags:
- Canned Response
operationId: add-new-canned-response-to-account
summary: Add a New Canned Response
description: Add a new Canned Response to Account
security:
- userApiKey: []
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/canned_response_create_update_payload'
responses:
200:
description: Success
schema:
description: 'Newly Created Canned Response'
$ref: '#/definitions/canned_response'
403:
description: Access denied

View file

@ -0,0 +1,20 @@
tags:
- Canned Response
operationId: delete-canned-response-from-account
summary: Remove a Canned Response from Account
description: Remove a Canned Response from Account
security:
- userApiKey: []
parameters:
- in: path
name: id
type: integer
required: true
description: The ID of the canned response to be deleted
responses:
200:
description: Success
404:
description: Canned Response not found
403:
description: Access denied

View file

@ -0,0 +1,17 @@
tags:
- Canned Response
operationId: get-account-canned-response
summary: List all Canned Responses in an Account
description: Get Details of Canned Responses in an Account
security:
- userApiKey: []
responses:
200:
description: Success
schema:
type: array
description: 'Array of all canned responses'
items:
$ref: '#/definitions/canned_response'
403:
description: Access denied

View file

@ -0,0 +1,28 @@
tags:
- Canned Response
operationId: update-canned-response-in-account
summary: Update Canned Response in Account
description: Update a Canned Response in Account
security:
- userApiKey: []
parameters:
- in: path
name: id
type: integer
required: true
description: The ID of the canned response to be updated.
- name: data
in: body
required: true
schema:
$ref: '#/definitions/canned_response_create_update_payload'
responses:
200:
description: Success
schema:
description: 'The updated canned response'
$ref: '#/definitions/canned_response'
404:
description: Agent not found
403:
description: Access denied

View file

@ -154,6 +154,21 @@
delete: delete:
$ref: ./application/agents/delete.yml $ref: ./application/agents/delete.yml
# Agents
/api/v1/accounts/{account_id}/canned_responses:
parameters:
- $ref: '#/parameters/account_id'
get:
$ref: ./application/canned_responses/index.yml
post:
$ref: ./application/canned_responses/create.yml
/api/v1/accounts/{account_id}/canned_responses/{id}:
parameters:
- $ref: '#/parameters/account_id'
patch:
$ref: ./application/canned_responses/update.yml
delete:
$ref: ./application/canned_responses/delete.yml
# Contacts # Contacts
/api/v1/accounts/{account_id}/contacts: /api/v1/accounts/{account_id}/contacts:

View file

@ -1333,6 +1333,167 @@
} }
} }
}, },
"/api/v1/accounts/{account_id}/canned_responses": {
"parameters": [
{
"$ref": "#/parameters/account_id"
}
],
"get": {
"tags": [
"Canned Response"
],
"operationId": "get-account-canned-response",
"summary": "List all Canned Responses in an Account",
"description": "Get Details of Canned Responses in an Account",
"security": [
{
"userApiKey": [
]
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"description": "Array of all canned responses",
"items": {
"$ref": "#/definitions/canned_response"
}
}
},
"403": {
"description": "Access denied"
}
}
},
"post": {
"tags": [
"Canned Response"
],
"operationId": "add-new-canned-response-to-account",
"summary": "Add a New Canned Response",
"description": "Add a new Canned Response to Account",
"security": [
{
"userApiKey": [
]
}
],
"parameters": [
{
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/canned_response_create_update_payload"
}
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/canned_response"
}
},
"403": {
"description": "Access denied"
}
}
}
},
"/api/v1/accounts/{account_id}/canned_responses/{id}": {
"parameters": [
{
"$ref": "#/parameters/account_id"
}
],
"patch": {
"tags": [
"Canned Response"
],
"operationId": "update-canned-response-in-account",
"summary": "Update Canned Response in Account",
"description": "Update a Canned Response in Account",
"security": [
{
"userApiKey": [
]
}
],
"parameters": [
{
"in": "path",
"name": "id",
"type": "integer",
"required": true,
"description": "The ID of the canned response to be updated."
},
{
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/canned_response_create_update_payload"
}
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/canned_response"
}
},
"404": {
"description": "Agent not found"
},
"403": {
"description": "Access denied"
}
}
},
"delete": {
"tags": [
"Canned Response"
],
"operationId": "delete-canned-response-from-account",
"summary": "Remove a Canned Response from Account",
"description": "Remove a Canned Response from Account",
"security": [
{
"userApiKey": [
]
}
],
"parameters": [
{
"in": "path",
"name": "id",
"type": "integer",
"required": true,
"description": "The ID of the canned response to be deleted"
}
],
"responses": {
"200": {
"description": "Success"
},
"404": {
"description": "Canned Response not found"
},
"403": {
"description": "Access denied"
}
}
}
},
"/api/v1/accounts/{account_id}/contacts": { "/api/v1/accounts/{account_id}/contacts": {
"get": { "get": {
"tags": [ "tags": [
@ -3549,6 +3710,27 @@
} }
} }
}, },
"canned_response": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "ID of the canned response"
},
"content": {
"type": "string",
"description": "Message content for canned response"
},
"short_code": {
"type": "string",
"description": "Short Code for quick access of the canned response"
},
"account_id": {
"type": "integer",
"description": "Account Id"
}
}
},
"contact": { "contact": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -4196,6 +4378,19 @@
} }
} }
}, },
"canned_response_create_update_payload": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "Message content for canned response"
},
"short_code": {
"type": "string",
"description": "Short Code for quick access of the canned response"
}
}
},
"contact_create": { "contact_create": {
"type": "object", "type": "object",
"required": [ "required": [
@ -4894,6 +5089,7 @@
"tags": [ "tags": [
"Account AgentBots", "Account AgentBots",
"Agent", "Agent",
"Canned Response",
"Contact", "Contact",
"Conversation", "Conversation",
"Conversation Assignment", "Conversation Assignment",