@inweb/client 25.6.0 → 25.6.2

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.
@@ -132,7 +132,8 @@ export declare class Assembly {
132
132
  * @async
133
133
  */
134
134
  save(): Promise<this>;
135
- setPreview(image: BodyInit | null): Promise<this>;
135
+ setPreview(image?: BodyInit | null): Promise<this>;
136
+ deletePreview(): Promise<this>;
136
137
  /**
137
138
  * Returns list of assembly models.
138
139
  *
@@ -465,10 +465,8 @@ export declare class Client extends EventEmitter2<ClientEventMap> {
465
465
  * @param description - Project description.
466
466
  * @param startDate - Project start date.
467
467
  * @param endDate - Project end date.
468
- * @param avatarUrl - Project preview image URL. Can be
469
- * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}.
470
468
  */
471
- createProject(name: string, description?: string, startDate?: Date | string, endDate?: Date | string, avatarUrl?: string): Promise<Project>;
469
+ createProject(name: string, description?: string, startDate?: Date | string, endDate?: Date | string): Promise<Project>;
472
470
  /**
473
471
  * Delete the project from the server.
474
472
  *
package/lib/Api/File.d.ts CHANGED
@@ -99,7 +99,7 @@ export declare class File {
99
99
  */
100
100
  get owner(): IShortUserDescription;
101
101
  /**
102
- * File preview image URL. Use {@link File#setPreview | setPreview()} to change preview image.
102
+ * File preview image URL. Use {@link File.setPreview | setPreview()} to change preview image.
103
103
  *
104
104
  * @readonly
105
105
  */
@@ -200,16 +200,21 @@ export declare class File {
200
200
  * Set or remove the file preview.
201
201
  *
202
202
  * @async
203
- * @param image - Preview image. Can be a <a
204
- * href="https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs"
205
- * target="_blank">Data URL</a> string, <a
206
- * href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"
207
- * target="_blank">ArrayBuffer</a>, <a
208
- * href="https://developer.mozilla.org/docs/Web/API/Blob/Blob" target="_blank">Blob</a> or
209
- * Web API <a href="https://developer.mozilla.org/docs/Web/API/File"
210
- * target="_blank">File</a> object. Setting the `image` to `null` will remove the preview.
203
+ * @param image - Preview image.Can be a
204
+ * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}
205
+ * string,
206
+ * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
207
+ * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or Web API
208
+ * {@link https://developer.mozilla.org/docs/Web/API/File | File} object. Setting the
209
+ * `image` to `null` will remove the preview.
211
210
  */
212
- setPreview(image: BodyInit | null): Promise<this>;
211
+ setPreview(image?: BodyInit | null): Promise<this>;
212
+ /**
213
+ * Remove the file preview.
214
+ *
215
+ * @async
216
+ */
217
+ deletePreview(): Promise<this>;
213
218
  /**
214
219
  * Returns a list of models of the active version of the file.
215
220
  *
@@ -93,7 +93,7 @@ export declare class Project {
93
93
  */
94
94
  get owner(): IShortUserDescription;
95
95
  /**
96
- * Project preview image URL. Use [setPreview()]{@link Project#setPreview} to change preview image.
96
+ * Project preview image URL. Use {@link Project.setPreview | setPreview()} to change preview image.
97
97
  *
98
98
  * @readonly
99
99
  */
@@ -153,16 +153,21 @@ export declare class Project {
153
153
  * Set or remove the project preview.
154
154
  *
155
155
  * @async
156
- * @param image - Preview image. Can be a <a
157
- * href="https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs"
158
- * target="_blank">Data URL</a> string, <a
159
- * href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"
160
- * target="_blank">ArrayBuffer</a>, <a
161
- * href="https://developer.mozilla.org/docs/Web/API/Blob/Blob" target="_blank">Blob</a> or
162
- * Web API <a href="https://developer.mozilla.org/docs/Web/API/File"
163
- * target="_blank">File</a> object. Setting the `image` to `null` will remove the preview.
164
- */
165
- setPreview(image: BodyInit | null): Promise<any>;
156
+ * @param image - Preview image. Can be a
157
+ * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}
158
+ * string,
159
+ * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
160
+ * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or Web API
161
+ * {@link https://developer.mozilla.org/docs/Web/API/File | File} object. Setting the
162
+ * `image` to `null` will remove the preview.
163
+ */
164
+ setPreview(image?: BodyInit | null): Promise<any>;
165
+ /**
166
+ * Remove the project preview.
167
+ *
168
+ * @async
169
+ */
170
+ deletePreview(): Promise<this>;
166
171
  /**
167
172
  * Returns a list of project roles. Project {@link Member | members} have different abilities
168
173
  * depending on the role they have in a project.
package/lib/Api/User.d.ts CHANGED
@@ -11,7 +11,7 @@ export declare class User {
11
11
  */
12
12
  constructor(data: any, httpClient: IHttpClient);
13
13
  /**
14
- * User avatar image URL. Use {@link User#setAvatar | setAvatar()} to change avatar image.
14
+ * User avatar image URL. Use {@link User.setAvatar | setAvatar()} to change avatar image.
15
15
  *
16
16
  * @readonly
17
17
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/client",
3
- "version": "25.6.0",
3
+ "version": "25.6.2",
4
4
  "description": "JavaScript REST API client for the Open Cloud Server",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -26,6 +26,6 @@
26
26
  "ts-docs": "typedoc"
27
27
  },
28
28
  "dependencies": {
29
- "@inweb/eventemitter2": "~25.6.0"
29
+ "@inweb/eventemitter2": "~25.6.2"
30
30
  }
31
31
  }
@@ -271,7 +271,12 @@ export class Assembly {
271
271
 
272
272
  // Reserved for future use
273
273
 
274
- setPreview(image: BodyInit | null): Promise<this> {
274
+ setPreview(image?: BodyInit | null): Promise<this> {
275
+ console.warn("Assembly does not support preview");
276
+ return Promise.resolve(this);
277
+ }
278
+
279
+ deletePreview(): Promise<this> {
275
280
  console.warn("Assembly does not support preview");
276
281
  return Promise.resolve(this);
277
282
  }
package/src/Api/Client.ts CHANGED
@@ -888,15 +888,12 @@ export class Client extends EventEmitter2<ClientEventMap> {
888
888
  * @param description - Project description.
889
889
  * @param startDate - Project start date.
890
890
  * @param endDate - Project end date.
891
- * @param avatarUrl - Project preview image URL. Can be
892
- * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}.
893
891
  */
894
892
  createProject(
895
893
  name: string,
896
894
  description?: string,
897
895
  startDate?: Date | string,
898
- endDate?: Date | string,
899
- avatarUrl?: string
896
+ endDate?: Date | string
900
897
  ): Promise<Project> {
901
898
  return this.httpClient
902
899
  .post("/projects", {
@@ -904,7 +901,6 @@ export class Client extends EventEmitter2<ClientEventMap> {
904
901
  description,
905
902
  startDate: startDate instanceof Date ? startDate.toISOString() : startDate,
906
903
  endDate: endDate instanceof Date ? endDate.toISOString() : endDate,
907
- avatarUrl,
908
904
  })
909
905
  .then((response) => response.json())
910
906
  .then((data) => new Project(data, this.httpClient));
package/src/Api/File.ts CHANGED
@@ -213,7 +213,7 @@ export class File {
213
213
  }
214
214
 
215
215
  /**
216
- * File preview image URL. Use {@link File#setPreview | setPreview()} to change preview image.
216
+ * File preview image URL. Use {@link File.setPreview | setPreview()} to change preview image.
217
217
  *
218
218
  * @readonly
219
219
  */
@@ -358,17 +358,31 @@ export class File {
358
358
  * Set or remove the file preview.
359
359
  *
360
360
  * @async
361
- * @param image - Preview image. Can be a <a
362
- * href="https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs"
363
- * target="_blank">Data URL</a> string, <a
364
- * href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"
365
- * target="_blank">ArrayBuffer</a>, <a
366
- * href="https://developer.mozilla.org/docs/Web/API/Blob/Blob" target="_blank">Blob</a> or
367
- * Web API <a href="https://developer.mozilla.org/docs/Web/API/File"
368
- * target="_blank">File</a> object. Setting the `image` to `null` will remove the preview.
361
+ * @param image - Preview image.Can be a
362
+ * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}
363
+ * string,
364
+ * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
365
+ * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or Web API
366
+ * {@link https://developer.mozilla.org/docs/Web/API/File | File} object. Setting the
367
+ * `image` to `null` will remove the preview.
368
+ */
369
+ async setPreview(image?: BodyInit | null): Promise<this> {
370
+ if (!image) {
371
+ await this.deletePreview();
372
+ } else {
373
+ const response = await this.internalPost("/preview", image);
374
+ this.data = await response.json();
375
+ }
376
+ return this;
377
+ }
378
+
379
+ /**
380
+ * Remove the file preview.
381
+ *
382
+ * @async
369
383
  */
370
- async setPreview(image: BodyInit | null): Promise<this> {
371
- const response = await (image ? this.internalPost("/preview", image) : this.internalDelete("/preview"));
384
+ async deletePreview(): Promise<this> {
385
+ const response = await this.internalDelete("/preview");
372
386
  this.data = await response.json();
373
387
  return this;
374
388
  }
@@ -187,7 +187,7 @@ export class Project {
187
187
  }
188
188
 
189
189
  /**
190
- * Project preview image URL. Use [setPreview()]{@link Project#setPreview} to change preview image.
190
+ * Project preview image URL. Use {@link Project.setPreview | setPreview()} to change preview image.
191
191
  *
192
192
  * @readonly
193
193
  */
@@ -293,18 +293,32 @@ export class Project {
293
293
  * Set or remove the project preview.
294
294
  *
295
295
  * @async
296
- * @param image - Preview image. Can be a <a
297
- * href="https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs"
298
- * target="_blank">Data URL</a> string, <a
299
- * href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer"
300
- * target="_blank">ArrayBuffer</a>, <a
301
- * href="https://developer.mozilla.org/docs/Web/API/Blob/Blob" target="_blank">Blob</a> or
302
- * Web API <a href="https://developer.mozilla.org/docs/Web/API/File"
303
- * target="_blank">File</a> object. Setting the `image` to `null` will remove the preview.
304
- */
305
-
306
- async setPreview(image: BodyInit | null): Promise<any> {
307
- const response = await (image ? this.internalPost("/preview", image) : this.internalDelete("/preview"));
296
+ * @param image - Preview image. Can be a
297
+ * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}
298
+ * string,
299
+ * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer},
300
+ * {@link https://developer.mozilla.org/docs/Web/API/Blob/Blob | Blob} or Web API
301
+ * {@link https://developer.mozilla.org/docs/Web/API/File | File} object. Setting the
302
+ * `image` to `null` will remove the preview.
303
+ */
304
+
305
+ async setPreview(image?: BodyInit | null): Promise<any> {
306
+ if (!image) {
307
+ await this.deletePreview();
308
+ } else {
309
+ const response = await this.internalPost("/preview", image);
310
+ this.data = await response.json();
311
+ }
312
+ return this;
313
+ }
314
+
315
+ /**
316
+ * Remove the project preview.
317
+ *
318
+ * @async
319
+ */
320
+ async deletePreview(): Promise<this> {
321
+ const response = await this.internalDelete("/preview");
308
322
  this.data = await response.json();
309
323
  return this;
310
324
  }
package/src/Api/User.ts CHANGED
@@ -42,7 +42,7 @@ export class User {
42
42
  }
43
43
 
44
44
  /**
45
- * User avatar image URL. Use {@link User#setAvatar | setAvatar()} to change avatar image.
45
+ * User avatar image URL. Use {@link User.setAvatar | setAvatar()} to change avatar image.
46
46
  *
47
47
  * @readonly
48
48
  */