@brostark/solutions-client 1.1.21 → 1.1.23

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.
@@ -16,7 +16,7 @@ const generateLiveAPI = (apiUrl, apiKey) => {
16
16
  */
17
17
  createLive: async () => {
18
18
  const response = await (0, httpRequest_1.httpPostRequest)(`${apiUrl}/live`, apiKey, {});
19
- return response.data;
19
+ return response;
20
20
  },
21
21
  /**
22
22
  * Get the active live stream
@@ -24,7 +24,7 @@ const generateLiveAPI = (apiUrl, apiKey) => {
24
24
  */
25
25
  getActiveLive: async () => {
26
26
  const response = await (0, httpRequest_1.httpGetRequest)(`${apiUrl}/live`, apiKey);
27
- return response.data;
27
+ return response;
28
28
  },
29
29
  };
30
30
  };
@@ -1,3 +1,4 @@
1
+ import { ListOptions } from "../../lib/types";
1
2
  /**
2
3
  * Generates an API to manage media
3
4
  * @param apiUrl - The API URL
@@ -17,5 +18,11 @@ export declare const generateMediaAPI: (apiUrl: string, apiKey: string) => {
17
18
  * @returns A promise with the deleted media
18
19
  */
19
20
  delete: (filename: string) => Promise<any>;
21
+ /**
22
+ * Lists the media
23
+ * @param options - The pagination options
24
+ * @returns A promise with the list of media
25
+ */
26
+ list: (options?: ListOptions) => Promise<any>;
20
27
  };
21
28
  //# sourceMappingURL=media.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/api/v1/media.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM;IAE3D;;;;OAIG;mBACkB,IAAI,YAAY,MAAM;IAM3C;;;;OAIG;uBACsB,MAAM;CAMlC,CAAA"}
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/api/v1/media.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM;IAE3D;;;;OAIG;mBACkB,IAAI,YAAY,MAAM;IAM3C;;;;OAIG;uBACsB,MAAM;IAM/B;;;;OAIG;qBACmB,WAAW;CAMpC,CAAA"}
@@ -17,7 +17,7 @@ const generateMediaAPI = (apiUrl, apiKey) => {
17
17
  */
18
18
  upload: async (file, filename) => {
19
19
  const response = await (0, httpRequest_1.httpUploadRequest)(`${apiUrl}/media/${filename}`, apiKey, file);
20
- return response.data;
20
+ return response;
21
21
  },
22
22
  /**
23
23
  * Deletes a media
@@ -26,7 +26,16 @@ const generateMediaAPI = (apiUrl, apiKey) => {
26
26
  */
27
27
  delete: async (filename) => {
28
28
  const response = await (0, httpRequest_1.httpDeleteRequest)(`${apiUrl}/media/${filename}`, apiKey);
29
- return response.data;
29
+ return response;
30
+ },
31
+ /**
32
+ * Lists the media
33
+ * @param options - The pagination options
34
+ * @returns A promise with the list of media
35
+ */
36
+ list: async (options = {}) => {
37
+ const response = await (0, httpRequest_1.httpListRequest)(`${apiUrl}/media`, apiKey, options);
38
+ return response;
30
39
  },
31
40
  };
32
41
  };
