@inweb/client 25.9.3 → 25.9.5

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.
@@ -1,11 +1,11 @@
1
1
  import { IHttpClient } from "./IHttpClient";
2
2
  import { IAssociatedFileData, IAssemblyVersionInfo, IModelTransformMatrix } from "./IAssembly";
3
- import { IShortUserDescription } from "./IUser";
3
+ import { IShortUserDesc } from "./IUser";
4
4
  import { Model } from "./Model";
5
5
  import { ClashTest } from "./ClashTest";
6
6
  /**
7
- * Provides properties and methods for obtaining information about an assembly on the server
8
- * and managing its data.
7
+ * Provides properties and methods for obtaining information about an assembly on the Open
8
+ * Cloud Server and managing its data.
9
9
  */
10
10
  export declare class Assembly {
11
11
  private _data;
@@ -14,7 +14,7 @@ export declare class Assembly {
14
14
  path: string;
15
15
  /**
16
16
  * @param data - Raw assembly data received from the server.
17
- * @param httpClient - HTTP client instance used to send REST API requests to the server.
17
+ * @param httpClient - HTTP client instance used to send requests to the REST API server..
18
18
  */
19
19
  constructor(data: any, httpClient: IHttpClient);
20
20
  appendVersionParam(relativePath: string): string;
@@ -72,17 +72,9 @@ export declare class Assembly {
72
72
  /**
73
73
  * Assembly owner information.
74
74
  *
75
- * @property {string} userId - User ID.
76
- * @property {string} userName - User name.
77
- * @property {string} name - First name.
78
- * @property {string} lastName - Last name.
79
- * @property {string} fullName - Full name.
80
- * @property {string} initials - Initials.
81
- * @property {string} email - User email.
82
- * @property {string} avatarUrl - User avatar image URL.
83
75
  * @readonly
84
76
  */
85
- get owner(): IShortUserDescription;
77
+ get owner(): IShortUserDesc;
86
78
  get previewUrl(): string;
87
79
  /**
88
80
  * List of assembly related job IDs.
@@ -1,5 +1,5 @@
1
1
  import { IHttpClient } from "./IHttpClient";
2
- import { IShortUserDescription } from "./IUser";
2
+ import { IShortUserDesc } from "./IUser";
3
3
  /**
4
4
  * Provides properties and methods for obtaining information about a file/assembly clash detection test.
5
5
  */
@@ -10,7 +10,7 @@ export declare class ClashTest {
10
10
  /**
11
11
  * @param data - Raw test data received from the server.
12
12
  * @param basePath - The clash test API base path of the file/assembly that owns the test.
13
- * @param httpClient - HTTP client instance used to send REST API requests to the server.
13
+ * @param httpClient - HTTP client instance used to send requests to the REST API server.
14
14
  */
15
15
  constructor(data: any, basePath: string, httpClient: IHttpClient);
16
16
  protected internalGet(relativePath: string): Promise<Response>;
@@ -62,17 +62,9 @@ export declare class ClashTest {
62
62
  /**
63
63
  * Test owner information.
64
64
  *
65
- * @property {string} userId - User ID.
66
- * @property {string} userName - User name.
67
- * @property {string} name - First name.
68
- * @property {string} lastName - Last name.
69
- * @property {string} fullName - Full name.
70
- * @property {string} initials - Initials.
71
- * @property {string} email - User email.
72
- * @property {string} avatarUrl - User avatar image URL.
73
65
  * @readonly
74
66
  */
75
- get owner(): IShortUserDescription;
67
+ get owner(): IShortUserDesc;
76
68
  /**
77
69
  * First selection set for clash detection. Objects from `selectionSetA` will be tested
78
70
  * against each others by objects from the `selectionSetB` during the test.
@@ -7,7 +7,8 @@ import { Job } from "./Job";
7
7
  import { Project } from "./Project";
8
8
  import { User } from "./User";
9
9
  /**
10
- * Provides methods for managing server resources such as users, files, assemblies, jobs, projects, etc.
10
+ * Provides methods for managing Open Cloud Server resources such as users, files, assemblies,
11
+ * jobs, projects, etc.
11
12
  */
12
13
  export declare class Client extends EventEmitter2<ClientEventMap> {
13
14
  private _serverUrl;
@@ -24,13 +25,13 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
24
25
  url?: string;
25
26
  });
26
27
  /**
27
- * Open Cloud Server REST API base URL. Use {@link configure | configure()} to change server URL.
28
+ * Open Cloud REST API server base URL. Use {@link configure | configure()} to change server URL.
28
29
  *
29
30
  * @readonly
30
31
  */
31
32
  get serverUrl(): string;
32
33
  /**
33
- * HTTP client instance used to send REST API requests and receive responses from the server.
34
+ * HTTP client instance used to send requests to the REST API server.
34
35
  *
35
36
  * @readonly
36
37
  */
@@ -6,8 +6,14 @@ export declare function error400(text: string, _default?: string): string;
6
6
  * occurs, access denied, or object not found.
7
7
  */
8
8
  export declare class FetchError extends Error {
9
- protected status: number;
10
- protected statusText: string;
9
+ /**
10
+ * {@link https://developer.mozilla.org/docs/Web/HTTP/Status | HTTP status code} of the response.
11
+ */
12
+ status: number;
13
+ /**
14
+ * Status message corresponding to the {@link status | status code}.
15
+ */
16
+ statusText: string;
11
17
  /**
12
18
  * @property status - The
13
19
  * {@link https://developer.mozilla.org/docs/Web/HTTP/Status | HTTP status code} of the response.
package/lib/Api/File.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { IHttpClient } from "./IHttpClient";
2
- import { IFileStatus, IFileReferences, IFileVersionInfo } from "./IFile";
3
- import { IShortUserDescription } from "./IUser";
2
+ import { IFileStatus, IFileReferences, IFileVersionInfo, IGrantedTo } from "./IFile";
3
+ import { IShortUserDesc } from "./IUser";
4
4
  import { Model } from "./Model";
5
5
  import { Permission } from "./Permission";
6
6
  import { Job } from "./Job";
7
7
  /**
8
- * Provides properties and methods for obtaining information about a file on the server and
9
- * managing its data and versions.
8
+ * Provides properties and methods for obtaining information about a file on the Open Cloud
9
+ * Server and managing its data and versions.
10
10
  */
11
11
  export declare class File {
12
12
  private _data;
@@ -15,7 +15,7 @@ export declare class File {
15
15
  path: string;
16
16
  /**
17
17
  * @param data - Raw file data received from the server.
18
- * @param httpClient - HTTP client instance used to send REST API requests to the server.
18
+ * @param httpClient - HTTP client instance used to send requests to the REST API server.
19
19
  */
20
20
  constructor(data: any, httpClient: IHttpClient);
21
21
  private appendVersionParam;
@@ -99,17 +99,9 @@ export declare class File {
99
99
  /**
100
100
  * File owner information.
101
101
  *
102
- * @property {string} userId - User ID.
103
- * @property {string} userName - User name.
104
- * @property {string} name - First name.
105
- * @property {string} lastName - Last name.
106
- * @property {string} fullName - Full name.
107
- * @property {string} initials - Initials.
108
- * @property {string} email - User email.
109
- * @property {string} avatarUrl - User avatar image URL.
110
102
  * @readonly
111
103
  */
112
- get owner(): IShortUserDescription;
104
+ get owner(): IShortUserDesc;
113
105
  /**
114
106
  * File preview image URL or empty string if the file does not have a preview. Use
115
107
  * {@link setPreview | setPreview()} to change preview image.
@@ -161,17 +153,9 @@ export declare class File {
161
153
  /**
162
154
  * Information about the user who made the last update.
163
155
  *
164
- * @property {string} userId - User ID.
165
- * @property {string} userName - User name.
166
- * @property {string} name - First name.
167
- * @property {string} lastName - Last name.
168
- * @property {string} fullName - Full name.
169
- * @property {string} initials - Initials.
170
- * @property {string} email - User email.
171
- * @property {string} avatarUrl - User avatar image URL.
172
156
  * @readonly
173
157
  */
174
- get updatedBy(): IShortUserDescription;
158
+ get updatedBy(): IShortUserDesc;
175
159
  /**
176
160
  * Zero-based file version number for version files. The original file has version `0`.
177
161
  */
@@ -482,7 +466,17 @@ export declare class File {
482
466
  */
483
467
  getPermission(permissionId: string): Promise<Permission>;
484
468
  /**
485
- * Creates a new file permission.
469
+ * Creates a new file permission for a user, project, or group.
470
+ *
471
+ * @example <caption>Grant the specified user permission to "update" the file.</caption>
472
+ * const action = "update";
473
+ * const grantedTo = [{ user: { id: myUser.id, email: myUser.email } }];
474
+ * await file.createPermission(action, grantedTo);
475
+ *
476
+ * @example <caption>Add a file to the specified project in `read-only` mode.</caption>
477
+ * const actions = ["read", "readSourceFile"];
478
+ * const grantedTo = [{ project: { id: myProject.id, name: myProject.name } }];
479
+ * await file.createPermission(actions, grantedTo);
486
480
  *
487
481
  * @param actions - Actions are allowed to be performed on a file with this permission:
488
482
  *
@@ -492,10 +486,10 @@ export declare class File {
492
486
  * - `readViewpoint` - The ability to read file viewpoints.
493
487
  * - `createViewpoint` - The ability to create file viewpoints.
494
488
  *
495
- * @param grantedTo - A list of principials that will get access to the file.
489
+ * @param grantedTo - A list of entities that will get access to the file.
496
490
  * @param _public - Specifies whether all users have access to the file or not.
497
491
  */
498
- createPermission(actions: string | string[], grantedTo: any[], _public: boolean): Promise<Permission>;
492
+ createPermission(actions: string | string[], grantedTo: IGrantedTo[], _public: boolean): Promise<Permission>;
499
493
  /**
500
494
  * Removes the specified permission from the file.
501
495
  *
@@ -11,7 +11,7 @@ export declare class HttpClient implements IHttpClient {
11
11
  delete(relativePath: string): Promise<Response>;
12
12
  uploadFile(relativePath: string, file: File, onProgress?: (progress: number) => void): Promise<XMLHttpRequest>;
13
13
  downloadFile(relativePath: string, onProgress?: (progress: number, chunk: Uint8Array) => void, signal?: AbortSignal): Promise<Response>;
14
- downloadFileRange(relativePath: string, requestId: number, ranges: Array<{
14
+ downloadFileRange(relativePath: string, reserved: number, ranges: Array<{
15
15
  begin: number;
16
16
  end: number;
17
17
  requestId: number;
@@ -1,12 +1,36 @@
1
+ /**
2
+ * Defines the data status.
3
+ */
1
4
  export interface IFileDataStatus {
5
+ /**
6
+ * Data state. Can be `none`, `waiting`, `inprogress`, `done` or `failed`.
7
+ */
2
8
  state: string;
9
+ /**
10
+ * Unique ID of the data job.
11
+ */
3
12
  jobId?: string;
4
13
  jobUrl?: string;
5
14
  }
15
+ /**
16
+ * Defines the file status.
17
+ */
6
18
  export interface IFileStatus {
19
+ /**
20
+ * Status of geometry data of `vsfx` type.
21
+ */
7
22
  geometry: IFileDataStatus;
23
+ /**
24
+ * Status of geometry data of `gltf` type.
25
+ */
8
26
  geometryGltf: IFileDataStatus;
27
+ /**
28
+ * Status of the properties.
29
+ */
9
30
  properties: IFileDataStatus;
31
+ /**
32
+ * Status of the validation.
33
+ */
10
34
  validation: IFileDataStatus;
11
35
  }
12
36
  /**
@@ -43,3 +67,51 @@ export interface IFileVersionInfo {
43
67
  size: number;
44
68
  ownerId: string;
45
69
  }
70
+ /**
71
+ * Defines the entity, that will have access to the {@link File | file}.
72
+ */
73
+ export interface IGrantedTo {
74
+ /**
75
+ * The user that has access to the file.
76
+ */
77
+ user?: {
78
+ /**
79
+ * User ID.
80
+ */
81
+ id: string;
82
+ /**
83
+ * User email.
84
+ */
85
+ email: string;
86
+ };
87
+ /**
88
+ * The project that has access to the file.
89
+ */
90
+ project?: {
91
+ /**
92
+ * Project ID.
93
+ */
94
+ id: string;
95
+ /**
96
+ * Project name.
97
+ */
98
+ name: string;
99
+ };
100
+ /**
101
+ * The group that has access to the file.
102
+ */
103
+ group?: {
104
+ /**
105
+ * Project ID.
106
+ */
107
+ projectId: string;
108
+ /**
109
+ * Group ID.
110
+ */
111
+ groupId: string;
112
+ /**
113
+ * Group name.
114
+ */
115
+ name: string;
116
+ };
117
+ }
@@ -1,15 +1,96 @@
1
+ /**
2
+ * Defines the HTTP client used to send requests to the REST API server.
3
+ */
1
4
  export interface IHttpClient {
5
+ /**
6
+ * REST API server base URL.
7
+ */
2
8
  serverUrl: string;
9
+ /**
10
+ * Request HTTP headers. You can add specific headers after user log in.
11
+ *
12
+ * The following headers are added automatically:
13
+ *
14
+ * - `Authorization`- Added after user log in.
15
+ * - `Content-Type` - Added before sending `POST` and `PUT` request according the request body.
16
+ */
3
17
  headers: HeadersInit;
18
+ /**
19
+ * Current logged in user ID.
20
+ */
4
21
  signInUserId: string;
22
+ /**
23
+ * `True` if the current logged in user is and administrator.
24
+ */
5
25
  signInUserIsAdmin: boolean;
26
+ /**
27
+ * Sends the GET request to the specified endpoint.
28
+ *
29
+ * @param relativePath - Endpoint relative path.
30
+ * @param signal - An
31
+ * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
32
+ * signal, which can be used to abort waiting as desired.
33
+ */
6
34
  get(relativePath: string, signal?: AbortSignal): Promise<Response>;
35
+ /**
36
+ * Sends the POST request to the specified endpoint.
37
+ *
38
+ * @param relativePath - Endpoint relative path.
39
+ * @param body - Request body. Can be
40
+ * {@link https://developer.mozilla.org/docs/Web/API/FormData | FormData},
41
+ * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
42
+ * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob}, JSON object or plain text.
43
+ */
7
44
  post(relativePath: string, body?: BodyInit | object): Promise<Response>;
45
+ /**
46
+ * Sends the PUT request to the specified endpoint.
47
+ *
48
+ * @param relativePath - Endpoint relative path.
49
+ * @param body - Request body. Can be
50
+ * {@link https://developer.mozilla.org/docs/Web/API/FormData | FormData},
51
+ * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
52
+ * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob}, JSON object or plain text.
53
+ */
8
54
  put(relativePath: string, body?: BodyInit | object): Promise<Response>;
55
+ /**
56
+ * Sends the DELETE request to the specified endpoint.
57
+ *
58
+ * @param relativePath - Endpoint relative path.
59
+ */
9
60
  delete(relativePath: string): Promise<Response>;
61
+ /**
62
+ * Upload a file to the server.
63
+ *
64
+ * @param relativePath - File relative path.
65
+ * @param file - {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object
66
+ * are generally retrieved from a
67
+ * {@link https://developer.mozilla.org/docs/Web/API/FileList | FileList} object returned as
68
+ * a result of a user selecting files using the HTML `<input>` element.
69
+ * @param onProgress - Upload progress callback.
70
+ */
10
71
  uploadFile(relativePath: string, file: globalThis.File, onProgress?: (progress: number) => void): Promise<XMLHttpRequest>;
72
+ /**
73
+ * Downloads the specified file from the server.
74
+ *
75
+ * @param relativePath - File relative path.
76
+ * @param onProgress - Download progress callback.
77
+ * @param signal - An
78
+ * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
79
+ * signal. Allows to communicate with a fetch request and abort it if desired.
80
+ */
11
81
  downloadFile(relativePath: string, onProgress?: (progress: number, chunk: Uint8Array) => void, signal?: AbortSignal): Promise<Response>;
12
- downloadFileRange(relativePath: string, requestId: number, ranges: Array<{
82
+ /**
83
+ * Downloads a part of file from the server.
84
+ *
85
+ * @param relativePath - File relative path.
86
+ * @param reserved - Reserved, do not use.
87
+ * @param ranges - A range of resource file contents to download.
88
+ * @param onProgress - Download progress callback.
89
+ * @param signal - An
90
+ * {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
91
+ * signal. Allows to communicate with a fetch request and abort it if desired.
92
+ */
93
+ downloadFileRange(relativePath: string, reserved: number, ranges: Array<{
13
94
  begin: number;
14
95
  end: number;
15
96
  requestId: number;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Defines the {@link Role | role} actions are allowed to be performed.
3
+ */
4
+ export interface IRoleActions {
5
+ /**
6
+ * Defines what actions are allowed to be performed at the project level. The available
7
+ * actions include:
8
+ *
9
+ * - `update` - The ability to update the project details.
10
+ * - `createTopic` - The ability to create a new topic.
11
+ * - `createDocument` - The ability to create a new document.
12
+ */
13
+ projectActions?: string[];
14
+ /**
15
+ * Defines what actions are allowed to be performed at the topic level. The available actions include:
16
+ *
17
+ * - `update` - The ability to update the topic.
18
+ * - `updateBimSnippet` - The ability to update the BIM snippet for topics.
19
+ * - `updateRelatedTopics` - The ability to update the collection of related topics.
20
+ * - `updateDocumentReferences` - The ability to update the collection of document references.
21
+ * - `updateFiles` - The ability to update the file header.
22
+ * - `createComment` - The ability to create a comment.
23
+ * - `createViewpoint` - The ability to create a new viewpoint.
24
+ */
25
+ topicActions?: string[];
26
+ /**
27
+ * Defines what actions are allowed to be performed at the comment level. The available
28
+ * actions include:
29
+ *
30
+ * - `update` - The ability to update the comment.
31
+ * - `delete` - The ability to delete the comment.
32
+ */
33
+ commentActions?: string[];
34
+ /**
35
+ * Defines what actions are allowed to be performed at the viewpoint level. The available
36
+ * actions include:
37
+ *
38
+ * - `update` - The ability to update the viewpoint.
39
+ * - `delete` - The ability to delete the viewpoint.
40
+ */
41
+ viewpointActions?: string[];
42
+ /**
43
+ * Defines what actions are allowed to be performed at the groups level. The available actions include:
44
+ *
45
+ * - `create` - The ability to create the group.
46
+ * - `update` - The ability to update the group.
47
+ * - `updateUser` - The ability to add users to the group.
48
+ * - `delete` - The ability to delete the group.
49
+ */
50
+ odaGroupActions?: string[];
51
+ /**
52
+ * Defines what actions are allowed to be performed at the roles level. The available actions include:
53
+ *
54
+ * - `create` - The ability to create the role.
55
+ * - `update` - The ability to update the role.
56
+ * - `delete` - The ability to delete the role.
57
+ */
58
+ odaRoleActions?: string[];
59
+ }
@@ -1,10 +1,39 @@
1
- export interface IShortUserDescription {
1
+ /**
2
+ * Defines brief user information.
3
+ */
4
+ export interface IShortUserDesc {
5
+ /**
6
+ * Unique user ID.
7
+ */
2
8
  userId: string;
9
+ /**
10
+ * User name.
11
+ */
3
12
  userName: string;
13
+ /**
14
+ * First name.
15
+ */
4
16
  name: string;
17
+ /**
18
+ * Last name.
19
+ */
5
20
  lastName: string;
21
+ /**
22
+ * User email.
23
+ */
6
24
  email: string;
25
+ /**
26
+ * User avatar image URL or empty string if the user does not have an avatar.
27
+ */
7
28
  avatarUrl?: string;
29
+ /**
30
+ * User full name. Contains the user's first and last name. If first name and last names are
31
+ * empty, contains the user name.
32
+ */
8
33
  fullName?: string;
34
+ /**
35
+ * User initials. Contains a first letters of the user's first and last names. If first name
36
+ * and last names are empty, contains the first letter of the user name.
37
+ */
9
38
  initials?: string;
10
39
  }
package/lib/Api/Job.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { IHttpClient } from "./IHttpClient";
2
2
  /**
3
- * Provides properties and methods for obtaining information about a job on the server.
3
+ * Provides properties and methods for obtaining information about a job on the Open Cloud Server.
4
4
  */
5
5
  export declare class Job {
6
6
  private _data;
7
7
  httpClient: IHttpClient;
8
8
  /**
9
9
  * @param data - Raw job data received from the server.
10
- * @param httpClient - HTTP client instance used to send REST API requests to the server.
10
+ * @param httpClient - HTTP client instance used to send requests to the REST API server.
11
11
  */
12
12
  constructor(data: any, httpClient: IHttpClient);
13
13
  protected internalGet(): Promise<Response>;
@@ -1,5 +1,5 @@
1
1
  import { IHttpClient } from "./IHttpClient";
2
- import { IShortUserDescription } from "./IUser";
2
+ import { IShortUserDesc } from "./IUser";
3
3
  /**
4
4
  * Provides properties and methods for obtaining information about a {@link User | user} who has
5
5
  * access to the {@link Project | project}.
@@ -11,7 +11,7 @@ export declare class Member {
11
11
  /**
12
12
  * @param data - Raw member data received from the server.
13
13
  * @param projectId - Owner project ID.
14
- * @param httpClient - HTTP client instance used to send REST API requests to the server.
14
+ * @param httpClient - HTTP client instance used to send requests to the REST API server.
15
15
  */
16
16
  constructor(data: any, projectId: string, httpClient: IHttpClient);
17
17
  private internalGet;
@@ -31,7 +31,8 @@ export declare class Member {
31
31
  */
32
32
  get id(): string;
33
33
  /**
34
- * Member role. See {@link Project.getRoles | Project.getRoles()} for more details.
34
+ * Member role name in the project. See {@link Project.getRoles | Project.getRoles()} for list
35
+ * of project roles.
35
36
  */
36
37
  get role(): string;
37
38
  set role(value: string);
@@ -44,17 +45,9 @@ export declare class Member {
44
45
  /**
45
46
  * User information.
46
47
  *
47
- * @property {string} userId - User ID.
48
- * @property {string} userName - User name.
49
- * @property {string} name - First name.
50
- * @property {string} lastName - Last name.
51
- * @property {string} fullName - Full name.
52
- * @property {string} initials - Initials.
53
- * @property {string} email - User email.
54
- * @property {string} avatarUrl - User avatar image URL.
55
48
  * @readonly
56
49
  */
57
- get user(): IShortUserDescription;
50
+ get user(): IShortUserDesc;
58
51
  /**
59
52
  * Reloads member data from the server.
60
53
  */
@@ -1,4 +1,5 @@
1
1
  import { IHttpClient } from "./IHttpClient";
2
+ import { IGrantedTo } from "./IFile";
2
3
  /**
3
4
  * Provides properties and methods for obtaining information about {@link File | file} actions
4
5
  * granted to a specific {@link User | users}, or project {@link Member | member}.
@@ -10,7 +11,7 @@ export declare class Permission {
10
11
  /**
11
12
  * @param data - Raw permission data received from the server.
12
13
  * @param fileId - Owner file ID.
13
- * @param httpClient - HTTP client instance used to send REST API requests to the server.
14
+ * @param httpClient - HTTP client instance used to send requests to the REST API server.
14
15
  */
15
16
  constructor(data: any, fileId: string, httpClient: IHttpClient);
16
17
  private internalGet;
@@ -41,22 +42,10 @@ export declare class Permission {
41
42
  */
42
43
  get id(): string;
43
44
  /**
44
- * Principials are any entity that can be authenticated by the server, such as a any user or
45
- * project that will get access to the file.
46
- *
47
- * @typedef {any} Principial
48
- * @property {any} user - The user entry that get access to the file.
49
- * @property {string} user.id - User ID.
50
- * @property {string} user.name - User name.
51
- * @property {any} project - The project entry that get access to the file.
52
- * @property {string} project.id - Project ID.
53
- * @property {string} project.name - Project name.
54
- */
55
- /**
56
- * A list of principials that will get access to the file.
45
+ * A list of entities that will get access to the file.
57
46
  */
58
- get grantedTo(): any[];
59
- set grantedTo(value: any[]);
47
+ get grantedTo(): IGrantedTo[];
48
+ set grantedTo(value: IGrantedTo[]);
60
49
  /**
61
50
  * Specifies whether all users have access to the file or not.
62
51
  */
@@ -69,6 +58,17 @@ export declare class Permission {
69
58
  /**
70
59
  * Updates permission data on the server.
71
60
  *
61
+ * @example <caption>Update file permissions for the the specified project.</caption>
62
+ * const myFile = client.getFile(myFileId);
63
+ * const permissions = await myFile.getPermissions();
64
+ * const projectPermissions = permissions.filter((permission) =>
65
+ * permission.grantedTo.some((x) => x.project?.id === myProjectId)
66
+ * );
67
+ * const newActions = ["read", "readSourceFile", "update"];
68
+ * await Promise.allSettled(
69
+ * projectPermissions.map((permission) => permission.update({ newActions }))
70
+ * );
71
+ *
72
72
  * @param data - Raw permission data.
73
73
  */
74
74
  update(data: any): Promise<this>;