@deepgram/sdk 2.1.1 → 2.3.0
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/README.md +251 -360
- package/dist/billing.d.ts +4 -4
- package/dist/helpers/secondsToTimestamp.d.ts +1 -1
- package/dist/httpRequest.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/invitation.d.ts +5 -5
- package/dist/keys.d.ts +3 -3
- package/dist/members.d.ts +5 -5
- package/dist/projects.d.ts +8 -8
- package/dist/scopes.d.ts +5 -5
- package/dist/transcription/index.d.ts +5 -5
- package/dist/transcription/liveTranscription.d.ts +1 -0
- package/dist/transcription/preRecordedTranscription.d.ts +1 -1
- package/dist/types/alternatives.d.ts +1 -1
- package/dist/types/balance.d.ts +3 -1
- package/dist/types/balanceList.d.ts +3 -1
- package/dist/types/channel.d.ts +1 -1
- package/dist/types/createKeyOptions.d.ts +1 -1
- package/dist/types/entity.d.ts +1 -1
- package/dist/types/error.d.ts +1 -1
- package/dist/types/hit.d.ts +1 -1
- package/dist/types/invitationList.d.ts +3 -1
- package/dist/types/invitationOptions.d.ts +1 -1
- package/dist/types/key.d.ts +3 -1
- package/dist/types/keyResponse.d.ts +3 -1
- package/dist/types/keyResponseObj.d.ts +1 -1
- package/dist/types/keyword.d.ts +1 -1
- package/dist/types/liveTranscriptionOptions.d.ts +15 -15
- package/dist/types/liveTranscriptionResponse.d.ts +1 -1
- package/dist/types/member.d.ts +1 -1
- package/dist/types/memberList.d.ts +3 -1
- package/dist/types/message.d.ts +3 -1
- package/dist/types/metadata.d.ts +11 -1
- package/dist/types/paragraph.d.ts +1 -1
- package/dist/types/paragraphGroup.d.ts +1 -1
- package/dist/types/prerecordedTranscriptionOptions.d.ts +16 -16
- package/dist/types/prerecordedTranscriptionResponse.d.ts +14 -10
- package/dist/types/project.d.ts +3 -1
- package/dist/types/projectPatchRequest.d.ts +1 -1
- package/dist/types/projectPatchResponse.d.ts +3 -1
- package/dist/types/projectResponse.d.ts +3 -1
- package/dist/types/requestFunction.d.ts +4 -3
- package/dist/types/scopeList.d.ts +3 -1
- package/dist/types/search.d.ts +1 -1
- package/dist/types/sentence.d.ts +1 -1
- package/dist/types/summary.d.ts +1 -1
- package/dist/types/toggleConfigOptions.d.ts +1 -1
- package/dist/types/topic.d.ts +1 -1
- package/dist/types/topicGroup.d.ts +1 -1
- package/dist/types/transcriptionSource.d.ts +5 -4
- package/dist/types/translation.d.ts +1 -1
- package/dist/types/usageCallback.d.ts +1 -1
- package/dist/types/usageField.d.ts +3 -1
- package/dist/types/usageFieldOptions.d.ts +1 -1
- package/dist/types/usageOptions.d.ts +2 -2
- package/dist/types/usageRequest.d.ts +3 -1
- package/dist/types/usageRequestDetail.d.ts +1 -1
- package/dist/types/usageRequestList.d.ts +3 -1
- package/dist/types/usageRequestListOptions.d.ts +1 -1
- package/dist/types/usageRequestMessage.d.ts +1 -1
- package/dist/types/usageResponse.d.ts +3 -1
- package/dist/types/usageResponseDetail.d.ts +1 -1
- package/dist/types/utterance.d.ts +1 -1
- package/dist/types/warning.d.ts +5 -0
- package/dist/types/wordBase.d.ts +1 -1
- package/dist/usage.d.ts +7 -7
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -2,458 +2,355 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/deepgram/node-sdk/actions/workflows/CI.yml) [](https://www.npmjs.com/package/@deepgram/sdk) [](CODE_OF_CONDUCT.md)
|
|
4
4
|
|
|
5
|
-
Official Node.js SDK for [Deepgram](https://www.deepgram.com/)
|
|
6
|
-
speech recognition APIs.
|
|
7
|
-
|
|
5
|
+
Official Node.js SDK for [Deepgram](https://www.deepgram.com/). Start building with our powerful transcription & speech understanding API.
|
|
8
6
|
> This SDK only supports hosted usage of api.deepgram.com.
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
> ### Deprecated JS Browser SDK
|
|
9
|
+
>
|
|
10
|
+
> As of version 2.x, the JS Browser SDK was removed from the Node SDK and will become an independent Client SDK.
|
|
11
|
+
> To use the older SDK, please `npm i @deepgram/sdk@1.2.1` and use `@deepgram/sdk/browser`.
|
|
12
|
+
|
|
13
|
+
* [Deepgram Node.js SDK](#deepgram-nodejs-sdk)
|
|
14
|
+
* [Getting an API Key](#getting-an-api-key)
|
|
15
|
+
* [Installation](#installation)
|
|
16
|
+
* [Constructor](#constructor)
|
|
17
|
+
* [Transcription](#transcription)
|
|
18
|
+
* [Remote Files](#remote-files)
|
|
19
|
+
* [Local Files](#local-files)
|
|
20
|
+
* [Live Audio](#live-audio)
|
|
21
|
+
* [Projects](#projects)
|
|
22
|
+
* [Get Projects](#get-projects)
|
|
23
|
+
* [Get Project](#get-project)
|
|
24
|
+
* [Update Project](#update-project)
|
|
25
|
+
* [Delete Project](#delete-project)
|
|
26
|
+
* [Keys](#keys)
|
|
27
|
+
* [List Keys](#list-keys)
|
|
28
|
+
* [Get Key](#get-key)
|
|
29
|
+
* [Create Key](#create-key)
|
|
30
|
+
* [Delete Key](#delete-key)
|
|
31
|
+
* [Members](#members)
|
|
32
|
+
* [Get Members](#get-members)
|
|
33
|
+
* [Remove Member](#remove-member)
|
|
34
|
+
* [Scopes](#scopes)
|
|
35
|
+
* [Get Member Scopes](#get-member-scopes)
|
|
36
|
+
* [Update Scope](#update-scope)
|
|
37
|
+
* [Invitations](#invitations)
|
|
38
|
+
* [List Invites](#list-invites)
|
|
39
|
+
* [Send Invite](#send-invite)
|
|
40
|
+
* [Delete Invite](#delete-invite)
|
|
41
|
+
* [Leave Project](#leave-project)
|
|
42
|
+
* [Usage](#usage)
|
|
43
|
+
* [Get All Requests](#get-all-requests)
|
|
44
|
+
* [Get Request](#get-request)
|
|
45
|
+
* [Summarize Usage](#summarize-usage)
|
|
46
|
+
* [Get Fields](#get-fields)
|
|
47
|
+
* [Billing](#billing)
|
|
48
|
+
* [Get All Balances](#get-all-balances)
|
|
49
|
+
* [Get Balance](#get-balance)
|
|
50
|
+
* [Development and Contributing](#development-and-contributing)
|
|
51
|
+
* [Getting Help](#getting-help)
|
|
52
|
+
|
|
53
|
+
# Getting an API Key
|
|
54
|
+
|
|
55
|
+
🔑 To access the Deepgram API you will need a [free Deepgram API Key](https://console.deepgram.com/signup?jump=keys).
|
|
56
|
+
|
|
57
|
+
# Installation
|
|
23
58
|
|
|
24
59
|
```bash
|
|
25
60
|
npm install @deepgram/sdk
|
|
61
|
+
# - or -
|
|
62
|
+
# yarn add @deepgram/sdk
|
|
26
63
|
```
|
|
27
64
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
yarn add @deepgram/sdk
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Constructor
|
|
65
|
+
# Constructor
|
|
35
66
|
|
|
36
67
|
```js
|
|
37
68
|
const { Deepgram } = require("@deepgram/sdk");
|
|
69
|
+
// - or -
|
|
70
|
+
// import { Deepgram } from "@deepgram/sdk";
|
|
38
71
|
|
|
39
72
|
const deepgram = new Deepgram(DEEPGRAM_API_KEY);
|
|
40
73
|
```
|
|
41
74
|
|
|
42
|
-
#
|
|
75
|
+
# Transcription
|
|
43
76
|
|
|
44
|
-
##
|
|
77
|
+
## Remote Files
|
|
45
78
|
|
|
46
|
-
|
|
79
|
+
```js
|
|
80
|
+
const response = await deepgram.transcription.preRecorded(
|
|
81
|
+
{ url: URL_OF_FILE },
|
|
82
|
+
options
|
|
83
|
+
);
|
|
84
|
+
```
|
|
47
85
|
|
|
48
|
-
|
|
86
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/pre-recorded).
|
|
49
87
|
|
|
50
|
-
|
|
51
|
-
const fileSource = { url: URL_OF_FILE };
|
|
88
|
+
## Local Files
|
|
52
89
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
90
|
+
```js
|
|
91
|
+
const response = await deepgram.transcription.preRecorded(
|
|
92
|
+
{
|
|
93
|
+
stream: fs.createReadStream("/path/to/file"),
|
|
94
|
+
mimetype: MIMETYPE_OF_FILE,
|
|
95
|
+
},
|
|
96
|
+
options
|
|
97
|
+
);
|
|
56
98
|
```
|
|
57
99
|
|
|
58
|
-
|
|
100
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/pre-recorded).
|
|
101
|
+
|
|
102
|
+
## Live Audio
|
|
59
103
|
|
|
60
104
|
```js
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const response = await deepgram.transcription.preRecorded(streamSource, {
|
|
67
|
-
punctuate: true,
|
|
68
|
-
});
|
|
105
|
+
const ws = dg.transcription.live(options);
|
|
106
|
+
|
|
107
|
+
// source.addListener('got-some-audio', async (event) => {
|
|
108
|
+
ws.send(event);
|
|
109
|
+
// })
|
|
69
110
|
```
|
|
70
111
|
|
|
71
|
-
|
|
112
|
+
See an example, here: [https://github.com/deepgram-devs/node-live-example](https://github.com/deepgram-devs/node-live-example).
|
|
72
113
|
|
|
73
|
-
See
|
|
114
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/streaming).
|
|
74
115
|
|
|
75
|
-
|
|
116
|
+
# Projects
|
|
117
|
+
|
|
118
|
+
## Get Projects
|
|
119
|
+
|
|
120
|
+
Returns all projects accessible by the API key.
|
|
76
121
|
|
|
77
|
-
#### listRequests
|
|
78
|
-
Retrieves all requests associated with the provided project_id based on the provided options.
|
|
79
|
-
```js
|
|
80
|
-
deepgram.usage
|
|
81
|
-
.listRequests("84b227ad-dfac-4096-82f6-f7397006050b", {
|
|
82
|
-
start: "2022-07-01",
|
|
83
|
-
end: "2022-07-28",
|
|
84
|
-
})
|
|
85
|
-
.then((response) => {
|
|
86
|
-
console.log("Usage: ", response);
|
|
87
|
-
})
|
|
88
|
-
.catch((err) => {
|
|
89
|
-
console.log("ERROR: ", err);
|
|
90
|
-
});
|
|
91
|
-
```
|
|
92
|
-
#### getRequest
|
|
93
|
-
Retrieves a specific request associated with the provided project_id.
|
|
94
122
|
```js
|
|
95
|
-
deepgram.
|
|
96
|
-
.getRequest(
|
|
97
|
-
// projectId
|
|
98
|
-
"84b227ad-dfac-4096-82f6-f7397006050b",
|
|
99
|
-
// requestId
|
|
100
|
-
"f12cc224-282b-4de4-90f1-651d5fdf04f1"
|
|
101
|
-
)
|
|
102
|
-
.then((response) => {
|
|
103
|
-
fs.writeFileSync(
|
|
104
|
-
`usage.json`,
|
|
105
|
-
JSON.stringify(response),
|
|
106
|
-
() => `Wrote json`
|
|
107
|
-
);
|
|
108
|
-
})
|
|
109
|
-
.catch((err) => {
|
|
110
|
-
console.log("ERROR: ", err);
|
|
111
|
-
});
|
|
123
|
+
const result = await deepgram.projects.list();
|
|
112
124
|
```
|
|
113
125
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
punctuate: true,
|
|
120
|
-
diarize: true
|
|
121
|
-
})
|
|
122
|
-
.then((response) => {
|
|
123
|
-
console.log("Usage: ", response);
|
|
124
|
-
})
|
|
125
|
-
.catch((err) => {
|
|
126
|
-
console.log("ERROR: ", err);
|
|
127
|
-
});
|
|
128
|
-
```
|
|
126
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/get-projects).
|
|
127
|
+
|
|
128
|
+
## Get Project
|
|
129
|
+
|
|
130
|
+
Retrieves a specific project based on the provided project_id.
|
|
129
131
|
|
|
130
|
-
### getFields
|
|
131
|
-
Retrieves features used by the provided project_id based on the provided options.
|
|
132
132
|
```js
|
|
133
|
-
deepgram.
|
|
134
|
-
.getFields("84b227ad-dfac-4096-82f6-f7397006050b", {
|
|
135
|
-
start: "2022-07-01",
|
|
136
|
-
end: "2022-07-28",
|
|
137
|
-
})
|
|
138
|
-
.then((response) => {
|
|
139
|
-
console.log("Usage: ", response);
|
|
140
|
-
})
|
|
141
|
-
.catch((err) => {
|
|
142
|
-
console.log("ERROR: ", err);
|
|
143
|
-
});
|
|
133
|
+
const result = await deepgram.projects.get(project_id);
|
|
144
134
|
```
|
|
145
135
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
136
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/get-project).
|
|
137
|
+
|
|
138
|
+
## Update Project
|
|
139
|
+
|
|
140
|
+
Update a project.
|
|
141
|
+
|
|
149
142
|
```js
|
|
150
|
-
deepgram.
|
|
151
|
-
.get(
|
|
152
|
-
"84b227ad-dfac-4096-82f6-f7397006050b",
|
|
153
|
-
"f12cc224-282b-4de4-90f1-651d5fdf04f1"
|
|
154
|
-
)
|
|
155
|
-
.then((response) => {
|
|
156
|
-
fs.writeFileSync(
|
|
157
|
-
`scope.json`,
|
|
158
|
-
JSON.stringify(response),
|
|
159
|
-
() => `Wrote json`
|
|
160
|
-
);
|
|
161
|
-
})
|
|
162
|
-
.catch((err) => {
|
|
163
|
-
console.log("ERROR: ", err);
|
|
164
|
-
});
|
|
143
|
+
const result = await deepgram.projects.update(project_id, options);
|
|
165
144
|
```
|
|
166
145
|
|
|
167
|
-
|
|
168
|
-
|
|
146
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/update-project).
|
|
147
|
+
|
|
148
|
+
## Delete Project
|
|
149
|
+
|
|
150
|
+
Delete a project.
|
|
151
|
+
|
|
169
152
|
```js
|
|
170
|
-
deepgram.
|
|
171
|
-
.update(
|
|
172
|
-
"84b227ad-dfac-4096-82f6-f7397006050b",
|
|
173
|
-
"f12cc224-282b-4de4-90f1-651d5fdf04f1",
|
|
174
|
-
"member:read"
|
|
175
|
-
)
|
|
176
|
-
.then((response) => {
|
|
177
|
-
console.log({response})
|
|
178
|
-
})
|
|
179
|
-
.catch((err) => {
|
|
180
|
-
console.log("ERROR: ", err);
|
|
181
|
-
});
|
|
153
|
+
await deepgram.projects.delete(project_id);
|
|
182
154
|
```
|
|
183
155
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
156
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/delete-project).
|
|
157
|
+
|
|
158
|
+
# Keys
|
|
159
|
+
|
|
160
|
+
## List Keys
|
|
161
|
+
|
|
162
|
+
Retrieves all keys associated with the provided project_id.
|
|
163
|
+
|
|
187
164
|
```js
|
|
188
|
-
deepgram.
|
|
189
|
-
.list()
|
|
190
|
-
.then((response) => {
|
|
191
|
-
console.log("list", response);
|
|
192
|
-
})
|
|
193
|
-
.catch((err) => {
|
|
194
|
-
console.log("err", err);
|
|
195
|
-
});
|
|
165
|
+
const result = await deepgram.keys.list(project_id);
|
|
196
166
|
```
|
|
197
167
|
|
|
198
|
-
|
|
199
|
-
|
|
168
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/list-keys).
|
|
169
|
+
|
|
170
|
+
## Get Key
|
|
171
|
+
|
|
172
|
+
Retrieves a specific key associated with the provided project_id.
|
|
173
|
+
|
|
200
174
|
```js
|
|
201
|
-
deepgram.
|
|
202
|
-
.get("84b227ad-dfac-4096-82f6-f7397006050b")
|
|
203
|
-
.then((response) => {
|
|
204
|
-
console.log("list", response);
|
|
205
|
-
})
|
|
206
|
-
.catch((err) => {
|
|
207
|
-
console.log("err", err);
|
|
208
|
-
});
|
|
175
|
+
const result = await deepgram.keys.get(project_id, key_id);
|
|
209
176
|
```
|
|
210
177
|
|
|
211
|
-
|
|
212
|
-
|
|
178
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/get-key).
|
|
179
|
+
|
|
180
|
+
## Create Key
|
|
181
|
+
|
|
182
|
+
Creates an API key with the provided scopes.
|
|
183
|
+
|
|
213
184
|
```js
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
{ project_id: "84b227ad-dfac-4096-82f6-f7397006050b" },
|
|
217
|
-
{
|
|
218
|
-
name: "A new name",
|
|
219
|
-
}
|
|
220
|
-
)
|
|
221
|
-
.then((response) => {
|
|
222
|
-
console.log("list", response);
|
|
223
|
-
})
|
|
224
|
-
.catch((err) => {
|
|
225
|
-
console.log("err", err);
|
|
226
|
-
});
|
|
185
|
+
let scopes = ["member", "etc"];
|
|
186
|
+
const result = await deepgram.keys.create(project_id, comment, scopes, options);
|
|
227
187
|
```
|
|
228
188
|
|
|
229
|
-
|
|
230
|
-
|
|
189
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/create-key).
|
|
190
|
+
|
|
191
|
+
## Delete Key
|
|
192
|
+
|
|
193
|
+
Deletes a specific key associated with the provided project_id.
|
|
194
|
+
|
|
231
195
|
```js
|
|
232
|
-
deepgram.
|
|
233
|
-
.delete("84b227ad-dfac-4096-82f6-f7397006050b")
|
|
234
|
-
.then((response) => {
|
|
235
|
-
console.log("delete", response);
|
|
236
|
-
})
|
|
237
|
-
.catch((err) => {
|
|
238
|
-
console.log("err", err);
|
|
239
|
-
});
|
|
196
|
+
await deepgram.keys.delete(project_id, key_id);
|
|
240
197
|
```
|
|
241
198
|
|
|
242
|
-
|
|
199
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/delete-key).
|
|
200
|
+
|
|
201
|
+
# Members
|
|
202
|
+
|
|
203
|
+
## Get Members
|
|
204
|
+
|
|
205
|
+
Retrieves account objects for all of the accounts in the specified project_id.
|
|
243
206
|
|
|
244
|
-
#### listMembers
|
|
245
|
-
Retrieves account objects for all of the accounts in the specified project.
|
|
246
207
|
```js
|
|
247
|
-
deepgram.members
|
|
248
|
-
.listMembers("84b227ad-dfac-4096-82f6-f7397006050b")
|
|
249
|
-
.then((response) => {
|
|
250
|
-
console.log("Members: ", response);
|
|
251
|
-
})
|
|
252
|
-
.catch((err) => {
|
|
253
|
-
console.log("Members ERROR: ", err);
|
|
254
|
-
});
|
|
208
|
+
const result = await deepgram.members.listMembers(project_id);
|
|
255
209
|
```
|
|
256
210
|
|
|
257
|
-
|
|
211
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/get-members).
|
|
212
|
+
|
|
213
|
+
## Remove Member
|
|
214
|
+
|
|
258
215
|
Removes member account for specified member_id.
|
|
259
|
-
```js
|
|
260
|
-
deepgram.members
|
|
261
|
-
.removeMember(
|
|
262
|
-
"84b227ad-dfac-4096-82f6-f7397006050b",
|
|
263
|
-
"f12cc224-282b-4de4-90f1-651d5fdf04f1"
|
|
264
|
-
)
|
|
265
|
-
.then((response) => {
|
|
266
|
-
console.log("Member DELETED: ", response);
|
|
267
|
-
})
|
|
268
|
-
.catch((err) => {
|
|
269
|
-
console.log("Member DELETED ERROR: ", err);
|
|
270
|
-
});
|
|
271
|
-
```
|
|
272
216
|
|
|
273
|
-
### Keys
|
|
274
|
-
#### list
|
|
275
|
-
Retrieves all keys associated with the provided project_id.
|
|
276
217
|
```js
|
|
277
|
-
deepgram.
|
|
278
|
-
.list("84b227ad-dfac-4096-82f6-f7397006050b")
|
|
279
|
-
.then((res) => {
|
|
280
|
-
console.log({ res });
|
|
281
|
-
})
|
|
282
|
-
.catch((err) => {
|
|
283
|
-
console.log("ERROR: ", err);
|
|
284
|
-
});
|
|
218
|
+
const result = await deepgram.members.removeMember(project_id, member_id);
|
|
285
219
|
```
|
|
286
220
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
)
|
|
295
|
-
.then((res) => {
|
|
296
|
-
console.log({ res });
|
|
297
|
-
})
|
|
298
|
-
.catch((err) => {
|
|
299
|
-
console.log("ERROR: ", err);
|
|
300
|
-
});
|
|
301
|
-
```
|
|
221
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/remove-member).
|
|
222
|
+
|
|
223
|
+
# Scopes
|
|
224
|
+
|
|
225
|
+
## Get Member Scopes
|
|
226
|
+
|
|
227
|
+
Retrieves scopes of the specified member in the specified project.
|
|
302
228
|
|
|
303
|
-
#### create
|
|
304
|
-
Creates an API key with the provided scopes.
|
|
305
229
|
```js
|
|
306
|
-
deepgram.
|
|
307
|
-
.create(
|
|
308
|
-
"84b227ad-dfac-4096-82f6-f7397006050b",
|
|
309
|
-
"Temporary key",
|
|
310
|
-
["usage"],
|
|
311
|
-
{
|
|
312
|
-
timeToLive: 5000,
|
|
313
|
-
}
|
|
314
|
-
)
|
|
315
|
-
.then((res) => {
|
|
316
|
-
console.log({ res });
|
|
317
|
-
})
|
|
318
|
-
.catch((err) => {
|
|
319
|
-
console.log("ERROR: ", err);
|
|
320
|
-
});
|
|
230
|
+
const result = await deepgram.scopes.get(project_id, member_id);
|
|
321
231
|
```
|
|
322
232
|
|
|
323
|
-
|
|
324
|
-
|
|
233
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/get-member-scopes).
|
|
234
|
+
|
|
235
|
+
## Update Scope
|
|
236
|
+
|
|
237
|
+
Updates the scope for the specified member in the specified project.
|
|
238
|
+
|
|
325
239
|
```js
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
"84b227ad-dfac-4096-82f6-f7397006050b",
|
|
329
|
-
"f12cc224-282b-4de4-90f1-651d5fdf04f1"
|
|
330
|
-
)
|
|
331
|
-
.then((response) => {
|
|
332
|
-
console.log("KEY DELTED: ", response);
|
|
333
|
-
})
|
|
334
|
-
.catch((err) => {
|
|
335
|
-
console.log("KEY DELETED ERROR: ", err);
|
|
336
|
-
});
|
|
240
|
+
let scope = "member:read";
|
|
241
|
+
const result = await deepgram.scopes.update(project_id, member_id, scope);
|
|
337
242
|
```
|
|
338
243
|
|
|
339
|
-
|
|
340
|
-
|
|
244
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/update-scope).
|
|
245
|
+
|
|
246
|
+
# Invitations
|
|
247
|
+
|
|
248
|
+
## List Invites
|
|
249
|
+
|
|
341
250
|
Retrieves all invitations associated with the provided project_id.
|
|
251
|
+
|
|
342
252
|
```js
|
|
343
|
-
deepgram.invitations
|
|
344
|
-
.list("84b227ad-dfac-4096-82f6-f7397006050b")
|
|
345
|
-
.then((res) => {
|
|
346
|
-
console.log({ res });
|
|
347
|
-
})
|
|
348
|
-
.catch((err) => {
|
|
349
|
-
console.log("ERROR: ", err);
|
|
350
|
-
});
|
|
253
|
+
const result = await deepgram.invitations.list(project_id);
|
|
351
254
|
```
|
|
352
255
|
|
|
353
|
-
|
|
256
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/list-invites).
|
|
257
|
+
|
|
258
|
+
## Send Invite
|
|
259
|
+
|
|
354
260
|
Sends an invitation to the provided email address.
|
|
261
|
+
|
|
355
262
|
```js
|
|
356
|
-
deepgram.invitation
|
|
357
|
-
.send("84b227ad-dfac-4096-82f6-f7397006050b", {
|
|
358
|
-
email: "user@email.com",
|
|
359
|
-
scope: "member",
|
|
360
|
-
})
|
|
361
|
-
.then((response) => {
|
|
362
|
-
console.log("Invitation sent: ", response);
|
|
363
|
-
})
|
|
364
|
-
.catch((err) => {
|
|
365
|
-
console.log("Invitation ERROR: ", err);
|
|
366
|
-
});
|
|
263
|
+
const result = await deepgram.invitation.send(project_id, options);
|
|
367
264
|
```
|
|
368
265
|
|
|
369
|
-
|
|
370
|
-
|
|
266
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/send-invites).
|
|
267
|
+
|
|
268
|
+
## Delete Invite
|
|
269
|
+
|
|
270
|
+
Removes the specified invitation from the project.
|
|
271
|
+
|
|
371
272
|
```js
|
|
372
|
-
deepgram.
|
|
373
|
-
|
|
374
|
-
.then((response) => {
|
|
375
|
-
console.log({response});
|
|
376
|
-
})
|
|
377
|
-
.catch((err) => {
|
|
378
|
-
console.log("Invitation leave ERROR: ", err);
|
|
379
|
-
});
|
|
273
|
+
let email = "devrel@deepgram.com";
|
|
274
|
+
const result = await deepgram.invitation.delete(project_id, email);
|
|
380
275
|
```
|
|
381
276
|
|
|
382
|
-
|
|
383
|
-
|
|
277
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/delete-invite).
|
|
278
|
+
|
|
279
|
+
## Leave Project
|
|
280
|
+
|
|
281
|
+
Removes the authenticated user from the project.
|
|
282
|
+
|
|
384
283
|
```js
|
|
385
|
-
deepgram.invitation
|
|
386
|
-
.delete("84b227ad-dfac-4096-82f6-f7397006050b", "user@email.com")
|
|
387
|
-
.then((response) => {
|
|
388
|
-
console.log({response});
|
|
389
|
-
})
|
|
390
|
-
.catch((err) => {
|
|
391
|
-
console.log("Invitation delete ERROR: ", err);
|
|
392
|
-
});
|
|
284
|
+
const result = await deepgram.invitation.leave(project_id);
|
|
393
285
|
```
|
|
394
286
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
287
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/leave-project).
|
|
288
|
+
|
|
289
|
+
# Usage
|
|
290
|
+
|
|
291
|
+
## Get All Requests
|
|
292
|
+
|
|
293
|
+
Retrieves all requests associated with the provided project_id based on the provided options.
|
|
294
|
+
|
|
398
295
|
```js
|
|
399
|
-
deepgram.
|
|
400
|
-
.listBalances("84b227ad-dfac-4096-82f6-f7397006050b")
|
|
401
|
-
.then((response) => {
|
|
402
|
-
console.log({response});
|
|
403
|
-
})
|
|
404
|
-
.catch((err) => {
|
|
405
|
-
console.log("Billing listBalances ERROR: ", err);
|
|
406
|
-
});
|
|
296
|
+
const result = await deepgram.usage.listRequests(project_id, options);
|
|
407
297
|
```
|
|
408
298
|
|
|
409
|
-
|
|
410
|
-
|
|
299
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/get-all-requests).
|
|
300
|
+
|
|
301
|
+
## Get Request
|
|
302
|
+
|
|
303
|
+
Retrieves a specific request associated with the provided project_id.
|
|
304
|
+
|
|
411
305
|
```js
|
|
412
|
-
deepgram.
|
|
413
|
-
.getBalance("84b227ad-dfac-4096-82f6-f7397006050b", "21b98377-657e-471a-b75e-299fb99ec2c3")
|
|
414
|
-
.then((response) => {
|
|
415
|
-
console.log({response});
|
|
416
|
-
})
|
|
417
|
-
.catch((err) => {
|
|
418
|
-
console.log("Billing getBalance ERROR: ", err);
|
|
419
|
-
});
|
|
306
|
+
const result = await deepgram.usage.getRequest(project_id, request_id);
|
|
420
307
|
```
|
|
421
308
|
|
|
422
|
-
|
|
309
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/get-request).
|
|
423
310
|
|
|
424
|
-
|
|
311
|
+
## Summarize Usage
|
|
425
312
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
313
|
+
Retrieves usage associated with the provided project_id based on the provided options.
|
|
314
|
+
|
|
315
|
+
```js
|
|
316
|
+
const result = await deepgram.usage.getUsage(project_id, options);
|
|
429
317
|
```
|
|
430
318
|
|
|
431
|
-
|
|
432
|
-
|
|
319
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/summarize-usage).
|
|
320
|
+
|
|
321
|
+
## Get Fields
|
|
322
|
+
|
|
323
|
+
Lists the features, models, tags, languages, and processing method used for requests in the specified project.
|
|
433
324
|
|
|
434
325
|
```js
|
|
435
|
-
const
|
|
436
|
-
deepgramApiKey: "YOUR_DEEPGRAM_API_KEY",
|
|
437
|
-
urlToFile:
|
|
438
|
-
"https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav",
|
|
439
|
-
};
|
|
326
|
+
const result = await deepgram.usage.getFields(project_id, options);
|
|
440
327
|
```
|
|
441
328
|
|
|
442
|
-
|
|
329
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/get-fields).
|
|
443
330
|
|
|
444
|
-
|
|
445
|
-
|
|
331
|
+
# Billing
|
|
332
|
+
|
|
333
|
+
## Get All Balances
|
|
334
|
+
|
|
335
|
+
Retrieves the list of balance info for the specified project.
|
|
336
|
+
|
|
337
|
+
```js
|
|
338
|
+
const result = await deepgram.billing.listBalances(project_id);
|
|
446
339
|
```
|
|
447
340
|
|
|
448
|
-
|
|
341
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/get-all-balances).
|
|
342
|
+
|
|
343
|
+
## Get Balance
|
|
449
344
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
345
|
+
Retrieves the balance info for the specified project and balance_id.
|
|
346
|
+
|
|
347
|
+
```js
|
|
348
|
+
const result = await deepgram.billing.getBalance(project_id, balance_id);
|
|
349
|
+
```
|
|
455
350
|
|
|
456
|
-
|
|
351
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/get-balance).
|
|
352
|
+
|
|
353
|
+
# Development and Contributing
|
|
457
354
|
|
|
458
355
|
Interested in contributing? We ❤️ pull requests!
|
|
459
356
|
|
|
@@ -461,17 +358,11 @@ To make sure our community is safe for all, be sure to review and agree to our
|
|
|
461
358
|
[Code of Conduct](./CODE_OF_CONDUCT.md). Then see the
|
|
462
359
|
[Contribution](./CONTRIBUTING.md) guidelines for more information.
|
|
463
360
|
|
|
464
|
-
|
|
361
|
+
# Getting Help
|
|
465
362
|
|
|
466
363
|
We love to hear from you so if you have questions, comments or find a bug in the
|
|
467
364
|
project, let us know! You can either:
|
|
468
365
|
|
|
469
|
-
- [Open an issue](https://github.com/deepgram/node-sdk/issues/new)
|
|
470
|
-
-
|
|
471
|
-
|
|
472
|
-
## Further Reading
|
|
473
|
-
|
|
474
|
-
Check out the Developer Documentation at [https://developers.deepgram.com/](https://developers.deepgram.com/)
|
|
475
|
-
|
|
476
|
-
[signup]: https://console.deepgram.com/signup?utm_medium=github&utm_source=DEVREL&utm_content=node-sdk
|
|
477
|
-
[license]: LICENSE.txt
|
|
366
|
+
- [Open an issue in this repository](https://github.com/deepgram/node-sdk/issues/new)
|
|
367
|
+
- [Join the Deepgram Github Discussions Community](https://github.com/orgs/deepgram/discussions)
|
|
368
|
+
- [Join the Deepgram Discord Community](https://discord.gg/xWRaCDBtW4)
|