@api-client/core 0.13.0 → 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.
@@ -41722,10 +41722,13 @@
41722
41722
  "@id": "#209"
41723
41723
  },
41724
41724
  {
41725
+ "@id": "#191"
41726
+ },
41727
+ {
41725
41728
  "@id": "#194"
41726
41729
  },
41727
41730
  {
41728
- "@id": "#191"
41731
+ "@id": "#203"
41729
41732
  },
41730
41733
  {
41731
41734
  "@id": "#197"
@@ -41734,9 +41737,6 @@
41734
41737
  "@id": "#200"
41735
41738
  },
41736
41739
  {
41737
- "@id": "#203"
41738
- },
41739
- {
41740
41740
  "@id": "#206"
41741
41741
  },
41742
41742
  {
@@ -42470,16 +42470,16 @@
42470
42470
  "@id": "#219"
42471
42471
  },
42472
42472
  {
42473
- "@id": "#219"
42473
+ "@id": "#210"
42474
42474
  },
42475
42475
  {
42476
42476
  "@id": "#213"
42477
42477
  },
42478
42478
  {
42479
- "@id": "#210"
42479
+ "@id": "#216"
42480
42480
  },
42481
42481
  {
42482
- "@id": "#216"
42482
+ "@id": "#219"
42483
42483
  }
42484
42484
  ],
42485
42485
  "doc:root": false,
@@ -43096,7 +43096,7 @@
43096
43096
  "doc:ExternalDomainElement",
43097
43097
  "doc:DomainElement"
43098
43098
  ],
43099
- "doc:raw": "addressType: 'REGISTERED-OFFICE-ADDRESS'\nstreetName: 'UITBREIDINGSTRAAT'\nhouseNumber: '84'\nhouseNumberAddition: '/1'\npostalCode: '2600'\ncity: 'BERCHEM (ANTWERPEN)'\ncountry: 'Belgium'\ncountryCode: 'BE'\nfullFormatedAddress: \"UITBREIDINGSTRAAT 84 /1, 2600 BERCHEM (ANTWERPEN), BELIUM\"\n",
43099
+ "doc:raw": "countryCode: \"BE\"\ngraydonEnterpriseId: 1057155523\nregistrationId: \"0422319093\"\nvatNumber: \"BE0422319093\"\ngraydonCompanyId: \"0422319093\"\nisBranchOffice: false\n",
43100
43100
  "core:mediaType": "application/yaml",
