-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Shuyou <[email protected]>
- Loading branch information
1 parent
6ed6eaa
commit 272681a
Showing
16 changed files
with
1,119 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { HttpBaseClient } from '../HttpClient'; | ||
import { | ||
Constructor, | ||
FetchOptions, | ||
HttpAliasBaseReq, | ||
HttpBaseResponse, | ||
HttpAliasCreateReq, | ||
HttpAliasAlterReq, | ||
HttpAliasDescribeReq, | ||
HttpAliasDropReq, | ||
HttpAliasDescribeResponse, | ||
} from '../types'; | ||
|
||
/** | ||
* | ||
* @param {Constructor<HttpBaseClient>} Base - The base class to be extended. | ||
* @returns {class} - The extended class with additional methods for collection management. | ||
* | ||
* @method listAliases - Lists all aliases in a collection. | ||
* @method createAlias - Creates a new alias in a collection. | ||
* @method describeAlias - Describes an alias. | ||
* @method dropAlias - Deletes an alias. | ||
* @method alterAlias - Modifies an alias to another collection. | ||
*/ | ||
export function Alias<T extends Constructor<HttpBaseClient>>(Base: T) { | ||
return class extends Base { | ||
get aliasPrefix() { | ||
return '/vectordb/aliases'; | ||
} | ||
|
||
async listAliases(params: HttpAliasBaseReq, options?: FetchOptions) { | ||
const url = `${this.aliasPrefix}/list`; | ||
return await this.POST<HttpBaseResponse<string[]>>(url, params, options); | ||
} | ||
|
||
async createAlias(params: HttpAliasCreateReq, options?: FetchOptions) { | ||
const url = `${this.aliasPrefix}/create`; | ||
return await this.POST<HttpBaseResponse>(url, params, options); | ||
} | ||
|
||
async describeAlias(params: HttpAliasDescribeReq, options?: FetchOptions) { | ||
const url = `${this.aliasPrefix}/describe`; | ||
return await this.POST<HttpAliasDescribeResponse>(url, params, options); | ||
} | ||
|
||
async dropAlias(params: HttpAliasDropReq, options?: FetchOptions) { | ||
const url = `${this.aliasPrefix}/drop`; | ||
return await this.POST<HttpBaseResponse>(url, params, options); | ||
} | ||
|
||
async alterAlias(params: HttpAliasAlterReq, options?: FetchOptions) { | ||
const url = `${this.aliasPrefix}/alter`; | ||
return await this.POST<HttpBaseResponse>(url, params, options); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { HttpBaseClient } from '../HttpClient'; | ||
import { | ||
Constructor, | ||
FetchOptions, | ||
HttpBaseReq, | ||
HttpImportListResponse, | ||
HttpImportCreateReq, | ||
HttpImportCreateResponse, | ||
HttpImportProgressReq, | ||
} from '../types'; | ||
|
||
/** | ||
* | ||
* @param {Constructor<HttpBaseClient>} Base - The base class to be extended. | ||
* @returns {class} - The extended class with additional methods for collection management. | ||
* | ||
* @method listImportJobs - Lists all import jobs. | ||
* @method createImportJobs - Creates new import jobs. | ||
* @method getImportJobProgress - Retrieves the progress of an import job. | ||
*/ | ||
export function Import<T extends Constructor<HttpBaseClient>>(Base: T) { | ||
return class extends Base { | ||
get importPrefix() { | ||
return '/vectordb/jobs/import'; | ||
} | ||
|
||
async listImportJobs(params: HttpBaseReq, options?: FetchOptions) { | ||
const url = `${this.importPrefix}/list`; | ||
return await this.POST<HttpImportListResponse>(url, params, options); | ||
} | ||
|
||
async createImportJobs( | ||
params: HttpImportCreateReq, | ||
options?: FetchOptions | ||
) { | ||
const url = `${this.importPrefix}/create`; | ||
return await this.POST<HttpImportCreateResponse>(url, params, options); | ||
} | ||
|
||
async getImportJobProgress( | ||
params: HttpImportProgressReq, | ||
options?: FetchOptions | ||
) { | ||
const url = `${this.importPrefix}/get_progress`; | ||
return await this.POST<HttpImportCreateResponse>(url, params, options); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { HttpBaseClient } from '../HttpClient'; | ||
import { | ||
Constructor, | ||
FetchOptions, | ||
HttpBaseReq, | ||
HttpBaseResponse, | ||
HttpIndexCreateReq, | ||
HttpIndexBaseReq, | ||
HttpIndexDescribeResponse, | ||
} from '../types'; | ||
|
||
/** | ||
* | ||
* @param {Constructor<HttpBaseClient>} Base - The base class to be extended. | ||
* @returns {class} - The extended class with additional methods for collection management. | ||
* | ||
*@method createIndex - Creates an index. | ||
*@method dropIndex - Deletes an index. | ||
*@method describeIndex - Describes an index. | ||
*@method listIndexes - Lists all indexes. | ||
*/ | ||
export function MilvusIndex<T extends Constructor<HttpBaseClient>>(Base: T) { | ||
return class extends Base { | ||
get indexPrefix() { | ||
return '/vectordb/indexes'; | ||
} | ||
|
||
async createIndex(params: HttpIndexCreateReq, options?: FetchOptions) { | ||
const url = `${this.indexPrefix}/create`; | ||
return this.POST<HttpBaseResponse>(url, params, options); | ||
} | ||
|
||
async dropIndex(params: HttpIndexBaseReq, options?: FetchOptions) { | ||
const url = `${this.indexPrefix}/drop`; | ||
return this.POST<HttpBaseResponse>(url, params, options); | ||
} | ||
|
||
async describeIndex(params: HttpIndexBaseReq, options?: FetchOptions) { | ||
const url = `${this.indexPrefix}/describe`; | ||
return this.POST<HttpIndexDescribeResponse>(url, params, options); | ||
} | ||
|
||
async listIndexes(params: HttpBaseReq, options?: FetchOptions) { | ||
const url = `${this.indexPrefix}/list`; | ||
return this.POST<HttpBaseResponse<string[]>>(url, params, options); | ||
} | ||
}; | ||
} |
Oops, something went wrong.