@api-client/core 0.13.1 → 0.13.3
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/src/sdk/HttpWeb.d.ts.map +1 -1
- package/build/src/sdk/HttpWeb.js +6 -0
- package/build/src/sdk/HttpWeb.js.map +1 -1
- package/build/src/sdk/OrganizationsSdk.d.ts +10 -0
- package/build/src/sdk/OrganizationsSdk.d.ts.map +1 -1
- package/build/src/sdk/OrganizationsSdk.js +40 -0
- package/build/src/sdk/OrganizationsSdk.js.map +1 -1
- package/build/src/sdk/RouteBuilder.d.ts +2 -1
- package/build/src/sdk/RouteBuilder.d.ts.map +1 -1
- package/build/src/sdk/RouteBuilder.js +5 -2
- package/build/src/sdk/RouteBuilder.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +9 -9
- package/package.json +1 -1
- package/src/sdk/HttpWeb.ts +6 -0
- package/src/sdk/OrganizationsSdk.ts +40 -0
- package/src/sdk/RouteBuilder.ts +6 -2
|
@@ -42473,13 +42473,13 @@
|
|
|
42473
42473
|
"@id": "#210"
|
|
42474
42474
|
},
|
|
42475
42475
|
{
|
|
42476
|
-
"@id": "#
|
|
42476
|
+
"@id": "#219"
|
|
42477
42477
|
},
|
|
42478
42478
|
{
|
|
42479
|
-
"@id": "#
|
|
42479
|
+
"@id": "#213"
|
|
42480
42480
|
},
|
|
42481
42481
|
{
|
|
42482
|
-
"@id": "#
|
|
42482
|
+
"@id": "#216"
|
|
42483
42483
|
}
|
|
42484
42484
|
],
|
|
42485
42485
|
"doc:root": false,
|
|
@@ -43913,7 +43913,7 @@
|
|
|
43913
43913
|
"doc:ExternalDomainElement",
|
|
43914
43914
|
"doc:DomainElement"
|
|
43915
43915
|
],
|
|
43916
|
-
"doc:raw": "type: 'GENERAL'\
|
|
43916
|
+
"doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
|
|
43917
43917
|
"core:mediaType": "application/yaml",
|
|
43918
43918
|
"sourcemaps:sources": [
|
|
43919
43919
|
{
|
|
@@ -43934,7 +43934,7 @@
|
|
|
43934
43934
|
"doc:ExternalDomainElement",
|
|
43935
43935
|
"doc:DomainElement"
|
|
43936
43936
|
],
|
|
43937
|
-
"doc:raw": "
|
|
43937
|
+
"doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
|
|
43938
43938
|
"core:mediaType": "application/yaml",
|
|
43939
43939
|
"sourcemaps:sources": [
|
|
43940
43940
|
{
|
|
@@ -43955,7 +43955,7 @@
|
|
|
43955
43955
|
"doc:ExternalDomainElement",
|
|
43956
43956
|
"doc:DomainElement"
|
|
43957
43957
|
],
|
|
43958
|
-
"doc:raw": "type:
|
|
43958
|
+
"doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
|
|
43959
43959
|
"core:mediaType": "application/yaml",
|
|
43960
43960
|
"sourcemaps:sources": [
|
|
43961
43961
|
{
|
|
@@ -44781,17 +44781,17 @@
|
|
|
44781
44781
|
{
|
|
44782
44782
|
"@id": "#215/source-map/lexical/element_0",
|
|
44783
44783
|
"sourcemaps:element": "amf://id#215",
|
|
44784
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44784
|
+
"sourcemaps:value": "[(1,0)-(7,0)]"
|
|
44785
44785
|
},
|
|
44786
44786
|
{
|
|
44787
44787
|
"@id": "#218/source-map/lexical/element_0",
|
|
44788
44788
|
"sourcemaps:element": "amf://id#218",
|
|
44789
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44789
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
44790
44790
|
},
|
|
44791
44791
|
{
|
|
44792
44792
|
"@id": "#221/source-map/lexical/element_0",
|
|
44793
44793
|
"sourcemaps:element": "amf://id#221",
|
|
44794
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44794
|
+
"sourcemaps:value": "[(1,0)-(6,0)]"
|
|
44795
44795
|
},
|
|
44796
44796
|
{
|
|
44797
44797
|
"@id": "#338/source-map/synthesized-field/element_1",
|
package/package.json
CHANGED
package/src/sdk/HttpWeb.ts
CHANGED
|
@@ -16,6 +16,9 @@ export class HttpWeb extends Http {
|
|
|
16
16
|
if (token) {
|
|
17
17
|
requestHeaders.append('Authorization', `Bearer ${token}`)
|
|
18
18
|
}
|
|
19
|
+
if (!requestHeaders.has('Accept')) {
|
|
20
|
+
requestHeaders.append('Accept', 'application/json')
|
|
21
|
+
}
|
|
19
22
|
const init: RequestInit = {
|
|
20
23
|
method,
|
|
21
24
|
headers: requestHeaders.toJSON(),
|
|
@@ -53,6 +56,9 @@ export class HttpWeb extends Http {
|
|
|
53
56
|
if (!requestHeaders.has('Content-Type')) {
|
|
54
57
|
requestHeaders.append('Content-Type', 'application/json')
|
|
55
58
|
}
|
|
59
|
+
if (!requestHeaders.has('Accept')) {
|
|
60
|
+
requestHeaders.append('Accept', 'application/json')
|
|
61
|
+
}
|
|
56
62
|
const init: RequestInit = {
|
|
57
63
|
method,
|
|
58
64
|
headers: requestHeaders.toJSON(),
|
|
@@ -401,6 +401,46 @@ export class OrganizationsSdk extends SdkBase {
|
|
|
401
401
|
return data
|
|
402
402
|
},
|
|
403
403
|
|
|
404
|
+
/**
|
|
405
|
+
* Reads user objects in the organization by their keys.
|
|
406
|
+
* Note that the API returns only the users that are part of the organization.
|
|
407
|
+
* If a user is not part of the organization, it will not be ignored. It is up to the caller to handle this case.
|
|
408
|
+
* @param oid The key of the organization parent organization.
|
|
409
|
+
* @param eys A list of user keys to read.
|
|
410
|
+
* @param request Optional request options.
|
|
411
|
+
* @returns The created user object.
|
|
412
|
+
*/
|
|
413
|
+
readBatch: async (oid: string, keys: string[], request: SdkOptions = {}): Promise<ContextListResult<IUser>> => {
|
|
414
|
+
const { token } = request
|
|
415
|
+
const url = this.sdk.getUrl(RouteBuilder.organizationUserBatch(oid))
|
|
416
|
+
const body = {
|
|
417
|
+
ids: keys,
|
|
418
|
+
}
|
|
419
|
+
const result = await this.sdk.http.post(url.toString(), {
|
|
420
|
+
body: JSON.stringify(body),
|
|
421
|
+
token,
|
|
422
|
+
})
|
|
423
|
+
this.inspectCommonStatusCodes(result)
|
|
424
|
+
const E_PREFIX = 'Unable to read the user batch info. '
|
|
425
|
+
if (result.status !== 200) {
|
|
426
|
+
this.logInvalidResponse(result)
|
|
427
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
428
|
+
}
|
|
429
|
+
if (!result.body) {
|
|
430
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
431
|
+
}
|
|
432
|
+
let data: ContextListResult<IUser>
|
|
433
|
+
try {
|
|
434
|
+
data = JSON.parse(result.body)
|
|
435
|
+
} catch {
|
|
436
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
437
|
+
}
|
|
438
|
+
if (!Array.isArray(data.items)) {
|
|
439
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
440
|
+
}
|
|
441
|
+
return data
|
|
442
|
+
},
|
|
443
|
+
|
|
404
444
|
/**
|
|
405
445
|
* Activates a user in the organization.
|
|
406
446
|
* If the user is already active the API will respond with an error.
|
package/src/sdk/RouteBuilder.ts
CHANGED
|
@@ -27,10 +27,10 @@ export class RouteBuilder {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* @returns The path to the /files/{oid}/batch route.
|
|
30
|
+
* @returns The path to the /files/{oid}/batch/read-meta route.
|
|
31
31
|
*/
|
|
32
32
|
static filesBatch(oid: string): string {
|
|
33
|
-
return `${RouteBuilder.files(oid)}/batch`
|
|
33
|
+
return `${RouteBuilder.files(oid)}/batch/read-meta`
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -166,6 +166,10 @@ export class RouteBuilder {
|
|
|
166
166
|
return `${this.organization(oid)}/users`
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
static organizationUserBatch(oid: string): string {
|
|
170
|
+
return `${this.organization(oid)}/users/batch/read`
|
|
171
|
+
}
|
|
172
|
+
|
|
169
173
|
static organizationUser(oid: string, key: string): string {
|
|
170
174
|
return `${this.organization(oid)}/users/${key}`
|
|
171
175
|
}
|