@brostark/solutions-client 1.1.9 → 1.1.11
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/search.d.ts +7 -0
- package/dist/api/v1/search.d.ts.map +1 -1
- package/dist/api/v1/search.js +10 -0
- package/dist/client.d.ts +9 -21
- package/dist/client.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/v1/search.ts +12 -0
- package/src/client.ts +7 -1
package/dist/api/v1/search.d.ts
CHANGED
|
@@ -38,6 +38,13 @@ export declare const generateSearchAPI: (apiUrl: string, apiKey: string) => {
|
|
|
38
38
|
* @returns A promise with the deleted document
|
|
39
39
|
*/
|
|
40
40
|
deleteDocument: (collectionName: string, documentId: string) => Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* Gets a document from a search collection by its ID
|
|
43
|
+
* @param collectionName - The name of the collection to get the document from
|
|
44
|
+
* @param documentId - The ID of the document to get
|
|
45
|
+
* @returns A promise with the document
|
|
46
|
+
*/
|
|
47
|
+
getDocumentById: (collectionName: string, documentId: string) => Promise<any>;
|
|
41
48
|
/**
|
|
42
49
|
* Searches for documents in a search collection
|
|
43
50
|
* @param collectionName - The name of the collection to search in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/api/v1/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAIjE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM;IAE5D;;;;OAIG;gCAC8B,WAAW;IAK5C;;;;OAIG;+BAC8B,iBAAiB,CAAC,MAAM,CAAC,sBAAsB;IAMhF;;;;OAIG;6BAC4B,MAAM;IAMrC;;;;;OAKG;sCACqC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;IAMpF;;;;;OAKG;qCACoC,MAAM,cAAc,MAAM;IAMjE;;;;;OAKG;4BAC2B,MAAM,SAAS,iBAAiB,CAAC,MAAM,CAAC,WAAW,KAAG,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC;CAcrI,CAAA"}
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/api/v1/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAIjE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM;IAE5D;;;;OAIG;gCAC8B,WAAW;IAK5C;;;;OAIG;+BAC8B,iBAAiB,CAAC,MAAM,CAAC,sBAAsB;IAMhF;;;;OAIG;6BAC4B,MAAM;IAMrC;;;;;OAKG;sCACqC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;IAMpF;;;;;OAKG;qCACoC,MAAM,cAAc,MAAM;IAMjE;;;;;OAKG;sCACqC,MAAM,cAAc,MAAM;IAMlE;;;;;OAKG;4BAC2B,MAAM,SAAS,iBAAiB,CAAC,MAAM,CAAC,WAAW,KAAG,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC;CAcrI,CAAA"}
|
package/dist/api/v1/search.js
CHANGED
|
@@ -57,6 +57,16 @@ const generateSearchAPI = (apiUrl, apiKey) => {
|
|
|
57
57
|
const response = await (0, httpRequest_1.httpDeleteRequest)(`${apiUrl}/search/collections/${collectionName}/documents/${documentId}`, apiKey);
|
|
58
58
|
return response.data;
|
|
59
59
|
},
|
|
60
|
+
/**
|
|
61
|
+
* Gets a document from a search collection by its ID
|
|
62
|
+
* @param collectionName - The name of the collection to get the document from
|
|
63
|
+
* @param documentId - The ID of the document to get
|
|
64
|
+
* @returns A promise with the document
|
|
65
|
+
*/
|
|
66
|
+
getDocumentById: async (collectionName, documentId) => {
|
|
67
|
+
const response = await (0, httpRequest_1.httpGetRequest)(`${apiUrl}/search/collections/${collectionName}/documents/${documentId}`, apiKey);
|
|
68
|
+
return response.data;
|
|
69
|
+
},
|
|
60
70
|
/**
|
|
61
71
|
* Searches for documents in a search collection
|
|
62
72
|
* @param collectionName - The name of the collection to search in
|
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { generateLiveAPI } from "./api/v1/live";
|
|
2
|
+
import { generateSearchAPI } from "./api/v1/search";
|
|
3
|
+
import { generateVideoAPI } from "./api/v1/video";
|
|
1
4
|
import { ApiVersion } from "./constant";
|
|
2
5
|
/**
|
|
3
6
|
* Options for creating the client
|
|
@@ -8,31 +11,16 @@ export interface CreateClientOptions {
|
|
|
8
11
|
/** The API version (default: DEFAULT_API_VERSION) */
|
|
9
12
|
version?: ApiVersion;
|
|
10
13
|
}
|
|
14
|
+
export interface BrostarkSolutionsClient {
|
|
15
|
+
live: ReturnType<typeof generateLiveAPI>;
|
|
16
|
+
video: ReturnType<typeof generateVideoAPI>;
|
|
17
|
+
search: ReturnType<typeof generateSearchAPI>;
|
|
18
|
+
}
|
|
11
19
|
/**
|
|
12
20
|
* Creates an instance of the API client
|
|
13
21
|
* @param apiKey - The API key for authentication
|
|
14
22
|
* @param options - The configuration options for the client
|
|
15
23
|
* @returns An object containing the different APIs available
|
|
16
24
|
*/
|
|
17
|
-
export declare function createClient(apiKey: string, options?: CreateClientOptions):
|
|
18
|
-
live: {
|
|
19
|
-
createLive: () => Promise<any>;
|
|
20
|
-
getActiveLive: () => Promise<any>;
|
|
21
|
-
};
|
|
22
|
-
video: {
|
|
23
|
-
list: (options?: import("./lib/types").ListOptions) => Promise<any>;
|
|
24
|
-
upload: (file: File) => Promise<any>;
|
|
25
|
-
get: (id: string) => Promise<any>;
|
|
26
|
-
stream: (filename: string) => Promise<string>;
|
|
27
|
-
remove: (id: string) => Promise<any>;
|
|
28
|
-
};
|
|
29
|
-
search: {
|
|
30
|
-
listCollections: (options?: import("./lib/types").ListOptions) => Promise<any>;
|
|
31
|
-
createCollection: (params: import("./lib/types").BrostarkSolutions.Search.CreateCollectionParams) => Promise<any>;
|
|
32
|
-
deleteCollection: (name: string) => Promise<any>;
|
|
33
|
-
upsertDocuments: (collectionName: string, documents: Record<string, unknown>[]) => Promise<any>;
|
|
34
|
-
deleteDocument: (collectionName: string, documentId: string) => Promise<any>;
|
|
35
|
-
query: (collectionName: string, query: import("./lib/types").BrostarkSolutions.Search.SearchQuery) => Promise<import("./lib/types").BrostarkSolutions.Search.SearchResult>;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
25
|
+
export declare function createClient(apiKey: string, options?: CreateClientOptions): BrostarkSolutionsClient;
|
|
38
26
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
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,UAAU,EAAyC,MAAM,YAAY,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;IACzC,KAAK,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;IAC3C,MAAM,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;CAC9C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,uBAAuB,CAavG"}
|
package/package.json
CHANGED
package/src/api/v1/search.ts
CHANGED
|
@@ -66,6 +66,18 @@ export const generateSearchAPI = (apiUrl: string, apiKey: string) => {
|
|
|
66
66
|
return response.data;
|
|
67
67
|
},
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Gets a document from a search collection by its ID
|
|
71
|
+
* @param collectionName - The name of the collection to get the document from
|
|
72
|
+
* @param documentId - The ID of the document to get
|
|
73
|
+
* @returns A promise with the document
|
|
74
|
+
*/
|
|
75
|
+
getDocumentById: async (collectionName: string, documentId: string) => {
|
|
76
|
+
const response = await httpGetRequest(`${apiUrl}/search/collections/${collectionName}/documents/${documentId}`, apiKey);
|
|
77
|
+
|
|
78
|
+
return response.data;
|
|
79
|
+
},
|
|
80
|
+
|
|
69
81
|
/**
|
|
70
82
|
* Searches for documents in a search collection
|
|
71
83
|
* @param collectionName - The name of the collection to search in
|
package/src/client.ts
CHANGED
|
@@ -13,13 +13,19 @@ export interface CreateClientOptions {
|
|
|
13
13
|
version?: ApiVersion;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export interface BrostarkSolutionsClient {
|
|
17
|
+
live: ReturnType<typeof generateLiveAPI>;
|
|
18
|
+
video: ReturnType<typeof generateVideoAPI>;
|
|
19
|
+
search: ReturnType<typeof generateSearchAPI>;
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
/**
|
|
17
23
|
* Creates an instance of the API client
|
|
18
24
|
* @param apiKey - The API key for authentication
|
|
19
25
|
* @param options - The configuration options for the client
|
|
20
26
|
* @returns An object containing the different APIs available
|
|
21
27
|
*/
|
|
22
|
-
export function createClient(apiKey: string, options: CreateClientOptions = {}) {
|
|
28
|
+
export function createClient(apiKey: string, options: CreateClientOptions = {}): BrostarkSolutionsClient {
|
|
23
29
|
const {
|
|
24
30
|
host = DEFAULT_API_HOST,
|
|
25
31
|
version = DEFAULT_API_VERSION,
|