@api-client/core 0.13.1 → 0.13.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/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 +8 -8
- 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
|
@@ -41728,13 +41728,13 @@
|
|
|
41728
41728
|
"@id": "#194"
|
|
41729
41729
|
},
|
|
41730
41730
|
{
|
|
41731
|
-
"@id": "#
|
|
41731
|
+
"@id": "#203"
|
|
41732
41732
|
},
|
|
41733
41733
|
{
|
|
41734
|
-
"@id": "#
|
|
41734
|
+
"@id": "#197"
|
|
41735
41735
|
},
|
|
41736
41736
|
{
|
|
41737
|
-
"@id": "#
|
|
41737
|
+
"@id": "#200"
|
|
41738
41738
|
},
|
|
41739
41739
|
{
|
|
41740
41740
|
"@id": "#206"
|
|
@@ -43138,7 +43138,7 @@
|
|
|
43138
43138
|
"doc:ExternalDomainElement",
|
|
43139
43139
|
"doc:DomainElement"
|
|
43140
43140
|
],
|
|
43141
|
-
"doc:raw": "
|
|
43141
|
+
"doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
|
|
43142
43142
|
"core:mediaType": "application/yaml",
|
|
43143
43143
|
"sourcemaps:sources": [
|
|
43144
43144
|
{
|
|
@@ -43159,7 +43159,7 @@
|
|
|
43159
43159
|
"doc:ExternalDomainElement",
|
|
43160
43160
|
"doc:DomainElement"
|
|
43161
43161
|
],
|
|
43162
|
-
"doc:raw": "
|
|
43162
|
+
"doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
|
|
43163
43163
|
"core:mediaType": "application/yaml",
|
|
43164
43164
|
"sourcemaps:sources": [
|
|
43165
43165
|
{
|
|
@@ -43180,7 +43180,7 @@
|
|
|
43180
43180
|
"doc:ExternalDomainElement",
|
|
43181
43181
|
"doc:DomainElement"
|
|
43182
43182
|
],
|
|
43183
|
-
"doc:raw": "code: '
|
|
43183
|
+
"doc:raw": "code: '5'\ndescription: 'Limited company'\n",
|
|
43184
43184
|
"core:mediaType": "application/yaml",
|
|
43185
43185
|
"sourcemaps:sources": [
|
|
43186
43186
|
{
|
|
@@ -44426,12 +44426,12 @@
|
|
|
44426
44426
|
{
|
|
44427
44427
|
"@id": "#199/source-map/lexical/element_0",
|
|
44428
44428
|
"sourcemaps:element": "amf://id#199",
|
|
44429
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44429
|
+
"sourcemaps:value": "[(1,0)-(5,0)]"
|
|
44430
44430
|
},
|
|
44431
44431
|
{
|
|
44432
44432
|
"@id": "#202/source-map/lexical/element_0",
|
|
44433
44433
|
"sourcemaps:element": "amf://id#202",
|
|
44434
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44434
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
44435
44435
|
},
|
|
44436
44436
|
{
|
|
44437
44437
|
"@id": "#205/source-map/lexical/element_0",
|
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)}/batch/read`
|
|
171
|
+
}
|
|
172
|
+
|
|
169
173
|
static organizationUser(oid: string, key: string): string {
|
|
170
174
|
return `${this.organization(oid)}/users/${key}`
|
|
171
175
|
}
|