@brostark/solutions-client 1.1.16 → 1.1.17
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/api/v1/media.d.ts +15 -0
- package/dist/api/v1/media.d.ts.map +1 -0
- package/dist/api/v1/media.js +24 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/package.json +1 -1
- package/src/api/v1/media.ts +23 -0
- package/src/client.ts +3 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates an API to manage media
|
|
3
|
+
* @param apiUrl - The API URL
|
|
4
|
+
* @param apiKey - The API key for authentication
|
|
5
|
+
* @returns An object containing methods to interact with the media API
|
|
6
|
+
*/
|
|
7
|
+
export declare const generateMediaAPI: (apiUrl: string, apiKey: string) => {
|
|
8
|
+
/**
|
|
9
|
+
* Uploads a new video
|
|
10
|
+
* @param file - The video file to upload
|
|
11
|
+
* @returns A promise with information about the uploaded video (URL and path)
|
|
12
|
+
*/
|
|
13
|
+
upload: (file: File, filename: string) => Promise<any>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +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;CAM9C,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateMediaAPI = void 0;
|
|
4
|
+
const httpRequest_1 = require("../../lib/httpRequest");
|
|
5
|
+
/**
|
|
6
|
+
* Generates an API to manage media
|
|
7
|
+
* @param apiUrl - The API URL
|
|
8
|
+
* @param apiKey - The API key for authentication
|
|
9
|
+
* @returns An object containing methods to interact with the media API
|
|
10
|
+
*/
|
|
11
|
+
const generateMediaAPI = (apiUrl, apiKey) => {
|
|
12
|
+
return {
|
|
13
|
+
/**
|
|
14
|
+
* Uploads a new video
|
|
15
|
+
* @param file - The video file to upload
|
|
16
|
+
* @returns A promise with information about the uploaded video (URL and path)
|
|
17
|
+
*/
|
|
18
|
+
upload: async (file, filename) => {
|
|
19
|
+
const response = await (0, httpRequest_1.httpUploadRequest)(`${apiUrl}/media/${filename}`, apiKey, file);
|
|
20
|
+
return response.data;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.generateMediaAPI = generateMediaAPI;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { generateLiveAPI } from "./api/v1/live";
|
|
2
|
+
import { generateMediaAPI } from "./api/v1/media";
|
|
2
3
|
import { generateSearchAPI } from "./api/v1/search";
|
|
3
4
|
import { generateVideoAPI } from "./api/v1/video";
|
|
4
5
|
import { ApiVersion } from "./constant";
|
|
@@ -14,6 +15,7 @@ export interface CreateClientOptions {
|
|
|
14
15
|
export interface BrostarkSolutionsClient {
|
|
15
16
|
live: ReturnType<typeof generateLiveAPI>;
|
|
16
17
|
video: ReturnType<typeof generateVideoAPI>;
|
|
18
|
+
media: ReturnType<typeof generateMediaAPI>;
|
|
17
19
|
search: ReturnType<typeof generateSearchAPI>;
|
|
18
20
|
}
|
|
19
21
|
/**
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,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H,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,uBAAuB,CAcvG"}
|
package/dist/client.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createClient = createClient;
|
|
4
4
|
const live_1 = require("./api/v1/live");
|
|
5
|
+
const media_1 = require("./api/v1/media");
|
|
5
6
|
const search_1 = require("./api/v1/search");
|
|
6
7
|
const video_1 = require("./api/v1/video");
|
|
7
8
|
const constant_1 = require("./constant");
|
|
@@ -16,6 +17,7 @@ function createClient(apiKey, options = {}) {
|
|
|
16
17
|
const apiUrl = `${host}/${version}`;
|
|
17
18
|
return {
|
|
18
19
|
live: (0, live_1.generateLiveAPI)(apiUrl, apiKey),
|
|
20
|
+
media: (0, media_1.generateMediaAPI)(apiUrl, apiKey),
|
|
19
21
|
video: (0, video_1.generateVideoAPI)(apiUrl, apiKey),
|
|
20
22
|
search: (0, search_1.generateSearchAPI)(apiUrl, apiKey),
|
|
21
23
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { httpUploadRequest } from "../../lib/httpRequest";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generates an API to manage media
|
|
6
|
+
* @param apiUrl - The API URL
|
|
7
|
+
* @param apiKey - The API key for authentication
|
|
8
|
+
* @returns An object containing methods to interact with the media API
|
|
9
|
+
*/
|
|
10
|
+
export const generateMediaAPI = (apiUrl: string, apiKey: string) => {
|
|
11
|
+
return {
|
|
12
|
+
/**
|
|
13
|
+
* Uploads a new video
|
|
14
|
+
* @param file - The video file to upload
|
|
15
|
+
* @returns A promise with information about the uploaded video (URL and path)
|
|
16
|
+
*/
|
|
17
|
+
upload: async (file: File, filename: string) => {
|
|
18
|
+
const response = await httpUploadRequest(`${apiUrl}/media/${filename}`, apiKey, file);
|
|
19
|
+
|
|
20
|
+
return response.data;
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/client.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { generateLiveAPI } from "./api/v1/live";
|
|
2
|
+
import { generateMediaAPI } from "./api/v1/media";
|
|
2
3
|
import { generateSearchAPI } from "./api/v1/search";
|
|
3
4
|
import { generateVideoAPI } from "./api/v1/video";
|
|
4
5
|
import { ApiVersion, DEFAULT_API_HOST, DEFAULT_API_VERSION } from "./constant";
|
|
@@ -16,6 +17,7 @@ export interface CreateClientOptions {
|
|
|
16
17
|
export interface BrostarkSolutionsClient {
|
|
17
18
|
live: ReturnType<typeof generateLiveAPI>;
|
|
18
19
|
video: ReturnType<typeof generateVideoAPI>;
|
|
20
|
+
media: ReturnType<typeof generateMediaAPI>;
|
|
19
21
|
search: ReturnType<typeof generateSearchAPI>;
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -35,6 +37,7 @@ export function createClient(apiKey: string, options: CreateClientOptions = {}):
|
|
|
35
37
|
|
|
36
38
|
return {
|
|
37
39
|
live: generateLiveAPI(apiUrl, apiKey),
|
|
40
|
+
media: generateMediaAPI(apiUrl, apiKey),
|
|
38
41
|
video: generateVideoAPI(apiUrl, apiKey),
|
|
39
42
|
search: generateSearchAPI(apiUrl, apiKey),
|
|
40
43
|
}
|