@api-client/core 0.5.4 → 0.5.5
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/build/browser.d.ts +1 -0
- package/build/browser.js +1 -0
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/src/models/Backend.d.ts +7 -9
- package/build/src/models/HttpHistory.d.ts +2 -2
- package/build/src/models/Project.d.ts +1 -1
- package/build/src/models/Project.js +2 -2
- package/build/src/models/Project.js.map +1 -1
- package/build/src/models/SerializableError.d.ts +1 -0
- package/build/src/models/SerializableError.js.map +1 -1
- package/build/src/runtime/store/Errors.d.ts +50 -0
- package/build/src/runtime/store/Errors.js +63 -0
- package/build/src/runtime/store/Errors.js.map +1 -0
- package/build/src/runtime/store/FilesSdk.d.ts +41 -26
- package/build/src/runtime/store/FilesSdk.js +100 -53
- package/build/src/runtime/store/FilesSdk.js.map +1 -1
- package/build/src/runtime/store/HistorySdk.d.ts +14 -7
- package/build/src/runtime/store/HistorySdk.js +34 -12
- package/build/src/runtime/store/HistorySdk.js.map +1 -1
- package/build/src/runtime/store/Sdk.d.ts +4 -0
- package/build/src/runtime/store/Sdk.js +4 -0
- package/build/src/runtime/store/Sdk.js.map +1 -1
- package/build/src/runtime/store/SdkBase.d.ts +16 -6
- package/build/src/runtime/store/SdkBase.js +54 -4
- package/build/src/runtime/store/SdkBase.js.map +1 -1
- package/build/src/runtime/store/SharedSdk.d.ts +8 -2
- package/build/src/runtime/store/SharedSdk.js +21 -7
- package/build/src/runtime/store/SharedSdk.js.map +1 -1
- package/build/src/runtime/store/UsersSdk.d.ts +10 -4
- package/build/src/runtime/store/UsersSdk.js +12 -6
- package/build/src/runtime/store/UsersSdk.js.map +1 -1
- package/package.json +2 -2
- package/src/models/Backend.ts +7 -9
- package/src/models/HttpHistory.ts +2 -2
- package/src/models/Project.ts +2 -2
- package/src/models/SerializableError.ts +1 -0
- package/src/runtime/store/Errors.ts +100 -0
- package/src/runtime/store/FilesSdk.ts +116 -62
- package/src/runtime/store/HistorySdk.ts +42 -17
- package/src/runtime/store/Sdk.ts +5 -0
- package/src/runtime/store/SdkBase.ts +63 -9
- package/src/runtime/store/SharedSdk.ts +26 -9
- package/src/runtime/store/UsersSdk.ts +14 -8
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { SdkBase, E_RESPONSE_STATUS, E_RESPONSE_NO_VALUE, E_INVALID_JSON, E_RESPONSE_UNKNOWN } from './SdkBase.js';
|
|
1
|
+
import { SdkBase, E_RESPONSE_STATUS, E_RESPONSE_NO_VALUE, E_INVALID_JSON, E_RESPONSE_UNKNOWN, ISdkRequestOptions } from './SdkBase.js';
|
|
2
2
|
import { RouteBuilder } from './RouteBuilder.js';
|
|
3
3
|
import { IListOptions, IListResponse } from '../../models/Backend.js';
|
|
4
4
|
import { IUser } from '../../models/store/User.js';
|
|
5
5
|
|
|
6
6
|
export class UsersSdk extends SdkBase {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Reads the current user.
|
|
9
|
+
* @param request Optional request options.
|
|
10
|
+
*/
|
|
11
|
+
async me(request: ISdkRequestOptions = {}): Promise<IUser> {
|
|
12
|
+
const token = request.token || this.sdk.token;
|
|
9
13
|
const url = this.sdk.getUrl(RouteBuilder.usersMe());
|
|
10
14
|
const result = await this.sdk.http.get(url.toString(), { token });
|
|
11
15
|
this.inspectCommonStatusCodes(result.status);
|
|
@@ -33,9 +37,10 @@ export class UsersSdk extends SdkBase {
|
|
|
33
37
|
* Lists users in the store
|
|
34
38
|
*
|
|
35
39
|
* @param options Optional query options.
|
|
40
|
+
* @param request Optional request options.
|
|
36
41
|
*/
|
|
37
|
-
async list(options?: IListOptions): Promise<IListResponse
|
|
38
|
-
const
|
|
42
|
+
async list(options?: IListOptions, request: ISdkRequestOptions = {}): Promise<IListResponse<IUser>> {
|
|
43
|
+
const token = request.token || this.sdk.token;
|
|
39
44
|
const url = this.sdk.getUrl(RouteBuilder.users());
|
|
40
45
|
this.sdk.appendListOptions(url, options);
|
|
41
46
|
const result = await this.sdk.http.get(url.toString(), { token });
|
|
@@ -48,7 +53,7 @@ export class UsersSdk extends SdkBase {
|
|
|
48
53
|
if (!result.body) {
|
|
49
54
|
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
50
55
|
}
|
|
51
|
-
let data: IListResponse
|
|
56
|
+
let data: IListResponse<IUser>;
|
|
52
57
|
try {
|
|
53
58
|
data = JSON.parse(result.body);
|
|
54
59
|
} catch (e) {
|
|
@@ -63,10 +68,11 @@ export class UsersSdk extends SdkBase {
|
|
|
63
68
|
/**
|
|
64
69
|
* Reads a user information from the store.
|
|
65
70
|
* @param key The user key.
|
|
71
|
+
* @param request Optional request options.
|
|
66
72
|
* @returns The user object
|
|
67
73
|
*/
|
|
68
|
-
async read(key: string): Promise<IUser> {
|
|
69
|
-
const
|
|
74
|
+
async read(key: string, request: ISdkRequestOptions = {}): Promise<IUser> {
|
|
75
|
+
const token = request.token || this.sdk.token;
|
|
70
76
|
const url = this.sdk.getUrl(RouteBuilder.user(key));
|
|
71
77
|
const result = await this.sdk.http.get(url.toString(), { token });
|
|
72
78
|
this.inspectCommonStatusCodes(result.status);
|