@deepgram/sdk 1.3.1-beta.1 → 1.4.1
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 +203 -196
- package/CODE_OF_CONDUCT.md +127 -127
- package/CONTRIBUTING.md +50 -50
- package/LICENSE +21 -21
- package/README.md +151 -151
- package/{dist → bundle}/billing.d.ts +3 -2
- package/{dist → bundle}/billing.js +4 -4
- package/bundle/billing.js.map +1 -0
- package/bundle/browser/httpFetch.d.ts +1 -0
- package/bundle/browser/httpFetch.js +75 -0
- package/bundle/browser/httpFetch.js.map +1 -0
- package/bundle/browser/index.d.ts +21 -0
- package/bundle/browser/index.js +35 -0
- package/bundle/browser/index.js.map +1 -0
- package/bundle/browser/transcription/index.d.ts +17 -0
- package/bundle/browser/transcription/index.js +75 -0
- package/bundle/browser/transcription/index.js.map +1 -0
- package/bundle/browser/transcription/preRecordedTranscription.d.ts +9 -0
- package/bundle/browser/transcription/preRecordedTranscription.js +87 -0
- package/bundle/browser/transcription/preRecordedTranscription.js.map +1 -0
- package/{dist → bundle}/constants/defaultOptions.d.ts +0 -0
- package/{dist → bundle}/constants/defaultOptions.js +0 -0
- package/{dist → bundle}/constants/defaultOptions.js.map +0 -0
- package/{dist → bundle}/constants/index.d.ts +0 -0
- package/{dist → bundle}/constants/index.js +0 -0
- package/{dist → bundle}/constants/index.js.map +0 -0
- package/{dist → bundle}/enums/alternatives.d.ts +0 -0
- package/{dist → bundle}/enums/alternatives.js +0 -0
- package/{dist → bundle}/enums/alternatives.js.map +0 -0
- package/{dist → bundle}/enums/connectionState.d.ts +0 -0
- package/{dist → bundle}/enums/connectionState.js +0 -0
- package/{dist → bundle}/enums/connectionState.js.map +0 -0
- package/{dist → bundle}/enums/diarization.d.ts +0 -0
- package/{dist → bundle}/enums/diarization.js +0 -0
- package/{dist → bundle}/enums/diarization.js.map +0 -0
- package/{dist → bundle}/enums/index.d.ts +0 -0
- package/{dist → bundle}/enums/index.js +0 -0
- package/{dist → bundle}/enums/index.js.map +0 -0
- package/{dist → bundle}/enums/liveTranscriptionEvents.d.ts +0 -0
- package/{dist → bundle}/enums/liveTranscriptionEvents.js +0 -0
- package/{dist → bundle}/enums/liveTranscriptionEvents.js.map +0 -0
- package/{dist → bundle}/enums/models.d.ts +0 -0
- package/{dist → bundle}/enums/models.js +0 -0
- package/{dist → bundle}/enums/models.js.map +0 -0
- package/{dist → bundle}/enums/punctuation.d.ts +0 -0
- package/{dist → bundle}/enums/punctuation.js +0 -0
- package/{dist → bundle}/enums/punctuation.js.map +0 -0
- package/{dist → bundle}/enums/searchKind.d.ts +0 -0
- package/{dist → bundle}/enums/searchKind.js +0 -0
- package/{dist → bundle}/enums/searchKind.js.map +0 -0
- package/{dist → bundle}/helpers/index.d.ts +1 -0
- package/{dist → bundle}/helpers/index.js +1 -0
- package/{dist → bundle}/helpers/index.js.map +1 -1
- package/{dist → bundle}/helpers/secondsToTimestamp.d.ts +0 -0
- package/{dist → bundle}/helpers/secondsToTimestamp.js +0 -0
- package/{dist → bundle}/helpers/secondsToTimestamp.js.map +0 -0
- package/bundle/helpers/validateOptions.d.ts +1 -0
- package/bundle/helpers/validateOptions.js +13 -0
- package/bundle/helpers/validateOptions.js.map +1 -0
- package/{dist → bundle}/httpRequest.d.ts +0 -0
- package/{dist → bundle}/httpRequest.js +0 -0
- package/{dist → bundle}/httpRequest.js.map +0 -0
- package/bundle/index.d.ts +21 -0
- package/bundle/index.js +35 -0
- package/bundle/index.js.map +1 -0
- package/{dist → bundle}/invitation.d.ts +3 -2
- package/{dist → bundle}/invitation.js +6 -6
- package/bundle/invitation.js.map +1 -0
- package/{dist → bundle}/keys.d.ts +3 -2
- package/{dist → bundle}/keys.js +6 -6
- package/bundle/keys.js.map +1 -0
- package/{dist → bundle}/members.d.ts +3 -2
- package/{dist → bundle}/members.js +4 -4
- package/bundle/members.js.map +1 -0
- package/{dist → bundle}/projects.d.ts +4 -3
- package/{dist → bundle}/projects.js +6 -6
- package/bundle/projects.js.map +1 -0
- package/{dist → bundle}/scopes.d.ts +3 -2
- package/{dist → bundle}/scopes.js +4 -4
- package/bundle/scopes.js.map +1 -0
- package/{dist → bundle}/transcription/index.d.ts +0 -0
- package/{dist → bundle}/transcription/index.js +0 -0
- package/{dist → bundle}/transcription/index.js.map +0 -0
- package/{dist → bundle}/transcription/liveTranscription.d.ts +0 -0
- package/{dist → bundle}/transcription/liveTranscription.js +0 -0
- package/{dist → bundle}/transcription/liveTranscription.js.map +0 -0
- package/{dist → bundle}/transcription/preRecordedTranscription.d.ts +0 -0
- package/{dist → bundle}/transcription/preRecordedTranscription.js +0 -0
- package/{dist → bundle}/transcription/preRecordedTranscription.js.map +0 -0
- package/{dist → bundle}/types/balance.d.ts +0 -0
- package/{dist → bundle}/types/balance.js +0 -0
- package/{dist → bundle}/types/balance.js.map +0 -0
- package/{dist → bundle}/types/balanceList.d.ts +0 -0
- package/{dist → bundle}/types/balanceList.js +0 -0
- package/{dist → bundle}/types/balanceList.js.map +0 -0
- package/{dist → bundle}/types/channel.d.ts +0 -0
- package/{dist → bundle}/types/channel.js +0 -0
- package/{dist → bundle}/types/channel.js.map +0 -0
- package/{dist → bundle}/types/createKeyOptions.d.ts +0 -0
- package/{dist → bundle}/types/createKeyOptions.js +0 -0
- package/{dist → bundle}/types/createKeyOptions.js.map +0 -0
- package/{dist → bundle}/types/hit.d.ts +0 -0
- package/{dist → bundle}/types/hit.js +0 -0
- package/{dist → bundle}/types/hit.js.map +0 -0
- package/{dist → bundle}/types/index.d.ts +3 -0
- package/{dist → bundle}/types/index.js +3 -0
- package/{dist → bundle}/types/index.js.map +1 -1
- package/{dist → bundle}/types/invitationList.d.ts +0 -0
- package/{dist → bundle}/types/invitationList.js +0 -0
- package/{dist → bundle}/types/invitationList.js.map +0 -0
- package/{dist → bundle}/types/invitationOptions.d.ts +0 -0
- package/{dist → bundle}/types/invitationOptions.js +0 -0
- package/{dist → bundle}/types/invitationOptions.js.map +0 -0
- package/{dist → bundle}/types/key.d.ts +0 -0
- package/{dist → bundle}/types/key.js +0 -0
- package/{dist → bundle}/types/key.js.map +0 -0
- package/bundle/types/keyResponse.d.ts +10 -0
- package/{dist → bundle}/types/keyResponse.js +0 -0
- package/{dist → bundle}/types/keyResponse.js.map +0 -0
- package/bundle/types/keyResponseObj.d.ts +42 -0
- package/bundle/types/keyResponseObj.js +3 -0
- package/bundle/types/keyResponseObj.js.map +1 -0
- package/{dist → bundle}/types/keyword.d.ts +0 -0
- package/{dist → bundle}/types/keyword.js +0 -0
- package/{dist → bundle}/types/keyword.js.map +0 -0
- package/{dist → bundle}/types/liveTranscriptionOptions.d.ts +0 -0
- package/{dist → bundle}/types/liveTranscriptionOptions.js +0 -0
- package/{dist → bundle}/types/liveTranscriptionOptions.js.map +0 -0
- package/{dist → bundle}/types/liveTranscriptionResponse.d.ts +0 -0
- package/{dist → bundle}/types/liveTranscriptionResponse.js +0 -0
- package/{dist → bundle}/types/liveTranscriptionResponse.js.map +0 -0
- package/{dist → bundle}/types/member.d.ts +0 -0
- package/{dist → bundle}/types/member.js +0 -0
- package/{dist → bundle}/types/member.js.map +0 -0
- package/{dist → bundle}/types/memberList.d.ts +0 -0
- package/{dist → bundle}/types/memberList.js +0 -0
- package/{dist → bundle}/types/memberList.js.map +0 -0
- package/{dist → bundle}/types/message.d.ts +0 -0
- package/{dist → bundle}/types/message.js +0 -0
- package/{dist → bundle}/types/message.js.map +0 -0
- package/{dist → bundle}/types/metadata.d.ts +0 -0
- package/{dist → bundle}/types/metadata.js +0 -0
- package/{dist → bundle}/types/metadata.js.map +0 -0
- package/{dist → bundle}/types/prerecordedTranscriptionOptions.d.ts +0 -0
- package/{dist → bundle}/types/prerecordedTranscriptionOptions.js +0 -0
- package/{dist → bundle}/types/prerecordedTranscriptionOptions.js.map +0 -0
- package/{dist → bundle}/types/prerecordedTranscriptionResponse.d.ts +0 -0
- package/{dist → bundle}/types/prerecordedTranscriptionResponse.js +0 -0
- package/{dist → bundle}/types/prerecordedTranscriptionResponse.js.map +0 -0
- package/{dist → bundle}/types/project.d.ts +0 -0
- package/{dist → bundle}/types/project.js +0 -0
- package/{dist → bundle}/types/project.js.map +0 -0
- package/bundle/types/projectPatchRequest.d.ts +4 -0
- package/bundle/types/projectPatchRequest.js +3 -0
- package/bundle/types/projectPatchRequest.js.map +1 -0
- package/{dist → bundle}/types/projectPatchResponse.d.ts +0 -0
- package/{dist → bundle}/types/projectPatchResponse.js +0 -0
- package/{dist → bundle}/types/projectPatchResponse.js.map +0 -0
- package/{dist → bundle}/types/projectResponse.d.ts +0 -0
- package/{dist → bundle}/types/projectResponse.js +0 -0
- package/{dist → bundle}/types/projectResponse.js.map +0 -0
- package/bundle/types/requestFunction.d.ts +5 -0
- package/bundle/types/requestFunction.js +3 -0
- package/bundle/types/requestFunction.js.map +1 -0
- package/{dist → bundle}/types/scopeList.d.ts +0 -0
- package/{dist → bundle}/types/scopeList.js +0 -0
- package/{dist → bundle}/types/scopeList.js.map +0 -0
- package/{dist → bundle}/types/search.d.ts +0 -0
- package/{dist → bundle}/types/search.js +0 -0
- package/{dist → bundle}/types/search.js.map +0 -0
- package/{dist → bundle}/types/transcriptionSource.d.ts +0 -0
- package/{dist → bundle}/types/transcriptionSource.js +0 -0
- package/{dist → bundle}/types/transcriptionSource.js.map +0 -0
- package/{dist → bundle}/types/usageCallback.d.ts +0 -0
- package/{dist → bundle}/types/usageCallback.js +0 -0
- package/{dist → bundle}/types/usageCallback.js.map +0 -0
- package/{dist → bundle}/types/usageField.d.ts +0 -0
- package/{dist → bundle}/types/usageField.js +0 -0
- package/{dist → bundle}/types/usageField.js.map +0 -0
- package/{dist → bundle}/types/usageFieldOptions.d.ts +0 -0
- package/{dist → bundle}/types/usageFieldOptions.js +0 -0
- package/{dist → bundle}/types/usageFieldOptions.js.map +0 -0
- package/{dist → bundle}/types/usageOptions.d.ts +0 -0
- package/{dist → bundle}/types/usageOptions.js +0 -0
- package/{dist → bundle}/types/usageOptions.js.map +0 -0
- package/{dist → bundle}/types/usageRequest.d.ts +0 -0
- package/{dist → bundle}/types/usageRequest.js +0 -0
- package/{dist → bundle}/types/usageRequest.js.map +0 -0
- package/{dist → bundle}/types/usageRequestDetail.d.ts +0 -0
- package/{dist → bundle}/types/usageRequestDetail.js +0 -0
- package/{dist → bundle}/types/usageRequestDetail.js.map +0 -0
- package/{dist → bundle}/types/usageRequestList.d.ts +0 -0
- package/{dist → bundle}/types/usageRequestList.js +0 -0
- package/{dist → bundle}/types/usageRequestList.js.map +0 -0
- package/{dist → bundle}/types/usageRequestListOptions.d.ts +0 -0
- package/{dist → bundle}/types/usageRequestListOptions.js +0 -0
- package/{dist → bundle}/types/usageRequestListOptions.js.map +0 -0
- package/{dist → bundle}/types/usageRequestMessage.d.ts +0 -0
- package/{dist → bundle}/types/usageRequestMessage.js +0 -0
- package/{dist → bundle}/types/usageRequestMessage.js.map +0 -0
- package/{dist → bundle}/types/usageResponse.d.ts +0 -0
- package/{dist → bundle}/types/usageResponse.js +0 -0
- package/{dist → bundle}/types/usageResponse.js.map +0 -0
- package/{dist → bundle}/types/usageResponseDetail.d.ts +0 -0
- package/{dist → bundle}/types/usageResponseDetail.js +0 -0
- package/{dist → bundle}/types/usageResponseDetail.js.map +0 -0
- package/{dist → bundle}/types/utterance.d.ts +0 -0
- package/{dist → bundle}/types/utterance.js +0 -0
- package/{dist → bundle}/types/utterance.js.map +0 -0
- package/{dist → bundle}/types/wordBase.d.ts +0 -0
- package/{dist → bundle}/types/wordBase.js +0 -0
- package/{dist → bundle}/types/wordBase.js.map +0 -0
- package/{dist → bundle}/usage.d.ts +3 -2
- package/{dist → bundle}/usage.js +6 -6
- package/bundle/usage.js.map +1 -0
- package/{dist → bundle}/userAgent.d.ts +0 -0
- package/{dist → bundle}/userAgent.js +1 -1
- package/bundle/userAgent.js.map +1 -0
- package/dist/browser/index.js +1659 -0
- package/dist/index.d.ts +1315 -24
- package/dist/index.js +1 -41
- package/package.json +67 -59
- package/webpack.config.js +15 -0
- package/.devcontainer/Dockerfile +0 -16
- package/.devcontainer/devcontainer.json +0 -29
- package/dist/billing.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/invitation.js.map +0 -1
- package/dist/keys.js.map +0 -1
- package/dist/members.js.map +0 -1
- package/dist/projects.js.map +0 -1
- package/dist/scopes.js.map +0 -1
- package/dist/types/keyResponse.d.ts +0 -50
- package/dist/usage.js.map +0 -1
- package/dist/userAgent.js.map +0 -1
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
|
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
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Keys } from "./keys";
|
|
2
|
+
import { Projects } from "./projects";
|
|
3
|
+
import { Transcriber } from "./transcription";
|
|
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
|
+
keys: Keys;
|
|
13
|
+
projects: Projects;
|
|
14
|
+
transcription: Transcriber;
|
|
15
|
+
usage: Usage;
|
|
16
|
+
members: Members;
|
|
17
|
+
invitation: Invitation;
|
|
18
|
+
billing: Billing;
|
|
19
|
+
scopes: Scopes;
|
|
20
|
+
constructor(apiKey: string, apiUrl?: string);
|
|
21
|
+
}
|
package/bundle/index.js
ADDED
|
@@ -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 keys_1 = require("./keys");
|
|
6
|
+
var projects_1 = require("./projects");
|
|
7
|
+
var transcription_1 = require("./transcription");
|
|
8
|
+
var usage_1 = require("./usage");
|
|
9
|
+
var members_1 = require("./members");
|
|
10
|
+
var invitation_1 = require("./invitation");
|
|
11
|
+
var billing_1 = require("./billing");
|
|
12
|
+
var scopes_1 = require("./scopes");
|
|
13
|
+
var helpers_1 = require("./helpers");
|
|
14
|
+
var httpRequest_1 = require("./httpRequest");
|
|
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.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);
|
|
25
|
+
this.transcription = new transcription_1.Transcriber(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);
|
|
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/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
|
-
|
|
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.
|
|
@@ -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.Invitation = void 0;
|
|
40
|
-
var httpRequest_1 = require("./httpRequest");
|
|
41
40
|
var Invitation = /** @class */ (function () {
|
|
42
|
-
function Invitation(_credentials, _apiUrl) {
|
|
41
|
+
function Invitation(_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 Invitation = /** @class */ (function () {
|
|
|
51
51
|
Invitation.prototype.list = function (projectId) {
|
|
52
52
|
return __awaiter(this, void 0, void 0, function () {
|
|
53
53
|
return __generator(this, function (_a) {
|
|
54
|
-
return [2 /*return*/,
|
|
54
|
+
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/invites"))];
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
};
|
|
@@ -62,7 +62,7 @@ var Invitation = /** @class */ (function () {
|
|
|
62
62
|
Invitation.prototype.send = function (projectId, options) {
|
|
63
63
|
return __awaiter(this, void 0, void 0, function () {
|
|
64
64
|
return __generator(this, function (_a) {
|
|
65
|
-
return [2 /*return*/,
|
|
65
|
+
return [2 /*return*/, this._request("POST", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/invites"), JSON.stringify({
|
|
66
66
|
email: options.email,
|
|
67
67
|
scope: options.scope,
|
|
68
68
|
}))];
|
|
@@ -76,7 +76,7 @@ var Invitation = /** @class */ (function () {
|
|
|
76
76
|
Invitation.prototype.leave = function (projectId) {
|
|
77
77
|
return __awaiter(this, void 0, void 0, function () {
|
|
78
78
|
return __generator(this, function (_a) {
|
|
79
|
-
return [2 /*return*/,
|
|
79
|
+
return [2 /*return*/, this._request("DELETE", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/leave"))];
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
82
|
};
|
|
@@ -89,7 +89,7 @@ var Invitation = /** @class */ (function () {
|
|
|
89
89
|
Invitation.prototype.delete = function (projectId, email) {
|
|
90
90
|
return __awaiter(this, void 0, void 0, function () {
|
|
91
91
|
return __generator(this, function (_a) {
|
|
92
|
-
return [2 /*return*/,
|
|
92
|
+
return [2 /*return*/, this._request("DELETE", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/invites/").concat(email))];
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
95
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invitation.js","sourceRoot":"","sources":["../src/invitation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;IACE,oBACU,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,yBAAI,GAAV,UAAW,SAAiB;;;gBAC1B,sBAAO,IAAI,CAAC,QAAQ,CAClB,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,aAAU,CACvC,EAAC;;;KACH;IAED;;;OAGG;IACG,yBAAI,GAAV,UAAW,SAAiB,EAAE,OAA0B;;;gBACtD,sBAAO,IAAI,CAAC,QAAQ,CAClB,MAAM,EACN,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,aAAU,EACtC,IAAI,CAAC,SAAS,CAAC;wBACb,KAAK,EAAE,OAAO,CAAC,KAAK;wBACpB,KAAK,EAAE,OAAO,CAAC,KAAK;qBACrB,CAAC,CACH,EAAC;;;KACH;IAED;;;OAGG;IACG,0BAAK,GAAX,UAAY,SAAiB;;;gBAC3B,sBAAO,IAAI,CAAC,QAAQ,CAClB,QAAQ,EACR,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,WAAQ,CACrC,EAAC;;;KACH;IAED;;;;;OAKG;IACG,2BAAM,GAAZ,UAAa,SAAiB,EAAE,KAAa;;;gBAC3C,sBAAO,IAAI,CAAC,QAAQ,CAClB,QAAQ,EACR,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,sBAAY,KAAK,CAAE,CAChD,EAAC;;;KACH;IACH,iBAAC;AAAD,CAAC,AAlED,IAkEC;AAlEY,gCAAU"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { CreateKeyOptions, KeyResponse, Key } from "./types";
|
|
1
|
+
import { CreateKeyOptions, KeyResponse, Key, RequestFunction } from "./types";
|
|
2
2
|
export declare class Keys {
|
|
3
3
|
private _credentials;
|
|
4
4
|
private _apiUrl;
|
|
5
|
-
|
|
5
|
+
private _request;
|
|
6
|
+
constructor(_credentials: string, _apiUrl: string, _request: RequestFunction);
|
|
6
7
|
private apiPath;
|
|
7
8
|
/**
|
|
8
9
|
* Retrieves all keys associated with the provided projectId
|
package/{dist → bundle}/keys.js
RENAMED
|
@@ -48,11 +48,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
exports.Keys = void 0;
|
|
51
|
-
var httpRequest_1 = require("./httpRequest");
|
|
52
51
|
var Keys = /** @class */ (function () {
|
|
53
|
-
function Keys(_credentials, _apiUrl) {
|
|
52
|
+
function Keys(_credentials, _apiUrl, _request) {
|
|
54
53
|
this._credentials = _credentials;
|
|
55
54
|
this._apiUrl = _apiUrl;
|
|
55
|
+
this._request = _request;
|
|
56
56
|
this.apiPath = "/v1/projects";
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
@@ -64,7 +64,7 @@ var Keys = /** @class */ (function () {
|
|
|
64
64
|
var response, output;
|
|
65
65
|
return __generator(this, function (_a) {
|
|
66
66
|
switch (_a.label) {
|
|
67
|
-
case 0: return [4 /*yield*/,
|
|
67
|
+
case 0: return [4 /*yield*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/keys"))];
|
|
68
68
|
case 1:
|
|
69
69
|
response = _a.sent();
|
|
70
70
|
output = response.api_keys.map(function (apiKey) {
|
|
@@ -83,7 +83,7 @@ var Keys = /** @class */ (function () {
|
|
|
83
83
|
Keys.prototype.get = function (projectId, keyId) {
|
|
84
84
|
return __awaiter(this, void 0, void 0, function () {
|
|
85
85
|
return __generator(this, function (_a) {
|
|
86
|
-
return [2 /*return*/,
|
|
86
|
+
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/keys/").concat(keyId))];
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
};
|
|
@@ -103,7 +103,7 @@ var Keys = /** @class */ (function () {
|
|
|
103
103
|
options.timeToLive !== undefined) {
|
|
104
104
|
throw new Error("Please provide expirationDate or timeToLive or neither. Providing both is not allowed.");
|
|
105
105
|
}
|
|
106
|
-
return [2 /*return*/,
|
|
106
|
+
return [2 /*return*/, this._request("POST", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/keys"), JSON.stringify({
|
|
107
107
|
comment: comment,
|
|
108
108
|
scopes: scopes,
|
|
109
109
|
expiration_date: options && options.expirationDate
|
|
@@ -122,7 +122,7 @@ var Keys = /** @class */ (function () {
|
|
|
122
122
|
Keys.prototype.delete = function (projectId, keyId) {
|
|
123
123
|
return __awaiter(this, void 0, void 0, function () {
|
|
124
124
|
return __generator(this, function (_a) {
|
|
125
|
-
return [2 /*return*/,
|
|
125
|
+
return [2 /*return*/, this._request("DELETE", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/keys/").concat(keyId))];
|
|
126
126
|
});
|
|
127
127
|
});
|
|
128
128
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;IACE,cACU,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,mBAAI,GAAV,UAAW,SAAiB;;;;;4BACT,qBAAM,IAAI,CAAC,QAAQ,CAClC,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,UAAO,CACpC,EAAA;;wBALK,QAAQ,GAAG,SAKhB;wBAEK,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAC,MAAsB;4BAC1D,6BACK,MAAM,GACN,MAAM,CAAC,OAAO,EACjB;wBACJ,CAAC,CAAC,CAAC;wBAEH,sBAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAC;;;;KAC7B;IAED;;;;OAIG;IACG,kBAAG,GAAT,UAAU,SAAiB,EAAE,KAAa;;;gBACxC,sBAAO,IAAI,CAAC,QAAQ,CAClB,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,mBAAS,KAAK,CAAE,CAC7C,EAAC;;;KACH;IAED;;;;;;OAMG;IACG,qBAAM,GAAZ,UACE,SAAiB,EACjB,OAAe,EACf,MAAqB,EACrB,OAA0B;;;gBAE1B,6EAA6E;gBAC7E,IACE,OAAO;oBACP,OAAO,CAAC,cAAc,KAAK,SAAS;oBACpC,OAAO,CAAC,UAAU,KAAK,SAAS,EAChC;oBACA,MAAM,IAAI,KAAK,CACb,wFAAwF,CACzF,CAAC;iBACH;gBAED,sBAAO,IAAI,CAAC,QAAQ,CAClB,MAAM,EACN,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,UAAO,EACnC,IAAI,CAAC,SAAS,CAAC;wBACb,OAAO,SAAA;wBACP,MAAM,QAAA;wBACN,eAAe,EACb,OAAO,IAAI,OAAO,CAAC,cAAc;4BAC/B,CAAC,CAAC,OAAO,CAAC,cAAc;4BACxB,CAAC,CAAC,SAAS;wBACf,uBAAuB,EACrB,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;qBACjE,CAAC,CACH,EAAC;;;KACH;IAED;;;;OAIG;IACG,qBAAM,GAAZ,UAAa,SAAiB,EAAE,KAAa;;;gBAC3C,sBAAO,IAAI,CAAC,QAAQ,CAClB,QAAQ,EACR,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,mBAAS,KAAK,CAAE,CAC7C,EAAC;;;KACH;IACH,WAAC;AAAD,CAAC,AApGD,IAoGC;AApGY,oBAAI"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { MemberList, Message } from "./types";
|
|
1
|
+
import { MemberList, Message, RequestFunction } from "./types";
|
|
2
2
|
export declare class Members {
|
|
3
3
|
private _credentials;
|
|
4
4
|
private _apiUrl;
|
|
5
|
-
|
|
5
|
+
private _request;
|
|
6
|
+
constructor(_credentials: string, _apiUrl: string, _request: RequestFunction);
|
|
6
7
|
private apiPath;
|
|
7
8
|
/**
|
|
8
9
|
* Retrieves account objects for all of the accounts in 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.Members = void 0;
|
|
40
|
-
var httpRequest_1 = require("./httpRequest");
|
|
41
40
|
var Members = /** @class */ (function () {
|
|
42
|
-
function Members(_credentials, _apiUrl) {
|
|
41
|
+
function Members(_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 Members = /** @class */ (function () {
|
|
|
51
51
|
Members.prototype.listMembers = function (projectId) {
|
|
52
52
|
return __awaiter(this, void 0, void 0, function () {
|
|
53
53
|
return __generator(this, function (_a) {
|
|
54
|
-
return [2 /*return*/,
|
|
54
|
+
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/members"))];
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
};
|
|
@@ -63,7 +63,7 @@ var Members = /** @class */ (function () {
|
|
|
63
63
|
Members.prototype.removeMember = function (projectId, memberId) {
|
|
64
64
|
return __awaiter(this, void 0, void 0, function () {
|
|
65
65
|
return __generator(this, function (_a) {
|
|
66
|
-
return [2 /*return*/,
|
|
66
|
+
return [2 /*return*/, this._request("DELETE", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/members/").concat(memberId))];
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"members.js","sourceRoot":"","sources":["../src/members.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,6BAAW,GAAjB,UAAkB,SAAiB;;;gBACjC,sBAAO,IAAI,CAAC,QAAQ,CAClB,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,aAAU,CACvC,EAAC;;;KACH;IAED;;;;OAIG;IACG,8BAAY,GAAlB,UAAmB,SAAiB,EAAE,QAAgB;;;gBACpD,sBAAO,IAAI,CAAC,QAAQ,CAClB,QAAQ,EACR,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,UAAG,IAAI,CAAC,OAAO,cAAI,SAAS,sBAAY,QAAQ,CAAE,CACnD,EAAC;;;KACH;IACH,cAAC;AAAD,CAAC,AAnCD,IAmCC;AAnCY,0BAAO"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Project, ProjectPatchResponse, ProjectResponse } from "./types";
|
|
1
|
+
import { Project, ProjectPatchResponse, ProjectResponse, ProjectPatchRequest, RequestFunction } from "./types";
|
|
2
2
|
export declare class Projects {
|
|
3
3
|
private _credentials;
|
|
4
4
|
private _apiUrl;
|
|
5
|
-
|
|
5
|
+
private _request;
|
|
6
|
+
constructor(_credentials: string, _apiUrl: string, _request: RequestFunction);
|
|
6
7
|
private apiPath;
|
|
7
8
|
/**
|
|
8
9
|
* Returns all projects accessible by the API key
|
|
@@ -17,5 +18,5 @@ export declare class Projects {
|
|
|
17
18
|
* Update a specific project
|
|
18
19
|
* @param project project to update
|
|
19
20
|
*/
|
|
20
|
-
update(project: Project): Promise<ProjectPatchResponse>;
|
|
21
|
+
update(project: Project, payload: ProjectPatchRequest): Promise<ProjectPatchResponse>;
|
|
21
22
|
}
|