@pipedream/trint 0.0.3 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/get-transcript/get-transcript.mjs +39 -0
- package/actions/upload-file/upload-file.mjs +102 -0
- package/common/download-formats.mjs +66 -0
- package/common/languages.mjs +218 -0
- package/package.json +4 -1
- package/sources/common/base-webhook.mjs +53 -0
- package/sources/new-transcript-complete/new-transcript-complete.mjs +21 -0
- package/sources/new-transcript-complete/test-event.mjs +7 -0
- package/sources/new-transcript-verified/new-transcript-verified.mjs +21 -0
- package/sources/new-transcript-verified/test-event.mjs +7 -0
- package/sources/new-transcript-version/new-transcript-version.mjs +20 -0
- package/sources/new-transcript-version/test-event.mjs +6 -0
- package/trint.app.mjs +117 -4
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import trint from "../../trint.app.mjs";
|
|
2
|
+
import downloadFormats from "../../common/download-formats.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "trint-get-transcript",
|
|
6
|
+
name: "Get Transcript",
|
|
7
|
+
description: "Retrieve the full transcription of a processed media file. [See the documentation](https://dev.trint.com/reference/get-file)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
annotations: {
|
|
11
|
+
destructiveHint: false,
|
|
12
|
+
openWorldHint: true,
|
|
13
|
+
readOnlyHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
trint,
|
|
17
|
+
transcriptId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
trint,
|
|
20
|
+
"transcriptId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
format: {
|
|
24
|
+
type: "string",
|
|
25
|
+
label: "Format",
|
|
26
|
+
description: "The format to export the transcript in. Will return JSON, HTML, or a URL to the transcript in the selected format.",
|
|
27
|
+
options: downloadFormats,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const response = await this.trint.getTranscript({
|
|
32
|
+
$,
|
|
33
|
+
format: this.format,
|
|
34
|
+
transcriptId: this.transcriptId,
|
|
35
|
+
});
|
|
36
|
+
$.export("$summary", `Successfully retrieved transcript for transcript ID: ${this.transcriptId}`);
|
|
37
|
+
return response;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import trint from "../../trint.app.mjs";
|
|
2
|
+
import { getFileStreamAndMetadata } from "@pipedream/platform";
|
|
3
|
+
import languages from "../../common/languages.mjs";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
key: "trint-upload-file",
|
|
7
|
+
name: "Upload File",
|
|
8
|
+
description: "Upload media files directly to Trint for immediate transcription. [See the documentation](https://dev.trint.com/reference/upload)",
|
|
9
|
+
version: "0.0.2",
|
|
10
|
+
type: "action",
|
|
11
|
+
annotations: {
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
readOnlyHint: false,
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
trint,
|
|
18
|
+
filePath: {
|
|
19
|
+
type: "string",
|
|
20
|
+
label: "File Path or URL",
|
|
21
|
+
description: "The file to upload. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.mp4`)",
|
|
22
|
+
format: "file-ref",
|
|
23
|
+
},
|
|
24
|
+
language: {
|
|
25
|
+
type: "string",
|
|
26
|
+
label: "Language",
|
|
27
|
+
description: "The language to transcribe",
|
|
28
|
+
options: languages,
|
|
29
|
+
optional: true,
|
|
30
|
+
},
|
|
31
|
+
detectSpeakerChange: {
|
|
32
|
+
type: "boolean",
|
|
33
|
+
label: "Detect Speaker Change",
|
|
34
|
+
description: "Automatically split paragraphs based on change of speaker. If the parameter is not specified it defaults to `true`.",
|
|
35
|
+
optional: true,
|
|
36
|
+
},
|
|
37
|
+
workspaceId: {
|
|
38
|
+
propDefinition: [
|
|
39
|
+
trint,
|
|
40
|
+
"workspaceId",
|
|
41
|
+
],
|
|
42
|
+
optional: true,
|
|
43
|
+
},
|
|
44
|
+
folderId: {
|
|
45
|
+
propDefinition: [
|
|
46
|
+
trint,
|
|
47
|
+
"folderId",
|
|
48
|
+
(c) => ({
|
|
49
|
+
workspaceId: c.workspaceId,
|
|
50
|
+
}),
|
|
51
|
+
],
|
|
52
|
+
optional: true,
|
|
53
|
+
},
|
|
54
|
+
customDictionary: {
|
|
55
|
+
type: "boolean",
|
|
56
|
+
label: "Custom Dictionary",
|
|
57
|
+
description: "Use the Vocab Builder during the transcription of the file. If the parameter is not specified it defaults to `true`.",
|
|
58
|
+
optional: true,
|
|
59
|
+
},
|
|
60
|
+
syncDir: {
|
|
61
|
+
type: "dir",
|
|
62
|
+
accessMode: "read",
|
|
63
|
+
sync: true,
|
|
64
|
+
optional: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
methods: {
|
|
68
|
+
streamToBuffer(stream) {
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
const chunks = [];
|
|
71
|
+
stream.on("data", (chunk) => chunks.push(chunk));
|
|
72
|
+
stream.on("end", () => resolve(Buffer.concat(chunks)));
|
|
73
|
+
stream.on("error", reject);
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
async run({ $ }) {
|
|
78
|
+
const {
|
|
79
|
+
stream, metadata,
|
|
80
|
+
} = await getFileStreamAndMetadata(this.filePath);
|
|
81
|
+
const fileBinary = await this.streamToBuffer(stream);
|
|
82
|
+
|
|
83
|
+
const response = await this.trint.uploadFile({
|
|
84
|
+
$,
|
|
85
|
+
params: {
|
|
86
|
+
"filename": metadata.name,
|
|
87
|
+
"language": this.language,
|
|
88
|
+
"detect-speaker-change": this.detectSpeakerChange,
|
|
89
|
+
"custom-dictionary": this.customDictionary,
|
|
90
|
+
"workspace-id": this.workspaceId,
|
|
91
|
+
"folder-id": this.folderId,
|
|
92
|
+
},
|
|
93
|
+
headers: {
|
|
94
|
+
"Content-Type": metadata.contentType || "application/octet-stream",
|
|
95
|
+
},
|
|
96
|
+
data: Buffer.from(fileBinary, "binary"),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
$.export("$summary", `Successfully uploaded file to Trint: ${response.trintId}`);
|
|
100
|
+
return response;
|
|
101
|
+
},
|
|
102
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
label: "JSON",
|
|
4
|
+
value: "json",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
label: "HTML",
|
|
8
|
+
value: "html",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: "Edit Decision List",
|
|
12
|
+
value: "edl",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: "Comments",
|
|
16
|
+
value: "csv/comments",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "Avid DS",
|
|
20
|
+
value: "avid-ds",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "Highlights",
|
|
24
|
+
value: "csv/highlights",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "Transcript",
|
|
28
|
+
value: "csv/full",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "Markers",
|
|
32
|
+
value: "csv/markers",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "Microsoft Word",
|
|
36
|
+
value: "docx",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "XML",
|
|
40
|
+
value: "xml",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "Premiere XML",
|
|
44
|
+
value: "premiere-xml",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Spruce STL",
|
|
48
|
+
value: "spruce-stl",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "SubRip SRT",
|
|
52
|
+
value: "srt",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "Telestream Vantage XML",
|
|
56
|
+
value: "vantage-xml",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: "Text",
|
|
60
|
+
value: "text",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: "WebVTT",
|
|
64
|
+
value: "webvtt",
|
|
65
|
+
},
|
|
66
|
+
];
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
value: "en-GB",
|
|
4
|
+
label: "English (British spelling)",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
value: "en",
|
|
8
|
+
label: "English (American spelling)",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
value: "es",
|
|
12
|
+
label: "Spanish",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
value: "de",
|
|
16
|
+
label: "German",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: "ar",
|
|
20
|
+
label: "Arabic",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: "bg",
|
|
24
|
+
label: "Bulgarian",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
value: "bn",
|
|
28
|
+
label: "Bengali",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: "ca",
|
|
32
|
+
label: "Catalan",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: "cmn",
|
|
36
|
+
label: "Chinese Mandarin",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: "hr",
|
|
40
|
+
label: "Croatian",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "cs",
|
|
44
|
+
label: "Czech",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: "da",
|
|
48
|
+
label: "Danish",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: "nl",
|
|
52
|
+
label: "Dutch",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
value: "fa",
|
|
56
|
+
label: "Farsi (Persian)",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: "fi",
|
|
60
|
+
label: "Finnish",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: "fr",
|
|
64
|
+
label: "French",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: "el",
|
|
68
|
+
label: "Greek",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
value: "he",
|
|
72
|
+
label: "Hebrew",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
value: "hi",
|
|
76
|
+
label: "Hindi",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
value: "hu",
|
|
80
|
+
label: "Hungarian",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
value: "it",
|
|
84
|
+
label: "Italian",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
value: "ja",
|
|
88
|
+
label: "Japanese",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
value: "ko",
|
|
92
|
+
label: "Korean",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
value: "lv",
|
|
96
|
+
label: "Latvian",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
value: "lt",
|
|
100
|
+
label: "Lithuanian",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
value: "ms",
|
|
104
|
+
label: "Malay",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
value: "no",
|
|
108
|
+
label: "Norwegian",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
value: "pl",
|
|
112
|
+
label: "Polish",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
value: "pt",
|
|
116
|
+
label: "Portuguese",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
value: "ro",
|
|
120
|
+
label: "Romanian",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
value: "ru",
|
|
124
|
+
label: "Russian",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
value: "sk",
|
|
128
|
+
label: "Slovakian",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
value: "sl",
|
|
132
|
+
label: "Slovenian",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
value: "sv",
|
|
136
|
+
label: "Swedish",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
value: "sw",
|
|
140
|
+
label: "Swahili",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
value: "tr",
|
|
144
|
+
label: "Turkish",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
value: "id",
|
|
148
|
+
label: "Indonesian",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
value: "uk",
|
|
152
|
+
label: "Ukrainian",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
value: "yue",
|
|
156
|
+
label: "Cantonese",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
value: "cy",
|
|
160
|
+
label: "Welsh",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
value: "ba",
|
|
164
|
+
label: "Bashkir",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
value: "eu",
|
|
168
|
+
label: "Basque",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
value: "be",
|
|
172
|
+
label: "Belarusian",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
value: "et",
|
|
176
|
+
label: "Estonian",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
value: "ga",
|
|
180
|
+
label: "Irish",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
value: "gl",
|
|
184
|
+
label: "Galician",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
value: "mn",
|
|
188
|
+
label: "Mongolian",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
value: "mr",
|
|
192
|
+
label: "Marathi",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
value: "mt",
|
|
196
|
+
label: "Maltese",
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
value: "ta",
|
|
200
|
+
label: "Tamil",
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
value: "th",
|
|
204
|
+
label: "Thai",
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
value: "ug",
|
|
208
|
+
label: "Uyghur",
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
value: "ur",
|
|
212
|
+
label: "Urdu",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
value: "vi",
|
|
216
|
+
label: "Vietnamese",
|
|
217
|
+
},
|
|
218
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/trint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Pipedream Trint Components",
|
|
5
5
|
"main": "trint.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@pipedream/platform": "^3.2.2"
|
|
14
17
|
}
|
|
15
18
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import trint from "../../trint.app.mjs";
|
|
2
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
props: {
|
|
6
|
+
trint,
|
|
7
|
+
http: {
|
|
8
|
+
type: "$.interface.http",
|
|
9
|
+
customResponse: true,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
hooks: {
|
|
13
|
+
async activate() {
|
|
14
|
+
await this.trint.registerWebhook({
|
|
15
|
+
data: {
|
|
16
|
+
callbackUrl: this.http.endpoint,
|
|
17
|
+
callbackSubscriptions: this.getEventTypes(),
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
async deactivate() {
|
|
22
|
+
await this.trint.deregisterWebhook({
|
|
23
|
+
data: {
|
|
24
|
+
callbackUrl: this.http.endpoint,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
methods: {
|
|
30
|
+
getEventTypes() {
|
|
31
|
+
throw new ConfigurationError("getEventTypes is not implemented");
|
|
32
|
+
},
|
|
33
|
+
generateMeta(body) {
|
|
34
|
+
return {
|
|
35
|
+
id: body.transcriptId,
|
|
36
|
+
summary: `New ${body.eventType} event`,
|
|
37
|
+
ts: Date.now(),
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
async run({ body }) {
|
|
42
|
+
this.http.respond({
|
|
43
|
+
status: 200,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (!body) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const meta = this.generateMeta(body);
|
|
51
|
+
this.$emit(body, meta);
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import common from "../common/base-webhook.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "trint-new-transcript-complete",
|
|
7
|
+
name: "New Transcript Complete (Instant)",
|
|
8
|
+
description: "Emit new event when a transcript is complete. [See the documentation](https://dev.trint.com/reference/register-webhook-endpoint)",
|
|
9
|
+
type: "source",
|
|
10
|
+
version: "0.0.1",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
getEventTypes() {
|
|
15
|
+
return [
|
|
16
|
+
"TRANSCRIPT_COMPLETE",
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
sampleEmit,
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import common from "../common/base-webhook.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "trint-new-transcript-verified",
|
|
7
|
+
name: "New Transcript Verified (Instant)",
|
|
8
|
+
description: "Emit new event when a transcript is verified. [See the documentation](https://dev.trint.com/reference/register-webhook-endpoint)",
|
|
9
|
+
type: "source",
|
|
10
|
+
version: "0.0.1",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
getEventTypes() {
|
|
15
|
+
return [
|
|
16
|
+
"TRANSCRIPT_VERIFIED",
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
sampleEmit,
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import common from "../common/base-webhook.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "trint-new-transcript-version",
|
|
7
|
+
name: "New Transcript Version (Instant)",
|
|
8
|
+
description: "Emit new event when a new transcript version is created. [See the documentation](https://dev.trint.com/reference/register-webhook-endpoint)",
|
|
9
|
+
type: "source",
|
|
10
|
+
version: "0.0.1",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getEventTypes() {
|
|
14
|
+
return [
|
|
15
|
+
"TRANSCRIPT_NEW_VERSION",
|
|
16
|
+
];
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
sampleEmit,
|
|
20
|
+
};
|
package/trint.app.mjs
CHANGED
|
@@ -1,11 +1,124 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
const DEFAULT_LIMIT = 50;
|
|
3
|
+
|
|
1
4
|
export default {
|
|
2
5
|
type: "app",
|
|
3
6
|
app: "trint",
|
|
4
|
-
propDefinitions: {
|
|
7
|
+
propDefinitions: {
|
|
8
|
+
workspaceId: {
|
|
9
|
+
type: "string",
|
|
10
|
+
label: "Workspace ID",
|
|
11
|
+
description: "The ID of a workspace",
|
|
12
|
+
async options() {
|
|
13
|
+
const workspaces = await this.listWorkspaces();
|
|
14
|
+
return workspaces?.map(({
|
|
15
|
+
_id: value, name: label,
|
|
16
|
+
}) => ({
|
|
17
|
+
value,
|
|
18
|
+
label,
|
|
19
|
+
})) || [];
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
folderId: {
|
|
23
|
+
type: "string",
|
|
24
|
+
label: "Folder ID",
|
|
25
|
+
description: "The ID of a folder",
|
|
26
|
+
async options({ workspaceId }) {
|
|
27
|
+
const folders = await this.listFolders({
|
|
28
|
+
params: {
|
|
29
|
+
"workspace-id": workspaceId,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
return folders?.map(({
|
|
33
|
+
_id: value, name: label,
|
|
34
|
+
}) => ({
|
|
35
|
+
value,
|
|
36
|
+
label,
|
|
37
|
+
})) || [];
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
transcriptId: {
|
|
41
|
+
type: "string",
|
|
42
|
+
label: "Transcript ID",
|
|
43
|
+
description: "The ID of a transcript",
|
|
44
|
+
async options({ page }) {
|
|
45
|
+
const transcripts = await this.listTranscripts({
|
|
46
|
+
params: {
|
|
47
|
+
limit: DEFAULT_LIMIT,
|
|
48
|
+
skip: DEFAULT_LIMIT * page,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
return transcripts?.filter(({ fileType }) => fileType === "TRANSCRIPT")?.map(({
|
|
52
|
+
id: value, title: label,
|
|
53
|
+
}) => ({
|
|
54
|
+
value,
|
|
55
|
+
label,
|
|
56
|
+
})) || [];
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
5
60
|
methods: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
61
|
+
_baseUrl() {
|
|
62
|
+
return "https://api.trint.com";
|
|
63
|
+
},
|
|
64
|
+
_makeRequest({
|
|
65
|
+
$ = this, url, path, headers, ...opts
|
|
66
|
+
}) {
|
|
67
|
+
return axios($, {
|
|
68
|
+
url: url || `${this._baseUrl()}${path}`,
|
|
69
|
+
headers: {
|
|
70
|
+
...headers,
|
|
71
|
+
"api-key": `${this.$auth.api_key}`,
|
|
72
|
+
},
|
|
73
|
+
...opts,
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
registerWebhook(opts = {}) {
|
|
77
|
+
return this._makeRequest({
|
|
78
|
+
method: "PUT",
|
|
79
|
+
path: "/callbacks/transcript",
|
|
80
|
+
...opts,
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
deregisterWebhook(opts = {}) {
|
|
84
|
+
return this._makeRequest({
|
|
85
|
+
method: "DELETE",
|
|
86
|
+
path: "/callbacks/transcript",
|
|
87
|
+
...opts,
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
getTranscript({
|
|
91
|
+
format, transcriptId, ...opts
|
|
92
|
+
}) {
|
|
93
|
+
return this._makeRequest({
|
|
94
|
+
path: `/export/${format}/${transcriptId}`,
|
|
95
|
+
...opts,
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
listWorkspaces(opts = {}) {
|
|
99
|
+
return this._makeRequest({
|
|
100
|
+
path: "/workspaces",
|
|
101
|
+
...opts,
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
listFolders(opts = {}) {
|
|
105
|
+
return this._makeRequest({
|
|
106
|
+
path: "/folders",
|
|
107
|
+
...opts,
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
listTranscripts(opts = {}) {
|
|
111
|
+
return this._makeRequest({
|
|
112
|
+
path: "/transcripts",
|
|
113
|
+
...opts,
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
uploadFile(opts = {}) {
|
|
117
|
+
return this._makeRequest({
|
|
118
|
+
method: "POST",
|
|
119
|
+
url: "https://upload.trint.com/",
|
|
120
|
+
...opts,
|
|
121
|
+
});
|
|
9
122
|
},
|
|
10
123
|
},
|
|
11
124
|
};
|