@gitbook/api 0.19.0 → 0.20.1

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/dist/index.cjs CHANGED
@@ -367,6 +367,7 @@ var ContentType = /* @__PURE__ */ ((ContentType2) => {
367
367
  ContentType2["Json"] = "application/json";
368
368
  ContentType2["FormData"] = "multipart/form-data";
369
369
  ContentType2["UrlEncoded"] = "application/x-www-form-urlencoded";
370
+ ContentType2["Text"] = "text/plain";
370
371
  return ContentType2;
371
372
  })(ContentType || {});
372
373
  var HttpClient = class {
@@ -386,6 +387,7 @@ var HttpClient = class {
386
387
  };
387
388
  this.contentFormatters = {
388
389
  ["application/json" /* Json */]: (input) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
390
+ ["text/plain" /* Text */]: (input) => input !== null && typeof input !== "string" ? JSON.stringify(input) : input,
389
391
  ["multipart/form-data" /* FormData */]: (input) => Object.keys(input || {}).reduce((formData, key) => {
390
392
  const property = input[key];
391
393
  formData.append(
@@ -436,10 +438,10 @@ var HttpClient = class {
436
438
  {
437
439
  ...requestParams,
438
440
  headers: {
439
- ...type && type !== "multipart/form-data" /* FormData */ ? { "Content-Type": type } : {},
440
- ...requestParams.headers || {}
441
+ ...requestParams.headers || {},
442
+ ...type && type !== "multipart/form-data" /* FormData */ ? { "Content-Type": type } : {}
441
443
  },
442
- signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
444
+ signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null,
443
445
  body: typeof body === "undefined" || body === null ? null : payloadFormatter(body)
444
446
  }
445
447
  ).then(async (response) => {
@@ -450,18 +452,15 @@ var HttpClient = class {
450
452
  if (r.ok) {
451
453
  r.data = data2;
452
454
  } else {
453
- r.error = data2;
455
+ throw new Error(`${response.status} ${response.statusText}`);
454
456
  }
455
457
  return r;
456
- }).catch((e) => {
457
- r.error = e;
458
- return r;
459
458
  });
460
459
  if (cancelToken) {
461
460
  this.abortControllers.delete(cancelToken);
462
461
  }
463
462
  if (!response.ok)
464
- throw data;
463
+ throw new Error(`${response.status} ${response.statusText}`);
465
464
  return data;
466
465
  });
467
466
  };
@@ -1151,15 +1150,13 @@ var Api = class extends HttpClient {
1151
1150
  format: "json",
1152
1151
  ...params
1153
1152
  }),
1154
- listSpaceIntegrationsBlocks: (spaceId, params = {}) => this.request(
1155
- {
1156
- path: `/spaces/${spaceId}/integration-blocks`,
1157
- method: "GET",
1158
- secure: true,
1159
- format: "json",
1160
- ...params
1161
- }
1162
- ),
1153
+ listSpaceIntegrationsBlocks: (spaceId, params = {}) => this.request({
1154
+ path: `/spaces/${spaceId}/integration-blocks`,
1155
+ method: "GET",
1156
+ secure: true,
1157
+ format: "json",
1158
+ ...params
1159
+ }),
1163
1160
  getSpaceCustomFields: (spaceId, params = {}) => this.request({
1164
1161
  path: `/spaces/${spaceId}/custom-fields`,
1165
1162
  method: "GET",
@@ -1174,15 +1171,6 @@ var Api = class extends HttpClient {
1174
1171
  secure: true,
1175
1172
  type: "application/json" /* Json */,
1176
1173
  ...params
1177
- }),
1178
- generateDrawing: (spaceId, data, params = {}) => this.request({
1179
- path: `/spaces/${spaceId}/drawings`,
1180
- method: "POST",
1181
- body: data,
1182
- secure: true,
1183
- type: "application/json" /* Json */,
1184
- format: "json",
1185
- ...params
1186
1174
  })
1187
1175
  };
1188
1176
  this.collections = {
@@ -1512,16 +1500,14 @@ var Api = class extends HttpClient {
1512
1500
  format: "json",
1513
1501
  ...params
1514
1502
  }),
1515
- listTeamsForOrganizationMember: (organizationId, userId, query, params = {}) => this.request(
1516
- {
1517
- path: `/orgs/${organizationId}/members/${userId}/teams`,
1518
- method: "GET",
1519
- query,
1520
- secure: true,
1521
- format: "json",
1522
- ...params
1523
- }
1524
- ),
1503
+ listTeamsForOrganizationMember: (organizationId, userId, query, params = {}) => this.request({
1504
+ path: `/orgs/${organizationId}/members/${userId}/teams`,
1505
+ method: "GET",
1506
+ query,
1507
+ secure: true,
1508
+ format: "json",
1509
+ ...params
1510
+ }),
1525
1511
  listTeamsInOrganizationById: (organizationId, query, params = {}) => this.request({
1526
1512
  path: `/orgs/${organizationId}/teams`,
1527
1513
  method: "GET",
@@ -1774,6 +1760,21 @@ var Api = class extends HttpClient {
1774
1760
  format: "json",
1775
1761
  ...params
1776
1762
  }),
1763
+ listOrgExperimentalFeatures: (organizationId, params = {}) => this.request({
1764
+ path: `/orgs/${organizationId}/experiments`,
1765
+ method: "GET",
1766
+ secure: true,
1767
+ format: "json",
1768
+ ...params
1769
+ }),
1770
+ updateOrgExperimentalFeatures: (organizationId, data, params = {}) => this.request({
1771
+ path: `/orgs/${organizationId}/experiments`,
1772
+ method: "POST",
1773
+ body: data,
1774
+ secure: true,
1775
+ type: "application/json" /* Json */,
1776
+ ...params
1777
+ }),
1777
1778
  listEntitySchemas: (organizationId, query, params = {}) => this.request({
1778
1779
  path: `/orgs/${organizationId}/schemas`,
1779
1780
  method: "GET",
package/dist/index.js CHANGED
@@ -299,6 +299,7 @@ var ContentType = /* @__PURE__ */ ((ContentType2) => {
299
299
  ContentType2["Json"] = "application/json";
300
300
  ContentType2["FormData"] = "multipart/form-data";
301
301
  ContentType2["UrlEncoded"] = "application/x-www-form-urlencoded";
302
+ ContentType2["Text"] = "text/plain";
302
303
  return ContentType2;
303
304
  })(ContentType || {});
304
305
  var HttpClient = class {
@@ -318,6 +319,7 @@ var HttpClient = class {
318
319
  };
319
320
  this.contentFormatters = {
320
321
  ["application/json" /* Json */]: (input) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
322
+ ["text/plain" /* Text */]: (input) => input !== null && typeof input !== "string" ? JSON.stringify(input) : input,
321
323
  ["multipart/form-data" /* FormData */]: (input) => Object.keys(input || {}).reduce((formData, key) => {
322
324
  const property = input[key];
323
325
  formData.append(
@@ -368,10 +370,10 @@ var HttpClient = class {
368
370
  {
369
371
  ...requestParams,
370
372
  headers: {
371
- ...type && type !== "multipart/form-data" /* FormData */ ? { "Content-Type": type } : {},
372
- ...requestParams.headers || {}
373
+ ...requestParams.headers || {},
374
+ ...type && type !== "multipart/form-data" /* FormData */ ? { "Content-Type": type } : {}
373
375
  },
374
- signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
376
+ signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null,
375
377
  body: typeof body === "undefined" || body === null ? null : payloadFormatter(body)
376
378
  }
377
379
  ).then(async (response) => {
@@ -382,18 +384,15 @@ var HttpClient = class {
382
384
  if (r.ok) {
383
385
  r.data = data2;
384
386
  } else {
385
- r.error = data2;
387
+ throw new Error(`${response.status} ${response.statusText}`);
386
388
  }
387
389
  return r;
388
- }).catch((e) => {
389
- r.error = e;
390
- return r;
391
390
  });
392
391
  if (cancelToken) {
393
392
  this.abortControllers.delete(cancelToken);
394
393
  }
395
394
  if (!response.ok)
396
- throw data;
395
+ throw new Error(`${response.status} ${response.statusText}`);
397
396
  return data;
398
397
  });
399
398
  };
@@ -1083,15 +1082,13 @@ var Api = class extends HttpClient {
1083
1082
  format: "json",
1084
1083
  ...params
1085
1084
  }),
1086
- listSpaceIntegrationsBlocks: (spaceId, params = {}) => this.request(
1087
- {
1088
- path: `/spaces/${spaceId}/integration-blocks`,
1089
- method: "GET",
1090
- secure: true,
1091
- format: "json",
1092
- ...params
1093
- }
1094
- ),
1085
+ listSpaceIntegrationsBlocks: (spaceId, params = {}) => this.request({
1086
+ path: `/spaces/${spaceId}/integration-blocks`,
1087
+ method: "GET",
1088
+ secure: true,
1089
+ format: "json",
1090
+ ...params
1091
+ }),
1095
1092
  getSpaceCustomFields: (spaceId, params = {}) => this.request({
1096
1093
  path: `/spaces/${spaceId}/custom-fields`,
1097
1094
  method: "GET",
@@ -1106,15 +1103,6 @@ var Api = class extends HttpClient {
1106
1103
  secure: true,
1107
1104
  type: "application/json" /* Json */,
1108
1105
  ...params
1109
- }),
1110
- generateDrawing: (spaceId, data, params = {}) => this.request({
1111
- path: `/spaces/${spaceId}/drawings`,
1112
- method: "POST",
1113
- body: data,
1114
- secure: true,
1115
- type: "application/json" /* Json */,
1116
- format: "json",
1117
- ...params
1118
1106
  })
1119
1107
  };
1120
1108
  this.collections = {
@@ -1444,16 +1432,14 @@ var Api = class extends HttpClient {
1444
1432
  format: "json",
1445
1433
  ...params
1446
1434
  }),
1447
- listTeamsForOrganizationMember: (organizationId, userId, query, params = {}) => this.request(
1448
- {
1449
- path: `/orgs/${organizationId}/members/${userId}/teams`,
1450
- method: "GET",
1451
- query,
1452
- secure: true,
1453
- format: "json",
1454
- ...params
1455
- }
1456
- ),
1435
+ listTeamsForOrganizationMember: (organizationId, userId, query, params = {}) => this.request({
1436
+ path: `/orgs/${organizationId}/members/${userId}/teams`,
1437
+ method: "GET",
1438
+ query,
1439
+ secure: true,
1440
+ format: "json",
1441
+ ...params
1442
+ }),
1457
1443
  listTeamsInOrganizationById: (organizationId, query, params = {}) => this.request({
1458
1444
  path: `/orgs/${organizationId}/teams`,
1459
1445
  method: "GET",
@@ -1706,6 +1692,21 @@ var Api = class extends HttpClient {
1706
1692
  format: "json",
1707
1693
  ...params
1708
1694
  }),
1695
+ listOrgExperimentalFeatures: (organizationId, params = {}) => this.request({
1696
+ path: `/orgs/${organizationId}/experiments`,
1697
+ method: "GET",
1698
+ secure: true,
1699
+ format: "json",
1700
+ ...params
1701
+ }),
1702
+ updateOrgExperimentalFeatures: (organizationId, data, params = {}) => this.request({
1703
+ path: `/orgs/${organizationId}/experiments`,
1704
+ method: "POST",
1705
+ body: data,
1706
+ secure: true,
1707
+ type: "application/json" /* Json */,
1708
+ ...params
1709
+ }),
1709
1710
  listEntitySchemas: (organizationId, query, params = {}) => this.request({
1710
1711
  path: `/orgs/${organizationId}/schemas`,
1711
1712
  method: "GET",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
- "version": "0.19.0",
7
+ "version": "0.20.1",
8
8
  "sideEffects": false,
9
9
  "files": [
10
10
  "README.md",
@@ -12,7 +12,7 @@
12
12
  "dist/**"
13
13
  ],
14
14
  "dependencies": {
15
- "swagger-typescript-api": "^9.3.1"
15
+ "swagger-typescript-api": "^13.0.3"
16
16
  },
17
17
  "devDependencies": {
18
18
  "swagger-cli": "^4.0.4",
package/spec/openapi.json CHANGED
@@ -106,12 +106,14 @@
106
106
  "commentStatus": {
107
107
  "name": "status",
108
108
  "in": "query",
109
- "description": "When provided, only comments with the given status are returned. Only \"all\" is supported for now.",
109
+ "description": "When provided, only comments with the given status are returned. Defaults to \"all\".",
110
110
  "schema": {
111
111
  "type": "string",
112
112
  "default": "all",
113
113
  "enum": [
114
- "all"
114
+ "all",
115
+ "open",
116
+ "resolved"
115
117
  ]
116
118
  }
117
119
  },
@@ -1216,7 +1218,10 @@
1216
1218
  "preview": {
1217
1219
  "type": "string"
1218
1220
  }
1219
- }
1221
+ },
1222
+ "required": [
1223
+ "id"
1224
+ ]
1220
1225
  },
1221
1226
  "changeRequest": {
1222
1227
  "description": "The change request containing this comment, if the comment was made inside a change request.",
@@ -1453,16 +1458,6 @@
1453
1458
  }
1454
1459
  ]
1455
1460
  },
1456
- "GeneratedDrawing": {
1457
- "type": "object",
1458
- "description": "Drawing generated from a prompt",
1459
- "properties": {
1460
- "mermaid": {
1461
- "description": "Mermaid diagram generated",
1462
- "type": "string"
1463
- }
1464
- }
1465
- },
1466
1461
  "Document": {
1467
1462
  "oneOf": [
1468
1463
  {
@@ -5533,6 +5528,37 @@
5533
5528
  "education"
5534
5529
  ]
5535
5530
  },
5531
+ "OrganizationExperimentalFeature": {
5532
+ "type": "object",
5533
+ "properties": {
5534
+ "id": {
5535
+ "type": "string"
5536
+ },
5537
+ "title": {
5538
+ "type": "string"
5539
+ },
5540
+ "description": {
5541
+ "type": "string"
5542
+ },
5543
+ "enabled": {
5544
+ "type": "boolean"
5545
+ },
5546
+ "stage": {
5547
+ "type": "string",
5548
+ "enum": [
5549
+ "alpha",
5550
+ "beta"
5551
+ ]
5552
+ }
5553
+ },
5554
+ "required": [
5555
+ "id",
5556
+ "title",
5557
+ "description",
5558
+ "enabled",
5559
+ "stage"
5560
+ ]
5561
+ },
5536
5562
  "MemberRole": {
5537
5563
  "type": "string",
5538
5564
  "description": "\"The role of a member in an organization.\n\"admin\": Can administrate the content: create, delete spaces, ...\n\"create\": Can create content.\n\"review\": Can review content.\n\"edit\": Can edit the content (live or change requests).\n\"comment\": Can access the content and its discussions.\n\"read\": Can access the content, but cannot update it in any way.\n",
@@ -11230,6 +11256,24 @@
11230
11256
  {
11231
11257
  "$ref": "#/components/schemas/OrganizationInstallationsChannel"
11232
11258
  },
11259
+ {
11260
+ "type": "object",
11261
+ "properties": {
11262
+ "channel": {
11263
+ "type": "string",
11264
+ "enum": [
11265
+ "organization-experimental-features"
11266
+ ]
11267
+ },
11268
+ "organization": {
11269
+ "type": "string"
11270
+ }
11271
+ },
11272
+ "required": [
11273
+ "channel",
11274
+ "organization"
11275
+ ]
11276
+ },
11233
11277
  {
11234
11278
  "type": "object",
11235
11279
  "properties": {
@@ -14601,7 +14645,7 @@
14601
14645
  }
14602
14646
  ],
14603
14647
  "responses": {
14604
- "200": {
14648
+ "205": {
14605
14649
  "description": "The comment has been deleted."
14606
14650
  },
14607
14651
  "default": {
@@ -14898,7 +14942,7 @@
14898
14942
  }
14899
14943
  ],
14900
14944
  "responses": {
14901
- "200": {
14945
+ "205": {
14902
14946
  "description": "The comment has been deleted."
14903
14947
  },
14904
14948
  "default": {
@@ -15824,7 +15868,7 @@
15824
15868
  }
15825
15869
  ],
15826
15870
  "responses": {
15827
- "200": {
15871
+ "205": {
15828
15872
  "description": "The comment has been deleted."
15829
15873
  },
15830
15874
  "default": {
@@ -16100,7 +16144,7 @@
16100
16144
  }
16101
16145
  ],
16102
16146
  "responses": {
16103
- "200": {
16147
+ "205": {
16104
16148
  "description": "The comment has been deleted."
16105
16149
  },
16106
16150
  "default": {
@@ -16441,63 +16485,6 @@
16441
16485
  }
16442
16486
  }
16443
16487
  },
16444
- "/spaces/{spaceId}/drawings": {
16445
- "post": {
16446
- "operationId": "generateDrawing",
16447
- "summary": "Generate a drawing from text.",
16448
- "tags": [
16449
- "spaces"
16450
- ],
16451
- "security": [
16452
- {
16453
- "user-internal": []
16454
- }
16455
- ],
16456
- "parameters": [
16457
- {
16458
- "$ref": "#/components/parameters/spaceId"
16459
- }
16460
- ],
16461
- "requestBody": {
16462
- "required": true,
16463
- "content": {
16464
- "application/json": {
16465
- "schema": {
16466
- "type": "object",
16467
- "properties": {
16468
- "text": {
16469
- "type": "string",
16470
- "description": "Instruction to describe the drawing."
16471
- },
16472
- "context": {
16473
- "type": "string",
16474
- "description": "Text context to provide for the generation."
16475
- }
16476
- },
16477
- "required": [
16478
- "text"
16479
- ]
16480
- }
16481
- }
16482
- }
16483
- },
16484
- "responses": {
16485
- "200": {
16486
- "description": "Generated drawing",
16487
- "content": {
16488
- "application/json": {
16489
- "schema": {
16490
- "$ref": "#/components/schemas/GeneratedDrawing"
16491
- }
16492
- }
16493
- }
16494
- },
16495
- "default": {
16496
- "$ref": "#/components/responses/UnexpectedError"
16497
- }
16498
- }
16499
- }
16500
- },
16501
16488
  "/collections/{collectionId}": {
16502
16489
  "get": {
16503
16490
  "operationId": "getCollectionById",
@@ -20271,6 +20258,81 @@
20271
20258
  }
20272
20259
  }
20273
20260
  },
20261
+ "/orgs/{organizationId}/experiments": {
20262
+ "get": {
20263
+ "operationId": "listOrgExperimentalFeatures",
20264
+ "summary": "List experiemental features for the given organization.",
20265
+ "tags": [
20266
+ "organizations"
20267
+ ],
20268
+ "security": [
20269
+ {
20270
+ "user": []
20271
+ }
20272
+ ],
20273
+ "parameters": [
20274
+ {
20275
+ "$ref": "#/components/parameters/organizationId"
20276
+ }
20277
+ ],
20278
+ "responses": {
20279
+ "200": {
20280
+ "description": "OK",
20281
+ "content": {
20282
+ "application/json": {
20283
+ "schema": {
20284
+ "type": "array",
20285
+ "items": {
20286
+ "$ref": "#/components/schemas/OrganizationExperimentalFeature"
20287
+ }
20288
+ }
20289
+ }
20290
+ }
20291
+ },
20292
+ "default": {
20293
+ "$ref": "#/components/responses/UnexpectedError"
20294
+ }
20295
+ }
20296
+ },
20297
+ "post": {
20298
+ "operationId": "updateOrgExperimentalFeatures",
20299
+ "summary": "Toggle on or off experimental features.",
20300
+ "tags": [
20301
+ "organizations"
20302
+ ],
20303
+ "security": [
20304
+ {
20305
+ "user": []
20306
+ }
20307
+ ],
20308
+ "parameters": [
20309
+ {
20310
+ "$ref": "#/components/parameters/organizationId"
20311
+ }
20312
+ ],
20313
+ "requestBody": {
20314
+ "required": true,
20315
+ "content": {
20316
+ "application/json": {
20317
+ "schema": {
20318
+ "type": "object",
20319
+ "additionalProperties": {
20320
+ "type": "boolean"
20321
+ }
20322
+ }
20323
+ }
20324
+ }
20325
+ },
20326
+ "responses": {
20327
+ "204": {
20328
+ "description": "OK"
20329
+ },
20330
+ "default": {
20331
+ "$ref": "#/components/responses/UnexpectedError"
20332
+ }
20333
+ }
20334
+ }
20335
+ },
20274
20336
  "/orgs/{organizationId}/schemas": {
20275
20337
  "get": {
20276
20338
  "operationId": "listEntitySchemas",