-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - gorgias_oauth #17827
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
61 changes: 61 additions & 0 deletions
61
components/gorgias_oauth/actions/create-macro/create-macro.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,61 @@ | ||
| import gorgias_oauth from "../../gorgias_oauth.app.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import constants from "../../common/constants.mjs"; | ||
|
|
||
| export default { | ||
| key: "gorgias_oauth-create-macro", | ||
| name: "Create Macro", | ||
| description: "Create a macro. [See the documentation](https://developers.gorgias.com/reference/create-macro)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| gorgias_oauth, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "The name of the Macro. Tips: choose a name that can be easily searched.", | ||
| }, | ||
| intent: { | ||
| type: "string", | ||
| label: "Intent", | ||
| description: "The intention of the macro should be used for", | ||
| optional: true, | ||
| options: constants.macroIntents, | ||
| }, | ||
| language: { | ||
| propDefinition: [ | ||
| gorgias_oauth, | ||
| "language", | ||
| ], | ||
| description: "The language of the macro", | ||
| }, | ||
| actions: { | ||
| type: "string[]", | ||
| label: "Actions", | ||
| description: `A list of actions to be applied on tickets. [See the documentation](https://developers.gorgias.com/reference/create-macro) for more info. | ||
| \nExample: [{ | ||
| "arguments": { | ||
| "tags": "question, order-status" | ||
| }, | ||
| "name": "addTags", | ||
| "title": "add tags", | ||
| "type": "user" | ||
| }]`, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const data = { | ||
| name: this.name, | ||
| intent: this.intent, | ||
| language: this.language, | ||
| actions: parseObject(this.actions), | ||
| }; | ||
| const response = await this.gorgias_oauth.createMacro({ | ||
| $, | ||
| data, | ||
| }); | ||
| $.export("$summary", `Successfully created macro ${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
26 changes: 26 additions & 0 deletions
26
components/gorgias_oauth/actions/delete-macro/delete-macro.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,26 @@ | ||
| import gorgias_oauth from "../../gorgias_oauth.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "gorgias_oauth-delete-macro", | ||
| name: "Delete Macro", | ||
| description: "Delete a macro. [See the documentation](https://developers.gorgias.com/reference/delete-macro)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| gorgias_oauth, | ||
| macroId: { | ||
| propDefinition: [ | ||
| gorgias_oauth, | ||
| "macroId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.gorgias_oauth.deleteMacro({ | ||
| $, | ||
| id: this.macroId, | ||
| }); | ||
| $.export("$summary", `Successfully deleted macro ${this.macroId}`); | ||
| return response; | ||
| }, | ||
| }; |
27 changes: 27 additions & 0 deletions
27
components/gorgias_oauth/actions/get-ticket/get-ticket.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,27 @@ | ||
| import gorgias_oauth from "../../gorgias_oauth.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "gorgias_oauth-get-ticket", | ||
| name: "Get Ticket", | ||
| description: "Get a ticket. [See the documentation](https://developers.gorgias.com/reference/get-ticket)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| gorgias_oauth, | ||
| ticketId: { | ||
| propDefinition: [ | ||
| gorgias_oauth, | ||
| "ticketId", | ||
| ], | ||
| description: "The ID of a ticket to get", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.gorgias_oauth.retrieveTicket({ | ||
| $, | ||
| id: this.ticketId, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved ticket with ID: ${this.ticketId}`); | ||
| return response; | ||
| }, | ||
| }; |
46 changes: 46 additions & 0 deletions
46
components/gorgias_oauth/actions/list-macros/list-macros.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,46 @@ | ||
| import gorgias_oauth from "../../gorgias_oauth.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "gorgias_oauth-list-macros", | ||
| name: "List Macros", | ||
| description: "List all macros. [See the documentation](https://developers.gorgias.com/reference/list-macros)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| gorgias_oauth, | ||
| search: { | ||
| type: "string", | ||
| label: "Search", | ||
| description: "Filter macros containing the given search query", | ||
| optional: true, | ||
| }, | ||
| limit: { | ||
| propDefinition: [ | ||
| gorgias_oauth, | ||
| "limit", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const params = { | ||
| search: this.search, | ||
| limit: this.limit, | ||
| }; | ||
|
|
||
| const macros = []; | ||
| const paginator = this.gorgias_oauth.paginate({ | ||
| $, | ||
| fn: this.gorgias_oauth.listMacros, | ||
| params, | ||
| }); | ||
| for await (const macro of paginator) { | ||
| macros.push(macro); | ||
| } | ||
|
|
||
| const suffix = macros.length === 1 | ||
| ? "" | ||
| : "s"; | ||
| $.export("$summary", `Returned ${macros.length} macro${suffix}`); | ||
| return macros; | ||
| }, | ||
| }; |
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
73 changes: 73 additions & 0 deletions
73
components/gorgias_oauth/actions/update-macro/update-macro.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,73 @@ | ||
| import gorgias_oauth from "../../gorgias_oauth.app.mjs"; | ||
| import constants from "../../common/constants.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "gorgias_oauth-update-macro", | ||
| name: "Update Macro", | ||
| description: "Update a macro. [See the documentation](https://developers.gorgias.com/reference/update-macro)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| gorgias_oauth, | ||
| macroId: { | ||
| propDefinition: [ | ||
| gorgias_oauth, | ||
| "macroId", | ||
| ], | ||
| }, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "The name of the Macro. Tips: choose a name that can be easily searched.", | ||
| optional: true, | ||
| }, | ||
| intent: { | ||
| type: "string", | ||
| label: "Intent", | ||
| description: "The intention of the macro should be used for", | ||
| optional: true, | ||
| options: constants.macroIntents, | ||
| }, | ||
| language: { | ||
| propDefinition: [ | ||
| gorgias_oauth, | ||
| "language", | ||
| ], | ||
| description: "The language of the macro", | ||
| }, | ||
| actions: { | ||
| type: "string[]", | ||
| label: "Actions", | ||
| description: `A list of actions to be applied on tickets. [See the documentation](https://developers.gorgias.com/reference/create-macro) for more info. | ||
| \nExample: [{ | ||
| "arguments": { | ||
| "tags": "question, order-status" | ||
| }, | ||
| "name": "addTags", | ||
| "title": "add tags", | ||
| "type": "user" | ||
| }]`, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const macro = await this.gorgias_oauth.getMacro({ | ||
| $, | ||
| id: this.macroId, | ||
| }); | ||
| const data = { | ||
| name: this.name || macro.name, | ||
| intent: this.intent, | ||
| language: this.language, | ||
| actions: parseObject(this.actions), | ||
| }; | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const response = await this.gorgias_oauth.updateMacro({ | ||
| $, | ||
| id: this.macroId, | ||
| data, | ||
| }); | ||
| $.export("$summary", `Successfully updated macro ${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
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.