polfan-server-js-client 0.2.36 → 0.2.37

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.
@@ -2,14 +2,15 @@ import { AbstractRestClient, RestClientResponse } from "./AbstractRestClient";
2
2
  export interface File {
3
3
  id: string;
4
4
  url: string;
5
- original_url: string;
6
- original_name: string;
7
- mime_type: string;
5
+ name: string;
6
+ mime: string;
8
7
  size: number;
9
- image_dimensions: [number, number] | null;
8
+ width?: number;
9
+ height?: number;
10
10
  }
11
11
  export declare class FilesClient extends AbstractRestClient {
12
12
  protected defaultUrl: string;
13
13
  uploadFile(file: Parameters<typeof FormData.prototype.append>[1]): Promise<RestClientResponse<File>>;
14
- getFileMetadata(id: string): Promise<RestClientResponse<File>>;
14
+ getFileMeta(id: string): Promise<RestClientResponse<File>>;
15
+ getFileMetaBulk(ids: string[]): Promise<RestClientResponse<File[]>>;
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polfan-server-js-client",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
4
4
  "description": "JavaScript client library for handling communication with Polfan chat server.",
5
5
  "author": "Jarosław Żak",
6
6
  "license": "MIT",
@@ -3,15 +3,15 @@ import {AbstractRestClient, RestClientResponse} from "./AbstractRestClient";
3
3
  export interface File {
4
4
  id: string;
5
5
  url: string;
6
- original_url: string;
7
- original_name: string;
8
- mime_type: string;
6
+ name: string;
7
+ mime: string;
9
8
  size: number;
10
- image_dimensions: [number, number] | null;
9
+ width?: number;
10
+ height?: number;
11
11
  }
12
12
 
13
13
  export class FilesClient extends AbstractRestClient {
14
- protected defaultUrl: string = 'https://polfan.pl/webservice/api/files';
14
+ protected defaultUrl: string = 'https://files.devana.pl/files';
15
15
 
16
16
  public async uploadFile(file: Parameters<typeof FormData.prototype.append>[1]): Promise<RestClientResponse<File>> {
17
17
  const formData = new FormData();
@@ -24,7 +24,13 @@ export class FilesClient extends AbstractRestClient {
24
24
  return this.convertFetchResponse<File>(response);
25
25
  }
26
26
 
27
- public async getFileMetadata(id: string): Promise<RestClientResponse<File>> {
27
+ public async getFileMeta(id: string): Promise<RestClientResponse<File>> {
28
28
  return this.send('GET', '/' + id);
29
29
  }
30
+
31
+ public async getFileMetaBulk(ids: string[]): Promise<RestClientResponse<File[]>> {
32
+ const searchParams = new URLSearchParams();
33
+ ids.forEach(id => searchParams.append('id[]', id));
34
+ return this.send('GET', '?' + searchParams);
35
+ }
30
36
  }