Skip to content

Commit fd35e0d

Browse files
[ENH] add collection forking to js client (chroma-core#4372)
1 parent 5d89dcf commit fd35e0d

File tree

1 file changed

+165
-0
lines changed
  • clients/js/packages/chromadb-core/src/generated

1 file changed

+165
-0
lines changed

clients/js/packages/chromadb-core/src/generated/api.ts

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2482,6 +2482,89 @@ export const ApiApiFetchParamCreator = function (
24822482
options: localVarRequestOptions,
24832483
};
24842484
},
2485+
/**
2486+
* @summary Forks an existing collection.
2487+
* @param {string} tenant <p>Tenant ID</p>
2488+
* @param {string} database <p>Database name</p>
2489+
* @param {string} collectionId <p>UUID of the collection to update</p>
2490+
* @param {Api.ForkCollectionPayload} request
2491+
* @param {RequestInit} [options] Override http request option.
2492+
* @throws {RequiredError}
2493+
*/
2494+
forkCollection(
2495+
tenant: string,
2496+
database: string,
2497+
collectionId: string,
2498+
request: Api.ForkCollectionPayload,
2499+
options: RequestInit = {},
2500+
): FetchArgs {
2501+
// verify required parameter 'tenant' is not null or undefined
2502+
if (tenant === null || tenant === undefined) {
2503+
throw new RequiredError(
2504+
"tenant",
2505+
"Required parameter tenant was null or undefined when calling forkCollection.",
2506+
);
2507+
}
2508+
// verify required parameter 'database' is not null or undefined
2509+
if (database === null || database === undefined) {
2510+
throw new RequiredError(
2511+
"database",
2512+
"Required parameter database was null or undefined when calling forkCollection.",
2513+
);
2514+
}
2515+
// verify required parameter 'collectionId' is not null or undefined
2516+
if (collectionId === null || collectionId === undefined) {
2517+
throw new RequiredError(
2518+
"collectionId",
2519+
"Required parameter collectionId was null or undefined when calling forkCollection.",
2520+
);
2521+
}
2522+
// verify required parameter 'request' is not null or undefined
2523+
if (request === null || request === undefined) {
2524+
throw new RequiredError(
2525+
"request",
2526+
"Required parameter request was null or undefined when calling forkCollection.",
2527+
);
2528+
}
2529+
let localVarPath =
2530+
`/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/fork`
2531+
.replace("{tenant}", encodeURIComponent(String(tenant)))
2532+
.replace("{database}", encodeURIComponent(String(database)))
2533+
.replace("{collection_id}", encodeURIComponent(String(collectionId)));
2534+
const localVarPathQueryStart = localVarPath.indexOf("?");
2535+
const localVarRequestOptions: RequestInit = Object.assign(
2536+
{ method: "POST" },
2537+
options,
2538+
);
2539+
const localVarHeaderParameter: Headers = options.headers
2540+
? new Headers(options.headers)
2541+
: new Headers();
2542+
const localVarQueryParameter = new URLSearchParams(
2543+
localVarPathQueryStart !== -1
2544+
? localVarPath.substring(localVarPathQueryStart + 1)
2545+
: "",
2546+
);
2547+
if (localVarPathQueryStart !== -1) {
2548+
localVarPath = localVarPath.substring(0, localVarPathQueryStart);
2549+
}
2550+
2551+
localVarHeaderParameter.set("Content-Type", "application/json");
2552+
2553+
localVarRequestOptions.headers = localVarHeaderParameter;
2554+
2555+
if (request !== undefined) {
2556+
localVarRequestOptions.body = JSON.stringify(request || {});
2557+
}
2558+
2559+
const localVarQueryParameterString = localVarQueryParameter.toString();
2560+
if (localVarQueryParameterString) {
2561+
localVarPath += "?" + localVarQueryParameterString;
2562+
}
2563+
return {
2564+
url: localVarPath,
2565+
options: localVarRequestOptions,
2566+
};
2567+
},
24852568
/**
24862569
* @summary Retrieves a collection by ID or name.
24872570
* @param {string} tenant <p>Tenant ID</p>
@@ -4811,6 +4894,63 @@ export const ApiApiFp = function (configuration?: Configuration) {
48114894
});
48124895
};
48134896
},
4897+
/**
4898+
* @summary Forks an existing collection.
4899+
* @param {string} tenant <p>Tenant ID</p>
4900+
* @param {string} database <p>Database name</p>
4901+
* @param {string} collectionId <p>UUID of the collection to update</p>
4902+
* @param {Api.ForkCollectionPayload} request
4903+
* @param {RequestInit} [options] Override http request option.
4904+
* @throws {RequiredError}
4905+
*/
4906+
forkCollection(
4907+
tenant: string,
4908+
database: string,
4909+
collectionId: string,
4910+
request: Api.ForkCollectionPayload,
4911+
options?: RequestInit,
4912+
): (fetch?: FetchAPI, basePath?: string) => Promise<Api.Collection> {
4913+
const localVarFetchArgs = ApiApiFetchParamCreator(
4914+
configuration,
4915+
).forkCollection(tenant, database, collectionId, request, options);
4916+
return (fetch: FetchAPI = defaultFetch, basePath: string = BASE_PATH) => {
4917+
return fetch(
4918+
basePath + localVarFetchArgs.url,
4919+
localVarFetchArgs.options,
4920+
).then((response) => {
4921+
const contentType = response.headers.get("Content-Type");
4922+
const mimeType = contentType
4923+
? contentType.replace(/;.*/, "")
4924+
: undefined;
4925+
4926+
if (response.status === 200) {
4927+
if (mimeType === "application/json") {
4928+
return response.json() as any;
4929+
}
4930+
throw response;
4931+
}
4932+
if (response.status === 401) {
4933+
if (mimeType === "application/json") {
4934+
throw response;
4935+
}
4936+
throw response;
4937+
}
4938+
if (response.status === 404) {
4939+
if (mimeType === "application/json") {
4940+
throw response;
4941+
}
4942+
throw response;
4943+
}
4944+
if (response.status === 500) {
4945+
if (mimeType === "application/json") {
4946+
throw response;
4947+
}
4948+
throw response;
4949+
}
4950+
throw response;
4951+
});
4952+
};
4953+
},
48144954
/**
48154955
* @summary Retrieves a collection by ID or name.
48164956
* @param {string} tenant <p>Tenant ID</p>
@@ -6113,6 +6253,31 @@ export class ApiApi extends BaseAPI {
61136253
)(this.fetch, this.basePath);
61146254
}
61156255

6256+
/**
6257+
* @summary Forks an existing collection.
6258+
* @param {string} tenant <p>Tenant ID</p>
6259+
* @param {string} database <p>Database name</p>
6260+
* @param {string} collectionId <p>UUID of the collection to update</p>
6261+
* @param {Api.ForkCollectionPayload} request
6262+
* @param {RequestInit} [options] Override http request option.
6263+
* @throws {RequiredError}
6264+
*/
6265+
public forkCollection(
6266+
tenant: string,
6267+
database: string,
6268+
collectionId: string,
6269+
request: Api.ForkCollectionPayload,
6270+
options?: RequestInit,
6271+
) {
6272+
return ApiApiFp(this.configuration).forkCollection(
6273+
tenant,
6274+
database,
6275+
collectionId,
6276+
request,
6277+
options,
6278+
)(this.fetch, this.basePath);
6279+
}
6280+
61166281
/**
61176282
* @summary Retrieves a collection by ID or name.
61186283
* @param {string} tenant <p>Tenant ID</p>

0 commit comments

Comments
 (0)