@gitbook/api 0.1.0 → 0.2.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.
package/dist/client.d.ts CHANGED
@@ -429,6 +429,9 @@ export declare enum ChangeRequestStatus {
429
429
  Archived = "archived",
430
430
  Merged = "merged"
431
431
  }
432
+ /**
433
+ * Permission of a user in a content.
434
+ */
432
435
  export interface UserContentPermission {
433
436
  /**
434
437
  * "The role of a member in an organization.
@@ -443,6 +446,23 @@ export interface UserContentPermission {
443
446
  permission: MemberRole;
444
447
  user: User;
445
448
  }
449
+ /**
450
+ * Permission of a member in a content.
451
+ */
452
+ export interface MemberContentPermission {
453
+ /**
454
+ * "The role of a member in an organization.
455
+ * "admin": Can administrate the content: create, delete spaces, ...
456
+ * "create": Can create content.
457
+ * "review": Can review content.
458
+ * "edit": Can edit the content (live or change requests).
459
+ * "comment": Can access the content and its discussions.
460
+ * "read": Can access the content, but cannot update it in any way.
461
+ *
462
+ */
463
+ permission: MemberRole;
464
+ space: Space;
465
+ }
446
466
  /**
447
467
  * Search result representing a space.
448
468
  */
@@ -1561,7 +1581,6 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1561
1581
  */
1562
1582
  askQuery: (query: {
1563
1583
  query: string;
1564
- mode?: 'fast' | 'precise';
1565
1584
  }, params?: RequestParams) => Promise<HttpResponse<{
1566
1585
  answer?: SearchAIAnswer;
1567
1586
  }, Error>>;
@@ -1641,7 +1660,6 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
1641
1660
  */
1642
1661
  askQueryInSpace: (spaceId: string, query: {
1643
1662
  query: string;
1644
- mode?: 'fast' | 'precise';
1645
1663
  }, params?: RequestParams) => Promise<HttpResponse<{
1646
1664
  answer?: SearchAIAnswer;
1647
1665
  }, Error>>;
@@ -2191,6 +2209,21 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
2191
2209
  * @secure
2192
2210
  */
2193
2211
  setUserAsSsoMemberForOrganization: (organizationId: string, userId: string, params?: RequestParams) => Promise<HttpResponse<void, Error>>;
2212
+ /**
2213
+ * No description
2214
+ *
2215
+ * @tags permissions, spaces
2216
+ * @name ListSpacesForOrganizationMember
2217
+ * @summary List permissions accross all spaces for a member of an organization
2218
+ * @request GET:/orgs/{organizationId}/members/{userId}/spaces
2219
+ * @secure
2220
+ */
2221
+ listSpacesForOrganizationMember: (organizationId: string, userId: string, query?: {
2222
+ page?: string;
2223
+ limit?: number;
2224
+ }, params?: RequestParams) => Promise<HttpResponse<List & {
2225
+ items: MemberContentPermission[];
2226
+ }, Error>>;
2194
2227
  /**
2195
2228
  * @description Lists teams for the specified organization.
2196
2229
  *
@@ -2203,6 +2236,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
2203
2236
  listTeamsInOrganizationById: (organizationId: string, query?: {
2204
2237
  page?: string;
2205
2238
  limit?: number;
2239
+ title?: string;
2206
2240
  }, params?: RequestParams) => Promise<HttpResponse<List & {
2207
2241
  items: OrganizationTeam[];
2208
2242
  }, Error>>;
@@ -2239,7 +2273,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
2239
2273
  * @secure
2240
2274
  */
2241
2275
  updateTeamInOrganizationById: (organizationId: string, teamId: string, data: {
2242
- title?: string;
2276
+ title: string;
2243
2277
  }, params?: RequestParams) => Promise<HttpResponse<OrganizationTeam, Error>>;
2244
2278
  /**
2245
2279
  * @description Deletes a specific team in an organization
package/dist/index.js CHANGED
@@ -785,6 +785,14 @@ var Api = class extends HttpClient {
785
785
  secure: true,
786
786
  ...params
787
787
  }),
788
+ listSpacesForOrganizationMember: (organizationId, userId, query, params = {}) => this.request({
789
+ path: `/orgs/${organizationId}/members/${userId}/spaces`,
790
+ method: "GET",
791
+ query,
792
+ secure: true,
793
+ format: "json",
794
+ ...params
795
+ }),
788
796
  listTeamsInOrganizationById: (organizationId, query, params = {}) => this.request({
789
797
  path: `/orgs/${organizationId}/teams`,
790
798
  method: "GET",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gitbook/api",
3
3
  "type": "module",
4
4
  "main": "./src/index.ts",
5
- "version": "0.1.0",
5
+ "version": "0.2.0",
6
6
  "sideEffects": false,
7
7
  "files": [
8
8
  "spec/**",
package/spec/openapi.json CHANGED
@@ -1426,6 +1426,7 @@
1426
1426
  },
1427
1427
  "UserContentPermission": {
1428
1428
  "type": "object",
1429
+ "description": "Permission of a user in a content.",
1429
1430
  "properties": {
1430
1431
  "permission": {
1431
1432
  "$ref": "#/components/schemas/MemberRole"
@@ -1439,6 +1440,22 @@
1439
1440
  "user"
1440
1441
  ]
1441
1442
  },
1443
+ "MemberContentPermission": {
1444
+ "type": "object",
1445
+ "description": "Permission of a member in a content.",
1446
+ "properties": {
1447
+ "permission": {
1448
+ "$ref": "#/components/schemas/MemberRole"
1449
+ },
1450
+ "space": {
1451
+ "$ref": "#/components/schemas/Space"
1452
+ }
1453
+ },
1454
+ "required": [
1455
+ "permission",
1456
+ "space"
1457
+ ]
1458
+ },
1442
1459
  "SearchSpaceResult": {
1443
1460
  "type": "object",
1444
1461
  "description": "Search result representing a space.",
@@ -4796,17 +4813,6 @@
4796
4813
  "schema": {
4797
4814
  "type": "string"
4798
4815
  }
4799
- },
4800
- {
4801
- "name": "mode",
4802
- "in": "query",
4803
- "schema": {
4804
- "type": "string",
4805
- "enum": [
4806
- "fast",
4807
- "precise"
4808
- ]
4809
- }
4810
4816
  }
4811
4817
  ],
4812
4818
  "responses": {
@@ -5062,17 +5068,6 @@
5062
5068
  "type": "string"
5063
5069
  }
5064
5070
  },
5065
- {
5066
- "name": "mode",
5067
- "in": "query",
5068
- "schema": {
5069
- "type": "string",
5070
- "enum": [
5071
- "fast",
5072
- "precise"
5073
- ]
5074
- }
5075
- },
5076
5071
  {
5077
5072
  "$ref": "#/components/parameters/spaceId"
5078
5073
  }
@@ -7134,6 +7129,68 @@
7134
7129
  }
7135
7130
  }
7136
7131
  },
7132
+ "/orgs/{organizationId}/members/{userId}/spaces": {
7133
+ "get": {
7134
+ "operationId": "listSpacesForOrganizationMember",
7135
+ "summary": "List permissions accross all spaces for a member of an organization",
7136
+ "tags": [
7137
+ "permissions",
7138
+ "spaces"
7139
+ ],
7140
+ "security": [
7141
+ {
7142
+ "user": []
7143
+ }
7144
+ ],
7145
+ "parameters": [
7146
+ {
7147
+ "$ref": "#/components/parameters/organizationId"
7148
+ },
7149
+ {
7150
+ "$ref": "#/components/parameters/userId"
7151
+ },
7152
+ {
7153
+ "$ref": "#/components/parameters/listPage"
7154
+ },
7155
+ {
7156
+ "$ref": "#/components/parameters/listLimit"
7157
+ }
7158
+ ],
7159
+ "responses": {
7160
+ "200": {
7161
+ "description": "Listing of spaces that can be accessed by the user in the organization.",
7162
+ "content": {
7163
+ "application/json": {
7164
+ "schema": {
7165
+ "allOf": [
7166
+ {
7167
+ "$ref": "#/components/schemas/List"
7168
+ },
7169
+ {
7170
+ "type": "object",
7171
+ "required": [
7172
+ "items"
7173
+ ],
7174
+ "properties": {
7175
+ "items": {
7176
+ "type": "array",
7177
+ "items": {
7178
+ "$ref": "#/components/schemas/MemberContentPermission"
7179
+ }
7180
+ }
7181
+ }
7182
+ }
7183
+ ]
7184
+ }
7185
+ }
7186
+ }
7187
+ },
7188
+ "default": {
7189
+ "$ref": "#/components/responses/UnexpectedError"
7190
+ }
7191
+ }
7192
+ }
7193
+ },
7137
7194
  "/orgs/{organizationId}/teams": {
7138
7195
  "get": {
7139
7196
  "operationId": "listTeamsInOrganizationById",
@@ -7156,6 +7213,14 @@
7156
7213
  },
7157
7214
  {
7158
7215
  "$ref": "#/components/parameters/listLimit"
7216
+ },
7217
+ {
7218
+ "in": "query",
7219
+ "name": "title",
7220
+ "description": "If provided, only teams whose name contains the given parameter will be returned. Case insensitive.",
7221
+ "schema": {
7222
+ "type": "string"
7223
+ }
7159
7224
  }
7160
7225
  ],
7161
7226
  "responses": {
@@ -7333,7 +7398,10 @@
7333
7398
  "title": {
7334
7399
  "type": "string"
7335
7400
  }
7336
- }
7401
+ },
7402
+ "required": [
7403
+ "title"
7404
+ ]
7337
7405
  }
7338
7406
  }
7339
7407
  }
package/spec/openapi.yaml CHANGED
@@ -1006,6 +1006,7 @@ components:
1006
1006
  - merged
1007
1007
  UserContentPermission:
1008
1008
  type: object
1009
+ description: Permission of a user in a content.
1009
1010
  properties:
1010
1011
  permission:
1011
1012
  $ref: "#/components/schemas/MemberRole"
@@ -1014,6 +1015,17 @@ components:
1014
1015
  required:
1015
1016
  - permission
1016
1017
  - user
1018
+ MemberContentPermission:
1019
+ type: object
1020
+ description: Permission of a member in a content.
1021
+ properties:
1022
+ permission:
1023
+ $ref: "#/components/schemas/MemberRole"
1024
+ space:
1025
+ $ref: "#/components/schemas/Space"
1026
+ required:
1027
+ - permission
1028
+ - space
1017
1029
  SearchSpaceResult:
1018
1030
  type: object
1019
1031
  description: Search result representing a space.
@@ -3219,13 +3231,6 @@ paths:
3219
3231
  required: true
3220
3232
  schema:
3221
3233
  type: string
3222
- - name: mode
3223
- in: query
3224
- schema:
3225
- type: string
3226
- enum:
3227
- - fast
3228
- - precise
3229
3234
  responses:
3230
3235
  "200":
3231
3236
  description: OK
@@ -3371,13 +3376,6 @@ paths:
3371
3376
  required: true
3372
3377
  schema:
3373
3378
  type: string
3374
- - name: mode
3375
- in: query
3376
- schema:
3377
- type: string
3378
- enum:
3379
- - fast
3380
- - precise
3381
3379
  - $ref: "#/components/parameters/spaceId"
3382
3380
  responses:
3383
3381
  "200":
@@ -4504,6 +4502,38 @@ paths:
4504
4502
  description: The user has been added as an SSO member of the organization.
4505
4503
  default:
4506
4504
  $ref: "#/components/responses/UnexpectedError"
4505
+ "/orgs/{organizationId}/members/{userId}/spaces":
4506
+ get:
4507
+ operationId: listSpacesForOrganizationMember
4508
+ summary: List permissions accross all spaces for a member of an organization
4509
+ tags:
4510
+ - permissions
4511
+ - spaces
4512
+ security:
4513
+ - user: []
4514
+ parameters:
4515
+ - $ref: "#/components/parameters/organizationId"
4516
+ - $ref: "#/components/parameters/userId"
4517
+ - $ref: "#/components/parameters/listPage"
4518
+ - $ref: "#/components/parameters/listLimit"
4519
+ responses:
4520
+ "200":
4521
+ description: Listing of spaces that can be accessed by the user in the organization.
4522
+ content:
4523
+ application/json:
4524
+ schema:
4525
+ allOf:
4526
+ - $ref: "#/components/schemas/List"
4527
+ - type: object
4528
+ required:
4529
+ - items
4530
+ properties:
4531
+ items:
4532
+ type: array
4533
+ items:
4534
+ $ref: "#/components/schemas/MemberContentPermission"
4535
+ default:
4536
+ $ref: "#/components/responses/UnexpectedError"
4507
4537
  "/orgs/{organizationId}/teams":
4508
4538
  get:
4509
4539
  operationId: listTeamsInOrganizationById
@@ -4518,6 +4548,11 @@ paths:
4518
4548
  - $ref: "#/components/parameters/organizationId"
4519
4549
  - $ref: "#/components/parameters/listPage"
4520
4550
  - $ref: "#/components/parameters/listLimit"
4551
+ - in: query
4552
+ name: title
4553
+ description: If provided, only teams whose name contains the given parameter will be returned. Case insensitive.
4554
+ schema:
4555
+ type: string
4521
4556
  responses:
4522
4557
  "200":
4523
4558
  description: OK
@@ -4624,6 +4659,8 @@ paths:
4624
4659
  properties:
4625
4660
  title:
4626
4661
  type: string
4662
+ required:
4663
+ - title
4627
4664
  delete:
4628
4665
  operationId: removeTeamFromOrganizationById
4629
4666
  summary: Delete a team in an organization