mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
🔀 Merge pull request #510 from RicardoE105/feature/pagerduty
⚡ Added get user by id
This commit is contained in:
commit
c18742e69e
|
@ -32,6 +32,11 @@ import {
|
|||
logEntryOperations,
|
||||
} from './LogEntryDescription';
|
||||
|
||||
import {
|
||||
userFields,
|
||||
userOperations,
|
||||
} from './UserDescription';
|
||||
|
||||
import {
|
||||
IIncident,
|
||||
} from './IncidentInterface';
|
||||
|
@ -81,6 +86,10 @@ export class PagerDuty implements INodeType {
|
|||
name: 'Log Entry',
|
||||
value: 'logEntry',
|
||||
},
|
||||
{
|
||||
name: 'User',
|
||||
value: 'user',
|
||||
},
|
||||
],
|
||||
default: 'incident',
|
||||
description: 'Resource to consume.',
|
||||
|
@ -94,6 +103,9 @@ export class PagerDuty implements INodeType {
|
|||
// LOG ENTRY
|
||||
...logEntryOperations,
|
||||
...logEntryFields,
|
||||
// USER
|
||||
...userOperations,
|
||||
...userFields,
|
||||
],
|
||||
};
|
||||
|
||||
|
@ -350,6 +362,14 @@ export class PagerDuty implements INodeType {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (resource === 'user') {
|
||||
//https://developer.pagerduty.com/api-reference/reference/REST/openapiv3.json/paths/~1users~1%7Bid%7D/get
|
||||
if (operation === 'get') {
|
||||
const userId = this.getNodeParameter('userId', i) as string;
|
||||
responseData = await pagerDutyApiRequest.call(this, 'GET', `/users/${userId}`);
|
||||
responseData = responseData.user;
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
|
|
51
packages/nodes-base/nodes/PagerDuty/UserDescription.ts
Normal file
51
packages/nodes-base/nodes/PagerDuty/UserDescription.ts
Normal file
|
@ -0,0 +1,51 @@
|
|||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const userOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a user',
|
||||
},
|
||||
],
|
||||
default: 'get',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const userFields = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
]
|
||||
},
|
||||
},
|
||||
description: 'Unique identifier for the user.',
|
||||
},
|
||||
] as INodeProperties[];
|
Loading…
Reference in a new issue