@deepgram/sdk 1.3.1 → 1.4.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.
Files changed (225) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/{dist → bundle}/billing.d.ts +3 -2
  3. package/{dist → bundle}/billing.js +4 -4
  4. package/bundle/billing.js.map +1 -0
  5. package/bundle/browser/httpFetch.d.ts +1 -0
  6. package/bundle/browser/httpFetch.js +75 -0
  7. package/bundle/browser/httpFetch.js.map +1 -0
  8. package/bundle/browser/index.d.ts +21 -0
  9. package/bundle/browser/index.js +35 -0
  10. package/bundle/browser/index.js.map +1 -0
  11. package/bundle/browser/transcription/index.d.ts +17 -0
  12. package/bundle/browser/transcription/index.js +75 -0
  13. package/bundle/browser/transcription/index.js.map +1 -0
  14. package/bundle/browser/transcription/preRecordedTranscription.d.ts +9 -0
  15. package/bundle/browser/transcription/preRecordedTranscription.js +87 -0
  16. package/bundle/browser/transcription/preRecordedTranscription.js.map +1 -0
  17. package/{dist → bundle}/constants/defaultOptions.d.ts +0 -0
  18. package/{dist → bundle}/constants/defaultOptions.js +0 -0
  19. package/{dist → bundle}/constants/defaultOptions.js.map +0 -0
  20. package/{dist → bundle}/constants/index.d.ts +0 -0
  21. package/{dist → bundle}/constants/index.js +0 -0
  22. package/{dist → bundle}/constants/index.js.map +0 -0
  23. package/{dist → bundle}/enums/alternatives.d.ts +0 -0
  24. package/{dist → bundle}/enums/alternatives.js +0 -0
  25. package/{dist → bundle}/enums/alternatives.js.map +0 -0
  26. package/{dist → bundle}/enums/connectionState.d.ts +0 -0
  27. package/{dist → bundle}/enums/connectionState.js +0 -0
  28. package/{dist → bundle}/enums/connectionState.js.map +0 -0
  29. package/{dist → bundle}/enums/diarization.d.ts +0 -0
  30. package/{dist → bundle}/enums/diarization.js +0 -0
  31. package/{dist → bundle}/enums/diarization.js.map +0 -0
  32. package/{dist → bundle}/enums/index.d.ts +0 -0
  33. package/{dist → bundle}/enums/index.js +0 -0
  34. package/{dist → bundle}/enums/index.js.map +0 -0
  35. package/{dist → bundle}/enums/liveTranscriptionEvents.d.ts +0 -0
  36. package/{dist → bundle}/enums/liveTranscriptionEvents.js +0 -0
  37. package/{dist → bundle}/enums/liveTranscriptionEvents.js.map +0 -0
  38. package/{dist → bundle}/enums/models.d.ts +0 -0
  39. package/{dist → bundle}/enums/models.js +0 -0
  40. package/{dist → bundle}/enums/models.js.map +0 -0
  41. package/{dist → bundle}/enums/punctuation.d.ts +0 -0
  42. package/{dist → bundle}/enums/punctuation.js +0 -0
  43. package/{dist → bundle}/enums/punctuation.js.map +0 -0
  44. package/{dist → bundle}/enums/searchKind.d.ts +0 -0
  45. package/{dist → bundle}/enums/searchKind.js +0 -0
  46. package/{dist → bundle}/enums/searchKind.js.map +0 -0
  47. package/{dist → bundle}/helpers/index.d.ts +1 -0
  48. package/{dist → bundle}/helpers/index.js +1 -0
  49. package/{dist → bundle}/helpers/index.js.map +1 -1
  50. package/{dist → bundle}/helpers/secondsToTimestamp.d.ts +0 -0
  51. package/{dist → bundle}/helpers/secondsToTimestamp.js +0 -0
  52. package/{dist → bundle}/helpers/secondsToTimestamp.js.map +0 -0
  53. package/bundle/helpers/validateOptions.d.ts +1 -0
  54. package/bundle/helpers/validateOptions.js +13 -0
  55. package/bundle/helpers/validateOptions.js.map +1 -0
  56. package/{dist → bundle}/httpRequest.d.ts +0 -0
  57. package/{dist → bundle}/httpRequest.js +0 -0
  58. package/{dist → bundle}/httpRequest.js.map +0 -0
  59. package/{dist → bundle}/index.d.ts +0 -4
  60. package/{dist → bundle}/index.js +13 -19
  61. package/bundle/index.js.map +1 -0
  62. package/{dist → bundle}/invitation.d.ts +3 -2
  63. package/{dist → bundle}/invitation.js +6 -6
  64. package/bundle/invitation.js.map +1 -0
  65. package/{dist → bundle}/keys.d.ts +3 -2
  66. package/{dist → bundle}/keys.js +6 -6
  67. package/bundle/keys.js.map +1 -0
  68. package/{dist → bundle}/members.d.ts +3 -2
  69. package/{dist → bundle}/members.js +4 -4
  70. package/bundle/members.js.map +1 -0
  71. package/{dist → bundle}/projects.d.ts +4 -3
  72. package/{dist → bundle}/projects.js +6 -6
  73. package/bundle/projects.js.map +1 -0
  74. package/{dist → bundle}/scopes.d.ts +3 -2
  75. package/{dist → bundle}/scopes.js +4 -4
  76. package/bundle/scopes.js.map +1 -0
  77. package/{dist → bundle}/transcription/index.d.ts +0 -0
  78. package/{dist → bundle}/transcription/index.js +0 -0
  79. package/{dist → bundle}/transcription/index.js.map +0 -0
  80. package/{dist → bundle}/transcription/liveTranscription.d.ts +0 -0
  81. package/{dist → bundle}/transcription/liveTranscription.js +0 -0
  82. package/{dist → bundle}/transcription/liveTranscription.js.map +0 -0
  83. package/{dist → bundle}/transcription/preRecordedTranscription.d.ts +0 -0
  84. package/{dist → bundle}/transcription/preRecordedTranscription.js +0 -0
  85. package/{dist → bundle}/transcription/preRecordedTranscription.js.map +0 -0
  86. package/{dist → bundle}/types/balance.d.ts +0 -0
  87. package/{dist → bundle}/types/balance.js +0 -0
  88. package/{dist → bundle}/types/balance.js.map +0 -0
  89. package/{dist → bundle}/types/balanceList.d.ts +0 -0
  90. package/{dist → bundle}/types/balanceList.js +0 -0
  91. package/{dist → bundle}/types/balanceList.js.map +0 -0
  92. package/{dist → bundle}/types/channel.d.ts +0 -0
  93. package/{dist → bundle}/types/channel.js +0 -0
  94. package/{dist → bundle}/types/channel.js.map +0 -0
  95. package/{dist → bundle}/types/createKeyOptions.d.ts +0 -0
  96. package/{dist → bundle}/types/createKeyOptions.js +0 -0
  97. package/{dist → bundle}/types/createKeyOptions.js.map +0 -0
  98. package/{dist → bundle}/types/hit.d.ts +0 -0
  99. package/{dist → bundle}/types/hit.js +0 -0
  100. package/{dist → bundle}/types/hit.js.map +0 -0
  101. package/{dist → bundle}/types/index.d.ts +3 -0
  102. package/{dist → bundle}/types/index.js +3 -0
  103. package/{dist → bundle}/types/index.js.map +1 -1
  104. package/{dist → bundle}/types/invitationList.d.ts +0 -0
  105. package/{dist → bundle}/types/invitationList.js +0 -0
  106. package/{dist → bundle}/types/invitationList.js.map +0 -0
  107. package/{dist → bundle}/types/invitationOptions.d.ts +0 -0
  108. package/{dist → bundle}/types/invitationOptions.js +0 -0
  109. package/{dist → bundle}/types/invitationOptions.js.map +0 -0
  110. package/{dist → bundle}/types/key.d.ts +0 -0
  111. package/{dist → bundle}/types/key.js +0 -0
  112. package/{dist → bundle}/types/key.js.map +0 -0
  113. package/bundle/types/keyResponse.d.ts +10 -0
  114. package/{dist → bundle}/types/keyResponse.js +0 -0
  115. package/{dist → bundle}/types/keyResponse.js.map +0 -0
  116. package/bundle/types/keyResponseObj.d.ts +42 -0
  117. package/bundle/types/keyResponseObj.js +3 -0
  118. package/bundle/types/keyResponseObj.js.map +1 -0
  119. package/{dist → bundle}/types/keyword.d.ts +0 -0
  120. package/{dist → bundle}/types/keyword.js +0 -0
  121. package/{dist → bundle}/types/keyword.js.map +0 -0
  122. package/{dist → bundle}/types/liveTranscriptionOptions.d.ts +0 -0
  123. package/{dist → bundle}/types/liveTranscriptionOptions.js +0 -0
  124. package/{dist → bundle}/types/liveTranscriptionOptions.js.map +0 -0
  125. package/{dist → bundle}/types/liveTranscriptionResponse.d.ts +0 -0
  126. package/{dist → bundle}/types/liveTranscriptionResponse.js +0 -0
  127. package/{dist → bundle}/types/liveTranscriptionResponse.js.map +0 -0
  128. package/{dist → bundle}/types/member.d.ts +0 -0
  129. package/{dist → bundle}/types/member.js +0 -0
  130. package/{dist → bundle}/types/member.js.map +0 -0
  131. package/{dist → bundle}/types/memberList.d.ts +0 -0
  132. package/{dist → bundle}/types/memberList.js +0 -0
  133. package/{dist → bundle}/types/memberList.js.map +0 -0
  134. package/{dist → bundle}/types/message.d.ts +0 -0
  135. package/{dist → bundle}/types/message.js +0 -0
  136. package/{dist → bundle}/types/message.js.map +0 -0
  137. package/{dist → bundle}/types/metadata.d.ts +0 -0
  138. package/{dist → bundle}/types/metadata.js +0 -0
  139. package/{dist → bundle}/types/metadata.js.map +0 -0
  140. package/{dist → bundle}/types/prerecordedTranscriptionOptions.d.ts +0 -0
  141. package/{dist → bundle}/types/prerecordedTranscriptionOptions.js +0 -0
  142. package/{dist → bundle}/types/prerecordedTranscriptionOptions.js.map +0 -0
  143. package/{dist → bundle}/types/prerecordedTranscriptionResponse.d.ts +0 -0
  144. package/{dist → bundle}/types/prerecordedTranscriptionResponse.js +0 -0
  145. package/{dist → bundle}/types/prerecordedTranscriptionResponse.js.map +0 -0
  146. package/{dist → bundle}/types/project.d.ts +0 -0
  147. package/{dist → bundle}/types/project.js +0 -0
  148. package/{dist → bundle}/types/project.js.map +0 -0
  149. package/bundle/types/projectPatchRequest.d.ts +4 -0
  150. package/bundle/types/projectPatchRequest.js +3 -0
  151. package/bundle/types/projectPatchRequest.js.map +1 -0
  152. package/{dist → bundle}/types/projectPatchResponse.d.ts +0 -0
  153. package/{dist → bundle}/types/projectPatchResponse.js +0 -0
  154. package/{dist → bundle}/types/projectPatchResponse.js.map +0 -0
  155. package/{dist → bundle}/types/projectResponse.d.ts +0 -0
  156. package/{dist → bundle}/types/projectResponse.js +0 -0
  157. package/{dist → bundle}/types/projectResponse.js.map +0 -0
  158. package/bundle/types/requestFunction.d.ts +5 -0
  159. package/bundle/types/requestFunction.js +3 -0
  160. package/bundle/types/requestFunction.js.map +1 -0
  161. package/{dist → bundle}/types/scopeList.d.ts +0 -0
  162. package/{dist → bundle}/types/scopeList.js +0 -0
  163. package/{dist → bundle}/types/scopeList.js.map +0 -0
  164. package/{dist → bundle}/types/search.d.ts +0 -0
  165. package/{dist → bundle}/types/search.js +0 -0
  166. package/{dist → bundle}/types/search.js.map +0 -0
  167. package/{dist → bundle}/types/transcriptionSource.d.ts +0 -0
  168. package/{dist → bundle}/types/transcriptionSource.js +0 -0
  169. package/{dist → bundle}/types/transcriptionSource.js.map +0 -0
  170. package/{dist → bundle}/types/usageCallback.d.ts +0 -0
  171. package/{dist → bundle}/types/usageCallback.js +0 -0
  172. package/{dist → bundle}/types/usageCallback.js.map +0 -0
  173. package/{dist → bundle}/types/usageField.d.ts +0 -0
  174. package/{dist → bundle}/types/usageField.js +0 -0
  175. package/{dist → bundle}/types/usageField.js.map +0 -0
  176. package/{dist → bundle}/types/usageFieldOptions.d.ts +0 -0
  177. package/{dist → bundle}/types/usageFieldOptions.js +0 -0
  178. package/{dist → bundle}/types/usageFieldOptions.js.map +0 -0
  179. package/{dist → bundle}/types/usageOptions.d.ts +0 -0
  180. package/{dist → bundle}/types/usageOptions.js +0 -0
  181. package/{dist → bundle}/types/usageOptions.js.map +0 -0
  182. package/{dist → bundle}/types/usageRequest.d.ts +0 -0
  183. package/{dist → bundle}/types/usageRequest.js +0 -0
  184. package/{dist → bundle}/types/usageRequest.js.map +0 -0
  185. package/{dist → bundle}/types/usageRequestDetail.d.ts +0 -0
  186. package/{dist → bundle}/types/usageRequestDetail.js +0 -0
  187. package/{dist → bundle}/types/usageRequestDetail.js.map +0 -0
  188. package/{dist → bundle}/types/usageRequestList.d.ts +0 -0
  189. package/{dist → bundle}/types/usageRequestList.js +0 -0
  190. package/{dist → bundle}/types/usageRequestList.js.map +0 -0
  191. package/{dist → bundle}/types/usageRequestListOptions.d.ts +0 -0
  192. package/{dist → bundle}/types/usageRequestListOptions.js +0 -0
  193. package/{dist → bundle}/types/usageRequestListOptions.js.map +0 -0
  194. package/{dist → bundle}/types/usageRequestMessage.d.ts +0 -0
  195. package/{dist → bundle}/types/usageRequestMessage.js +0 -0
  196. package/{dist → bundle}/types/usageRequestMessage.js.map +0 -0
  197. package/{dist → bundle}/types/usageResponse.d.ts +0 -0
  198. package/{dist → bundle}/types/usageResponse.js +0 -0
  199. package/{dist → bundle}/types/usageResponse.js.map +0 -0
  200. package/{dist → bundle}/types/usageResponseDetail.d.ts +0 -0
  201. package/{dist → bundle}/types/usageResponseDetail.js +0 -0
  202. package/{dist → bundle}/types/usageResponseDetail.js.map +0 -0
  203. package/{dist → bundle}/types/utterance.d.ts +0 -0
  204. package/{dist → bundle}/types/utterance.js +0 -0
  205. package/{dist → bundle}/types/utterance.js.map +0 -0
  206. package/{dist → bundle}/types/wordBase.d.ts +0 -0
  207. package/{dist → bundle}/types/wordBase.js +0 -0
  208. package/{dist → bundle}/types/wordBase.js.map +0 -0
  209. package/{dist → bundle}/usage.d.ts +3 -2
  210. package/{dist → bundle}/usage.js +6 -6
  211. package/bundle/usage.js.map +1 -0
  212. package/{dist → bundle}/userAgent.d.ts +0 -0
  213. package/{dist → bundle}/userAgent.js +1 -1
  214. package/{dist → bundle}/userAgent.js.map +0 -0
  215. package/package.json +11 -3
  216. package/webpack.config.js +15 -0
  217. package/dist/billing.js.map +0 -1
  218. package/dist/index.js.map +0 -1
  219. package/dist/invitation.js.map +0 -1
  220. package/dist/keys.js.map +0 -1
  221. package/dist/members.js.map +0 -1
  222. package/dist/projects.js.map +0 -1
  223. package/dist/scopes.js.map +0 -1
  224. package/dist/types/keyResponse.d.ts +0 -50
  225. package/dist/usage.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ---
