feat: Add APIs to create custom views on the dashboard (#2498)
This commit is contained in:
@@ -28,6 +28,8 @@ contact_inboxes:
|
||||
$ref: ./resource/contact_inboxes.yml
|
||||
contactable_inboxes:
|
||||
$ref: ./resource/contactable_inboxes.yml
|
||||
custom_filter:
|
||||
$ref: ./resource/custom_filter.yml
|
||||
account:
|
||||
$ref: ./resource/account.yml
|
||||
platform_account:
|
||||
@@ -74,6 +76,10 @@ conversation_message_create:
|
||||
team_create_update_payload:
|
||||
$ref: ./request/team/create_update_payload.yml
|
||||
|
||||
# Custom Filter request Payload
|
||||
custom_filter_create_update_payload:
|
||||
$ref: ./request/custom_filter/create_update_payload.yml
|
||||
|
||||
integrations_hook_create_payload:
|
||||
$ref: ./request/integrations/hook_create_payload.yml
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: The name of the custom filter
|
||||
type:
|
||||
type: string
|
||||
enum: ["conversation", "contact", "report"]
|
||||
description: The description about the custom filter
|
||||
query:
|
||||
type: object
|
||||
description: A query that needs to be saved as a custom filter
|
||||
21
swagger/definitions/resource/custom_filter.yml
Normal file
21
swagger/definitions/resource/custom_filter.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: number
|
||||
description: The ID of the custom filter
|
||||
name:
|
||||
type: string
|
||||
description: The name of the custom filter
|
||||
type:
|
||||
type: string
|
||||
enum: ["conversation", "contact", "report"]
|
||||
description: The description about the custom filter
|
||||
query:
|
||||
type: object
|
||||
description: A query that needs to be saved as a custom filter
|
||||
created_at:
|
||||
type: datetime
|
||||
description: The time at which the custom filter was created
|
||||
updated_at:
|
||||
type: datetime
|
||||
description: The time at which the custom filter was updated
|
||||
@@ -10,7 +10,7 @@ info:
|
||||
name: MIT License
|
||||
url: https://opensource.org/licenses/MIT
|
||||
host: app.chatwoot.com
|
||||
basePath:
|
||||
basePath:
|
||||
schemes:
|
||||
- https
|
||||
produces:
|
||||
@@ -62,8 +62,9 @@ x-tagGroups:
|
||||
- Integrations
|
||||
- Profile
|
||||
- Teams
|
||||
- Custom Filter
|
||||
- name: Public
|
||||
tags:
|
||||
tags:
|
||||
- Contacts API
|
||||
- Conversations API
|
||||
- Messages API
|
||||
- Messages API
|
||||
|
||||
6
swagger/parameters/custom_filter_id.yml
Normal file
6
swagger/parameters/custom_filter_id.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
in: path
|
||||
name: custom_filter_id
|
||||
schema:
|
||||
type: integer
|
||||
required: true
|
||||
description: The numeric ID of the custom filter
|
||||
@@ -28,9 +28,11 @@ page:
|
||||
platform_user_id:
|
||||
$ref: ./platform_user_id.yml
|
||||
|
||||
custom_filter_id:
|
||||
$ref: ./custom_filter_id.yml
|
||||
|
||||
public_inbox_identifier:
|
||||
$ref: ./public/inbox_identifier.yml
|
||||
|
||||
public_contact_identifier:
|
||||
$ref: ./public/contact_identifier.yml
|
||||
$ref: ./public/contact_identifier.yml
|
||||
|
||||
19
swagger/paths/custom_filters/create.yml
Normal file
19
swagger/paths/custom_filters/create.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
tags:
|
||||
- Custom Filter
|
||||
operationId: create-a-custom-filter
|
||||
summary: Create a custom filter
|
||||
description: Create a custom filter in the account
|
||||
parameters:
|
||||
- $ref: '#/parameters/account_id'
|
||||
- name: data
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/custom_filter_create_update_payload'
|
||||
responses:
|
||||
200:
|
||||
description: Success
|
||||
schema:
|
||||
$ref: '#/definitions/custom_filter'
|
||||
401:
|
||||
description: Unauthorized
|
||||
12
swagger/paths/custom_filters/delete.yml
Normal file
12
swagger/paths/custom_filters/delete.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
tags:
|
||||
- Custom Filter
|
||||
operationId: delete-a-custom-filter
|
||||
summary: Delete a custom filter
|
||||
description: Delete a custom filter from the account
|
||||
responses:
|
||||
200:
|
||||
description: Success
|
||||
401:
|
||||
description: Unauthorized
|
||||
404:
|
||||
description: The custom filter does not exist in the account
|
||||
15
swagger/paths/custom_filters/index.yml
Normal file
15
swagger/paths/custom_filters/index.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
tags:
|
||||
- Custom Filter
|
||||
operationId: list-all-filters
|
||||
summary: List all custom filters
|
||||
description: List all custom filters in a category of a user
|
||||
responses:
|
||||
200:
|
||||
description: Success
|
||||
schema:
|
||||
type: array
|
||||
description: 'Array of custom filters'
|
||||
items:
|
||||
$ref: '#/definitions/custom_filter'
|
||||
401:
|
||||
description: Unauthorized
|
||||
14
swagger/paths/custom_filters/show.yml
Normal file
14
swagger/paths/custom_filters/show.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
tags:
|
||||
- Custom Filter
|
||||
operationId: get-details-of-a-single-custom-filter
|
||||
summary: Get a custom filter details
|
||||
description: Get the details of a custom filter in the account
|
||||
responses:
|
||||
200:
|
||||
description: Success
|
||||
schema:
|
||||
$ref: '#/definitions/custom_filter'
|
||||
401:
|
||||
description: Unauthorized
|
||||
404:
|
||||
description: The given team ID does not exist in the account
|
||||
18
swagger/paths/custom_filters/update.yml
Normal file
18
swagger/paths/custom_filters/update.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
tags:
|
||||
- Custom Filter
|
||||
operationId: update-a-custom-filter
|
||||
summary: Update a custom filter
|
||||
description: Update a custom filter's attributes
|
||||
parameters:
|
||||
- name: data
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/custom_filter_create_update_payload'
|
||||
responses:
|
||||
200:
|
||||
description: Success
|
||||
schema:
|
||||
$ref: '#/definitions/custom_filter'
|
||||
401:
|
||||
description: Unauthorized
|
||||
@@ -92,7 +92,7 @@ public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversat
|
||||
- $ref: '#/parameters/public_contact_identifier'
|
||||
post:
|
||||
$ref: ./public/inboxes/conversations/create.yml
|
||||
get:
|
||||
get:
|
||||
$ref: ./public/inboxes/conversations/index.yml
|
||||
|
||||
public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages:
|
||||
@@ -102,7 +102,7 @@ public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversat
|
||||
- $ref: '#/parameters/conversation_id'
|
||||
post:
|
||||
$ref: ./public/inboxes/messages/create.yml
|
||||
get:
|
||||
get:
|
||||
$ref: ./public/inboxes/messages/index.yml
|
||||
public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages/{message_id}:
|
||||
parameters:
|
||||
@@ -264,3 +264,31 @@ public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversat
|
||||
$ref: ./teams/update.yml
|
||||
delete:
|
||||
$ref: ./teams/delete.yml
|
||||
|
||||
### Custom Filters
|
||||
|
||||
# Teams
|
||||
/api/v1/accounts/{account_id}/custom_filters:
|
||||
parameters:
|
||||
- $ref: '#/parameters/account_id'
|
||||
- in: query
|
||||
name: filter_type
|
||||
schema:
|
||||
type: string
|
||||
enum: ['conversation', 'contact', 'report']
|
||||
required: false
|
||||
description: The type of custom filter
|
||||
get:
|
||||
$ref: ./custom_filters/index.yml
|
||||
post:
|
||||
$ref: ./custom_filters/create.yml
|
||||
/api/v1/accounts/{account_id}/custom_filters/{custom_filter_id}:
|
||||
parameters:
|
||||
- $ref: '#/parameters/account_id'
|
||||
- $ref: '#/parameters/custom_filter_id'
|
||||
get:
|
||||
$ref: './custom_filters/show.yml'
|
||||
patch:
|
||||
$ref: ./custom_filters/update.yml
|
||||
delete:
|
||||
$ref: ./custom_filters/delete.yml
|
||||
|
||||
@@ -2527,6 +2527,162 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/accounts/{account_id}/custom_filters": {
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/parameters/account_id"
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "filter_type",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"conversation",
|
||||
"contact",
|
||||
"report"
|
||||
]
|
||||
},
|
||||
"required": false,
|
||||
"description": "The type of custom filter"
|
||||
}
|
||||
],
|
||||
"get": {
|
||||
"tags": [
|
||||
"Custom Filter"
|
||||
],
|
||||
"operationId": "list-all-filters",
|
||||
"summary": "List all custom filters",
|
||||
"description": "List all custom filters in a category of a user",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"description": "Array of custom filters",
|
||||
"items": {
|
||||
"$ref": "#/definitions/custom_filter"
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"tags": [
|
||||
"Custom Filter"
|
||||
],
|
||||
"operationId": "create-a-custom-filter",
|
||||
"summary": "Create a custom filter",
|
||||
"description": "Create a custom filter in the account",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/parameters/account_id"
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/custom_filter_create_update_payload"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/custom_filter"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/accounts/{account_id}/custom_filters/{custom_filter_id}": {
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/parameters/account_id"
|
||||
},
|
||||
{
|
||||
"$ref": "#/parameters/custom_filter_id"
|
||||
}
|
||||
],
|
||||
"get": {
|
||||
"tags": [
|
||||
"Custom Filter"
|
||||
],
|
||||
"operationId": "get-details-of-a-single-custom-filter",
|
||||
"summary": "Get a custom filter details",
|
||||
"description": "Get the details of a custom filter in the account",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/custom_filter"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
},
|
||||
"404": {
|
||||
"description": "The given team ID does not exist in the account"
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"tags": [
|
||||
"Custom Filter"
|
||||
],
|
||||
"operationId": "update-a-custom-filter",
|
||||
"summary": "Update a custom filter",
|
||||
"description": "Update a custom filter's attributes",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/custom_filter_create_update_payload"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/custom_filter"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": [
|
||||
"Custom Filter"
|
||||
],
|
||||
"operationId": "delete-a-custom-filter",
|
||||
"summary": "Delete a custom filter",
|
||||
"description": "Delete a custom filter from the account",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
},
|
||||
"404": {
|
||||
"description": "The custom filter does not exist in the account"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
@@ -2846,6 +3002,40 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"custom_filter": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"description": "The ID of the custom filter"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "The name of the custom filter"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"conversation",
|
||||
"contact",
|
||||
"report"
|
||||
],
|
||||
"description": "The description about the custom filter"
|
||||
},
|
||||
"query": {
|
||||
"type": "object",
|
||||
"description": "A query that needs to be saved as a custom filter"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "datetime",
|
||||
"description": "The time at which the custom filter was created"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "datetime",
|
||||
"description": "The time at which the custom filter was updated"
|
||||
}
|
||||
}
|
||||
},
|
||||
"account": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3191,6 +3381,28 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"custom_filter_create_update_payload": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "The name of the custom filter"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"conversation",
|
||||
"contact",
|
||||
"report"
|
||||
],
|
||||
"description": "The description about the custom filter"
|
||||
},
|
||||
"query": {
|
||||
"type": "object",
|
||||
"description": "A query that needs to be saved as a custom filter"
|
||||
}
|
||||
}
|
||||
},
|
||||
"integrations_hook_create_payload": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3643,6 +3855,15 @@
|
||||
"required": true,
|
||||
"description": "The numeric ID of the user on the platform"
|
||||
},
|
||||
"custom_filter_id": {
|
||||
"in": "path",
|
||||
"name": "custom_filter_id",
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"required": true,
|
||||
"description": "The numeric ID of the custom filter"
|
||||
},
|
||||
"public_inbox_identifier": {
|
||||
"in": "path",
|
||||
"name": "inbox_identifier",
|
||||
@@ -3684,7 +3905,8 @@
|
||||
"Messages",
|
||||
"Integrations",
|
||||
"Profile",
|
||||
"Teams"
|
||||
"Teams",
|
||||
"Custom Filter"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user