Skip to content

Commit 5424b40

Browse files
authored
Gong - Get Extensive Data Action (#16106)
* get-extensive-data * pnpm-lock.yaml * pnpm-lock.yaml * bump package version * revert package version * updates * improve error handling
1 parent ecb9960 commit 5424b40

File tree

4 files changed

+108
-3
lines changed

4 files changed

+108
-3
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import app from "../../gong.app.mjs";
2+
import constants from "../../common/constants.mjs";
3+
import { ConfigurationError } from "@pipedream/platform";
4+
5+
export default {
6+
key: "gong-get-extensive-data",
7+
name: "Get Extensive Data",
8+
description: "Lists detailed call data. [See the documentation](https://us-66463.app.gong.io/settings/api/documentation#post-/v2/calls/extensive)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
app,
13+
fromDateTime: {
14+
propDefinition: [
15+
app,
16+
"fromDateTime",
17+
],
18+
optional: true,
19+
},
20+
toDateTime: {
21+
propDefinition: [
22+
app,
23+
"toDateTime",
24+
],
25+
optional: true,
26+
},
27+
workspaceId: {
28+
optional: true,
29+
propDefinition: [
30+
app,
31+
"workspaceId",
32+
],
33+
},
34+
callIds: {
35+
propDefinition: [
36+
app,
37+
"callIds",
38+
],
39+
},
40+
primaryUserIds: {
41+
type: "string[]",
42+
label: "Primary User IDs",
43+
description: "An optional list of user identifiers, if supplied the API will return only the calls hosted by the specified users. The identifiers in this field match the primaryUserId field of the calls.",
44+
propDefinition: [
45+
app,
46+
"userId",
47+
],
48+
optional: true,
49+
},
50+
maxResults: {
51+
type: "integer",
52+
label: "Max Results",
53+
description: "The maximum number or results to return",
54+
default: constants.DEFAULT_MAX,
55+
optional: true,
56+
},
57+
},
58+
methods: {
59+
getExtensiveData(args = {}) {
60+
return this.app.post({
61+
path: "/calls/extensive",
62+
...args,
63+
});
64+
},
65+
},
66+
async run({ $ }) {
67+
const {
68+
app,
69+
getExtensiveData,
70+
maxResults,
71+
...filter
72+
} = this;
73+
74+
if (filter?.workspaceId && filter?.callIds) {
75+
throw new ConfigurationError("Must not provide both `callIds` and `workspaceId`");
76+
}
77+
78+
try {
79+
const calls = await app.paginate({
80+
resourceFn: getExtensiveData,
81+
resourceFnArgs: {
82+
step: $,
83+
data: {
84+
filter,
85+
},
86+
},
87+
resourceName: "calls",
88+
max: maxResults,
89+
});
90+
91+
if (calls?.length) {
92+
$.export("$summary", `Successfully retrieved data for ${calls.length} calls`);
93+
}
94+
return calls;
95+
}
96+
catch (error) {
97+
const noCallsMessage = "No calls found corresponding to the provided filters";
98+
if (error?.message.includes(noCallsMessage)) {
99+
$.export("$summary", noCallsMessage);
100+
} else {
101+
throw new ConfigurationError(`${error?.message}`);
102+
}
103+
}
104+
},
105+
};

components/gong/package.json

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

components/notiff_io/notiff_io.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

components/smartlead/smartlead.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

0 commit comments

Comments
 (0)