11
11
 
12
+ ## [1.4.0]
13
+
14
+ ### Added
15
+
16
+ - Added Browser compatible versions of the live and preRecorded transcription methods
12
17
  ## [1.3.1]
13
18
 
14
19
  ### Updated
@@ -182,7 +187,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
182
187
 
183
188
  ---
184
189
 
185
- [unreleased]: https://github.com/deepgram/node-sdk/compare/1.3.1...HEAD
190
+ [unreleased]: https://github.com/deepgram/node-sdk/compare/1.4.0...HEAD
191
+ [1.4.0]: https://github.com/deepgram/node-sdk/compare/1.3.1...1.4.0
186
192
  [1.3.1]: https://github.com/deepgram/node-sdk/compare/1.3.0...1.3.1
187
193
  [1.3.0]: https://github.com/deepgram/node-sdk/compare/1.2.4...1.3.0
188
194
  [1.2.4]: https://github.com/deepgram/node-sdk/compare/1.2.2...1.2.4
@@ -1,8 +1,9 @@
1
- import { BalanceList, Balance } from "./types";
1
+ import { BalanceList, Balance, RequestFunction } from "./types";
2
2
  export declare class Billing {
3
3
  private _credentials;
4
4
  private _apiUrl;
5
- constructor(_credentials: string, _apiUrl: string);
5
+ private _request;
6
+ constructor(_credentials: string, _apiUrl: string, _request: RequestFunction);
6
7
  private apiPath;
7
8
  /**
8
9
  * Retrieves list of balance info of the specified project.
@@ -37,11 +37,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.Billing = void 0;
40
- var httpRequest_1 = require("./httpRequest");
41
40
  var Billing = /** @class */ (function () {
42
- function Billing(_credentials, _apiUrl) {
41
+ function Billing(_credentials, _apiUrl, _request) {
43
42
  this._credentials = _credentials;
44
43
  this._apiUrl = _apiUrl;
44
+ this._request = _request;
45
45
  this.apiPath = "/v1/projects";
46
46
  }
47
47
  /**
@@ -51,7 +51,7 @@ var Billing = /** @class */ (function () {
51
51
  Billing.prototype.listBalances = function (projectId) {
52
52
  return __awaiter(this, void 0, void 0, function () {
53
53
  return __generator(this, function (_a) {
54
- return [2 /*return*/, (0, httpRequest_1._request)("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/balances"))];
54
+ return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/balances"))];
55
55
  });
56
56
  });
57
57
  };
@@ -63,7 +63,7 @@ var Billing = /** @class */ (function () {
63
63
  Billing.prototype.getBalance = function (projectId, balanceId) {
64
64
  return __awaiter(this, void 0, void 0, function () {
65
65
  return __generator(this, function (_a) {
66
- return [2 /*return*/, (0, httpRequest_1._request)("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/balances/").concat(balanceId))];
66
+ return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/balances/").concat(balanceId))];
67
67
  });
68
68
  });
69
69
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing.js","sourceRoot":"","sources":["../src/billing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;IACE,iBACU,YAAoB,EACpB,OAAe,EACf,QAAyB;QAFzB,iBAAY,GAAZ,YAAY,CAAQ;QACpB,YAAO,GAAP,OAAO,CAAQ;QACf,aAAQ,GAAR,QAAQ,CAAiB;QAG3B,YAAO,GAAG,cAAc,CAAC;IAF9B,CAAC;IAIJ;;;OAGG;IACG,8BAAY,GAAlB,UAAmB,SAAiB;;;gBAClC,sBAAO,IAAI,CAAC,QAAQ,CAClB,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,cAAW,CACxC,EAAC;;;KACH;IAED;;;;OAIG;IAEG,4BAAU,GAAhB,UAAiB,SAAiB,EAAE,SAAiB;;;gBACnD,sBAAO,IAAI,CAAC,QAAQ,CAClB,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,uBAAa,SAAS,CAAE,CACrD,EAAC;;;KACH;IACH,cAAC;AAAD,CAAC,AApCD,IAoCC;AApCY,0BAAO"}
@@ -0,0 +1 @@
1
+ export declare function _request<T>(method: string, api_key: string, apiUrl: string, path: string, payload?: string): Promise<T>;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports._request = void 0;
40
+ var userAgent_1 = require("../userAgent");
41
+ function _request(method, api_key, apiUrl, path, payload) {
42
+ return __awaiter(this, void 0, void 0, function () {
43
+ var url, response, json, err_1;
44
+ return __generator(this, function (_a) {
45
+ switch (_a.label) {
46
+ case 0:
47
+ url = "https://".concat(apiUrl).concat(path);
48
+ _a.label = 1;
49
+ case 1:
50
+ _a.trys.push([1, 4, , 5]);
51
+ return [4 /*yield*/, fetch(url, {
52
+ method: method,
53
+ headers: {
54
+ Authorization: "token ".concat(api_key),
55
+ "Content-Type": "application/json",
56
+ "X-DG-Agent": (0, userAgent_1.userAgent)(),
57
+ },
58
+ body: payload,
59
+ })];
60
+ case 2:
61
+ response = _a.sent();
62
+ return [4 /*yield*/, response.json()];
63
+ case 3:
64
+ json = _a.sent();
65
+ return [2 /*return*/, json];
66
+ case 4:
67
+ err_1 = _a.sent();
68
+ throw new Error("DG: ".concat(err_1));
69
+ case 5: return [2 /*return*/];
70
+ }
71
+ });
72
+ });
73
+ }
74
+ exports._request = _request;
75
+ //# sourceMappingURL=httpFetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpFetch.js","sourceRoot":"","sources":["../../src/browser/httpFetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAyC;AAEzC,SAAsB,QAAQ,CAC5B,MAAc,EACd,OAAe,EACf,MAAc,EACd,IAAY,EACZ,OAAgB;;;;;;oBAEV,GAAG,GAAG,kBAAW,MAAM,SAAG,IAAI,CAAE,CAAC;;;;oBAEpB,qBAAM,KAAK,CAAC,GAAG,EAAE;4BAChC,MAAM,EAAE,MAAM;4BACd,OAAO,EAAE;gCACP,aAAa,EAAE,gBAAS,OAAO,CAAE;gCACjC,cAAc,EAAE,kBAAkB;gCAClC,YAAY,EAAE,IAAA,qBAAS,GAAE;6BAC1B;4BACD,IAAI,EAAE,OAAO;yBACd,CAAC,EAAA;;oBARI,QAAQ,GAAG,SAQf;oBACW,qBAAM,QAAQ,CAAC,IAAI,EAAE,EAAA;;oBAA5B,IAAI,GAAG,SAAqB;oBAClC,sBAAO,IAAI,EAAC;;;oBAEZ,MAAM,IAAI,KAAK,CAAC,cAAO,KAAG,CAAE,CAAC,CAAC;;;;;CAEjC;AAvBD,4BAuBC"}
@@ -0,0 +1,21 @@
1
+ import { Transcriber } from "./transcription";
2
+ import { Projects } from "../projects";
3
+ import { Keys } from "../keys";
4
+ import { Usage } from "../usage";
5
+ import { Members } from "../members";
6
+ import { Invitation } from "../invitation";
7
+ import { Billing } from "../billing";
8
+ import { Scopes } from "../scopes";
9
+ export declare class Deepgram {
10
+ private _apiUrl;
11
+ private _apiKey;
12
+ transcription: Transcriber;
13
+ projects: Projects;
14
+ keys: Keys;
15
+ usage: Usage;
16
+ members: Members;
17
+ invitation: Invitation;
18
+ billing: Billing;
19
+ scopes: Scopes;
20
+ constructor(apiKey: string, apiUrl?: string);
21
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Deepgram = void 0;
4
+ var constants_1 = require("../constants");
5
+ var helpers_1 = require("../helpers");
6
+ var transcription_1 = require("./transcription");
7
+ var projects_1 = require("../projects");
8
+ var keys_1 = require("../keys");
9
+ var usage_1 = require("../usage");
10
+ var members_1 = require("../members");
11
+ var invitation_1 = require("../invitation");
12
+ var billing_1 = require("../billing");
13
+ var scopes_1 = require("../scopes");
14
+ var httpFetch_1 = require("./httpFetch");
15
+ var Deepgram = /** @class */ (function () {
16
+ function Deepgram(apiKey, apiUrl) {
17
+ this._apiKey = apiKey;
18
+ this._apiUrl = apiUrl || constants_1.DefaultOptions.apiUrl;
19
+ /**
20
+ * Ensures that the provided options were provided
21
+ */
22
+ (0, helpers_1.validateOptions)(this._apiKey, this._apiUrl);
23
+ this.transcription = new transcription_1.Transcriber(this._apiKey, this._apiUrl);
24
+ this.projects = new projects_1.Projects(this._apiKey, this._apiUrl, httpFetch_1._request);
25
+ this.keys = new keys_1.Keys(this._apiKey, this._apiUrl, httpFetch_1._request);
26
+ this.usage = new usage_1.Usage(this._apiKey, this._apiUrl, httpFetch_1._request);
27
+ this.members = new members_1.Members(this._apiKey, this._apiUrl, httpFetch_1._request);
28
+ this.invitation = new invitation_1.Invitation(this._apiKey, this._apiUrl, httpFetch_1._request);
29
+ this.billing = new billing_1.Billing(this._apiKey, this._apiUrl, httpFetch_1._request);
30
+ this.scopes = new scopes_1.Scopes(this._apiKey, this._apiUrl, httpFetch_1._request);
31
+ }
32
+ return Deepgram;
33
+ }());
34
+ exports.Deepgram = Deepgram;
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";;;AAAA,0CAA8C;AAC9C,sCAA6C;AAC7C,iDAA8C;AAC9C,wCAAuC;AACvC,gCAA+B;AAC/B,kCAAiC;AACjC,sCAAqC;AACrC,4CAA2C;AAC3C,sCAAqC;AACrC,oCAAmC;AAEnC,yCAAuC;AAEvC;IAaE,kBAAY,MAAc,EAAE,MAAe;QACzC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,0BAAc,CAAC,MAAM,CAAC;QAE/C;;WAEG;QACH,IAAA,yBAAe,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE5C,IAAI,CAAC,aAAa,GAAG,IAAI,2BAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,QAAQ,GAAG,IAAI,mBAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,oBAAQ,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,IAAI,WAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,oBAAQ,CAAC,CAAC;QAC3D,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,oBAAQ,CAAC,CAAC;QAC7D,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,oBAAQ,CAAC,CAAC;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,uBAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,oBAAQ,CAAC,CAAC;QACvE,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,oBAAQ,CAAC,CAAC;QACjE,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,oBAAQ,CAAC,CAAC;IACjE,CAAC;IACH,eAAC;AAAD,CAAC,AA/BD,IA+BC;AA/BY,4BAAQ"}
@@ -0,0 +1,17 @@
1
+ import { LiveTranscriptionOptions, PrerecordedTranscriptionOptions, PrerecordedTranscriptionResponse, UrlSource } from "../../types";
2
+ export declare class Transcriber {
3
+ private _credentials;
4
+ private _apiUrl;
5
+ constructor(_credentials: string, _apiUrl: string);
6
+ /**
7
+ * Transcribes prerecorded audio from a file or buffer
8
+ * @param source Url or Buffer of file to transcribe
9
+ * @param options Options to modify transcriptions
10
+ */
11
+ preRecorded(source: UrlSource, options?: PrerecordedTranscriptionOptions): Promise<PrerecordedTranscriptionResponse>;
12
+ /**
13
+ * Opens a websocket to Deepgram's API for live transcriptions
14
+ * @param options Options to modify transcriptions
15
+ */
16
+ live(options?: LiveTranscriptionOptions): WebSocket;
17
+ }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.Transcriber = void 0;
43
+ var querystring_1 = __importDefault(require("querystring"));
44
+ var preRecordedTranscription_1 = require("./preRecordedTranscription");
45
+ var Transcriber = /** @class */ (function () {
46
+ function Transcriber(_credentials, _apiUrl) {
47
+ this._credentials = _credentials;
48
+ this._apiUrl = _apiUrl;
49
+ }
50
+ /**
51
+ * Transcribes prerecorded audio from a file or buffer
52
+ * @param source Url or Buffer of file to transcribe
53
+ * @param options Options to modify transcriptions
54
+ */
55
+ Transcriber.prototype.preRecorded = function (source, options) {
56
+ return __awaiter(this, void 0, void 0, function () {
57
+ return __generator(this, function (_a) {
58
+ switch (_a.label) {
59
+ case 0: return [4 /*yield*/, (0, preRecordedTranscription_1.preRecordedTranscription)(this._credentials, this._apiUrl || "", source, options)];
60
+ case 1: return [2 /*return*/, _a.sent()];
61
+ }
62
+ });
63
+ });
64
+ };
65
+ /**
66
+ * Opens a websocket to Deepgram's API for live transcriptions
67
+ * @param options Options to modify transcriptions
68
+ */
69
+ Transcriber.prototype.live = function (options) {
70
+ return new WebSocket("wss://".concat(this._apiUrl, "/v1/listen?").concat(querystring_1.default.stringify(options)), ["token", this._credentials]);
71
+ };
72
+ return Transcriber;
73
+ }());
74
+ exports.Transcriber = Transcriber;
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/transcription/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,4DAAsC;AACtC,uEAAsE;AAEtE;IACE,qBAAoB,YAAoB,EAAU,OAAe;QAA7C,iBAAY,GAAZ,YAAY,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAQ;IAAG,CAAC;IAErE;;;;OAIG;IACG,iCAAW,GAAjB,UACE,MAAiB,EACjB,OAAyC;;;;4BAElC,qBAAM,IAAA,mDAAwB,EACnC,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,IAAI,EAAE,EAClB,MAAM,EACN,OAAO,CACR,EAAA;4BALD,sBAAO,SAKN,EAAC;;;;KACH;IAED;;;OAGG;IACH,0BAAI,GAAJ,UAAK,OAAkC;QACrC,OAAO,IAAI,SAAS,CAClB,gBAAS,IAAI,CAAC,OAAO,wBAAc,qBAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAE,EACnE,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAC7B,CAAC;IACJ,CAAC;IACH,kBAAC;AAAD,CAAC,AA9BD,IA8BC;AA9BY,kCAAW"}
@@ -0,0 +1,9 @@
1
+ import { PrerecordedTranscriptionOptions, PrerecordedTranscriptionResponse, UrlSource } from "../../types";
2
+ /**
3
+ * Transcribes audio from a url
4
+ * @param credentials Base64 encoded API key & secret
5
+ * @param apiUrl url string of Deepgram's API
6
+ * @param source Url or Buffer of file to transcribe
7
+ * @param options Options to modify transcriptions
8
+ */
9
+ export declare const preRecordedTranscription: (apiKey: string, apiUrl: string, source: UrlSource, options?: PrerecordedTranscriptionOptions | undefined) => Promise<PrerecordedTranscriptionResponse>;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __importDefault = (this && this.__importDefault) || function (mod) {
50
+ return (mod && mod.__esModule) ? mod : { "default": mod };
51
+ };
52
+ Object.defineProperty(exports, "__esModule", { value: true });
53
+ exports.preRecordedTranscription = void 0;
54
+ var querystring_1 = __importDefault(require("querystring"));
55
+ var types_1 = require("../../types");
56
+ var httpFetch_1 = require("../httpFetch");
57
+ function isUrlSource(providedSource) {
58
+ if (providedSource.url)
59
+ return true;
60
+ return false;
61
+ }
62
+ /**
63
+ * Transcribes audio from a url
64
+ * @param credentials Base64 encoded API key & secret
65
+ * @param apiUrl url string of Deepgram's API
66
+ * @param source Url or Buffer of file to transcribe
67
+ * @param options Options to modify transcriptions
68
+ */
69
+ var preRecordedTranscription = function (apiKey, apiUrl, source, options) { return __awaiter(void 0, void 0, void 0, function () {
70
+ var transcriptionOptions, body, response;
71
+ return __generator(this, function (_a) {
72
+ switch (_a.label) {
73
+ case 0:
74
+ transcriptionOptions = __assign({}, options);
75
+ if (!isUrlSource(source)) {
76
+ throw new Error("DG: Source must be a URL string");
77
+ }
78
+ body = JSON.stringify(source);
79
+ return [4 /*yield*/, (0, httpFetch_1._request)("POST", apiKey, apiUrl, "/v1/listen?".concat(querystring_1.default.stringify(transcriptionOptions)), body)];
80
+ case 1:
81
+ response = _a.sent();
82
+ return [2 /*return*/, Object.assign(new types_1.PrerecordedTranscriptionResponse(), response)];
83
+ }
84
+ });
85
+ }); };
86
+ exports.preRecordedTranscription = preRecordedTranscription;
87
+ //# sourceMappingURL=preRecordedTranscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preRecordedTranscription.js","sourceRoot":"","sources":["../../../src/browser/transcription/preRecordedTranscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAsC;AACtC,qCAIqB;AACrB,0CAAwC;AAExC,SAAS,WAAW,CAAC,cAAyB;IAC5C,IAAK,cAA4B,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACnD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACI,IAAM,wBAAwB,GAAG,UACtC,MAAc,EACd,MAAc,EACd,MAAiB,EACjB,OAAyC;;;;;gBAEnC,oBAAoB,YAAQ,EAAE,EAAK,OAAO,CAAE,CAAC;gBACnD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;oBACxB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;iBACpD;gBAEK,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;gBAEnB,qBAAM,IAAA,oBAAQ,EAC7B,MAAM,EACN,MAAM,EACN,MAAM,EACN,qBAAc,qBAAW,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAE,EAC3D,IAAI,CACL,EAAA;;gBANK,QAAQ,GAAG,SAMhB;gBAED,sBAAO,MAAM,CAAC,MAAM,CAAC,IAAI,wCAAgC,EAAE,EAAE,QAAQ,CAAC,EAAC;;;KACxE,CAAC;AAtBW,QAAA,wBAAwB,4BAsBnC"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1 +1,2 @@
1
1
  export * from "./secondsToTimestamp";
2
+ export * from "./validateOptions";
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./secondsToTimestamp"), exports);
18
+ __exportStar(require("./validateOptions"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,oDAAkC"}
File without changes
File without changes
@@ -0,0 +1 @@
1
+ export declare function validateOptions(apiKey: string, apiUrl: string): void;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateOptions = void 0;
4
+ function validateOptions(apiKey, apiUrl) {
5
+ if (!apiKey || apiKey.trim().length === 0) {
6
+ throw new Error("DG: API key is required");
7
+ }
8
+ if (!apiUrl || apiUrl.trim().length === 0) {
9
+ throw new Error("DG: API url should be a valid url or not provided");
10
+ }
11
+ }
12
+ exports.validateOptions = validateOptions;
13
+ //# sourceMappingURL=validateOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateOptions.js","sourceRoot":"","sources":["../../src/helpers/validateOptions.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAAC,MAAc,EAAE,MAAc;IAC5D,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;QACzC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C;IAED,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;QACzC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;AACH,CAAC;AARD,0CAQC"}
File without changes
File without changes
File without changes
@@ -18,8 +18,4 @@ export declare class Deepgram {
18
18
  billing: Billing;
19
19
  scopes: Scopes;
20
20
  constructor(apiKey: string, apiUrl?: string);
21
- /**
22
- * Ensures that the provided options were provided
23
- */
24
- private _validateOptions;
25
21
  }
@@ -10,31 +10,25 @@ var members_1 = require("./members");
10
10
  var invitation_1 = require("./invitation");
11
11
  var billing_1 = require("./billing");
12
12
  var scopes_1 = require("./scopes");
13
+ var helpers_1 = require("./helpers");
14
+ var httpRequest_1 = require("./httpRequest");
13
15
  var Deepgram = /** @class */ (function () {
14
16
  function Deepgram(apiKey, apiUrl) {
15
17
  this._apiKey = apiKey;
16
18
  this._apiUrl = apiUrl || constants_1.DefaultOptions.apiUrl;
17
- this._validateOptions();
18
- this.keys = new keys_1.Keys(this._apiKey, this._apiUrl);
19
- this.projects = new projects_1.Projects(this._apiKey, this._apiUrl);
19
+ /**
20
+ * Ensures that the provided options were provided
21
+ */
22
+ (0, helpers_1.validateOptions)(this._apiKey, this._apiUrl);
23
+ this.keys = new keys_1.Keys(this._apiKey, this._apiUrl, httpRequest_1._request);
24
+ this.projects = new projects_1.Projects(this._apiKey, this._apiUrl, httpRequest_1._request);
20
25
  this.transcription = new transcription_1.Transcriber(this._apiKey, this._apiUrl);
21
- this.usage = new usage_1.Usage(this._apiKey, this._apiUrl);
22
- this.members = new members_1.Members(this._apiKey, this._apiUrl);
23
- this.invitation = new invitation_1.Invitation(this._apiKey, this._apiUrl);
24
- this.billing = new billing_1.Billing(this._apiKey, this._apiUrl);
25
- this.scopes = new scopes_1.Scopes(this._apiKey, this._apiUrl);
26
+ this.usage = new usage_1.Usage(this._apiKey, this._apiUrl, httpRequest_1._request);
27
+ this.members = new members_1.Members(this._apiKey, this._apiUrl, httpRequest_1._request);
28
+ this.invitation = new invitation_1.Invitation(this._apiKey, this._apiUrl, httpRequest_1._request);
29
+ this.billing = new billing_1.Billing(this._apiKey, this._apiUrl, httpRequest_1._request);
30
+ this.scopes = new scopes_1.Scopes(this._apiKey, this._apiUrl, httpRequest_1._request);
26
31
  }
27
- /**
28
- * Ensures that the provided options were provided
29
- */
30
- Deepgram.prototype._validateOptions = function () {
31
- if (!this._apiKey || this._apiKey.trim().length === 0) {
32
- throw new Error("DG: API key is required");
33
- }
34
- if (!this._apiUrl || this._apiUrl.trim().length === 0) {
35
- throw new Error("DG: API url should be a valid url or not provided");
36
- }
37
- };
38
32
  return Deepgram;
39
33
  }());
40
34
  exports.Deepgram = Deepgram;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAA6C;AAC7C,+BAA8B;AAC9B,uCAAsC;AACtC,iDAA8C;AAC9C,iCAAgC;AAChC,qCAAoC;AACpC,2CAA0C;AAC1C,qCAAoC;AACpC,mCAAkC;AAElC,qCAA4C;AAC5C,6CAAyC;AAEzC;IAaE,kBAAY,MAAc,EAAE,MAAe;QACzC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,0BAAc,CAAC,MAAM,CAAC;QAE/C;;WAEG;QACH,IAAA,yBAAe,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE5C,IAAI,CAAC,IAAI,GAAG,IAAI,WAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,sBAAQ,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,GAAG,IAAI,mBAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,sBAAQ,CAAC,CAAC;QACnE,IAAI,CAAC,aAAa,GAAG,IAAI,2BAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,sBAAQ,CAAC,CAAC;QAC7D,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,sBAAQ,CAAC,CAAC;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,uBAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,sBAAQ,CAAC,CAAC;QACvE,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,sBAAQ,CAAC,CAAC;QACjE,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,sBAAQ,CAAC,CAAC;IACjE,CAAC;IACH,eAAC;AAAD,CAAC,AA/BD,IA+BC;AA/BY,4BAAQ"}
@@ -1,8 +1,9 @@
1
- import { Message, InvitationOptions, InvitationList } from "./types";
1
+ import { Message, InvitationOptions, InvitationList, RequestFunction } from "./types";
2
2
  export declare class Invitation {
3
3
  private _credentials;
4
4
  private _apiUrl;
5
- constructor(_credentials: string, _apiUrl: string);
5
+ private _request;
6
+ constructor(_credentials: string, _apiUrl: string, _request: RequestFunction);
6
7
  private apiPath;
7
8
  /**
8
9
  * Lists all the current invites of a specified project.