contentful-management 12.3.2 → 12.4.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.
@@ -2922,6 +2922,9 @@ var Snapshot = /*#__PURE__*/Object.freeze({
2922
2922
  const get$c = (http, params) => get$14(http, `/spaces/${params.spaceId}`);
2923
2923
  const getMany$b = (http, params) => get$14(http, `/spaces`, {
2924
2924
  params: params.query,
2925
+ headers: params.organizationId
2926
+ ? { 'X-Contentful-Organization': params.organizationId }
2927
+ : undefined,
2925
2928
  });
2926
2929
  const getManyForOrganization$5 = (http, params) => get$14(http, `/organizations/${params.organizationId}/spaces`, {
2927
2930
  params: params.query,
@@ -10845,6 +10848,7 @@ function wrapSpace(makeRequest, data) {
10845
10848
  * @internal
10846
10849
  */
10847
10850
  const wrapSpaceCollection = wrapCollection(wrapSpace);
10851
+ const wrapSpaceCursorPaginatedCollection = wrapCursorPaginatedCollection(wrapSpace);
10848
10852
 
10849
10853
  /**
10850
10854
  * @internal
@@ -13360,12 +13364,20 @@ function createClientApi(makeRequest) {
13360
13364
  * .catch(console.error)
13361
13365
  * ```
13362
13366
  */
13363
- getSpaces: function getSpaces(query = {}) {
13367
+ getSpaces: function getSpaces(query = {}, organizationId) {
13368
+ const { cursor, ...rest } = query;
13369
+ const normalizedQuery = cursor
13370
+ ? normalizeCursorPaginationParameters(rest)
13371
+ : rest;
13364
13372
  return makeRequest({
13365
13373
  entityType: 'Space',
13366
13374
  action: 'getMany',
13367
- params: { query: contentfulSdkCore.createRequestConfig({ query: query }).params },
13368
- }).then((data) => wrapSpaceCollection(makeRequest, data));
13375
+ params: { query: contentfulSdkCore.createRequestConfig({ query: normalizedQuery }).params, organizationId },
13376
+ }).then((data) =>
13377
+ // makeRequest returns the union type; cursor determines which branch is present at runtime so the casts are required
13378
+ cursor
13379
+ ? wrapSpaceCursorPaginatedCollection(makeRequest, normalizeCursorPaginationResponse(data))
13380
+ : wrapSpaceCollection(makeRequest, data));
13369
13381
  },
13370
13382
  /**
13371
13383
  * Gets a space