Skip to content

Commit caf5b8a

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

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
@@ -1569,6 +1569,89 @@ export const ApiApiFetchParamCreator = function (
15691569
options: localVarRequestOptions,
15701570
};
15711571
},
1572+
/**
1573+
* @summary Forks an existing collection.
1574+
* @param {string} tenant <p>Tenant ID</p>
1575+
* @param {string} database <p>Database name</p>
1576+
* @param {string} collectionId <p>UUID of the collection to update</p>
1577+
* @param {Api.ForkCollectionPayload} request
1578+
* @param {RequestInit} [options] Override http request option.
1579+
* @throws {RequiredError}
1580+
*/
1581+
forkCollection(
1582+
tenant: string,
1583+
database: string,
1584+
collectionId: string,
1585+
request: Api.ForkCollectionPayload,
1586+
options: RequestInit = {},
1587+
): FetchArgs {
1588+
// verify required parameter 'tenant' is not null or undefined
1589+
if (tenant === null || tenant === undefined) {
1590+
throw new RequiredError(
1591+
"tenant",
1592+
"Required parameter tenant was null or undefined when calling forkCollection.",
1593+
);
1594+
}
1595+
// verify required parameter 'database' is not null or undefined
1596+
if (database === null || database === undefined) {
1597+
throw new RequiredError(
1598+
"database",
1599+
"Required parameter database was null or undefined when calling forkCollection.",
1600+
);
1601+
}
1602+
// verify required parameter 'collectionId' is not null or undefined
1603+
if (collectionId === null || collectionId === undefined) {
1604+
throw new RequiredError(
1605+
"collectionId",
1606+
"Required parameter collectionId was null or undefined when calling forkCollection.",
1607+
);
1608+
}
1609+
// verify required parameter 'request' is not null or undefined
1610+
if (request === null || request === undefined) {
1611+
throw new RequiredError(
1612+
"request",
1613+
"Required parameter request was null or undefined when calling forkCollection.",
1614+
);
1615+
}
1616+
let localVarPath =
1617+
`/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/fork`
1618+
.replace("{tenant}", encodeURIComponent(String(tenant)))
1619+
.replace("{database}", encodeURIComponent(String(database)))
1620+
.replace("{collection_id}", encodeURIComponent(String(collectionId)));
1621+
const localVarPathQueryStart = localVarPath.indexOf("?");
1622+
const localVarRequestOptions: RequestInit = Object.assign(
1623+
{ method: "POST" },
1624+
options,
1625+
);
1626+
const localVarHeaderParameter: Headers = options.headers
1627+
? new Headers(options.headers)
1628+
: new Headers();
1629+
const localVarQueryParameter = new URLSearchParams(
1630+
localVarPathQueryStart !== -1
1631+
? localVarPath.substring(localVarPathQueryStart + 1)
1632+
: "",
1633+
);
1634+
if (localVarPathQueryStart !== -1) {
1635+
localVarPath = localVarPath.substring(0, localVarPathQueryStart);
1636+
}
1637+
1638+
localVarHeaderParameter.set("Content-Type", "application/json");
1639+
1640+
localVarRequestOptions.headers = localVarHeaderParameter;
1641+
1642+
if (request !== undefined) {
1643+
localVarRequestOptions.body = JSON.stringify(request || {});
1644+
}
1645+
1646+
const localVarQueryParameterString = localVarQueryParameter.toString();
1647+
if (localVarQueryParameterString) {
1648+
localVarPath += "?" + localVarQueryParameterString;
1649+
}
1650+
return {
1651+
url: localVarPath,
1652+
options: localVarRequestOptions,
1653+
};
1654+
},
15721655
/**
15731656
* @summary Retrieves a collection by ID or name.
15741657
* @param {string} tenant <p>Tenant ID</p>
@@ -3271,6 +3354,63 @@ export const ApiApiFp = function (configuration?: Configuration) {
32713354
});
32723355
};
32733356
},
3357+
/**
3358+
* @summary Forks an existing collection.
3359+
* @param {string} tenant <p>Tenant ID</p>
3360+
* @param {string} database <p>Database name</p>
3361+
* @param {string} collectionId <p>UUID of the collection to update</p>
3362+
* @param {Api.ForkCollectionPayload} request
3363+
* @param {RequestInit} [options] Override http request option.
3364+
* @throws {RequiredError}
3365+
*/
3366+
forkCollection(
3367+
tenant: string,
3368+
database: string,
3369+
collectionId: string,
3370+
request: Api.ForkCollectionPayload,
3371+
options?: RequestInit,
3372+
): (fetch?: FetchAPI, basePath?: string) => Promise<Api.Collection> {
3373+
const localVarFetchArgs = ApiApiFetchParamCreator(
3374+
configuration,
3375+
).forkCollection(tenant, database, collectionId, request, options);
3376+
return (fetch: FetchAPI = defaultFetch, basePath: string = BASE_PATH) => {
3377+
return fetch(
3378+
basePath + localVarFetchArgs.url,
3379+
localVarFetchArgs.options,
3380+
).then((response) => {
3381+
const contentType = response.headers.get("Content-Type");
3382+
const mimeType = contentType
3383+
? contentType.replace(/;.*/, "")
3384+
: undefined;
3385+
3386+
if (response.status === 200) {
3387+
if (mimeType === "application/json") {
3388+
return response.json() as any;
3389+
}
3390+
throw response;
3391+
}
3392+
if (response.status === 401) {
3393+
if (mimeType === "application/json") {
3394+
throw response;
3395+
}
3396+
throw response;
3397+
}
3398+
if (response.status === 404) {
3399+
if (mimeType === "application/json") {
3400+
throw response;
3401+
}
3402+
throw response;
3403+
}
3404+
if (response.status === 500) {
3405+
if (mimeType === "application/json") {
3406+
throw response;
3407+
}
3408+
throw response;
3409+
}
3410+
throw response;
3411+
});
3412+
};
3413+
},
32743414
/**
32753415
* @summary Retrieves a collection by ID or name.
32763416
* @param {string} tenant <p>Tenant ID</p>
@@ -4298,6 +4438,31 @@ export class ApiApi extends BaseAPI {
42984438
)(this.fetch, this.basePath);
42994439
}
43004440

4441+
/**
4442+
* @summary Forks an existing collection.
4443+
* @param {string} tenant <p>Tenant ID</p>
4444+
* @param {string} database <p>Database name</p>
4445+
* @param {string} collectionId <p>UUID of the collection to update</p>
4446+
* @param {Api.ForkCollectionPayload} request
4447+
* @param {RequestInit} [options] Override http request option.
4448+
* @throws {RequiredError}
4449+
*/
4450+
public forkCollection(
4451+
tenant: string,
4452+
database: string,
4453+
collectionId: string,
4454+
request: Api.ForkCollectionPayload,
4455+
options?: RequestInit,
4456+
) {
4457+
return ApiApiFp(this.configuration).forkCollection(
4458+
tenant,
4459+
database,
4460+
collectionId,
4461+
request,
4462+
options,
4463+
)(this.fetch, this.basePath);
4464+
}
4465+
43014466
/**
43024467
* @summary Retrieves a collection by ID or name.
43034468
* @param {string} tenant <p>Tenant ID</p>

0 commit comments

Comments
 (0)