Skip to content

Commit 4ad8a64

Browse files
[ENH] add collection forking to js client (chroma-core#4372)
1 parent 546f720 commit 4ad8a64

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
@@ -1486,6 +1486,89 @@ export const ApiApiFetchParamCreator = function (
14861486
options: localVarRequestOptions,
14871487
};
14881488
},
1489+
/**
1490+
* @summary Forks an existing collection.
1491+
* @param {string} tenant <p>Tenant ID</p>
1492+
* @param {string} database <p>Database name</p>
1493+
* @param {string} collectionId <p>UUID of the collection to update</p>
1494+
* @param {Api.ForkCollectionPayload} request
1495+
* @param {RequestInit} [options] Override http request option.
1496+
* @throws {RequiredError}
1497+
*/
1498+
forkCollection(
1499+
tenant: string,
1500+
database: string,
1501+
collectionId: string,
1502+
request: Api.ForkCollectionPayload,
1503+
options: RequestInit = {},
1504+
): FetchArgs {
1505+
// verify required parameter 'tenant' is not null or undefined
1506+
if (tenant === null || tenant === undefined) {
1507+
throw new RequiredError(
1508+
"tenant",
1509+
"Required parameter tenant was null or undefined when calling forkCollection.",
1510+
);
1511+
}
1512+
// verify required parameter 'database' is not null or undefined
1513+
if (database === null || database === undefined) {
1514+
throw new RequiredError(
1515+
"database",
1516+
"Required parameter database was null or undefined when calling forkCollection.",
1517+
);
1518+
}
1519+
// verify required parameter 'collectionId' is not null or undefined
1520+
if (collectionId === null || collectionId === undefined) {
1521+
throw new RequiredError(
1522+
"collectionId",
1523+
"Required parameter collectionId was null or undefined when calling forkCollection.",
1524+
);
1525+
}
1526+
// verify required parameter 'request' is not null or undefined
1527+
if (request === null || request === undefined) {
1528+
throw new RequiredError(
1529+
"request",
1530+
"Required parameter request was null or undefined when calling forkCollection.",
1531+
);
1532+
}
1533+
let localVarPath =
1534+
`/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/fork`
1535+
.replace("{tenant}", encodeURIComponent(String(tenant)))
1536+
.replace("{database}", encodeURIComponent(String(database)))
1537+
.replace("{collection_id}", encodeURIComponent(String(collectionId)));
1538+
const localVarPathQueryStart = localVarPath.indexOf("?");
1539+
const localVarRequestOptions: RequestInit = Object.assign(
1540+
{ method: "POST" },
1541+
options,
1542+
);
1543+
const localVarHeaderParameter: Headers = options.headers
1544+
? new Headers(options.headers)
1545+
: new Headers();
1546+
const localVarQueryParameter = new URLSearchParams(
1547+
localVarPathQueryStart !== -1
1548+
? localVarPath.substring(localVarPathQueryStart + 1)
1549+
: "",
1550+
);
1551+
if (localVarPathQueryStart !== -1) {
1552+
localVarPath = localVarPath.substring(0, localVarPathQueryStart);
1553+
}
1554+
1555+
localVarHeaderParameter.set("Content-Type", "application/json");
1556+
1557+
localVarRequestOptions.headers = localVarHeaderParameter;
1558+
1559+
if (request !== undefined) {
1560+
localVarRequestOptions.body = JSON.stringify(request || {});
1561+
}
1562+
1563+
const localVarQueryParameterString = localVarQueryParameter.toString();
1564+
if (localVarQueryParameterString) {
1565+
localVarPath += "?" + localVarQueryParameterString;
1566+
}
1567+
return {
1568+
url: localVarPath,
1569+
options: localVarRequestOptions,
1570+
};
1571+
},
14891572
/**
14901573
* @summary Retrieves a collection by ID or name.
14911574
* @param {string} tenant <p>Tenant ID</p>
@@ -3131,6 +3214,63 @@ export const ApiApiFp = function (configuration?: Configuration) {
31313214
});
31323215
};
31333216
},
3217+
/**
3218+
* @summary Forks an existing collection.
3219+
* @param {string} tenant <p>Tenant ID</p>
3220+
* @param {string} database <p>Database name</p>
3221+
* @param {string} collectionId <p>UUID of the collection to update</p>
3222+
* @param {Api.ForkCollectionPayload} request
3223+
* @param {RequestInit} [options] Override http request option.
3224+
* @throws {RequiredError}
3225+
*/
3226+
forkCollection(
3227+
tenant: string,
3228+
database: string,
3229+
collectionId: string,
3230+
request: Api.ForkCollectionPayload,
3231+
options?: RequestInit,
3232+
): (fetch?: FetchAPI, basePath?: string) => Promise<Api.Collection> {
3233+
const localVarFetchArgs = ApiApiFetchParamCreator(
3234+
configuration,
3235+
).forkCollection(tenant, database, collectionId, request, options);
3236+
return (fetch: FetchAPI = defaultFetch, basePath: string = BASE_PATH) => {
3237+
return fetch(
3238+
basePath + localVarFetchArgs.url,
3239+
localVarFetchArgs.options,
3240+
).then((response) => {
3241+
const contentType = response.headers.get("Content-Type");
3242+
const mimeType = contentType
3243+
? contentType.replace(/;.*/, "")
3244+
: undefined;
3245+
3246+
if (response.status === 200) {
3247+
if (mimeType === "application/json") {
3248+
return response.json() as any;
3249+
}
3250+
throw response;
3251+
}
3252+
if (response.status === 401) {
3253+
if (mimeType === "application/json") {
3254+
throw response;
3255+
}
3256+
throw response;
3257+
}
3258+
if (response.status === 404) {
3259+
if (mimeType === "application/json") {
3260+
throw response;
3261+
}
3262+
throw response;
3263+
}
3264+
if (response.status === 500) {
3265+
if (mimeType === "application/json") {
3266+
throw response;
3267+
}
3268+
throw response;
3269+
}
3270+
throw response;
3271+
});
3272+
};
3273+
},
31343274
/**
31353275
* @summary Retrieves a collection by ID or name.
31363276
* @param {string} tenant <p>Tenant ID</p>
@@ -4133,6 +4273,31 @@ export class ApiApi extends BaseAPI {
41334273
)(this.fetch, this.basePath);
41344274
}
41354275

4276+
/**
4277+
* @summary Forks an existing collection.
4278+
* @param {string} tenant <p>Tenant ID</p>
4279+
* @param {string} database <p>Database name</p>
4280+
* @param {string} collectionId <p>UUID of the collection to update</p>
4281+
* @param {Api.ForkCollectionPayload} request
4282+
* @param {RequestInit} [options] Override http request option.
4283+
* @throws {RequiredError}
4284+
*/
4285+
public forkCollection(
4286+
tenant: string,
4287+
database: string,
4288+
collectionId: string,
4289+
request: Api.ForkCollectionPayload,
4290+
options?: RequestInit,
4291+
) {
4292+
return ApiApiFp(this.configuration).forkCollection(
4293+
tenant,
4294+
database,
4295+
collectionId,
4296+
request,
4297+
options,
4298+
)(this.fetch, this.basePath);
4299+
}
4300+
41364301
/**
41374302
* @summary Retrieves a collection by ID or name.
41384303
* @param {string} tenant <p>Tenant ID</p>

0 commit comments

Comments
 (0)