Skip to content

Commit 0c6c5b8

Browse files
committed
Gorgias OAuth: Added new tagIds filter prop in Ticker Created source
1 parent 08b948b commit 0c6c5b8

File tree

11 files changed

+59
-11
lines changed

11 files changed

+59
-11
lines changed

components/gorgias_oauth/actions/create-customer/create-customer.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "gorgias_oauth-create-customer",
66
name: "Create Customer",
77
description: "Create a new customer. [See the docs](https://developers.gorgias.com/reference/post_api-customers)",
8-
version: "0.0.4",
8+
version: "0.0.5",
99
type: "action",
1010
props: {
1111
gorgias_oauth,

components/gorgias_oauth/actions/create-ticket/create-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gorgias_oauth-create-ticket",
55
name: "Create Ticket",
66
description: "Create a new ticket. [See the docs](https://developers.gorgias.com/reference/post_api-tickets)",
7-
version: "0.0.5",
7+
version: "0.0.6",
88
type: "action",
99
props: {
1010
gorgias_oauth,

components/gorgias_oauth/actions/list-tickets/list-tickets.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gorgias_oauth-list-tickets",
55
name: "List Tickets",
66
description: "List all tickets. [See the docs](https://developers.gorgias.com/reference/get_api-tickets)",
7-
version: "0.0.5",
7+
version: "0.0.6",
88
type: "action",
99
props: {
1010
gorgias_oauth,

components/gorgias_oauth/actions/retrieve-customer/retrieve-customer.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gorgias_oauth-retrieve-customer",
55
name: "Retrieve a Customer",
66
description: "Retrieve a customer. [See the docs](https://developers.gorgias.com/reference/get_api-customers-id-)",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
type: "action",
99
props: {
1010
gorgias_oauth,

components/gorgias_oauth/actions/update-customer/update-customer.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
key: "gorgias_oauth-update-customer",
1111
name: "Update Customer",
1212
description: "Update a customer. [See the docs](https://developers.gorgias.com/reference/put_api-customers-id-)",
13-
version: "0.0.4",
13+
version: "0.0.5",
1414
type: "action",
1515
props: {
1616
gorgias_oauth,

components/gorgias_oauth/actions/update-ticket/update-ticket.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "gorgias_oauth-update-ticket",
66
name: "Update Ticket",
77
description: "Updates a predefined ticket in the Gorgias system. [See the documentation](https://developers.gorgias.com/reference/update-ticket)",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "action",
1010
props: {
1111
gorgiasOauth,

components/gorgias_oauth/gorgias_oauth.app.mjs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,37 @@ export default {
169169
label: "Subject",
170170
description: "The subject of the ticket",
171171
},
172+
tagId: {
173+
type: "string",
174+
label: "Tag ID",
175+
description: "The tag id.",
176+
optional: true,
177+
async options({ prevContext: { cursor } }) {
178+
if (cursor === null) {
179+
return [];
180+
}
181+
const {
182+
meta: { next_cursor: nextCursor },
183+
data: tags,
184+
} = await this.listTags({
185+
params: {
186+
cursor,
187+
},
188+
});
189+
const options = tags.map(({
190+
id: value, name: label,
191+
}) => ({
192+
label,
193+
value,
194+
}));
195+
return {
196+
options,
197+
context: {
198+
cursor: nextCursor,
199+
},
200+
};
201+
},
202+
},
172203
},
173204
methods: {
174205
_defaultConfig({
@@ -356,5 +387,11 @@ export default {
356387
...opts,
357388
});
358389
},
390+
listTags(opts = {}) {
391+
return this._makeRequest({
392+
path: "/tags",
393+
...opts,
394+
});
395+
},
359396
},
360397
};

components/gorgias_oauth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/gorgias_oauth",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "Pipedream Gorgias OAuth Components",
55
"main": "gorgias_oauth.app.mjs",
66
"keywords": [

components/gorgias_oauth/sources/ticket-created/ticket-created.mjs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "gorgias_oauth-ticket-created",
88
name: "New Ticket",
99
description: "Emit new event when a ticket is created. [See the documentation](https://developers.gorgias.com/reference/the-event-object)",
10-
version: "0.1.5",
10+
version: "0.1.6",
1111
type: "source",
1212
props: {
1313
...base.props,
@@ -33,16 +33,27 @@ export default {
3333
"userId",
3434
],
3535
},
36+
tagIds: {
37+
type: "string[]",
38+
label: "Tag IDs",
39+
description: "The tag ids to filter tickets by.",
40+
propDefinition: [
41+
base.props.gorgias_oauth,
42+
"tagId",
43+
],
44+
},
3645
},
3746
methods: {
3847
...base.methods,
3948
getEventType() {
4049
return eventTypes.TICKET_CREATED;
4150
},
4251
isRelevant(ticket) {
52+
const tagIds = ticket.tags.map(({ id }) => id);
4353
return (!this.channel || ticket.channel === this.channel)
4454
&& (!this.via || ticket.via === this.via)
45-
&& (!this.assigneeId || ticket?.assignee_user_id === this.assigneeId);
55+
&& (!this.assigneeId || ticket?.assignee_user_id === this.assigneeId)
56+
&& (!this.tagIds || this.tagIds.some((tagId) => tagIds.includes(tagId)));
4657
},
4758
async processHistoricalEvent(event) {
4859
const ticket = await this.retrieveTicket(event.object_id);

components/gorgias_oauth/sources/ticket-message-created/ticket-message-created.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
key: "gorgias_oauth-ticket-message-created",
99
name: "New Ticket Message",
1010
description: "Emit new event when a ticket message is created. [See the documentation](https://developers.gorgias.com/reference/the-event-object)",
11-
version: "0.1.5",
11+
version: "0.1.6",
1212
type: "source",
1313
props: {
1414
...base.props,

0 commit comments

Comments
 (0)