@deepgram/sdk 1.4.0 → 1.4.4
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/CHANGELOG.md +25 -0
- package/dist/browser/index.js +1 -0
- package/dist/index.d.ts +1342 -0
- package/dist/index.js +1 -0
- package/package.json +9 -6
- package/tsconfig-es6.json +16 -0
- package/webpack.config.js +21 -1
- package/bundle/billing.d.ts +0 -19
- package/bundle/billing.js +0 -73
- package/bundle/billing.js.map +0 -1
- package/bundle/browser/httpFetch.d.ts +0 -1
- package/bundle/browser/httpFetch.js +0 -75
- package/bundle/browser/httpFetch.js.map +0 -1
- package/bundle/browser/index.d.ts +0 -21
- package/bundle/browser/index.js +0 -35
- package/bundle/browser/index.js.map +0 -1
- package/bundle/browser/transcription/index.d.ts +0 -17
- package/bundle/browser/transcription/index.js +0 -75
- package/bundle/browser/transcription/index.js.map +0 -1
- package/bundle/browser/transcription/preRecordedTranscription.d.ts +0 -9
- package/bundle/browser/transcription/preRecordedTranscription.js +0 -87
- package/bundle/browser/transcription/preRecordedTranscription.js.map +0 -1
- package/bundle/constants/defaultOptions.d.ts +0 -6
- package/bundle/constants/defaultOptions.js +0 -10
- package/bundle/constants/defaultOptions.js.map +0 -1
- package/bundle/constants/index.d.ts +0 -1
- package/bundle/constants/index.js +0 -18
- package/bundle/constants/index.js.map +0 -1
- package/bundle/enums/alternatives.d.ts +0 -4
- package/bundle/enums/alternatives.js +0 -3
- package/bundle/enums/alternatives.js.map +0 -1
- package/bundle/enums/connectionState.d.ts +0 -6
- package/bundle/enums/connectionState.js +0 -11
- package/bundle/enums/connectionState.js.map +0 -1
- package/bundle/enums/diarization.d.ts +0 -4
- package/bundle/enums/diarization.js +0 -3
- package/bundle/enums/diarization.js.map +0 -1
- package/bundle/enums/index.d.ts +0 -7
- package/bundle/enums/index.js +0 -24
- package/bundle/enums/index.js.map +0 -1
- package/bundle/enums/liveTranscriptionEvents.d.ts +0 -6
- package/bundle/enums/liveTranscriptionEvents.js +0 -3
- package/bundle/enums/liveTranscriptionEvents.js.map +0 -1
- package/bundle/enums/models.d.ts +0 -5
- package/bundle/enums/models.js +0 -3
- package/bundle/enums/models.js.map +0 -1
- package/bundle/enums/punctuation.d.ts +0 -4
- package/bundle/enums/punctuation.js +0 -3
- package/bundle/enums/punctuation.js.map +0 -1
- package/bundle/enums/searchKind.d.ts +0 -4
- package/bundle/enums/searchKind.js +0 -3
- package/bundle/enums/searchKind.js.map +0 -1
- package/bundle/helpers/index.d.ts +0 -2
- package/bundle/helpers/index.js +0 -19
- package/bundle/helpers/index.js.map +0 -1
- package/bundle/helpers/secondsToTimestamp.d.ts +0 -1
- package/bundle/helpers/secondsToTimestamp.js +0 -8
- package/bundle/helpers/secondsToTimestamp.js.map +0 -1
- package/bundle/helpers/validateOptions.d.ts +0 -1
- package/bundle/helpers/validateOptions.js +0 -13
- package/bundle/helpers/validateOptions.js.map +0 -1
- package/bundle/httpRequest.d.ts +0 -3
- package/bundle/httpRequest.js +0 -91
- package/bundle/httpRequest.js.map +0 -1
- package/bundle/index.d.ts +0 -21
- package/bundle/index.js +0 -35
- package/bundle/index.js.map +0 -1
- package/bundle/invitation.d.ts +0 -30
- package/bundle/invitation.js +0 -99
- package/bundle/invitation.js.map +0 -1
- package/bundle/keys.d.ts +0 -33
- package/bundle/keys.js +0 -132
- package/bundle/keys.js.map +0 -1
- package/bundle/members.d.ts +0 -19
- package/bundle/members.js +0 -73
- package/bundle/members.js.map +0 -1
- package/bundle/projects.d.ts +0 -22
- package/bundle/projects.js +0 -82
- package/bundle/projects.js.map +0 -1
- package/bundle/scopes.d.ts +0 -21
- package/bundle/scopes.js +0 -77
- package/bundle/scopes.js.map +0 -1
- package/bundle/transcription/index.d.ts +0 -18
- package/bundle/transcription/index.js +0 -72
- package/bundle/transcription/index.js.map +0 -1
- package/bundle/transcription/liveTranscription.d.ts +0 -23
- package/bundle/transcription/liveTranscription.js +0 -83
- package/bundle/transcription/liveTranscription.js.map +0 -1
- package/bundle/transcription/preRecordedTranscription.d.ts +0 -8
- package/bundle/transcription/preRecordedTranscription.js +0 -114
- package/bundle/transcription/preRecordedTranscription.js.map +0 -1
- package/bundle/types/balance.d.ts +0 -6
- package/bundle/types/balance.js +0 -3
- package/bundle/types/balance.js.map +0 -1
- package/bundle/types/balanceList.d.ts +0 -4
- package/bundle/types/balanceList.js +0 -3
- package/bundle/types/balanceList.js.map +0 -1
- package/bundle/types/channel.d.ts +0 -25
- package/bundle/types/channel.js +0 -3
- package/bundle/types/channel.js.map +0 -1
- package/bundle/types/createKeyOptions.d.ts +0 -13
- package/bundle/types/createKeyOptions.js +0 -3
- package/bundle/types/createKeyOptions.js.map +0 -1
- package/bundle/types/hit.d.ts +0 -21
- package/bundle/types/hit.js +0 -3
- package/bundle/types/hit.js.map +0 -1
- package/bundle/types/index.d.ts +0 -38
- package/bundle/types/index.js +0 -55
- package/bundle/types/index.js.map +0 -1
- package/bundle/types/invitationList.d.ts +0 -4
- package/bundle/types/invitationList.js +0 -3
- package/bundle/types/invitationList.js.map +0 -1
- package/bundle/types/invitationOptions.d.ts +0 -4
- package/bundle/types/invitationOptions.js +0 -3
- package/bundle/types/invitationOptions.js.map +0 -1
- package/bundle/types/key.d.ts +0 -25
- package/bundle/types/key.js +0 -3
- package/bundle/types/key.js.map +0 -1
- package/bundle/types/keyResponse.d.ts +0 -10
- package/bundle/types/keyResponse.js +0 -3
- package/bundle/types/keyResponse.js.map +0 -1
- package/bundle/types/keyResponseObj.d.ts +0 -42
- package/bundle/types/keyResponseObj.js +0 -3
- package/bundle/types/keyResponseObj.js.map +0 -1
- package/bundle/types/keyword.d.ts +0 -4
- package/bundle/types/keyword.js +0 -3
- package/bundle/types/keyword.js.map +0 -1
- package/bundle/types/liveTranscriptionOptions.d.ts +0 -148
- package/bundle/types/liveTranscriptionOptions.js +0 -3
- package/bundle/types/liveTranscriptionOptions.js.map +0 -1
- package/bundle/types/liveTranscriptionResponse.d.ts +0 -9
- package/bundle/types/liveTranscriptionResponse.js +0 -3
- package/bundle/types/liveTranscriptionResponse.js.map +0 -1
- package/bundle/types/member.d.ts +0 -7
- package/bundle/types/member.js +0 -3
- package/bundle/types/member.js.map +0 -1
- package/bundle/types/memberList.d.ts +0 -4
- package/bundle/types/memberList.js +0 -3
- package/bundle/types/memberList.js.map +0 -1
- package/bundle/types/message.d.ts +0 -3
- package/bundle/types/message.js +0 -3
- package/bundle/types/message.js.map +0 -1
- package/bundle/types/metadata.d.ts +0 -8
- package/bundle/types/metadata.js +0 -3
- package/bundle/types/metadata.js.map +0 -1
- package/bundle/types/prerecordedTranscriptionOptions.d.ts +0 -126
- package/bundle/types/prerecordedTranscriptionOptions.js +0 -3
- package/bundle/types/prerecordedTranscriptionOptions.js.map +0 -1
- package/bundle/types/prerecordedTranscriptionResponse.d.ts +0 -25
- package/bundle/types/prerecordedTranscriptionResponse.js +0 -51
- package/bundle/types/prerecordedTranscriptionResponse.js.map +0 -1
- package/bundle/types/project.d.ts +0 -17
- package/bundle/types/project.js +0 -3
- package/bundle/types/project.js.map +0 -1
- package/bundle/types/projectPatchRequest.d.ts +0 -4
- package/bundle/types/projectPatchRequest.js +0 -3
- package/bundle/types/projectPatchRequest.js.map +0 -1
- package/bundle/types/projectPatchResponse.d.ts +0 -6
- package/bundle/types/projectPatchResponse.js +0 -3
- package/bundle/types/projectPatchResponse.js.map +0 -1
- package/bundle/types/projectResponse.d.ts +0 -4
- package/bundle/types/projectResponse.js +0 -3
- package/bundle/types/projectResponse.js.map +0 -1
- package/bundle/types/requestFunction.d.ts +0 -5
- package/bundle/types/requestFunction.js +0 -3
- package/bundle/types/requestFunction.js.map +0 -1
- package/bundle/types/scopeList.d.ts +0 -3
- package/bundle/types/scopeList.js +0 -3
- package/bundle/types/scopeList.js.map +0 -1
- package/bundle/types/search.d.ts +0 -14
- package/bundle/types/search.js +0 -3
- package/bundle/types/search.js.map +0 -1
- package/bundle/types/transcriptionSource.d.ts +0 -14
- package/bundle/types/transcriptionSource.js +0 -3
- package/bundle/types/transcriptionSource.js.map +0 -1
- package/bundle/types/usageCallback.d.ts +0 -4
- package/bundle/types/usageCallback.js +0 -3
- package/bundle/types/usageCallback.js.map +0 -1
- package/bundle/types/usageField.d.ts +0 -7
- package/bundle/types/usageField.js +0 -3
- package/bundle/types/usageField.js.map +0 -1
- package/bundle/types/usageFieldOptions.d.ts +0 -4
- package/bundle/types/usageFieldOptions.js +0 -3
- package/bundle/types/usageFieldOptions.js.map +0 -1
- package/bundle/types/usageOptions.d.ts +0 -23
- package/bundle/types/usageOptions.js +0 -3
- package/bundle/types/usageOptions.js.map +0 -1
- package/bundle/types/usageRequest.d.ts +0 -11
- package/bundle/types/usageRequest.js +0 -3
- package/bundle/types/usageRequest.js.map +0 -1
- package/bundle/types/usageRequestDetail.d.ts +0 -30
- package/bundle/types/usageRequestDetail.js +0 -3
- package/bundle/types/usageRequestDetail.js.map +0 -1
- package/bundle/types/usageRequestList.d.ts +0 -6
- package/bundle/types/usageRequestList.js +0 -3
- package/bundle/types/usageRequestList.js.map +0 -1
- package/bundle/types/usageRequestListOptions.d.ts +0 -7
- package/bundle/types/usageRequestListOptions.js +0 -3
- package/bundle/types/usageRequestListOptions.js.map +0 -1
- package/bundle/types/usageRequestMessage.d.ts +0 -3
- package/bundle/types/usageRequestMessage.js +0 -3
- package/bundle/types/usageRequestMessage.js.map +0 -1
- package/bundle/types/usageResponse.d.ts +0 -10
- package/bundle/types/usageResponse.js +0 -3
- package/bundle/types/usageResponse.js.map +0 -1
- package/bundle/types/usageResponseDetail.d.ts +0 -6
- package/bundle/types/usageResponseDetail.js +0 -3
- package/bundle/types/usageResponseDetail.js.map +0 -1
- package/bundle/types/utterance.d.ts +0 -39
- package/bundle/types/utterance.js +0 -3
- package/bundle/types/utterance.js.map +0 -1
- package/bundle/types/wordBase.d.ts +0 -8
- package/bundle/types/wordBase.js +0 -3
- package/bundle/types/wordBase.js.map +0 -1
- package/bundle/usage.d.ts +0 -35
- package/bundle/usage.js +0 -122
- package/bundle/usage.js.map +0 -1
- package/bundle/userAgent.d.ts +0 -1
- package/bundle/userAgent.js +0 -20
- package/bundle/userAgent.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,11 +9,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
+
## [1.4.4]
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Added `replace` to transcription option types
|
|
17
|
+
|
|
18
|
+
## [1.4.3]
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- Added `tier` to transcription option types
|
|
23
|
+
|
|
24
|
+
## [1.4.2]
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- Updated build step to build separate files for browser version
|
|
29
|
+
|
|
30
|
+
## [1.4.1]
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- Small fix for npm deployment
|
|
35
|
+
|
|
12
36
|
## [1.4.0]
|
|
13
37
|
|
|
14
38
|
### Added
|
|
15
39
|
|
|
16
40
|
- Added Browser compatible versions of the live and preRecorded transcription methods
|
|
41
|
+
|
|
17
42
|
## [1.3.1]
|
|
18
43
|
|
|
19
44
|
### Updated
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t={587:t=>{function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,i,n,r){i=i||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(i);var o=1e3;r&&"number"==typeof r.maxKeys&&(o=r.maxKeys);var c=t.length;o>0&&c>o&&(c=o);for(var h=0;h<c;++h){var u,l,p,d,v=t[h].replace(a,"%20"),f=v.indexOf(n);f>=0?(u=v.substr(0,f),l=v.substr(f+1)):(u=v,l=""),p=decodeURIComponent(u),d=decodeURIComponent(l),e(s,p)?Array.isArray(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s}},361:t=>{var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,i,n,r){return i=i||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(r){var s=encodeURIComponent(e(r))+n;return Array.isArray(t[r])?t[r].map((function(t){return s+encodeURIComponent(e(t))})).join(i):s+encodeURIComponent(e(t[r]))})).join(i):r?encodeURIComponent(e(r))+n+encodeURIComponent(e(t)):""}},673:(t,e,i)=>{e.decode=e.parse=i(587),e.encode=e.stringify=i(361)}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,i),s.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};(()=>{i.d(n,{X:()=>g});var t=i(673);function e(t){return new Date(1e3*t).toISOString().substr(11,12)}class r{toWebVTT(){var t,i,n,r;if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let s="WEBVTT\n\n";s+=`NOTE\nTranscription provided by Deepgram\nRequest Id: ${null===(t=this.metadata)||void 0===t?void 0:t.request_id}\nCreated: ${null===(i=this.metadata)||void 0===i?void 0:i.created}\nDuration: ${null===(n=this.metadata)||void 0===n?void 0:n.duration}\nChannels: ${null===(r=this.metadata)||void 0===r?void 0:r.channels}\n\n`;for(let t=0;t<this.results.utterances.length;t++){const i=this.results.utterances[t];s+=`${t+1}\n${e(i.start)} --\x3e ${e(i.end)}\n- ${i.transcript}\n\n`}return s}toSRT(){if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let t="";for(let i=0;i<this.results.utterances.length;i++){const n=this.results.utterances[i];t+=`${i+1}\n${e(n.start).replace(".",",")} --\x3e ${e(n.end).replace(".",",")}\n${n.transcript}\n\n`}return t}}function s(){let t="@deepgram/sdk/UNKNOWN node/UNKNOWN";try{t=`@deepgram/sdk/1.4.4 node/${process.version.replace("v","")}`}catch(t){console.warn("Could not load package details")}return t}function a(t,e,i,n,r){return a=this,o=void 0,h=function*(){const a=`https://${i}${n}`;try{const i=yield fetch(a,{method:t,headers:{Authorization:`token ${e}`,"Content-Type":"application/json","X-DG-Agent":s()},body:r});return yield i.json()}catch(t){throw new Error(`DG: ${t}`)}},new((c=void 0)||(c=Promise))((function(t,e){function i(t){try{r(h.next(t))}catch(t){e(t)}}function n(t){try{r(h.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof c?r:new c((function(t){t(r)}))).then(i,n)}r((h=h.apply(a,o||[])).next())}));var a,o,c,h}class o{constructor(t,e){this._credentials=t,this._apiUrl=e}preRecorded(e,i){return n=this,s=void 0,c=function*(){return yield((e,i,n,s)=>{return o=void 0,c=void 0,u=function*(){const o=Object.assign({},s);if(!n.url)throw new Error("DG: Source must be a URL string");const c=JSON.stringify(n),h=yield a("POST",e,i,`/v1/listen?${t.stringify(o)}`,c);return Object.assign(new r,h)},new((h=void 0)||(h=Promise))((function(t,e){function i(t){try{r(u.next(t))}catch(t){e(t)}}function n(t){try{r(u.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof h?r:new h((function(t){t(r)}))).then(i,n)}r((u=u.apply(o,c||[])).next())}));var o,c,h,u})(this._credentials,this._apiUrl||"",e,i)},new((o=void 0)||(o=Promise))((function(t,e){function i(t){try{a(c.next(t))}catch(t){e(t)}}function r(t){try{a(c.throw(t))}catch(t){e(t)}}function a(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(i,r)}a((c=c.apply(n,s||[])).next())}));var n,s,o,c}live(e){return new WebSocket(`wss://${this._apiUrl}/v1/listen?${t.stringify(e)}`,["token",this._credentials])}}var c=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class h{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(){return c(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,this.apiPath)}))}get(t){return c(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}`)}))}update(t,e){return c(this,void 0,void 0,(function*(){return this._request("PATCH",this._credentials,this._apiUrl,`${this.apiPath}/${t.project_id}`,JSON.stringify(e))}))}}var u=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class l{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(t){return u(this,void 0,void 0,(function*(){return{api_keys:(yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys`)).api_keys.map((t=>Object.assign(Object.assign({},t),t.api_key)))}}))}get(t,e){return u(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys/${e}`)}))}create(t,e,i,n){return u(this,void 0,void 0,(function*(){if(n&&void 0!==n.expirationDate&&void 0!==n.timeToLive)throw new Error("Please provide expirationDate or timeToLive or neither. Providing both is not allowed.");return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys`,JSON.stringify({comment:e,scopes:i,expiration_date:n&&n.expirationDate?n.expirationDate:void 0,time_to_live_in_seconds:n&&n.timeToLive?n.timeToLive:void 0}))}))}delete(t,e){return u(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys/${e}`)}))}}var p=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class d{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listRequests(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/requests?${t.stringify(n)}`)}))}getRequest(t,e){return p(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/requests/${e}`)}))}getUsage(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage?${t.stringify(n)}`)}))}getFields(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage/fields?${t.stringify(n)}`)}))}}var v=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class f{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listMembers(t){return v(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members`)}))}removeMember(t,e){return v(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}`)}))}}var _=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class y{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(t){return _(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites`)}))}send(t,e){return _(this,void 0,void 0,(function*(){return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites`,JSON.stringify({email:e.email,scope:e.scope}))}))}leave(t){return _(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/leave`)}))}delete(t,e){return _(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites/${e}`)}))}}var $=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class w{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listBalances(t){return $(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/balances`)}))}getBalance(t,e){return $(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/balances/${e}`)}))}}var m=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class U{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}get(t,e){return m(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}/scopes`)}))}update(t,e,i){return m(this,void 0,void 0,(function*(){return this._request("PUT",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}/scopes`,JSON.stringify({scope:i}))}))}}class g{constructor(t,e){this._apiKey=t,this._apiUrl=e||"api.deepgram.com",function(t,e){if(!t||0===t.trim().length)throw new Error("DG: API key is required");if(!e||0===e.trim().length)throw new Error("DG: API url should be a valid url or not provided")}(this._apiKey,this._apiUrl),this.transcription=new o(this._apiKey,this._apiUrl),this.projects=new h(this._apiKey,this._apiUrl,a),this.keys=new l(this._apiKey,this._apiUrl,a),this.usage=new d(this._apiKey,this._apiUrl,a),this.members=new f(this._apiKey,this._apiUrl,a),this.invitation=new y(this._apiKey,this._apiUrl,a),this.billing=new w(this._apiKey,this._apiUrl,a),this.scopes=new U(this._apiKey,this._apiUrl,a)}}})();var r=n.X;export{r as Deepgram};
|