-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Ringcentral new action #16313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Ringcentral new action #16313
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
components/ringcentral/actions/create-contact/create-contact.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import ringcentral from "../../ringcentral.app.mjs"; | ||
| import utils from "../../common/utils.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. Values will be parsed as JSON where applicable. 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 && utils.parseObjectEntries(additionalOptions)), | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created contact (ID: ${response.id})`); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.