@prisme.ai/sdk 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +26 -0
- package/dist/_virtual/_tslib.js +107 -0
- package/dist/index.d.ts +7 -0
- package/dist/lib/ApiError.d.ts +8 -0
- package/dist/lib/ApiError.test.d.ts +1 -0
- package/dist/lib/HTTPError.d.ts +6 -0
- package/dist/lib/HTTPError.test.d.ts +1 -0
- package/dist/lib/api.d.ts +59 -0
- package/dist/lib/api.test.d.ts +1 -0
- package/dist/lib/events.d.ts +14 -0
- package/dist/lib/events.test.d.ts +1 -0
- package/dist/lib/fetcher.d.ts +11 -0
- package/dist/lib/fetcher.test.d.ts +1 -0
- package/dist/lib/types.d.ts +13 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.test.d.ts +1 -0
- package/dist/sdk/index.js +19 -0
- package/dist/sdk/lib/ApiError.js +24 -0
- package/dist/sdk/lib/HTTPError.js +21 -0
- package/dist/sdk/lib/api.js +553 -0
- package/dist/sdk/lib/events.js +65 -0
- package/dist/sdk/lib/fetcher.js +121 -0
- package/dist/sdk/lib/utils.js +18 -0
- package/index.ts +7 -0
- package/lib/ApiError.test.ts +13 -0
- package/lib/ApiError.ts +21 -0
- package/lib/HTTPError.test.ts +8 -0
- package/lib/HTTPError.ts +13 -0
- package/lib/api.test.ts +231 -0
- package/lib/api.ts +439 -0
- package/lib/events.test.ts +57 -0
- package/lib/events.ts +69 -0
- package/lib/fetcher.test.ts +200 -0
- package/lib/fetcher.ts +97 -0
- package/lib/types.ts +17 -0
- package/lib/utils.test.ts +38 -0
- package/lib/utils.ts +12 -0
- package/package.json +16 -0
- package/tsconfig.json +21 -0
package/Readme.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Prisme.ai SDk
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
This javascript library helps to communicate with Prisme.ai API. It provides methods to reach every endpoints and structure data responses.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
import api from '@prisme.ai/sdk';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
will give you a singleton preset to hit the prisme.ai cloud service.
|
|
14
|
+
|
|
15
|
+
You can set a different host by instantiating the Api class:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
import { Api } from '@prisme.ai/sdk';
|
|
19
|
+
const api = new Api('https://my.custom.host')
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
You are able to call un authentified methods like signin or signup, but you'll need a valid token to call the other. Just set its property:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
api.token = 'the token';
|
|
26
|
+
```
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/*! *****************************************************************************
|
|
6
|
+
Copyright (c) Microsoft Corporation.
|
|
7
|
+
|
|
8
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
+
purpose with or without fee is hereby granted.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
+
***************************************************************************** */
|
|
19
|
+
/* global Reflect, Promise */
|
|
20
|
+
|
|
21
|
+
var extendStatics = function(d, b) {
|
|
22
|
+
extendStatics = Object.setPrototypeOf ||
|
|
23
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
24
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
25
|
+
return extendStatics(d, b);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function __extends(d, b) {
|
|
29
|
+
if (typeof b !== "function" && b !== null)
|
|
30
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
31
|
+
extendStatics(d, b);
|
|
32
|
+
function __() { this.constructor = d; }
|
|
33
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.__assign = function() {
|
|
37
|
+
exports.__assign = Object.assign || function __assign(t) {
|
|
38
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
39
|
+
s = arguments[i];
|
|
40
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
41
|
+
}
|
|
42
|
+
return t;
|
|
43
|
+
};
|
|
44
|
+
return exports.__assign.apply(this, arguments);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function __rest(s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
+
t[p] = s[p];
|
|
51
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
+
t[p[i]] = s[p[i]];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
60
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
61
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
62
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
63
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
64
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
65
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function __generator(thisArg, body) {
|
|
70
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
71
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
72
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
73
|
+
function step(op) {
|
|
74
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
75
|
+
while (_) try {
|
|
76
|
+
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;
|
|
77
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
78
|
+
switch (op[0]) {
|
|
79
|
+
case 0: case 1: t = op; break;
|
|
80
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
81
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
82
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
83
|
+
default:
|
|
84
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
85
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
86
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
87
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
88
|
+
if (t[2]) _.ops.pop();
|
|
89
|
+
_.trys.pop(); continue;
|
|
90
|
+
}
|
|
91
|
+
op = body.call(thisArg, _);
|
|
92
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
93
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function __spreadArray(to, from) {
|
|
98
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
99
|
+
to[j] = from[i];
|
|
100
|
+
return to;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
exports.__awaiter = __awaiter;
|
|
104
|
+
exports.__extends = __extends;
|
|
105
|
+
exports.__generator = __generator;
|
|
106
|
+
exports.__rest = __rest;
|
|
107
|
+
exports.__spreadArray = __spreadArray;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class ApiError extends Error implements Prismeai.GenericError {
|
|
2
|
+
code: number;
|
|
3
|
+
error: Prismeai.GenericError['error'];
|
|
4
|
+
details: Prismeai.GenericError['details'];
|
|
5
|
+
constructor({ error, message, details }: Prismeai.GenericError, code: number);
|
|
6
|
+
toString(): string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export default ApiError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Fetcher from './fetcher';
|
|
2
|
+
import { Event, Workspace } from './types';
|
|
3
|
+
import { Events } from './events';
|
|
4
|
+
declare type UserPermissions = Prismeai.UserPermissions;
|
|
5
|
+
export declare class Api extends Fetcher {
|
|
6
|
+
me(): Promise<any>;
|
|
7
|
+
signin(email: string, password: string): Promise<Prismeai.User & {
|
|
8
|
+
token: string;
|
|
9
|
+
}>;
|
|
10
|
+
signup(email: string, password: string, firstName: string, lastName: string): Promise<Prismeai.User & {
|
|
11
|
+
token: string;
|
|
12
|
+
}>;
|
|
13
|
+
signout(): Promise<void>;
|
|
14
|
+
getWorkspaces(): Promise<Workspace[]>;
|
|
15
|
+
getWorkspace(id: string): Promise<Workspace | null>;
|
|
16
|
+
createWorkspace(name: string): Promise<Workspace>;
|
|
17
|
+
updateWorkspace(workspace: Workspace): Promise<Workspace>;
|
|
18
|
+
deleteWorkspace(workspaceId: Workspace['id']): Promise<Workspace>;
|
|
19
|
+
createAutomation(workspace: Workspace, automation: Prismeai.Automation): Promise<Prismeai.Automation & {
|
|
20
|
+
slug: string;
|
|
21
|
+
}>;
|
|
22
|
+
updateAutomation(workspace: Workspace, slug: string, automation: Prismeai.Automation): Promise<Prismeai.Automation & {
|
|
23
|
+
slug: string;
|
|
24
|
+
}>;
|
|
25
|
+
deleteAutomation(workspace: Workspace, slug: string): Promise<string>;
|
|
26
|
+
getPages(workspaceId: NonNullable<Workspace['id']>): Promise<Prismeai.Page[]>;
|
|
27
|
+
getPage(workspaceId: PrismeaiAPI.GetPage.Parameters.WorkspaceId, pageId: PrismeaiAPI.GetPage.Parameters.Id): Promise<Prismeai.DetailedPage>;
|
|
28
|
+
getPageBySlug(pageSlug: PrismeaiAPI.GetPageBySlug.Parameters.Slug): Promise<Prismeai.DetailedPage>;
|
|
29
|
+
createPage(workspaceId: NonNullable<Workspace['id']>, page: Prismeai.Page): Promise<Prismeai.Page>;
|
|
30
|
+
updatePage(workspaceId: NonNullable<Workspace['id']>, page: Prismeai.Page): Promise<Prismeai.Page>;
|
|
31
|
+
deletePage(workspaceId: NonNullable<Workspace['id']>, pageId: string): Promise<Pick<Prismeai.Page, 'id'>>;
|
|
32
|
+
streamEvents(workspaceId: string): Promise<Events>;
|
|
33
|
+
getEvents(workspaceId: string, options?: {
|
|
34
|
+
beforeDate?: Date | string;
|
|
35
|
+
}): Promise<Event<Date>[]>;
|
|
36
|
+
postEvents(workspaceId: PrismeaiAPI.SendWorkspaceEvent.Parameters.WorkspaceId, events: PrismeaiAPI.SendWorkspaceEvent.RequestBody['events']): Promise<boolean>;
|
|
37
|
+
getPermissions(subjectType: PrismeaiAPI.GetPermissions.Parameters.SubjectType, subjectId: string): Promise<PrismeaiAPI.GetPermissions.Responses.$200>;
|
|
38
|
+
addPermissions(subjectType: PrismeaiAPI.GetPermissions.Parameters.SubjectType, subjectId: string, permissions: UserPermissions): Promise<PrismeaiAPI.Share.Responses.$200>;
|
|
39
|
+
deletePermissions(subjectType: PrismeaiAPI.GetPermissions.Parameters.SubjectType, subjectId: string, userEmail: string): Promise<PrismeaiAPI.RevokePermissions.Responses.$200>;
|
|
40
|
+
getApps({ query, page, limit, workspaceId, }: {
|
|
41
|
+
query?: PrismeaiAPI.SearchApps.QueryParameters['text'];
|
|
42
|
+
page?: PrismeaiAPI.SearchApps.QueryParameters['page'];
|
|
43
|
+
limit?: PrismeaiAPI.SearchApps.QueryParameters['limit'];
|
|
44
|
+
workspaceId?: PrismeaiAPI.SearchApps.QueryParameters['workspaceId'];
|
|
45
|
+
}): Promise<PrismeaiAPI.SearchApps.Responses.$200>;
|
|
46
|
+
installApp(workspaceId: PrismeaiAPI.InstallAppInstance.PathParameters['workspaceId'], body: PrismeaiAPI.InstallAppInstance.RequestBody): Promise<PrismeaiAPI.InstallAppInstance.Responses.$200>;
|
|
47
|
+
updateApp(workspaceId: PrismeaiAPI.ConfigureAppInstance.PathParameters['workspaceId'], slug: PrismeaiAPI.ConfigureAppInstance.PathParameters['slug'], body: PrismeaiAPI.ConfigureAppInstance.RequestBody): Promise<PrismeaiAPI.ConfigureAppInstance.Responses.$200>;
|
|
48
|
+
uninstallApp(workspaceId: PrismeaiAPI.UninstallAppInstance.PathParameters['workspaceId'], slug: PrismeaiAPI.ConfigureAppInstance.PathParameters['slug']): Promise<PrismeaiAPI.UninstallAppInstance.Responses.$200>;
|
|
49
|
+
publishApp(body: PrismeaiAPI.PublishApp.RequestBody): Promise<PrismeaiAPI.PublishApp.Responses.$200>;
|
|
50
|
+
listAppInstances(workspaceId: PrismeaiAPI.ListAppInstances.PathParameters['workspaceId']): Promise<PrismeaiAPI.ListAppInstances.Responses.$200>;
|
|
51
|
+
fetchImports(workspaceId: PrismeaiAPI.ListAppInstances.Parameters.WorkspaceId): Promise<PrismeaiAPI.ListAppInstances.Responses.$200>;
|
|
52
|
+
getAppConfig<T>(workspaceId: PrismeaiAPI.GetAppInstanceConfig.Parameters.WorkspaceId, slug: PrismeaiAPI.GetAppInstanceConfig.Parameters.Slug): Promise<T>;
|
|
53
|
+
updateAppConfig(workspaceId: PrismeaiAPI.UpdateAppInstanceConfig.Parameters.WorkspaceId, slug: PrismeaiAPI.UpdateAppInstanceConfig.Parameters.Slug, config: any): Promise<PrismeaiAPI.UpdateAppInstanceConfig.Responses.$200['config']>;
|
|
54
|
+
uploadFiles(files: string | string[], workspaceId: string): Promise<PrismeaiAPI.UploadFile.Responses.$200>;
|
|
55
|
+
replaceAllImagesData(original: any, workspaceId: string): Promise<any>;
|
|
56
|
+
callAutomation(workspaceId: string, automation: string): Promise<any>;
|
|
57
|
+
}
|
|
58
|
+
declare const _default: Api;
|
|
59
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Socket } from 'socket.io-client';
|
|
2
|
+
export declare class Events {
|
|
3
|
+
protected client: Socket;
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
constructor(workspaceId: string, token: string, apiHost?: string);
|
|
6
|
+
get socket(): Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
7
|
+
destroy(): void;
|
|
8
|
+
all(listener: (eventName: string, eventData: Prismeai.PrismeEvent) => void): () => Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
9
|
+
on(ev: string, listener: (eventName: string, eventData: Prismeai.PrismeEvent) => void): () => Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
10
|
+
emit(event: string, payload?: any): void;
|
|
11
|
+
once(ev: string, listener: (eventName: string, eventData: Prismeai.PrismeEvent) => void): void;
|
|
12
|
+
close(): void;
|
|
13
|
+
}
|
|
14
|
+
export default Events;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class Fetcher {
|
|
2
|
+
host: string;
|
|
3
|
+
token: string | null;
|
|
4
|
+
constructor(host: string);
|
|
5
|
+
protected _fetch<T>(url: string, options?: RequestInit): Promise<T>;
|
|
6
|
+
get<T = any>(url: string): Promise<T>;
|
|
7
|
+
post<T>(url: string, body?: Record<string, any>): Promise<T>;
|
|
8
|
+
patch<T>(url: string, body: Record<string, any>): Promise<T>;
|
|
9
|
+
delete<T>(url: string): Promise<T>;
|
|
10
|
+
}
|
|
11
|
+
export default Fetcher;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import '@prisme.ai/types';
|
|
2
|
+
export interface Workspace extends Prismeai.Workspace {
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
export interface Event<DateType extends Date | string> extends Omit<Prismeai.PrismeEvent, 'createdAt'> {
|
|
6
|
+
createdAt: DateType;
|
|
7
|
+
}
|
|
8
|
+
export declare type EventsFilters = {
|
|
9
|
+
afterDate?: PrismeaiAPI.EventsLongpolling.Parameters.AfterDate;
|
|
10
|
+
beforeDate?: PrismeaiAPI.EventsLongpolling.Parameters.BeforeDate;
|
|
11
|
+
text?: PrismeaiAPI.EventsLongpolling.Parameters.Text;
|
|
12
|
+
query?: PrismeaiAPI.EventsLongpolling.Parameters.Query;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const removedUndefinedProperties: (obj: any, removeEmptyStrings?: boolean) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var api = require('./lib/api.js');
|
|
6
|
+
var ApiError = require('./lib/ApiError.js');
|
|
7
|
+
var events = require('./lib/events.js');
|
|
8
|
+
var fetcher = require('./lib/fetcher.js');
|
|
9
|
+
var HTTPError = require('./lib/HTTPError.js');
|
|
10
|
+
require('@prisme.ai/types');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.Api = api.Api;
|
|
15
|
+
exports["default"] = api["default"];
|
|
16
|
+
exports.ApiError = ApiError.ApiError;
|
|
17
|
+
exports.Events = events.Events;
|
|
18
|
+
exports.Fetcher = fetcher.Fetcher;
|
|
19
|
+
exports.HTTPError = HTTPError.HTTPError;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../_virtual/_tslib.js');
|
|
6
|
+
|
|
7
|
+
var ApiError = /** @class */ (function (_super) {
|
|
8
|
+
_tslib.__extends(ApiError, _super);
|
|
9
|
+
function ApiError(_a, code) {
|
|
10
|
+
var error = _a.error, message = _a.message, details = _a.details;
|
|
11
|
+
var _this = _super.call(this, message) || this;
|
|
12
|
+
_this.code = code;
|
|
13
|
+
_this.error = error;
|
|
14
|
+
_this.details = details;
|
|
15
|
+
return _this;
|
|
16
|
+
}
|
|
17
|
+
ApiError.prototype.toString = function () {
|
|
18
|
+
return this.error;
|
|
19
|
+
};
|
|
20
|
+
return ApiError;
|
|
21
|
+
}(Error));
|
|
22
|
+
|
|
23
|
+
exports.ApiError = ApiError;
|
|
24
|
+
exports["default"] = ApiError;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../_virtual/_tslib.js');
|
|
6
|
+
|
|
7
|
+
var HTTPError = /** @class */ (function (_super) {
|
|
8
|
+
_tslib.__extends(HTTPError, _super);
|
|
9
|
+
function HTTPError(status, code) {
|
|
10
|
+
var _this = _super.call(this, status) || this;
|
|
11
|
+
_this.code = code;
|
|
12
|
+
return _this;
|
|
13
|
+
}
|
|
14
|
+
HTTPError.prototype.toString = function () {
|
|
15
|
+
return "".concat(this.code, " ").concat(this.message);
|
|
16
|
+
};
|
|
17
|
+
return HTTPError;
|
|
18
|
+
}(Error));
|
|
19
|
+
|
|
20
|
+
exports.HTTPError = HTTPError;
|
|
21
|
+
exports["default"] = HTTPError;
|