-
Notifications
You must be signed in to change notification settings - Fork 28
/
types.go
380 lines (328 loc) · 12.8 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
// Copyright 2023-2024 Deepgram SDK contributors. All Rights Reserved.
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
/*
This package provides the types for the Deepgram Manage API.
*/
package interfaces
import (
"time"
"github.com/deepgram/deepgram-go-sdk/pkg/client/interfaces"
)
/***********************************/
// shared/common structs
/***********************************/
// Balance provides a balance
type Balance struct {
BalanceID string `json:"balance_id,omitempty"`
Amount float64 `json:"amount,omitempty"`
Units string `json:"units,omitempty"`
PurchaseOrderID string `json:"purchase_order_id,omitempty"`
}
// BalanceList provides a list of balances
type BalanceList struct {
Balances []Balance `json:"balances,omitempty"`
}
// Invitation provides an invitation
type Invite struct {
Email string `json:"email,omitempty"`
Scope string `json:"scope,omitempty"`
}
// InvitationList provides a list of invitations
type InvitesList struct {
Invites []Invite `json:"invites,omitempty"`
}
// APIKeyPermission Provides a user and key pairing
type APIKeyPermission struct {
Member Member `json:"member,omitempty"`
APIKey APIKey `json:"api_key,omitempty"`
}
// Key provides a key
type APIKey struct {
APIKeyID string `json:"api_key_id,omitempty"`
Key string `json:"key,omitempty"`
Comment string `json:"comment,omitempty"`
Scopes []string `json:"scopes,omitempty"`
Created string `json:"created,omitempty"`
}
// KeyList provides a list of keys
type APIKeysList struct {
APIKeys []APIKeyPermission `json:"api_keys,omitempty"`
}
// ScopeList provides a list of scopes
type ScopeList struct {
Scopes []string `json:"scopes,omitempty"`
}
// Member provides a member
type Member struct {
MemberID string `json:"member_id,omitempty"`
Email string `json:"email,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Scopes []string `json:"scopes,omitempty"`
}
// MemberList provides a list of members
type MemberList struct {
Members []Member `json:"members,omitempty"`
}
// Project provides a project
type Project struct {
ProjectID string `json:"project_id,omitempty"`
Name string `json:"name,omitempty"`
Company string `json:"company,omitempty"`
}
// ProjectList provides a list of projects
type ProjectList struct {
Projects []Project `json:"projects,omitempty"`
}
// Token provides a token
type Token struct {
In int `json:"in,omitempty"`
Out int `json:"out,omitempty"`
}
// TTS provides a TTS
type TTS struct {
Characters int `json:"characters,omitempty"`
Requests int `json:"requests,omitempty"`
}
// TokenDetails provides token details
type TokenDetails struct {
Feature string `json:"feature,omitempty"`
Input int `json:"input,omitempty"`
Output int `json:"output,omitempty"`
Model string `json:"model,omitempty"`
}
// SpeechSegment provides a speech segment
type SpeechSegment struct {
Characters int `json:"characters,omitempty"`
Model string `json:"model,omitempty"`
Tier string `json:"tier,omitempty"`
}
// TTSDetails provides token details
type TTSDetails struct {
Duration float64 `json:"duration,omitempty"`
SpeechSegments []SpeechSegment `json:"speech_segments,omitempty"`
// TODO: audio_metadata
}
// Config provides a config
type Config struct {
Language string `json:"language,omitempty"`
Model string `json:"model,omitempty"`
Punctuate *bool `json:"punctuate,omitempty"`
Utterances *bool `json:"utterances,omitempty"`
Diarize *bool `json:"diarize,omitempty"`
SmartFormat *bool `json:"smart_format,omitempty"`
InterimResults *bool `json:"interim_results,omitempty"`
Topics *string `json:"topics,omitempty"`
Intents *string `json:"intents,omitempty"`
Sentiment *bool `json:"sentiment,omitempty"`
Summarize *string `json:"summarize,omitempty"`
}
// Details provides details
type Details struct {
Usd float64 `json:"usd,omitempty"`
Duration float64 `json:"duration,omitempty"`
TotalAudio float64 `json:"total_audio,omitempty"`
Channels int `json:"channels,omitempty"`
Streams int `json:"streams,omitempty"`
Models []string `json:"models,omitempty"`
Method string `json:"method,omitempty"`
Tier string `json:"tier,omitempty"`
Tags []string `json:"tags,omitempty"`
Features []string `json:"features,omitempty"`
Config Config `json:"config,omitempty"`
}
// Response provides a response
type Response struct {
Details Details `json:"details,omitempty"`
Code int `json:"code,omitempty"`
Completed string `json:"completed,omitempty"`
TTSDetails *TTSDetails `json:"tts_details,omitempty"`
TokenDetails []TokenDetails `json:"token_details,omitempty"`
}
type Callback struct {
Attempts int `json:"attempts,omitempty"`
Code int `json:"code,omitempty"`
Completed string `json:"completed,omitempty"`
}
// Request provides a request
type Request struct {
RequestID string `json:"request_id,omitempty"`
ProjectUUID string `json:"project_uuid,omitempty"`
Created string `json:"created,omitempty"`
Path string `json:"path,omitempty"`
Accessor string `json:"accessor,omitempty"`
APIKeyID string `json:"api_key_id,omitempty"`
Response Response `json:"response,omitempty"`
Callback Callback `json:"callback,omitempty"`
}
// Model provides a list of models
type Model struct {
Name string `json:"name,omitempty"`
Language string `json:"language,omitempty"`
Version string `json:"version,omitempty"`
ModelID string `json:"model_id,omitempty"`
}
// Resolution provides a resolution
type Resolution struct {
Units string `json:"units,omitempty"`
Amount int `json:"amount,omitempty"`
}
// Result provides a list of results
type Result struct {
Start string `json:"start,omitempty"`
End string `json:"end,omitempty"`
Hours float64 `json:"hours,omitempty"`
TotalHours float64 `json:"total_hours,omitempty"`
Requests int `json:"requests,omitempty"`
Tokens Token `json:"tokens,omitempty"`
TTS TTS `json:"tts,omitempty"`
}
// RequestList provides a list of requests
type RequestList struct {
Page int `json:"page,omitempty"`
Limit int `json:"limit,omitempty"`
Requests []Request `json:"requests,omitempty"`
}
// UsageField provides a usage field
type UsageField struct {
Tags []string `json:"tags,omitempty"`
Models []Model `json:"models,omitempty"`
ProcessingMethods []string `json:"processing_methods,omitempty"`
Features []string `json:"features,omitempty"`
Languages []string `json:"languages,omitempty"`
}
// Usage provides a usage
type Usage struct {
Start string `json:"start,omitempty"`
End string `json:"end,omitempty"`
Resolution Resolution `json:"resolution,omitempty"`
Results []Result `json:"results,omitempty"`
}
/***********************************/
// Request/Input structs
/***********************************/
// ProjectUpdateRequest provides a project update
type ProjectUpdateRequest struct {
Name string `json:"name,omitempty" url:"name,omitempty"`
Company string `json:"company,omitempty" url:"company,omitempty"`
}
// InvitationRequest provides an invitation request
type InvitationRequest struct {
Email string `json:"email,omitempty" url:"email,omitempty"`
Scope string `json:"scope,omitempty" url:"scope,omitempty"`
}
// KeyCreateRequest provides a key create request
type KeyCreateRequest struct {
Comment string `json:"comment,omitempty" url:"comment,omitempty"`
Scopes []string `json:"scopes,omitempty" url:"scopes,omitempty"`
ExpirationDate time.Time `json:"expiration_date,omitempty" url:"expiration_date,omitempty"`
TimeToLive int `json:"time_to_live_in_seconds,omitempty" url:"time_to_live_in_seconds,omitempty"`
Tags []string `json:"tags,omitempty" url:"tags,omitempty"`
}
// ScopeUpdateRequest provides a scope update request
type ScopeUpdateRequest struct {
Scope string `json:"scope,omitempty" url:"scope,omitempty"`
}
// UsageListRequest provides a usage request
type UsageListRequest struct {
Start string `json:"start,omitempty" url:"start,omitempty"`
End string `json:"end,omitempty" url:"end,omitempty"`
Page int `json:"page,omitempty" url:"page,omitempty"`
Limit int `json:"limit,omitempty" url:"limit,omitempty"`
Status string `json:"status,omitempty" url:"status,omitempty"`
}
// UsageRequest provides a usage request
type UsageRequest struct {
Accessor string `json:"accessor,omitempty" url:"accessor,omitempty"`
Alternatives bool `json:"alternatives,omitempty" url:"alternatives,omitempty"`
AnalyzeSentiment bool `json:"analyze_sentiment,omitempty" url:"analyze_sentiment,omitempty"`
DetectEntities bool `json:"detect_entities,omitempty" url:"detect_entities,omitempty"`
DetectLanguage bool `json:"detect_language,omitempty" url:"detect_language,omitempty"`
DetectTopics bool `json:"detect_topics,omitempty" url:"detect_topics,omitempty"`
Diarize bool `json:"diarize,omitempty" url:"diarize,omitempty"`
End string `json:"end,omitempty" url:"end,omitempty"`
InterimResults bool `json:"interim_results,omitempty" url:"interim_results,omitempty"`
Keywords bool `json:"keywords,omitempty" url:"keywords,omitempty"`
Method string `json:"method,omitempty" url:"method,omitempty"` // Must be one of "sync" | "async" | "streaming"
Model string `json:"model,omitempty" url:"model,omitempty"`
Multichannel bool `json:"multichannel,omitempty" url:"multichannel,omitempty"`
Ner bool `json:"ner,omitempty" url:"ner,omitempty"`
Numbers bool `json:"numbers,omitempty" url:"numbers,omitempty"`
Numerals bool `json:"numerals,omitempty" url:"numerals,omitempty"`
Paragraphs bool `json:"paragraphs,omitempty" url:"paragraphs,omitempty"`
ProfanityFilter bool `json:"profanity_filter,omitempty" url:"profanity_filter,omitempty"`
Punctuate bool `json:"punctuate,omitempty" url:"punctuate,omitempty"`
Redact bool `json:"redact,omitempty" url:"redact,omitempty"`
Replace bool `json:"replace,omitempty" url:"replace,omitempty"`
Search bool `json:"search,omitempty" url:"search,omitempty"`
Sentiment bool `json:"sentiment,omitempty" url:"sentiment,omitempty"`
SentimentThreshold float64 `json:"sentiment_threshold,omitempty" url:"sentiment_threshold,omitempty"`
SmartFormat bool `json:"smart_format,omitempty" url:"smart_format,omitempty"`
Start string `json:"start,omitempty" url:"start,omitempty"`
Summarize bool `json:"summarize,omitempty" url:"summarize,omitempty"`
Tag []string `json:"tag,omitempty" url:"tag,omitempty"`
Translate bool `json:"translate,omitempty" url:"translate,omitempty"`
Utterances bool `json:"utterances,omitempty" url:"utterances,omitempty"`
UttSplit bool `json:"utt_split,omitempty" url:"utt_split,omitempty"`
}
/***********************************/
// Result/Output structs
/***********************************/
// BookmarksResult provides a generic message results
type MessageResult struct {
Message string `json:"message"`
}
// BalanceResult provides a result with a list of balances
type BalancesResult struct {
BalanceList
}
// BalanceResult provides a result with a single balance
type BalanceResult struct {
Balance
}
// InvitationResult provides a result with a single invitation
type InvitationsResult struct {
InvitesList
}
// InvitationResult provides a result with a single invitation
type KeysResult struct {
APIKeysList
}
// KeyResult provides a result with a single key
type KeyResult struct {
APIKeyPermission
}
// MembersResult provides a result with a list of members
type MembersResult struct {
MemberList
}
// ProjectsResult provides a result with a list of projects
type ProjectsResult struct {
ProjectList
}
// ProjectResult provides a result with a single project
type ProjectResult struct {
Project
}
type ScopeResult struct {
ScopeList
}
// UsageResult provides a result with a list of usage
type UsageListResult struct {
RequestList
}
// UsageRequestResult provides a result with a single usage request
type UsageRequestResult struct {
Request
}
// UsageFieldResult provides a result with a list of fields
type UsageFieldResult struct {
UsageField
}
// UsageSummary provides a result with a list of usage
type UsageResult struct {
Usage
}
// ErrorResponse is the Deepgram specific response error
type ErrorResponse interfaces.DeepgramError