@@ -18,7 +18,7 @@ const generateSearchAPI = (apiUrl, apiKey) => {
18
18
  */
19
19
  listCollections: async (options = {}) => {
20
20
  const response = await (0, httpRequest_1.httpListRequest)(`${apiUrl}/search/collections`, apiKey, options);
21
- return response.data;
21
+ return response;
22
22
  },
23
23
  /**
24
24
  * Creates a search collection
@@ -27,7 +27,7 @@ const generateSearchAPI = (apiUrl, apiKey) => {
27
27
  */
28
28
  createCollection: async (params) => {
29
29
  const response = await (0, httpRequest_1.httpPostRequest)(`${apiUrl}/search/collections`, apiKey, params);
30
- return response.data;
30
+ return response;
31
31
  },
32
32
  /**
33
33
  * Deletes a search collection
@@ -36,7 +36,7 @@ const generateSearchAPI = (apiUrl, apiKey) => {
36
36
  */
37
37
  deleteCollection: async (name) => {
38
38
  const response = await (0, httpRequest_1.httpDeleteRequest)(`${apiUrl}/search/collections/${name}`, apiKey);
39
- return response.data;
39
+ return response;
40
40
  },
41
41
  /**
42
42
  * Inserts a document into a search collection
@@ -46,7 +46,7 @@ const generateSearchAPI = (apiUrl, apiKey) => {
46
46
  */
47
47
  upsertDocuments: async (collectionName, documents) => {
48
48
  const response = await (0, httpRequest_1.httpPostRequest)(`${apiUrl}/search/collections/${collectionName}/documents`, apiKey, documents);
49
- return response.data;
49
+ return response;
50
50
  },
51
51
  /**
52
52
  * Deletes a document from a search collection
@@ -56,7 +56,7 @@ const generateSearchAPI = (apiUrl, apiKey) => {
56
56
  */
57
57
  deleteDocument: async (collectionName, documentId) => {
58
58
  const response = await (0, httpRequest_1.httpDeleteRequest)(`${apiUrl}/search/collections/${collectionName}/documents/${documentId}`, apiKey);
59
- return response.data;
59
+ return response;
60
60
  },
61
61
  /**
62
62
  * Deletes multiple documents from a search collection
@@ -66,7 +66,7 @@ const generateSearchAPI = (apiUrl, apiKey) => {
66
66
  */
67
67
  deleteMultipleDocuments: async (collectionName, documentIds) => {
68
68
  const response = await (0, httpRequest_1.httpPostRequest)(`${apiUrl}/search/collections/${collectionName}/documents/delete`, apiKey, { documentIds });
69
- return response.data;
69
+ return response;
70
70
  },
71
71
  /**
72
72
  * Gets a document from a search collection by its ID
@@ -19,7 +19,7 @@ const generateVideoAPI = (apiUrl, apiKey) => {
19
19
  */
20
20
  list: async (options = {}) => {
21
21
  const response = await (0, httpRequest_1.httpListRequest)(`${apiUrl}/videos`, apiKey, options);
22
- return response.data;
22
+ return response;
23
23
  },
24
24
  /**
25
25
  * Uploads a new video
@@ -28,7 +28,7 @@ const generateVideoAPI = (apiUrl, apiKey) => {
28
28
  */
29
29
  upload: async (file) => {
30
30
  const response = await (0, httpRequest_1.httpUploadRequest)(`${apiUrl}/upload/video`, apiKey, file);
31
- return response.data;
31
+ return response;
32
32
  },
33
33
  /**
34
34
  * Retrieves information about a specific video
@@ -37,7 +37,7 @@ const generateVideoAPI = (apiUrl, apiKey) => {
37
37
  */
38
38
  get: async (id) => {
39
39
  const response = await (0, httpRequest_1.httpGetRequest)(`${apiUrl}/videos/${id}`, apiKey);
40
- return response.data;
40
+ return response;
41
41
  },
42
42
  /**
43
43
  * Retrieves the video URL
@@ -46,7 +46,7 @@ const generateVideoAPI = (apiUrl, apiKey) => {
46
46
  */
47
47
  stream: async (filename) => {
48
48
  const response = await (0, httpRequest_1.httpGetRequest)(`${apiUrl}/stream/${accountId}/${filename.split("/").pop()?.split(".")[0]}`, apiKey);
49
- return response.data;
49
+ return response;
50
50
  },
51
51
  /**
52
52
  * Deletes a video
@@ -55,7 +55,7 @@ const generateVideoAPI = (apiUrl, apiKey) => {
55
55
  */
56
56
  remove: async (id) => {
57
57
  const response = await (0, httpRequest_1.httpDeleteRequest)(`${apiUrl}/videos/${id}`, apiKey);
58
- return response.data;
58
+ return response;
59
59
  }
60
60
  };
61
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brostark/solutions-client",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -15,7 +15,7 @@ export const generateLiveAPI = (apiUrl: string, apiKey: string) => {
15
15
  */
16
16
  createLive: async () => {
17
17
  const response = await httpPostRequest(`${apiUrl}/live`, apiKey, {});
18
- return response.data;
18
+ return response;
19
19
  },
20
20
 
21
21
  /**
@@ -24,7 +24,7 @@ export const generateLiveAPI = (apiUrl: string, apiKey: string) => {
24
24
  */
25
25
  getActiveLive: async () => {
26
26
  const response = await httpGetRequest(`${apiUrl}/live`, apiKey);
27
- return response.data;
27
+ return response;
28
28
  },
29
29
  }
30
30
  }
@@ -1,4 +1,5 @@
1
- import { httpDeleteRequest, httpUploadRequest } from "../../lib/httpRequest";
1
+ import { httpDeleteRequest, httpListRequest, httpUploadRequest } from "../../lib/httpRequest";
2
+ import { ListOptions } from "../../lib/types";
2
3
 
3
4
 
4
5
  /**
@@ -17,7 +18,7 @@ export const generateMediaAPI = (apiUrl: string, apiKey: string) => {
17
18
  upload: async (file: File, filename: string) => {
18
19
  const response = await httpUploadRequest(`${apiUrl}/media/${filename}`, apiKey, file);
19
20
 
20
- return response.data;
21
+ return response;
21
22
  },
22
23
 
23
24
  /**
@@ -28,7 +29,18 @@ export const generateMediaAPI = (apiUrl: string, apiKey: string) => {
28
29
  delete: async (filename: string) => {
29
30
  const response = await httpDeleteRequest(`${apiUrl}/media/${filename}`, apiKey);
30
31
 
31
- return response.data;
32
+ return response;
33
+ },
34
+
35
+ /**
36
+ * Lists the media
37
+ * @param options - The pagination options
38
+ * @returns A promise with the list of media
39
+ */
40
+ list: async (options: ListOptions = {}) => {
41
+ const response = await httpListRequest(`${apiUrl}/media`, apiKey, options);
42
+
43
+ return response;
32
44
  },
