feat: Add live agent load report api (#4297)

This change allows the admin user to fetch conversation metrics for an account, agents, and filter conversation metrics for a specific agent.

Fixes #4305
This commit is contained in:
Aswin Dev P.S
2022-03-29 10:31:52 +05:30
committed by GitHub
parent ccf52a620b
commit 5e8fd689c9
14 changed files with 455 additions and 119 deletions

View File

@@ -149,10 +149,11 @@ extended_message:
- $ref: ./resource/extension/message/with_source_sender.yml
## report list
report:
type: array
description: 'array of conversation count based on date'
items:
allOf:
- $ref: './resource/report.yml'
## report
account_summary:
$ref: './resource/reports/summary.yml'
agent_conversation_metrics:
$ref: './resource/reports/conversation/agent.yml'

View File

@@ -0,0 +1,18 @@
type: object
properties:
user:
type: object
properties:
id:
type: number
name:
type: string
thumbnail:
type: string
metric:
type: object
properties:
open:
type: number
unattended:
type: number

View File

@@ -0,0 +1,23 @@
tags:
- Reports
operationId: get-account-conversation-metrics
summary: Account Conversation Metrics
description: Get conversation metrics for Account
responses:
200:
description: Success
schema:
type: object
description: 'Object of account conversation metrics'
properties:
open:
type: number
unattended:
type: number
unassigned:
type: number
404:
description: reports not found
403:
description: Access denied

View File

@@ -0,0 +1,18 @@
tags:
- Reports
operationId: get-agent-conversation-metrics
summary: Agent Conversation Metrics
description: Get conversation metrics for Agent
responses:
200:
description: Success
schema:
type: array
description: 'Array of agent based conversation metrics'
items:
$ref: '#/definitions/agent_conversation_metrics'
404:
description: reports not found
403:
description: Access denied

View File

@@ -10,7 +10,12 @@ responses:
type: array
description: 'Array of date based conversation statistics'
items:
$ref: '#/definitions/report'
type: object
properties:
value:
type: string
timestamp:
type: number
404:
description: reports not found
403:

View File

@@ -7,10 +7,8 @@ responses:
200:
description: Success
schema:
type: array
description: 'Array of date based conversation statistics'
items:
$ref: '#/definitions/report'
description: 'Object of summary metrics'
$ref: '#/definitions/account_summary'
404:
description: reports not found
403:

View File

@@ -391,3 +391,35 @@
description: The timestamp from where report should stop.
get:
$ref: './application/reports/summary.yml'
# Conversation metrics for account
/api/v2/accounts/{account_id}/reports/conversations:
parameters:
- $ref: '#/parameters/account_id'
- in: query
name: type
type: string
enum:
- account
required: true
description: Type of report
get:
$ref: './application/reports/conversation/account.yml'
# Conversation metrics for agent
/api/v2/accounts/{account_id}/reports/conversations/:
parameters:
- $ref: '#/parameters/account_id'
- in: query
name: type
type: string
enum:
- agent
required: true
description: Type of report
- in: query
name: user_id
type: string
description: The numeric ID of the user
get:
$ref: './application/reports/conversation/agent.yml'

View File

@@ -3604,7 +3604,15 @@
"type": "array",
"description": "Array of date based conversation statistics",
"items": {
"$ref": "#/definitions/report"
"type": "object",
"properties": {
"value": {
"type": "string"
},
"timestamp": {
"type": "number"
}
}
}
}
},
@@ -3651,14 +3659,110 @@
"operationId": "list-all-conversation-statistics-summary",
"summary": "Get Account reports summary",
"description": "Get Account reports summary for a specific type and date range",
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/account_summary"
}
},
"404": {
"description": "reports not found"
},
"403": {
"description": "Access denied"
}
}
}
},
"/api/v2/accounts/{account_id}/reports/conversations": {
"parameters": [
{
"$ref": "#/parameters/account_id"
},
{
"in": "query",
"name": "type",
"type": "string",
"enum": [
"account"
],
"required": true,
"description": "Type of report"
}
],
"get": {
"tags": [
"Reports"
],
"operationId": "get-account-conversation-metrics",
"summary": "Account Conversation Metrics",
"description": "Get conversation metrics for Account",
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "object",
"description": "Object of account conversation metrics",
"properties": {
"open": {
"type": "number"
},
"unattended": {
"type": "number"
},
"unassigned": {
"type": "number"
}
}
}
},
"404": {
"description": "reports not found"
},
"403": {
"description": "Access denied"
}
}
}
},
"/api/v2/accounts/{account_id}/reports/conversations/": {
"parameters": [
{
"$ref": "#/parameters/account_id"
},
{
"in": "query",
"name": "type",
"type": "string",
"enum": [
"agent"
],
"required": true,
"description": "Type of report"
},
{
"in": "query",
"name": "user_id",
"type": "string",
"description": "The numeric ID of the user"
}
],
"get": {
"tags": [
"Reports"
],
"operationId": "get-agent-conversation-metrics",
"summary": "Agent Conversation Metrics",
"description": "Get conversation metrics for Agent",
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"description": "Array of date based conversation statistics",
"description": "Array of agent based conversation metrics",
"items": {
"$ref": "#/definitions/report"
"$ref": "#/definitions/agent_conversation_metrics"
}
}
},
@@ -4879,58 +4983,80 @@
}
]
},
"report": {
"type": "array",
"description": "array of conversation count based on date",
"items": {
"allOf": [
{
"type": "object",
"properties": {
"avg_first_response_time": {
"type": "string"
},
"avg_resolution_time": {
"type": "string"
},
"conversations_count": {
"type": "number"
},
"incoming_messages_count": {
"type": "number"
},
"outgoing_messages_count": {
"type": "number"
},
"resolutions_count": {
"type": "number"
},
"previous": {
"type": "object",
"properties": {
"avg_first_response_time": {
"type": "string"
},
"avg_resolution_time": {
"type": "string"
},
"conversations_count": {
"type": "number"
},
"incoming_messages_count": {
"type": "number"
},
"outgoing_messages_count": {
"type": "number"
},
"resolutions_count": {
"type": "number"
}
}
}
"account_summary": {
"type": "object",
"properties": {
"avg_first_response_time": {
"type": "string"
},
"avg_resolution_time": {
"type": "string"
},
"conversations_count": {
"type": "number"
},
"incoming_messages_count": {
"type": "number"
},
"outgoing_messages_count": {
"type": "number"
},
"resolutions_count": {
"type": "number"
},
"previous": {
"type": "object",
"properties": {
"avg_first_response_time": {
"type": "string"
},
"avg_resolution_time": {
"type": "string"
},
"conversations_count": {
"type": "number"
},
"incoming_messages_count": {
"type": "number"
},
"outgoing_messages_count": {
"type": "number"
},
"resolutions_count": {
"type": "number"
}
}
]
}
}
},
"agent_conversation_metrics": {
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"name": {
"type": "string"
},
"thumbnail": {
"type": "string"
}
}
},
"metric": {
"type": "object",
"properties": {
"open": {
"type": "number"
},
"unattended": {
"type": "number"
}
}
}
}
}
},