Skip to content

Commit f1fdb91

Browse files
Merge branch 'master' into 15748-getty-images
2 parents 680861a + b049cf5 commit f1fdb91

13 files changed

Lines changed: 121 additions & 10 deletions

File tree

components/google_contacts/actions/create-contact/create-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "google_contacts-create-contact",
66
name: "Create Contact",
77
description: "Creates a contact. [See the documentation](https://developers.google.com/people/api/rest/v1/people/createContact)",
8-
version: "0.1.2",
8+
version: "0.1.3",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,

components/google_contacts/actions/delete-contact/delete-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "google_contacts-delete-contact",
66
name: "Delete Contact",
77
description: "Deletes a contact. [See the documentation](https://developers.google.com/people/api/rest/v1/people/deleteContact)",
8-
version: "0.0.6",
8+
version: "0.0.7",
99
annotations: {
1010
destructiveHint: true,
1111
openWorldHint: true,

components/google_contacts/actions/get-contact/get-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "google_contacts-get-contact",
66
name: "Get Contact",
77
description: "Get information about a contact. [See the documentation](https://developers.google.com/people/api/rest/v1/people/get)",
8-
version: "0.0.6",
8+
version: "0.0.7",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,

components/google_contacts/actions/list-contacts/list-contacts.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "google_contacts-list-contacts",
77
name: "List Contacts",
88
description: "Lists all contacts of the authenticated user. [See the documentation](https://developers.google.com/people/api/rest/v1/people.connections/list)",
9-
version: "0.0.7",
9+
version: "0.0.8",
1010
annotations: {
1111
destructiveHint: false,
1212
openWorldHint: true,
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import common from "../common/base.mjs";
2+
import constants from "../../common/constants.mjs";
3+
4+
export default {
5+
...common,
6+
key: "google_contacts-list-directory-contacts",
7+
name: "List Directory Contacts",
8+
description: "Lists contacts from the Google Workspace directory (domain contacts). Use this to search directory profiles and domain shared contacts, as opposed to the user's personal contacts. Requires directory.readonly OAuth scope. Returns names, email addresses, phone numbers, and other fields specified in the read mask. [See the documentation](https://developers.google.com/people/api/rest/v1/people/listDirectoryPeople)",
9+
version: "0.0.1",
10+
annotations: {
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
readOnlyHint: true,
14+
},
15+
type: "action",
16+
props: {
17+
...common.props,
18+
fields: {
19+
propDefinition: [
20+
common.props.googleContacts,
21+
"fields",
22+
],
23+
},
24+
source: {
25+
type: "string",
26+
label: "Source",
27+
description: "Directory source to return",
28+
options: constants.SOURCE_OPTIONS,
29+
},
30+
mergeSources: {
31+
type: "string[]",
32+
label: "Merge Sources",
33+
description: "Optional. Additional data to merge into the directory sources if they are connected through verified join keys such as email addresses or phone numbers.",
34+
options: constants.MERGE_SOURCE_OPTIONS,
35+
optional: true,
36+
},
37+
pageSize: {
38+
type: "integer",
39+
label: "Page Size",
40+
description: "Optional. The number of people to include in the response. Valid values are between 1 and 1000, inclusive. Defaults to 100 if not set",
41+
optional: true,
42+
default: 100,
43+
min: 1,
44+
max: 1000,
45+
},
46+
pageToken: {
47+
type: "string",
48+
label: "Page Token",
49+
description: "Optional. A page token, received from a previous response nextPageToken. Provide this to retrieve the subsequent page.",
50+
optional: true,
51+
},
52+
requestSyncToken: {
53+
type: "boolean",
54+
label: "Request Sync Token",
55+
description: "Optional. Whether the response should return nextSyncToken. It can be used to get incremental changes since the last request by setting it on the request syncToken.",
56+
optional: true,
57+
},
58+
syncToken: {
59+
type: "string",
60+
label: "Sync Token",
61+
description: "Optional. A sync token, received from a previous response nextSyncToken Provide this to retrieve only the resources changed since the last request.",
62+
optional: true,
63+
},
64+
},
65+
methods: {
66+
async processResults(client) {
67+
const params = {
68+
readMask: this.fields.join(),
69+
sources: this.source,
70+
mergeSources: this.mergeSources?.join(),
71+
pageSize: this.pageSize,
72+
pageToken: this.pageToken,
73+
requestSyncToken: this.requestSyncToken,
74+
syncToken: this.syncToken,
75+
};
76+
77+
const response = await this.googleContacts.listDirectoryContacts(client, params);
78+
return response;
79+
},
80+
emitSummary($, response) {
81+
const count = Array.isArray(response)
82+
? response.length
83+
: (response?.people?.length ?? 0);
84+
$.export("$summary", `Successfully retrieved ${count} directory contacts`);
85+
},
86+
},
87+
};

components/google_contacts/actions/update-contact/update-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "google_contacts-update-contact",
66
name: "Update Contact",
77
description: "Updates a contact. [See the documentation](https://developers.google.com/people/api/rest/v1/people/updateContact)",
8-
version: "0.1.2",
8+
version: "0.1.3",
99
annotations: {
1010
destructiveHint: true,
1111
openWorldHint: true,

components/google_contacts/common/constants.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,24 @@ export default {
4949
"metadata",
5050
"name",
5151
],
52+
SOURCE_OPTIONS: [
53+
{
54+
label: "Google Workspace domain shared contact",
55+
value: "DIRECTORY_SOURCE_TYPE_DOMAIN_CONTACT",
56+
},
57+
{
58+
label: "Google Workspace domain profile",
59+
value: "DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE",
60+
},
61+
],
62+
MERGE_SOURCE_OPTIONS: [
63+
{
64+
label: "Unspecified",
65+
value: "DIRECTORY_MERGE_SOURCE_TYPE_UNSPECIFIED",
66+
},
67+
{
68+
label: "User owned contact",
69+
value: "DIRECTORY_MERGE_SOURCE_TYPE_CONTACT",
70+
},
71+
],
5272
};

components/google_contacts/google_contacts.app.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ export default {
7979
const { data } = await client.people.connections.list(params);
8080
return data;
8181
},
82+
async listDirectoryContacts(client, params) {
83+
const { data } = await client.people.listDirectoryPeople(params);
84+
return data;
85+
},
8286
async listContactGroups(client, params) {
8387
const { data } = await client.contactGroups.list(params);
8488
return data;

components/google_contacts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/google_contacts",
3-
"version": "0.2.2",
3+
"version": "0.3.0",
44
"description": "Pipedream Google Contacts Components",
55
"main": "google_contacts.app.mjs",
66
"keywords": [

components/google_contacts/sources/contact-created/contact-created.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "google_contacts-contact-created",
77
name: "New Contact Created",
88
description: "Emit new event when a new contact is created. [See the documentation](https://developers.google.com/people/api/rest/v1/people.connections/list)",
9-
version: "0.0.3",
9+
version: "0.0.4",
1010
type: "source",
1111
dedupe: "unique",
1212
methods: {

0 commit comments

Comments
 (0)