@inweb/client 26.1.2 → 26.1.4
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.js +434 -449
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +35 -35
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Assembly.d.ts +65 -69
- package/lib/Api/ClashTest.d.ts +16 -16
- package/lib/Api/Client.d.ts +78 -77
- package/lib/Api/Endpoint.d.ts +6 -6
- package/lib/Api/FetchError.d.ts +5 -5
- package/lib/Api/File.d.ts +120 -132
- package/lib/Api/IHttpClient.d.ts +4 -3
- package/lib/Api/IRole.d.ts +6 -6
- package/lib/Api/ISharedLink.d.ts +1 -1
- package/lib/Api/IUser.d.ts +4 -4
- package/lib/Api/Job.d.ts +12 -12
- package/lib/Api/Member.d.ts +6 -6
- package/lib/Api/Model.d.ts +18 -18
- package/lib/Api/OAuthClient.d.ts +10 -10
- package/lib/Api/Permission.d.ts +17 -20
- package/lib/Api/Project.d.ts +14 -13
- package/lib/Api/Role.d.ts +2 -2
- package/lib/Api/SharedLink.d.ts +2 -2
- package/lib/Api/User.d.ts +33 -31
- package/package.json +2 -2
- package/src/Api/Assembly.ts +66 -70
- package/src/Api/ClashTest.ts +16 -16
- package/src/Api/Client.ts +78 -77
- package/src/Api/Endpoint.ts +6 -6
- package/src/Api/FetchError.ts +5 -5
- package/src/Api/File.ts +121 -133
- package/src/Api/IHttpClient.ts +4 -3
- package/src/Api/IRole.ts +6 -6
- package/src/Api/ISharedLink.ts +1 -1
- package/src/Api/IUser.ts +4 -4
- package/src/Api/Job.ts +12 -12
- package/src/Api/Member.ts +6 -6
- package/src/Api/Model.ts +18 -18
- package/src/Api/OAuthClient.ts +10 -10
- package/src/Api/Permission.ts +17 -20
- package/src/Api/Project.ts +14 -13
- package/src/Api/Role.ts +2 -2
- package/src/Api/SharedLink.ts +2 -2
- package/src/Api/User.ts +33 -31
package/src/Api/Model.ts
CHANGED
|
@@ -29,8 +29,8 @@ import type { IModelTransformMatrix } from "./IAssembly";
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Provides properties and methods for working with view of the {@link File | file} or
|
|
32
|
-
* {@link Assembly| assembly}. For example, for `dwg` it is a `Model` space or layout, and for
|
|
33
|
-
* it is a `3D` view.
|
|
32
|
+
* {@link Assembly| assembly}. For example, for `dwg` it is a `Model` space or layout, and for
|
|
33
|
+
* `rvt` files it is a `3D` view.
|
|
34
34
|
*/
|
|
35
35
|
export class Model extends Endpoint {
|
|
36
36
|
private _data: any;
|
|
@@ -69,8 +69,8 @@ export class Model extends Endpoint {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
* Scene description resource file name. Use {@link downloadResource | downloadResource()} to
|
|
73
|
-
* scene description file.
|
|
72
|
+
* Scene description resource file name. Use {@link downloadResource | downloadResource()} to
|
|
73
|
+
* download scene description file.
|
|
74
74
|
*
|
|
75
75
|
* @readonly
|
|
76
76
|
*/
|
|
@@ -106,8 +106,8 @@ export class Model extends Endpoint {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* The list of geometry data resource files. Use {@link downloadResource | downloadResource()}
|
|
110
|
-
* download geometry data files.
|
|
109
|
+
* The list of geometry data resource files. Use {@link downloadResource | downloadResource()}
|
|
110
|
+
* to download geometry data files.
|
|
111
111
|
*
|
|
112
112
|
* @readonly
|
|
113
113
|
*/
|
|
@@ -188,8 +188,8 @@ export class Model extends Endpoint {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
|
-
* Saves a new model owner file/assembly viewpoint to the server. To create a new viewpoint
|
|
192
|
-
* `Viewer.createViewpoint()`.
|
|
191
|
+
* Saves a new model owner file/assembly viewpoint to the server. To create a new viewpoint
|
|
192
|
+
* use `Viewer.createViewpoint()`.
|
|
193
193
|
*
|
|
194
194
|
* @param viewpoint - Viewpoint object.
|
|
195
195
|
*/
|
|
@@ -231,14 +231,14 @@ export class Model extends Endpoint {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
|
-
* Downloads a resource file. Resource files are files that contain model scene descriptions,
|
|
235
|
-
* geometry data.
|
|
234
|
+
* Downloads a resource file. Resource files are files that contain model scene descriptions,
|
|
235
|
+
* or geometry data.
|
|
236
236
|
*
|
|
237
237
|
* @param dataId - Resource file name.
|
|
238
238
|
* @param onProgress - Download progress callback.
|
|
239
239
|
* @param signal - An
|
|
240
|
-
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
|
|
241
|
-
* to communicate with a fetch request and abort it if desired.
|
|
240
|
+
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
|
|
241
|
+
* signal. Allows to communicate with a fetch request and abort it if desired.
|
|
242
242
|
*/
|
|
243
243
|
downloadResource(
|
|
244
244
|
dataId: string,
|
|
@@ -249,16 +249,16 @@ export class Model extends Endpoint {
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
/**
|
|
252
|
-
* Downloads a part of resource file. Resource files are files that contain model scene
|
|
253
|
-
* or geometry data.
|
|
252
|
+
* Downloads a part of resource file. Resource files are files that contain model scene
|
|
253
|
+
* descriptions, or geometry data.
|
|
254
254
|
*
|
|
255
255
|
* @param dataId - Resource file name.
|
|
256
256
|
* @param ranges - A range of resource file contents to download.
|
|
257
257
|
* @param requestId - Request ID for download progress callback.
|
|
258
258
|
* @param onProgress - Download progress callback.
|
|
259
259
|
* @param signal - An
|
|
260
|
-
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
|
|
261
|
-
* to communicate with a fetch request and abort it if desired.
|
|
260
|
+
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
|
|
261
|
+
* signal. Allows to communicate with a fetch request and abort it if desired.
|
|
262
262
|
*/
|
|
263
263
|
downloadResourceRange(
|
|
264
264
|
dataId: string,
|
|
@@ -324,8 +324,8 @@ export class Model extends Endpoint {
|
|
|
324
324
|
* References are images, fonts, or any other files to correct rendering of the file.
|
|
325
325
|
*
|
|
326
326
|
* @param signal - An
|
|
327
|
-
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
|
|
328
|
-
* can be used to abort waiting as desired.
|
|
327
|
+
* {@link https://developer.mozilla.org/docs/Web/API/AbortController | AbortController}
|
|
328
|
+
* signal, which can be used to abort waiting as desired.
|
|
329
329
|
*/
|
|
330
330
|
getReferences(signal?: AbortSignal): Promise<IFileReferences> {
|
|
331
331
|
return this._file.getReferences(signal);
|
package/src/Api/OAuthClient.ts
CHANGED
|
@@ -25,8 +25,8 @@ import { IHttpClient } from "./IHttpClient";
|
|
|
25
25
|
import { Endpoint } from "./Endpoint";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Provides properties and methods for obtaining information about a OAuth 2.0 client that have
|
|
29
|
-
* the Open Cloud Server API.
|
|
28
|
+
* Provides properties and methods for obtaining information about a OAuth 2.0 client that have
|
|
29
|
+
* access the Open Cloud Server API.
|
|
30
30
|
*/
|
|
31
31
|
export class OAuthClient extends Endpoint {
|
|
32
32
|
private _data: any;
|
|
@@ -148,8 +148,8 @@ export class OAuthClient extends Endpoint {
|
|
|
148
148
|
/**
|
|
149
149
|
* Updates client data on the server.
|
|
150
150
|
*
|
|
151
|
-
* Only administrators can update OAuth clients. If the current logged in user is not an
|
|
152
|
-
* an exception will be thrown.
|
|
151
|
+
* Only administrators can update OAuth clients. If the current logged in user is not an
|
|
152
|
+
* administrator, an exception will be thrown.
|
|
153
153
|
*
|
|
154
154
|
* @param data - Raw client data. For more information, see
|
|
155
155
|
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#OAuthClient | Open Cloud OAuth Clients API}.
|
|
@@ -163,8 +163,8 @@ export class OAuthClient extends Endpoint {
|
|
|
163
163
|
/**
|
|
164
164
|
* Deletes a client from the server.
|
|
165
165
|
*
|
|
166
|
-
* Only administrators can delete OAuth clients. If the current logged in user is not an
|
|
167
|
-
* an exception will be thrown.
|
|
166
|
+
* Only administrators can delete OAuth clients. If the current logged in user is not an
|
|
167
|
+
* administrator, an exception will be thrown.
|
|
168
168
|
*
|
|
169
169
|
* @returns Returns the raw data of a deleted client. For more information, see
|
|
170
170
|
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#OAuthClient | Open Cloud OAuth Clients API}.
|
|
@@ -174,11 +174,11 @@ export class OAuthClient extends Endpoint {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
|
-
* Saves client properties changes to the server. Call this method to update client data on
|
|
178
|
-
* after any property changes.
|
|
177
|
+
* Saves client properties changes to the server. Call this method to update client data on
|
|
178
|
+
* the server after any property changes.
|
|
179
179
|
*
|
|
180
|
-
* Only administrators can update OAuth clients. If the current logged in user is not an
|
|
181
|
-
* an exception will be thrown.
|
|
180
|
+
* Only administrators can update OAuth clients. If the current logged in user is not an
|
|
181
|
+
* administrator, an exception will be thrown.
|
|
182
182
|
*/
|
|
183
183
|
save(): Promise<this> {
|
|
184
184
|
return this.update(this.data);
|
package/src/Api/Permission.ts
CHANGED
|
@@ -26,8 +26,8 @@ import { Endpoint } from "./Endpoint";
|
|
|
26
26
|
import { IGrantedTo } from "./IFile";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Provides properties and methods for obtaining information about {@link File | file} actions
|
|
30
|
-
* a specific user, project, or group.
|
|
29
|
+
* Provides properties and methods for obtaining information about {@link File | file} actions
|
|
30
|
+
* granted to a specific user, project, or group.
|
|
31
31
|
*/
|
|
32
32
|
export class Permission extends Endpoint {
|
|
33
33
|
private _data: any;
|
|
@@ -52,22 +52,19 @@ export class Permission extends Endpoint {
|
|
|
52
52
|
* - `readViewpoint` - The ability to read file viewpoints.
|
|
53
53
|
* - `createViewpoint` - The ability to create file viewpoints.
|
|
54
54
|
*
|
|
55
|
-
* @example Change file permissions for the the specified project
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* })
|
|
69
|
-
* );
|
|
70
|
-
* ```
|
|
55
|
+
* @example <caption>Change file permissions for the the specified project.</caption>
|
|
56
|
+
* const myFile = client.getFile(myFileId);
|
|
57
|
+
* const permissions = await myFile.getPermissions();
|
|
58
|
+
* const projectPermissions = permissions.filter((permission) =>
|
|
59
|
+
* permission.grantedTo.some((x) => x.project?.id === myProjectId)
|
|
60
|
+
* );
|
|
61
|
+
* const newActions = ["read", "readSourceFile", "update"];
|
|
62
|
+
* await Promise.all(
|
|
63
|
+
* projectPermissions.map((permission) => {
|
|
64
|
+
* permission.actions = newActions;
|
|
65
|
+
* return permission.save();
|
|
66
|
+
* })
|
|
67
|
+
* );
|
|
71
68
|
*/
|
|
72
69
|
get actions(): string[] {
|
|
73
70
|
return this.data.actions;
|
|
@@ -154,8 +151,8 @@ export class Permission extends Endpoint {
|
|
|
154
151
|
}
|
|
155
152
|
|
|
156
153
|
/**
|
|
157
|
-
* Saves permission properties changes to the server. Call this method to update permission
|
|
158
|
-
* server after any property changes.
|
|
154
|
+
* Saves permission properties changes to the server. Call this method to update permission
|
|
155
|
+
* data on the server after any property changes.
|
|
159
156
|
*/
|
|
160
157
|
save(): Promise<this> {
|
|
161
158
|
return this.update(this.data);
|
package/src/Api/Project.ts
CHANGED
|
@@ -31,8 +31,8 @@ import { File } from "./File";
|
|
|
31
31
|
import { userFullName, userInitials } from "./Utils";
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Provides properties and methods for obtaining information about a project on the Open Cloud
|
|
35
|
-
* managing its {@link Role | roles}, {@link Member | members} and models.
|
|
34
|
+
* Provides properties and methods for obtaining information about a project on the Open Cloud
|
|
35
|
+
* Server and managing its {@link Role | roles}, {@link Member | members} and models.
|
|
36
36
|
*/
|
|
37
37
|
export class Project extends Endpoint {
|
|
38
38
|
private _data: any;
|
|
@@ -270,8 +270,8 @@ export class Project extends Endpoint {
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
/**
|
|
273
|
-
* Saves project properties changes to the server. Call this method to update project data on
|
|
274
|
-
* server after any property changes.
|
|
273
|
+
* Saves project properties changes to the server. Call this method to update project data on
|
|
274
|
+
* the server after any property changes.
|
|
275
275
|
*/
|
|
276
276
|
save(): Promise<this> {
|
|
277
277
|
return this.update(this.data);
|
|
@@ -281,11 +281,12 @@ export class Project extends Endpoint {
|
|
|
281
281
|
* Sets or removes the project preview.
|
|
282
282
|
*
|
|
283
283
|
* @param image - Preview image. Can be a
|
|
284
|
-
* {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}
|
|
284
|
+
* {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}
|
|
285
|
+
* string,
|
|
285
286
|
* {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
|
|
286
287
|
* {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or
|
|
287
|
-
* {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object. Setting
|
|
288
|
-
* to `null` will remove the preview.
|
|
288
|
+
* {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object. Setting
|
|
289
|
+
* the `image` to `null` will remove the preview.
|
|
289
290
|
*/
|
|
290
291
|
|
|
291
292
|
async setPreview(image?: BodyInit | null): Promise<this> {
|
|
@@ -308,8 +309,8 @@ export class Project extends Endpoint {
|
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
/**
|
|
311
|
-
* Returns a list of project roles. Project members have different abilities depending on the
|
|
312
|
-
* have in a project.
|
|
312
|
+
* Returns a list of project roles. Project members have different abilities depending on the
|
|
313
|
+
* role they have in a project.
|
|
313
314
|
*/
|
|
314
315
|
getRoles(): Promise<Role[]> {
|
|
315
316
|
return this.get("/roles")
|
|
@@ -403,8 +404,8 @@ export class Project extends Endpoint {
|
|
|
403
404
|
* Information about the file (model) that can be reference in the project topics.
|
|
404
405
|
*
|
|
405
406
|
* @typedef {any} FileInformation
|
|
406
|
-
* @property {any[]} display_information - The list of fields to allow users to associate the
|
|
407
|
-
* a server model.
|
|
407
|
+
* @property {any[]} display_information - The list of fields to allow users to associate the
|
|
408
|
+
* file with a server model.
|
|
408
409
|
* @property {string} display_information.field_display_name - Field display name.
|
|
409
410
|
* @property {string} display_information.field_value - Field value.
|
|
410
411
|
* @property {any} file - The file reference object.
|
|
@@ -416,8 +417,8 @@ export class Project extends Endpoint {
|
|
|
416
417
|
* Returns a list of project files. For more information, see
|
|
417
418
|
* {@link https://cloud.opendesign.com/docs//pages/server/bcf3.html#ProjectFilesInformation | Open Cloud BCF3 API}.
|
|
418
419
|
*
|
|
419
|
-
* This list contains all files that the project has access to. To add a file to this list,
|
|
420
|
-
* {@link IGrantedTo.project | project} permission on the file using
|
|
420
|
+
* This list contains all files that the project has access to. To add a file to this list,
|
|
421
|
+
* create a {@link IGrantedTo.project | project} permission on the file using
|
|
421
422
|
* {@link File.createPermission | File.createPermission()}.
|
|
422
423
|
*/
|
|
423
424
|
getFilesInformation(): Promise<any[]> {
|
package/src/Api/Role.ts
CHANGED
|
@@ -125,8 +125,8 @@ export class Role extends Endpoint {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* Saves role properties changes to the server. Call this method to update role data on the
|
|
129
|
-
* after any property changes.
|
|
128
|
+
* Saves role properties changes to the server. Call this method to update role data on the
|
|
129
|
+
* server after any property changes.
|
|
130
130
|
*/
|
|
131
131
|
save(): Promise<this> {
|
|
132
132
|
return this.update(this.data);
|
package/src/Api/SharedLink.ts
CHANGED
|
@@ -126,8 +126,8 @@ export class SharedLink extends Endpoint {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
* Saves shared link properties changes to the server. Call this method to update shared link
|
|
130
|
-
* the server after any property changes.
|
|
129
|
+
* Saves shared link properties changes to the server. Call this method to update shared link
|
|
130
|
+
* data on the server after any property changes.
|
|
131
131
|
*/
|
|
132
132
|
save(): Promise<this> {
|
|
133
133
|
return this.update(this.data);
|
package/src/Api/User.ts
CHANGED
|
@@ -27,8 +27,8 @@ import { FetchError } from "./FetchError";
|
|
|
27
27
|
import { userFullName, userInitials } from "./Utils";
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* Provides properties and methods for obtaining information about a Open Cloud Server user and
|
|
31
|
-
* its data.
|
|
30
|
+
* Provides properties and methods for obtaining information about a Open Cloud Server user and
|
|
31
|
+
* manage its data.
|
|
32
32
|
*/
|
|
33
33
|
export class User extends Endpoint {
|
|
34
34
|
private _data: any;
|
|
@@ -142,8 +142,8 @@ export class User extends Endpoint {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
* Full name. Returns the user's first and last name. If first name and last names are empty,
|
|
146
|
-
* the user name.
|
|
145
|
+
* Full name. Returns the user's first and last name. If first name and last names are empty,
|
|
146
|
+
* returns the user name.
|
|
147
147
|
*
|
|
148
148
|
* @readonly
|
|
149
149
|
*/
|
|
@@ -161,8 +161,8 @@ export class User extends Endpoint {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
|
-
* User initials. Returns a first letters of the user's first and last names. If first name
|
|
165
|
-
* names are empty, returns the first letter of the user name.
|
|
164
|
+
* User initials. Returns a first letters of the user's first and last names. If first name
|
|
165
|
+
* and last names are empty, returns the first letter of the user name.
|
|
166
166
|
*
|
|
167
167
|
* @readonly
|
|
168
168
|
*/
|
|
@@ -233,8 +233,8 @@ export class User extends Endpoint {
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
/**
|
|
236
|
-
* The identity provider used to create the account. Can be `ldap`, `oauth`, `saml` or empty
|
|
237
|
-
* accounts.
|
|
236
|
+
* The identity provider used to create the account. Can be `ldap`, `oauth`, `saml` or empty
|
|
237
|
+
* for local accounts.
|
|
238
238
|
*
|
|
239
239
|
* @readonly
|
|
240
240
|
*/
|
|
@@ -265,8 +265,8 @@ export class User extends Endpoint {
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
/**
|
|
268
|
-
* The user's access token (API key). Use
|
|
269
|
-
* sign in to the server using this token.
|
|
268
|
+
* The user's access token (API key). Use
|
|
269
|
+
* {@link Client.signInWithToken | Client.signInWithToken()} to sign in to the server using this token.
|
|
270
270
|
*
|
|
271
271
|
* @readonly
|
|
272
272
|
*/
|
|
@@ -288,8 +288,8 @@ export class User extends Endpoint {
|
|
|
288
288
|
/**
|
|
289
289
|
* Reloads user data from the server.
|
|
290
290
|
*
|
|
291
|
-
* Only administrators can checkout other users. If the current logged in user is not an
|
|
292
|
-
* they can only checkout themselves, otherwise an exception will be thrown.
|
|
291
|
+
* Only administrators can checkout other users. If the current logged in user is not an
|
|
292
|
+
* administrator, they can only checkout themselves, otherwise an exception will be thrown.
|
|
293
293
|
*/
|
|
294
294
|
async checkout(): Promise<this> {
|
|
295
295
|
if (this.httpClient.signInUserIsAdmin) {
|
|
@@ -309,8 +309,8 @@ export class User extends Endpoint {
|
|
|
309
309
|
/**
|
|
310
310
|
* Updates user data on the server.
|
|
311
311
|
*
|
|
312
|
-
* Only administrators can update other users. If the current logged in user is not an
|
|
313
|
-
* they can only update themself, otherwise an exception will be thrown.
|
|
312
|
+
* Only administrators can update other users. If the current logged in user is not an
|
|
313
|
+
* administrator, they can only update themself, otherwise an exception will be thrown.
|
|
314
314
|
*
|
|
315
315
|
* @param data - Raw user data. For more information, see
|
|
316
316
|
* {@link https://cloud.opendesign.com/docs//pages/server/api.html#Users | Open Cloud Users API}.
|
|
@@ -333,11 +333,11 @@ export class User extends Endpoint {
|
|
|
333
333
|
/**
|
|
334
334
|
* Deletes a user from the server.
|
|
335
335
|
*
|
|
336
|
-
* Only administrators can delete users. If the current logged in user is not an
|
|
337
|
-
* exception will be thrown.
|
|
336
|
+
* Only administrators can delete users. If the current logged in user is not an
|
|
337
|
+
* administrator, an exception will be thrown.
|
|
338
338
|
*
|
|
339
|
-
* Administrators can delete themselves or other administrators. An administrator can only
|
|
340
|
-
* themself if they is not the last administrator.
|
|
339
|
+
* Administrators can delete themselves or other administrators. An administrator can only
|
|
340
|
+
* delete themself if they is not the last administrator.
|
|
341
341
|
*
|
|
342
342
|
* You need to re-login after deleting the current logged in user.
|
|
343
343
|
*
|
|
@@ -363,8 +363,8 @@ export class User extends Endpoint {
|
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
/**
|
|
366
|
-
* Saves user properties changes to the server. Call this method to update user data on the
|
|
367
|
-
* after any property changes.
|
|
366
|
+
* Saves user properties changes to the server. Call this method to update user data on the
|
|
367
|
+
* server after any property changes.
|
|
368
368
|
*/
|
|
369
369
|
save(): Promise<this> {
|
|
370
370
|
return this.update(this.data);
|
|
@@ -373,15 +373,16 @@ export class User extends Endpoint {
|
|
|
373
373
|
/**
|
|
374
374
|
* Sets or removes the user avatar.
|
|
375
375
|
*
|
|
376
|
-
* Only administrators can set the avatar of other users. If the current logged in user is
|
|
377
|
-
* administrator, they can only set their avatar, otherwise an exception will be thrown.
|
|
376
|
+
* Only administrators can set the avatar of other users. If the current logged in user is
|
|
377
|
+
* not an administrator, they can only set their avatar, otherwise an exception will be thrown.
|
|
378
378
|
*
|
|
379
379
|
* @param image - Avatar image. Can be a
|
|
380
|
-
* {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}
|
|
380
|
+
* {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}
|
|
381
|
+
* string,
|
|
381
382
|
* {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
|
|
382
383
|
* {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or
|
|
383
|
-
* {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object. Setting
|
|
384
|
-
* to `null` will remove the avatar.
|
|
384
|
+
* {@link https://developer.mozilla.org/docs/Web/API/File | Web API File} object. Setting
|
|
385
|
+
* the `image` to `null` will remove the avatar.
|
|
385
386
|
*/
|
|
386
387
|
async setAvatar(image?: BodyInit | null): Promise<this> {
|
|
387
388
|
if (!image) {
|
|
@@ -403,8 +404,8 @@ export class User extends Endpoint {
|
|
|
403
404
|
/**
|
|
404
405
|
* Removes the user avatar.
|
|
405
406
|
*
|
|
406
|
-
* Only administrators can remove the avatar of other users. If the current logged in user is
|
|
407
|
-
* administrator, they can only remove their avatar, otherwise an exception will be thrown.
|
|
407
|
+
* Only administrators can remove the avatar of other users. If the current logged in user is
|
|
408
|
+
* not an administrator, they can only remove their avatar, otherwise an exception will be thrown.
|
|
408
409
|
*/
|
|
409
410
|
async deleteAvatar(): Promise<this> {
|
|
410
411
|
if (this.httpClient.signInUserIsAdmin) {
|
|
@@ -424,14 +425,15 @@ export class User extends Endpoint {
|
|
|
424
425
|
/**
|
|
425
426
|
* Changes the user password.
|
|
426
427
|
*
|
|
427
|
-
* Only administrators can change the passwords of other users. If the current logged in user
|
|
428
|
-
* administrator, they can only change their password, otherwise an exception will
|
|
428
|
+
* Only administrators can change the passwords of other users. If the current logged in user
|
|
429
|
+
* is not an administrator, they can only change their password, otherwise an exception will
|
|
430
|
+
* be thrown.
|
|
429
431
|
*
|
|
430
432
|
* To change their password, non-administrator users must specify their old password.
|
|
431
433
|
*
|
|
432
434
|
* @param newPassword - New user password.
|
|
433
|
-
* @param oldPassword - Old user password. Only required for non-administrator users to
|
|
434
|
-
* password.
|
|
435
|
+
* @param oldPassword - Old user password. Only required for non-administrator users to
|
|
436
|
+
* change their password.
|
|
435
437
|
*/
|
|
436
438
|
async changePassword(newPassword: string, oldPassword?: string): Promise<this> {
|
|
437
439
|
if (this.httpClient.signInUserIsAdmin) {
|