first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import type { EmployeeProperties } from '../../Interfaces';
|
||||
|
||||
export const employeeGetDescription: EmployeeProperties = [
|
||||
{
|
||||
displayName: 'Employee ID',
|
||||
name: 'employeeId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['get'],
|
||||
resource: ['employee'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['get'],
|
||||
resource: ['employee'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Field Names or IDs',
|
||||
name: 'fields',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getEmployeeFields',
|
||||
},
|
||||
default: ['all'],
|
||||
description:
|
||||
'Set of fields to get from employee data. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function get(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
const body: IDataObject = {};
|
||||
const requestMethod = 'GET';
|
||||
|
||||
//meta data
|
||||
const id = this.getNodeParameter('employeeId', index) as string;
|
||||
|
||||
//query parameters
|
||||
let fields = this.getNodeParameter('options.fields', index, ['all']) as string[];
|
||||
|
||||
if (fields.includes('all')) {
|
||||
const { fields: allFields } = await apiRequest.call(
|
||||
this,
|
||||
requestMethod,
|
||||
'employees/directory',
|
||||
body,
|
||||
);
|
||||
fields = allFields.map((field: IDataObject) => field.id);
|
||||
}
|
||||
|
||||
//endpoint
|
||||
const endpoint = `employees/${id}?fields=${fields}`;
|
||||
|
||||
//response
|
||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, body);
|
||||
|
||||
//return
|
||||
return this.helpers.returnJsonArray(responseData as IDataObject[]);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { employeeGetDescription as description } from './description';
|
||||
import { get as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
Reference in New Issue
Block a user