43101
43101
  "sourcemaps:sources": [
43102
43102
  {
@@ -43117,7 +43117,7 @@
43117
43117
  "doc:ExternalDomainElement",
43118
43118
  "doc:DomainElement"
43119
43119
  ],
43120
- "doc:raw": "countryCode: \"BE\"\ngraydonEnterpriseId: 1057155523\nregistrationId: \"0422319093\"\nvatNumber: \"BE0422319093\"\ngraydonCompanyId: \"0422319093\"\nisBranchOffice: false\n",
43120
+ "doc:raw": "addressType: 'REGISTERED-OFFICE-ADDRESS'\nstreetName: 'UITBREIDINGSTRAAT'\nhouseNumber: '84'\nhouseNumberAddition: '/1'\npostalCode: '2600'\ncity: 'BERCHEM (ANTWERPEN)'\ncountry: 'Belgium'\ncountryCode: 'BE'\nfullFormatedAddress: \"UITBREIDINGSTRAAT 84 /1, 2600 BERCHEM (ANTWERPEN), BELIUM\"\n",
43121
43121
  "core:mediaType": "application/yaml",
43122
43122
  "sourcemaps:sources": [
43123
43123
  {
@@ -43138,7 +43138,7 @@
43138
43138
  "doc:ExternalDomainElement",
43139
43139
  "doc:DomainElement"
43140
43140
  ],
43141
- "doc:raw": "code: '5'\ndescription: 'Limited company'\n",
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": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
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: 'J'\ndescription: 'Information and communication'\n",
43183
+ "doc:raw": "code: '5'\ndescription: 'Limited company'\n",
43184
43184
  "core:mediaType": "application/yaml",
43185
43185
  "sourcemaps:sources": [
43186
43186
  {
@@ -43892,7 +43892,7 @@
43892
43892
  "doc:ExternalDomainElement",
43893
43893
  "doc:DomainElement"
43894
43894
  ],
43895
- "doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
43895
+ "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '22'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)22 000000'\n",
43896
43896
  "core:mediaType": "application/yaml",
43897
43897
  "sourcemaps:sources": [
43898
43898
  {
@@ -43934,7 +43934,7 @@
43934
43934
  "doc:ExternalDomainElement",
43935
43935
  "doc:DomainElement"
43936
43936
  ],
43937
- "doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
43937
+ "doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@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: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '22'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)22 000000'\n",
43958
+ "doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
43959
43959
  "core:mediaType": "application/yaml",
43960
43960
  "sourcemaps:sources": [
43961
43961
  {
@@ -44416,22 +44416,22 @@
44416
44416
  {
44417
44417
  "@id": "#193/source-map/lexical/element_0",
44418
44418
  "sourcemaps:element": "amf://id#193",
44419
- "sourcemaps:value": "[(1,0)-(10,0)]"
44419
+ "sourcemaps:value": "[(1,0)-(7,0)]"
44420
44420
  },
44421
44421
  {
44422
44422
  "@id": "#196/source-map/lexical/element_0",
44423
44423
  "sourcemaps:element": "amf://id#196",
44424
- "sourcemaps:value": "[(1,0)-(7,0)]"
44424
+ "sourcemaps:value": "[(1,0)-(10,0)]"
44425
44425
  },
44426
44426
  {
44427
44427
  "@id": "#199/source-map/lexical/element_0",
44428
44428
  "sourcemaps:element": "amf://id#199",
44429
- "sourcemaps:value": "[(1,0)-(3,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)-(5,0)]"
44434
+ "sourcemaps:value": "[(1,0)-(3,0)]"
44435
44435
  },
44436
44436
  {
44437
44437
  "@id": "#205/source-map/lexical/element_0",
@@ -44776,7 +44776,7 @@
44776
44776
  {
44777
44777
  "@id": "#212/source-map/lexical/element_0",
44778
44778
  "sourcemaps:element": "amf://id#212",
44779
- "sourcemaps:value": "[(1,0)-(7,0)]"
44779
+ "sourcemaps:value": "[(1,0)-(6,0)]"
44780
44780
  },
44781
44781
  {
44782
44782
  "@id": "#215/source-map/lexical/element_0",
@@ -44786,12 +44786,12 @@
44786
44786
  {
44787
44787
  "@id": "#218/source-map/lexical/element_0",
44788
44788
  "sourcemaps:element": "amf://id#218",
44789
- "sourcemaps:value": "[(1,0)-(3,0)]"
44789
+ "sourcemaps:value": "[(1,0)-(7,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)-(6,0)]"
44794
+ "sourcemaps:value": "[(1,0)-(3,0)]"
44795
44795
  },
44796
44796
  {
44797
44797
  "@id": "#338/source-map/synthesized-field/element_1",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@api-client/core",
3
3
  "description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
4
- "version": "0.13.0",
4
+ "version": "0.13.2",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -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.
@@ -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
  }
@@ -8,7 +8,6 @@ import {
8
8
  } from './SdkBase.js'
9
9
  import { RouteBuilder } from './RouteBuilder.js'
10
10
  import { IFile } from '../models/store/File.js'
11
- import { ListFileKind } from './FilesSdk.js'
12
11
  import { ContextListOptions, ContextListResult } from '../events/BaseEvents.js'
13
12
  import { Exception } from '../exceptions/exception.js'
14
13
 
@@ -22,16 +21,12 @@ export class SharedSdk extends SdkBase {
22
21
  */
23
22
  async list(
24
23
  organization: string,
25
- kinds?: ListFileKind[],
26
24
  options?: ContextListOptions,
27
25
  request: SdkOptions = {}
28
26
  ): Promise<ContextListResult<IFile>> {
29
27
  const { token } = request
30
28
  const url = this.sdk.getUrl(RouteBuilder.shared(organization))
31
29
  this.sdk.appendListOptions(url, options)
32
- if (Array.isArray(kinds)) {
33
- kinds.forEach((k) => url.searchParams.append('kind', k))
34
- }
35
30
  const result = await this.sdk.http.get(url.toString(), { token })
36
31
  this.inspectCommonStatusCodes(result)
37
32
  const E_PREFIX = 'Unable to list organizations. '