bkper-js 1.5.1 → 1.6.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.
- package/lib/index.d.ts +10 -0
- package/lib/model/App.js +6 -0
- package/lib/model/Bkper.js +12 -0
- package/lib/service/app-service.js +14 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -366,6 +366,10 @@ export declare class App {
|
|
|
366
366
|
* Perform update App, applying pending changes.
|
|
367
367
|
*/
|
|
368
368
|
update(): Promise<App>;
|
|
369
|
+
/**
|
|
370
|
+
* @returns The wrapped plain json object
|
|
371
|
+
*/
|
|
372
|
+
json(): bkper.App;
|
|
369
373
|
}
|
|
370
374
|
|
|
371
375
|
/**
|
|
@@ -414,6 +418,12 @@ export declare class Bkper {
|
|
|
414
418
|
* @returns The retrieved list of Books
|
|
415
419
|
*/
|
|
416
420
|
static getBooks(): Promise<Book[]>;
|
|
421
|
+
/**
|
|
422
|
+
* Gets all [[Apps]] available for the user.
|
|
423
|
+
*
|
|
424
|
+
* @returns The retrieved list of Apps
|
|
425
|
+
*/
|
|
426
|
+
static getApps(): Promise<App[]>;
|
|
417
427
|
/**
|
|
418
428
|
* Gets the current logged [[User]].
|
|
419
429
|
*
|
package/lib/model/App.js
CHANGED
package/lib/model/Bkper.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { Book } from "./Book.js";
|
|
11
11
|
import { App } from "./App.js";
|
|
12
|
+
import * as AppService from '../service/app-service.js';
|
|
12
13
|
import * as BookService from '../service/book-service.js';
|
|
13
14
|
import * as UserService from '../service/user-service.js';
|
|
14
15
|
import { HttpApiRequest } from '../service/http-api-request.js';
|
|
@@ -71,6 +72,17 @@ export class Bkper {
|
|
|
71
72
|
return books.map(book => new Book(book));
|
|
72
73
|
});
|
|
73
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Gets all [[Apps]] available for the user.
|
|
77
|
+
*
|
|
78
|
+
* @returns The retrieved list of Apps
|
|
79
|
+
*/
|
|
80
|
+
static getApps() {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
let apps = yield AppService.getApps();
|
|
83
|
+
return apps.map(app => new App(app));
|
|
84
|
+
});
|
|
85
|
+
}
|
|
74
86
|
/**
|
|
75
87
|
* Gets the current logged [[User]].
|
|
76
88
|
*
|
|
@@ -8,6 +8,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { HttpApiRequest } from "./http-api-request.js";
|
|
11
|
+
export function getApps() {
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
let response = yield new HttpApiRequest(`v5/apps`).setMethod('GET').fetch();
|
|
14
|
+
if (response.data == null) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
let appListPlain = response.data;
|
|
18
|
+
let appsJson = appListPlain.items;
|
|
19
|
+
if (appsJson == null) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
return appsJson;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
11
25
|
export function createApp(app) {
|
|
12
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
27
|
var response = yield new HttpApiRequest(`v5/apps`).setMethod('POST').setPayload(app).fetch();
|