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