2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2021-09-05 10:24:56 -07:00
2022-08-01 13:47:55 -07:00
import { LANGUAGES } from '../constants' ;
2021-09-05 10:24:56 -07:00
2021-12-03 00:44:16 -08:00
export const agentOperations : INodeProperties [ ] = [
2021-09-05 10:24:56 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-09-05 10:24:56 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create an agent' ,
2022-07-10 13:50:51 -07:00
action : 'Create an agent' ,
2021-09-05 10:24:56 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete an agent' ,
2022-07-10 13:50:51 -07:00
action : 'Delete an agent' ,
2021-09-05 10:24:56 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Retrieve an agent' ,
2022-07-10 13:50:51 -07:00
action : 'Get an agent' ,
2021-09-05 10:24:56 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-09-05 10:24:56 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Retrieve many agents' ,
2022-09-08 08:10:13 -07:00
action : 'Get many agents' ,
2021-09-05 10:24:56 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update an agent' ,
2022-07-10 13:50:51 -07:00
action : 'Update an agent' ,
2021-09-05 10:24:56 -07:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2021-09-05 10:24:56 -07:00
2021-12-03 00:44:16 -08:00
export const agentFields : INodeProperties [ ] = [
2021-09-05 10:24:56 -07:00
// ----------------------------------------
// agent: create
// ----------------------------------------
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2021-09-05 10:24:56 -07:00
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
operation : [ 'create' ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
} ,
{
displayName : 'First Name' ,
name : 'firstName' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
operation : [ 'create' ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
} ,
{
displayName : 'Roles' ,
name : 'roles' ,
description : 'Role to assign to the agent' ,
type : 'fixedCollection' ,
placeholder : 'Add Role' ,
typeOptions : {
multipleValues : true ,
} ,
required : true ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
operation : [ 'create' ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
options : [
{
displayName : 'Role Properties' ,
name : 'roleProperties' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Role Name or ID' ,
2021-09-05 10:24:56 -07:00
name : 'role' ,
2022-08-01 13:47:55 -07:00
description :
'Name of the role to assign to the agent. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-05 10:24:56 -07:00
type : 'options' ,
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getAgentRoles' ,
2021-09-05 10:24:56 -07:00
} ,
required : true ,
default : '' ,
} ,
{
displayName : 'Scope' ,
name : 'assignment_scope' ,
description : 'Scope in which the agent may use the permissions granted by the role' ,
type : 'options' ,
options : [
{
name : 'Entire Helpdesk' ,
value : 'entire_helpdesk' ,
} ,
{
name : 'Member Groups' ,
value : 'member_groups' ,
} ,
{
name : 'Specified Groups' ,
value : 'specified_groups' ,
} ,
{
name : 'Assigned Items' ,
value : 'assigned_items' ,
} ,
] ,
required : true ,
default : 'specified_groups' ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Group Names or IDs' ,
2021-09-05 10:24:56 -07:00
name : 'groups' ,
2022-08-01 13:47:55 -07:00
description :
'Groups in which the permissions granted by the role apply. Required only when Scope is Specified Groups - ignored otherwise. Choose from the list or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-05 10:24:56 -07:00
type : 'multiOptions' ,
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getAgentGroups' ,
2021-09-05 10:24:56 -07:00
} ,
default : [ ] ,
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
operation : [ 'create' ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
options : [
{
displayName : 'Address' ,
name : 'address' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Background Information' ,
name : 'background_information' ,
type : 'string' ,
default : '' ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Department Names or IDs' ,
2021-09-05 10:24:56 -07:00
name : 'department_ids' ,
type : 'multiOptions' ,
default : [ ] ,
2022-08-01 13:47:55 -07:00
description :
'IDs of the departments to which the agent belongs. Choose from the list or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-05 10:24:56 -07:00
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getDepartments' ,
2021-09-05 10:24:56 -07:00
} ,
} ,
{
displayName : 'Job Title' ,
name : 'job_title' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Language' ,
name : 'language' ,
type : 'options' ,
default : '' ,
options : LANGUAGES ,
} ,
{
displayName : 'Last Name' ,
name : 'last_name' ,
type : 'string' ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Location Name or ID' ,
2021-09-05 10:24:56 -07:00
name : 'location_id' ,
type : 'options' ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2021-09-05 10:24:56 -07:00
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getLocations' ,
2021-09-05 10:24:56 -07:00
} ,
} ,
{
2022-06-23 10:45:56 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-multi-options
displayName : 'Member of Group Names/IDs' ,
2021-09-05 10:24:56 -07:00
name : 'member_of' ,
type : 'multiOptions' ,
default : [ ] ,
2022-08-01 13:47:55 -07:00
description :
'Comma-separated IDs of the groups that the agent is a member of. Choose from the list or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-05 10:24:56 -07:00
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getAgentGroups' ,
2021-09-05 10:24:56 -07:00
} ,
} ,
{
displayName : 'Mobile Phone' ,
name : 'mobile_phone_number' ,
type : 'string' ,
default : '' ,
} ,
{
2022-06-23 10:45:56 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-multi-options
displayName : 'Observer of Group Names/IDs' ,
2021-09-05 10:24:56 -07:00
name : 'observer_of' ,
type : 'multiOptions' ,
default : [ ] ,
2022-08-01 13:47:55 -07:00
description :
'Comma-separated IDs of the groups that the agent is an observer of. Choose from the list or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-05 10:24:56 -07:00
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getAgentGroups' ,
2021-09-05 10:24:56 -07:00
} ,
} ,
{
displayName : 'Scoreboard Level ID' ,
name : 'scoreboard_level_id' ,
type : 'options' ,
description : 'ID of the level of the agent in the Arcade' ,
default : 1 ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
2021-09-05 10:24:56 -07:00
options : [
{
name : 'Beginner' ,
value : 1 ,
} ,
{
name : 'Intermediate' ,
value : 2 ,
} ,
{
name : 'Professional' ,
value : 3 ,
} ,
{
name : 'Expert' ,
value : 4 ,
} ,
{
name : 'Master' ,
value : 5 ,
} ,
{
name : 'Guru' ,
value : 6 ,
} ,
] ,
} ,
{
displayName : 'Time Format' ,
name : 'time_format' ,
type : 'options' ,
default : '12h' ,
options : [
{
name : '12-Hour Format' ,
value : '12h' ,
} ,
{
name : '24-Hour Format' ,
value : '24h' ,
} ,
] ,
} ,
{
displayName : 'Work Phone' ,
name : 'work_phone_number' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
// ----------------------------------------
// agent: delete
// ----------------------------------------
{
displayName : 'Agent ID' ,
name : 'agentId' ,
description : 'ID of the agent to delete' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
operation : [ 'delete' ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
} ,
// ----------------------------------------
// agent: get
// ----------------------------------------
{
displayName : 'Agent ID' ,
name : 'agentId' ,
description : 'ID of the agent to retrieve' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
operation : [ 'get' ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
} ,
// ----------------------------------------
// agent: getAll
// ----------------------------------------
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
default : false ,
description : 'Whether to return all results or only up to a given limit' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
operation : [ 'getAll' ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2021-09-05 10:24:56 -07:00
typeOptions : {
minValue : 1 ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
} ,
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
operation : [ 'getAll' ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Department Name or ID' ,
2021-09-05 10:24:56 -07:00
name : 'department_id' ,
type : 'options' ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'ID of the department to which the agent belongs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-05 10:24:56 -07:00
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getDepartments' ,
2021-09-05 10:24:56 -07:00
} ,
} ,
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2021-09-05 10:24:56 -07:00
default : '' ,
} ,
{
displayName : 'First Name' ,
name : 'first_name' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Job Title' ,
name : 'job_title' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Language' ,
name : 'language' ,
type : 'options' ,
default : '' ,
options : LANGUAGES ,
} ,
{
displayName : 'Last Name' ,
name : 'last_name' ,
type : 'string' ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Location Name or ID' ,
2021-09-05 10:24:56 -07:00
name : 'location_id' ,
type : 'options' ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'Choose from the list or specify an ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-05 10:24:56 -07:00
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getLocations' ,
2021-09-05 10:24:56 -07:00
} ,
} ,
{
displayName : 'Mobile Phone Number' ,
name : 'mobile_phone_number' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Work Phone Number' ,
name : 'work_phone_number' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
// ----------------------------------------
// agent: update
// ----------------------------------------
{
displayName : 'Agent ID' ,
name : 'agentId' ,
description : 'ID of the agent to update' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
operation : [ 'update' ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'agent' ] ,
operation : [ 'update' ] ,
2021-09-05 10:24:56 -07:00
} ,
} ,
options : [
{
displayName : 'Address' ,
name : 'address' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Background Information' ,
name : 'background_information' ,
type : 'string' ,
default : '' ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Department Names or IDs' ,
2021-09-05 10:24:56 -07:00
name : 'department_ids' ,
type : 'multiOptions' ,
default : [ ] ,
2022-08-01 13:47:55 -07:00
description :
'IDs of the departments to which the agent belongs. Choose from the list or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-05 10:24:56 -07:00
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getDepartments' ,
2021-09-05 10:24:56 -07:00
} ,
} ,
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2021-09-05 10:24:56 -07:00
default : '' ,
} ,
{
displayName : 'First Name' ,
name : 'first_name' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Job Title' ,
name : 'job_title' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Language' ,
name : 'language' ,
type : 'options' ,
default : '' ,
options : LANGUAGES ,
} ,
{
displayName : 'Last Name' ,
name : 'last_name' ,
type : 'string' ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Location Name or ID' ,
2021-09-05 10:24:56 -07:00
name : 'location_id' ,
type : 'options' ,
default : '' ,
2022-08-01 13:47:55 -07:00
description :
'Choose from the list or specify an ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-05 10:24:56 -07:00
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getLocations' ,
2021-09-05 10:24:56 -07:00
} ,
} ,
{
2022-06-23 10:45:56 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-multi-options
displayName : 'Member of Group Names/IDs' ,
2021-09-05 10:24:56 -07:00
name : 'member_of' ,
type : 'multiOptions' ,
default : [ ] ,
2022-08-01 13:47:55 -07:00
description :
'Comma-separated IDs of the groups that the agent is a member of. Choose from the list or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-05 10:24:56 -07:00
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getAgentGroups' ,
2021-09-05 10:24:56 -07:00
} ,
} ,
{
displayName : 'Mobile Phone' ,
name : 'mobile_phone_number' ,
type : 'string' ,
default : '' ,
} ,
{
2022-06-23 10:45:56 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-multi-options
displayName : 'Observer of Group Names/IDs' ,
2021-09-05 10:24:56 -07:00
name : 'observer_of' ,
type : 'multiOptions' ,
default : [ ] ,
2022-08-01 13:47:55 -07:00
description :
'Comma-separated IDs of the groups that the agent is an observer of. Choose from the list or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-05 10:24:56 -07:00
typeOptions : {
2021-12-03 00:44:16 -08:00
loadOptionsMethod : 'getAgentGroups' ,
2021-09-05 10:24:56 -07:00
} ,
} ,
{
displayName : 'Scoreboard Level ID' ,
name : 'scoreboard_level_id' ,
type : 'options' ,
description : 'ID of the level of the agent in the Arcade' ,
default : 1 ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
2021-09-05 10:24:56 -07:00
options : [
{
name : 'Beginner' ,
value : 1 ,
} ,
{
name : 'Intermediate' ,
value : 2 ,
} ,
{
name : 'Professional' ,
value : 3 ,
} ,
{
name : 'Expert' ,
value : 4 ,
} ,
{
name : 'Master' ,
value : 5 ,
} ,
{
name : 'Guru' ,
value : 6 ,
} ,
] ,
} ,
{
displayName : 'Time Format' ,
name : 'time_format' ,
type : 'options' ,
default : '12h' ,
options : [
{
name : '12-Hour Format' ,
value : '12h' ,
} ,
{
name : '24-Hour Format' ,
value : '24h' ,
} ,
] ,
} ,
{
displayName : 'Work Phone' ,
name : 'work_phone_number' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;