33
45
  }
34
46
  }
@@ -18,7 +18,7 @@ export const generateSearchAPI = (apiUrl: string, apiKey: string) => {
18
18
  */
19
19
  listCollections: async (options: ListOptions = {}) => {
20
20
  const response = await httpListRequest(`${apiUrl}/search/collections`, apiKey, options);
21
- return response.data;
21
+ return response;
22
22
  },
23
23
 
24
24
  /**
@@ -29,7 +29,7 @@ export const generateSearchAPI = (apiUrl: string, apiKey: string) => {
29
29
  createCollection: async (params: BrostarkSolutions.Search.CreateCollectionParams) => {
30
30
  const response = await httpPostRequest(`${apiUrl}/search/collections`, apiKey, params);
31
31
 
32
- return response.data;
32
+ return response;
33
33
  },
34
34
 
35
35
  /**
@@ -40,7 +40,7 @@ export const generateSearchAPI = (apiUrl: string, apiKey: string) => {
40
40
  deleteCollection: async (name: string) => {
41
41
  const response = await httpDeleteRequest(`${apiUrl}/search/collections/${name}`, apiKey);
42
42
 
43
- return response.data;
43
+ return response;
44
44
  },
45
45
 
46
46
  /**
@@ -52,7 +52,7 @@ export const generateSearchAPI = (apiUrl: string, apiKey: string) => {
52
52
  upsertDocuments: async (collectionName: string, documents: Record<string, unknown>[]) => {
53
53
  const response = await httpPostRequest(`${apiUrl}/search/collections/${collectionName}/documents`, apiKey, documents);
54
54
 
55
- return response.data;
55
+ return response;
56
56
  },
57
57
 
58
58
  /**
@@ -64,7 +64,7 @@ export const generateSearchAPI = (apiUrl: string, apiKey: string) => {
64
64
  deleteDocument: async (collectionName: string, documentId: string) => {
65
65
  const response = await httpDeleteRequest(`${apiUrl}/search/collections/${collectionName}/documents/${documentId}`, apiKey);
66
66
 
67
- return response.data;
67
+ return response;
68
68
  },
69
69
 
70
70
  /**
@@ -76,7 +76,7 @@ export const generateSearchAPI = (apiUrl: string, apiKey: string) => {
76
76
  deleteMultipleDocuments: async (collectionName: string, documentIds: string[]) => {
77
77
  const response = await httpPostRequest(`${apiUrl}/search/collections/${collectionName}/documents/delete`, apiKey, { documentIds });
78
78
 
79
- return response.data;
79
+ return response;
80
80
  },
81
81
 
82
82
  /**
@@ -19,7 +19,7 @@ export const generateVideoAPI = (apiUrl: string, apiKey: string) => {
19
19
  */
20
20
  list: async (options: ListOptions = {}) => {
21
21
  const response = await httpListRequest(`${apiUrl}/videos`, apiKey, options);
22
- return response.data;
22
+ return response;
23
23
  },
24
24
 
25
25
  /**
@@ -29,7 +29,7 @@ export const generateVideoAPI = (apiUrl: string, apiKey: string) => {
29
29
  */
30
30
  upload: async (file: File) => {
31
31
  const response = await httpUploadRequest(`${apiUrl}/upload/video`, apiKey, file);
32
- return response.data;
32
+ return response;
33
33
  },
34
34
 
35
35
  /**
@@ -39,7 +39,7 @@ export const generateVideoAPI = (apiUrl: string, apiKey: string) => {
39
39
  */
40
40
  get: async (id: string) => {
41
41
  const response = await httpGetRequest(`${apiUrl}/videos/${id}`, apiKey);
42
- return response.data;
42
+ return response;
43
43
  },
44
44
 
45
45
  /**
@@ -49,7 +49,7 @@ export const generateVideoAPI = (apiUrl: string, apiKey: string) => {
49
49
  */
50
50
  stream: async (filename: string): Promise<string> => {
51
51
  const response = await httpGetRequest(`${apiUrl}/stream/${accountId}/${filename.split("/").pop()?.split(".")[0]}`, apiKey);
52
- return response.data;
52
+ return response;
53
53
  },
54
54
 
55
55
  /**
@@ -59,7 +59,7 @@ export const generateVideoAPI = (apiUrl: string, apiKey: string) => {
59
59
  */
60
60
  remove: async (id: string) => {
61
61
  const response = await httpDeleteRequest(`${apiUrl}/videos/${id}`, apiKey);
62
- return response.data;
62
+ return response;
63
63
  }
64
64
  }
65
65
  }