From ec18b1c1df22147fe124a6c8e6f308e85eabbfc6 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 14 Apr 2025 22:22:34 -0300 Subject: [PATCH 1/4] package / pnpm bumps --- components/ringcentral/package.json | 4 ++-- pnpm-lock.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/ringcentral/package.json b/components/ringcentral/package.json index c5c5923c0c4a4..f3c72e1610d0d 100644 --- a/components/ringcentral/package.json +++ b/components/ringcentral/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/ringcentral", - "version": "0.4.1", + "version": "0.5.0", "description": "Pipedream Ringcentral Components", "main": "ringcentral.app.mjs", "keywords": [ @@ -14,6 +14,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.2.0" + "@pipedream/platform": "^3.0.3" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 37826898041cc..8d1e7ad9e236e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10893,8 +10893,8 @@ importers: components/ringcentral: dependencies: '@pipedream/platform': - specifier: ^1.2.0 - version: 1.6.6 + specifier: ^3.0.3 + version: 3.0.3 components/ringover: dependencies: From 024ff8908c5d9e156712f97a0d8adaec8aca93d3 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 14 Apr 2025 22:44:08 -0300 Subject: [PATCH 2/4] Create Contact action --- .../actions/create-contact/create-contact.mjs | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 components/ringcentral/actions/create-contact/create-contact.mjs diff --git a/components/ringcentral/actions/create-contact/create-contact.mjs b/components/ringcentral/actions/create-contact/create-contact.mjs new file mode 100644 index 0000000000000..37558bd3f714d --- /dev/null +++ b/components/ringcentral/actions/create-contact/create-contact.mjs @@ -0,0 +1,85 @@ +import ringcentral from "../../ringcentral.app.mjs"; + +export default { + key: "ringcentral-create-contact", + name: "Create Contact", + description: "Creates a user personal contact. [See the documentation](https://developers.ringcentral.com/api-reference/External-Contacts/createContact)", + version: "0.0.1", + type: "action", + props: { + ringcentral, + accountId: { + propDefinition: [ + ringcentral, + "accountId", + ], + }, + extensionId: { + propDefinition: [ + ringcentral, + "extensionId", + ], + description: "Internal identifier of the RingCentral extension/user", + }, + email: { + type: "string", + label: "Email", + description: "Email address of the contact", + optional: true, + }, + firstName: { + type: "string", + label: "First Name", + description: "First name of the contact", + optional: true, + }, + lastName: { + type: "string", + label: "Last Name", + description: "Last name of the contact", + optional: true, + }, + mobilePhone: { + type: "string", + label: "Mobile Phone", + description: "Mobile phone of the contact", + optional: true, + }, + additionalOptions: { + type: "object", + label: "Additional Options", + description: "Additional parameters to set for the contact. [See the documentation](https://developers.ringcentral.com/api-reference/External-Contacts/createContact) for all available parameters. Example: `{ \"notes\": \"Notes for the contact\" }`", + optional: true, + }, + }, + methods: { + createContact({ + accountId, extensionId, ...args + }) { + return this.ringcentral.makeRequest({ + method: "POST", + path: `/account/${accountId}/extension/${extensionId}/address-book/contact`, + ...args, + }); + }, + }, + async run({ $ }) { + const { // eslint-disable-next-line no-unused-vars + ringcentral, createContact, accountId, extensionId, additionalOptions, ...data + } = this; + + const response = + await createContact({ + $, + accountId, + extensionId, + data: { + ...data, + ...additionalOptions, + }, + }); + + $.export("$summary", `Successfully created contact (ID: ${response.id})`); + return response; + }, +}; From 8d5c099347db2056d651fdc7cf0f6cce6b3d1472 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 16 Apr 2025 23:54:17 -0300 Subject: [PATCH 3/4] Adding optional JSON parsing --- .../actions/create-contact/create-contact.mjs | 5 ++-- components/ringcentral/common/utils.mjs | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/components/ringcentral/actions/create-contact/create-contact.mjs b/components/ringcentral/actions/create-contact/create-contact.mjs index 37558bd3f714d..0da88cd4a8e19 100644 --- a/components/ringcentral/actions/create-contact/create-contact.mjs +++ b/components/ringcentral/actions/create-contact/create-contact.mjs @@ -1,4 +1,5 @@ import ringcentral from "../../ringcentral.app.mjs"; +import utils from "../../common/utils.mjs"; export default { key: "ringcentral-create-contact", @@ -48,7 +49,7 @@ export default { additionalOptions: { type: "object", label: "Additional Options", - description: "Additional parameters to set for the contact. [See the documentation](https://developers.ringcentral.com/api-reference/External-Contacts/createContact) for all available parameters. Example: `{ \"notes\": \"Notes for the contact\" }`", + description: "Additional parameters to set for the contact. [See the documentation](https://developers.ringcentral.com/api-reference/External-Contacts/createContact) for all available parameters. Values will be parsed as JSON where applicable. Example: `{ \"notes\": \"Notes for the contact\" }`", optional: true, }, }, @@ -75,7 +76,7 @@ export default { extensionId, data: { ...data, - ...additionalOptions, + ...(additionalOptions && utils.parseObjectEntries(additionalOptions)), }, }); diff --git a/components/ringcentral/common/utils.mjs b/components/ringcentral/common/utils.mjs index e45bcbb520666..10b8f98b9f92a 100644 --- a/components/ringcentral/common/utils.mjs +++ b/components/ringcentral/common/utils.mjs @@ -47,8 +47,32 @@ function parse(value) { } } +function optionalParseAsJSON(value) { + try { + return JSON.parse(value); + } catch (e) { + return value; + } +} + +function parseObjectEntries(value) { + const obj = typeof value === "string" + ? JSON.parse(value) + : value; + return Object.fromEntries( + Object.entries(obj).map(([ + key, + value, + ]) => [ + key, + optionalParseAsJSON(value), + ]), + ); +} + export default { emptyStrToUndefined, parse, emptyObjectToUndefined, + parseObjectEntries, }; From 0348340eb0fde8d0c4948e188634517408566517 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 17 Apr 2025 10:45:24 -0400 Subject: [PATCH 4/4] version --- components/ringcentral/actions/send-sms/send-sms.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ringcentral/actions/send-sms/send-sms.mjs b/components/ringcentral/actions/send-sms/send-sms.mjs index f499deb45fe3f..c0491cc7130f9 100644 --- a/components/ringcentral/actions/send-sms/send-sms.mjs +++ b/components/ringcentral/actions/send-sms/send-sms.mjs @@ -5,7 +5,7 @@ export default { key: "ringcentral-send-sms", name: "Send SMS", description: "Creates and sends a new text message. See the API docs [here](https://developers.ringcentral.com/api-reference/SMS/createSMSMessage)", - version: "0.5.1", + version: "0.5.2", type: "action", props: { ringcentral,