mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
feat: add get person by email to Copper
Copper 'Person' is more conveniently fetched by email (a unique key) in most workflows. Add a getPersonByEmail via https://developer.copper.com/people/fetch-a-person-by-email.html
This commit is contained in:
parent
c08d23c00f
commit
fd7417d8b0
|
@ -422,6 +422,23 @@ export class Copper implements INodeType {
|
||||||
const personId = this.getNodeParameter('personId', i);
|
const personId = this.getNodeParameter('personId', i);
|
||||||
|
|
||||||
responseData = await copperApiRequest.call(this, 'GET', `/people/${personId}`);
|
responseData = await copperApiRequest.call(this, 'GET', `/people/${personId}`);
|
||||||
|
} else if (operation === 'getByEmail') {
|
||||||
|
// ----------------------------------------
|
||||||
|
// person: getByEmail
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
// https://developer.copper.com/people/fetch-a-person-by-email.html
|
||||||
|
|
||||||
|
const body: IDataObject = {
|
||||||
|
email: this.getNodeParameter('personEmail', i),
|
||||||
|
};
|
||||||
|
|
||||||
|
responseData = await copperApiRequest.call(
|
||||||
|
this,
|
||||||
|
'POST',
|
||||||
|
'/people/fetch_by_email',
|
||||||
|
body,
|
||||||
|
);
|
||||||
} else if (operation === 'getAll') {
|
} else if (operation === 'getAll') {
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
// person: getAll
|
// person: getAll
|
||||||
|
|
|
@ -33,6 +33,11 @@ export const personOperations: INodeProperties[] = [
|
||||||
value: 'get',
|
value: 'get',
|
||||||
action: 'Get a person',
|
action: 'Get a person',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'GetByEmail',
|
||||||
|
value: 'getByEmail',
|
||||||
|
action: 'Get a person by email',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Get Many',
|
name: 'Get Many',
|
||||||
value: 'getAll',
|
value: 'getAll',
|
||||||
|
@ -134,6 +139,24 @@ export const personFields: INodeProperties[] = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// person: getByEmail
|
||||||
|
// ----------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Person Email',
|
||||||
|
name: 'personEmail',
|
||||||
|
description: 'Email of the person to retrieve',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: ['person'],
|
||||||
|
operation: ['getByEmail'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
// person: getAll
|
// person: getAll
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue