Skip to content

Commit cfeb3fa

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

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
@@ -1652,6 +1652,89 @@ export const ApiApiFetchParamCreator = function (
16521652
options: localVarRequestOptions,
16531653
};
16541654
},
1655+
/**
1656+
* @summary Forks an existing collection.
1657+
* @param {string} tenant <p>Tenant ID</p>
1658+
* @param {string} database <p>Database name</p>
1659+
* @param {string} collectionId <p>UUID of the collection to update</p>
1660+
* @param {Api.ForkCollectionPayload} request
1661+
* @param {RequestInit} [options] Override http request option.
1662+
* @throws {RequiredError}
1663+
*/
1664+
forkCollection(
1665+
tenant: string,
1666+
database: string,
1667+
collectionId: string,
1668+
request: Api.ForkCollectionPayload,
1669+
options: RequestInit = {},
1670+
): FetchArgs {
1671+
// verify required parameter 'tenant' is not null or undefined
1672+
if (tenant === null || tenant === undefined) {
1673+
throw new RequiredError(
1674+
"tenant",
1675+
"Required parameter tenant was null or undefined when calling forkCollection.",
1676+
);
1677+
}
1678+
// verify required parameter 'database' is not null or undefined
1679+
if (database === null || database === undefined) {
1680+
throw new RequiredError(
1681+
"database",
1682+
"Required parameter database was null or undefined when calling forkCollection.",
1683+
);
1684+
}
1685+
// verify required parameter 'collectionId' is not null or undefined
1686+
if (collectionId === null || collectionId === undefined) {
1687+
throw new RequiredError(
1688+
"collectionId",
1689+
"Required parameter collectionId was null or undefined when calling forkCollection.",
1690+
);
1691+
}
1692+
// verify required parameter 'request' is not null or undefined
1693+
if (request === null || request === undefined) {
1694+
throw new RequiredError(
1695+
"request",
1696+
"Required parameter request was null or undefined when calling forkCollection.",
1697+
);
1698+
}
1699+
let localVarPath =
1700+
`/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/fork`
1701+
.replace("{tenant}", encodeURIComponent(String(tenant)))
1702+
.replace("{database}", encodeURIComponent(String(database)))
1703+
.replace("{collection_id}", encodeURIComponent(String(collectionId)));
1704+
const localVarPathQueryStart = localVarPath.indexOf("?");
1705+
const localVarRequestOptions: RequestInit = Object.assign(
1706+
{ method: "POST" },
1707+
options,
1708+
);
1709+
const localVarHeaderParameter: Headers = options.headers
1710+
? new Headers(options.headers)
1711+
: new Headers();
1712+
const localVarQueryParameter = new URLSearchParams(
1713+
localVarPathQueryStart !== -1
1714+
? localVarPath.substring(localVarPathQueryStart + 1)
1715+
: "",
1716+
);
1717+
if (localVarPathQueryStart !== -1) {
1718+
localVarPath = localVarPath.substring(0, localVarPathQueryStart);
1719+
}
1720+
1721+
localVarHeaderParameter.set("Content-Type", "application/json");
1722+
1723+
localVarRequestOptions.headers = localVarHeaderParameter;
1724+
1725+
if (request !== undefined) {
1726+
localVarRequestOptions.body = JSON.stringify(request || {});
1727+
}
1728+
1729+
const localVarQueryParameterString = localVarQueryParameter.toString();
1730+
if (localVarQueryParameterString) {
1731+
localVarPath += "?" + localVarQueryParameterString;
1732+
}
1733+
return {
1734+
url: localVarPath,
1735+
options: localVarRequestOptions,
1736+
};
1737+
},
16551738
/**
16561739
* @summary Retrieves a collection by ID or name.
16571740
* @param {string} tenant <p>Tenant ID</p>
@@ -3411,6 +3494,63 @@ export const ApiApiFp = function (configuration?: Configuration) {
34113494
});
34123495
};
34133496
},
3497+
/**
3498+
* @summary Forks an existing collection.
3499+
* @param {string} tenant <p>Tenant ID</p>
3500+
* @param {string} database <p>Database name</p>
3501+
* @param {string} collectionId <p>UUID of the collection to update</p>
3502+
* @param {Api.ForkCollectionPayload} request
3503+
* @param {RequestInit} [options] Override http request option.
3504+
* @throws {RequiredError}
3505+
*/
3506+
forkCollection(
3507+
tenant: string,
3508+
database: string,
3509+
collectionId: string,
3510+
request: Api.ForkCollectionPayload,
3511+
options?: RequestInit,
3512+
): (fetch?: FetchAPI, basePath?: string) => Promise<Api.Collection> {
3513+
const localVarFetchArgs = ApiApiFetchParamCreator(
3514+
configuration,
3515+
).forkCollection(tenant, database, collectionId, request, options);
3516+
return (fetch: FetchAPI = defaultFetch, basePath: string = BASE_PATH) => {
3517+
return fetch(
3518+
basePath + localVarFetchArgs.url,
3519+
localVarFetchArgs.options,
3520+
).then((response) => {
3521+
const contentType = response.headers.get("Content-Type");
3522+
const mimeType = contentType
3523+
? contentType.replace(/;.*/, "")
3524+
: undefined;
3525+
3526+
if (response.status === 200) {
3527+
if (mimeType === "application/json") {
3528+
return response.json() as any;
3529+
}
3530+
throw response;
3531+
}
3532+
if (response.status === 401) {
3533+
if (mimeType === "application/json") {
3534+
throw response;
3535+
}
3536+
throw response;
3537+
}
3538+
if (response.status === 404) {
3539+
if (mimeType === "application/json") {
3540+
throw response;
3541+
}
3542+
throw response;
3543+
}
3544+
if (response.status === 500) {
3545+
if (mimeType === "application/json") {
3546+
throw response;
3547+
}
3548+
throw response;
3549+
}
3550+
throw response;
3551+
});
3552+
};
3553+
},
34143554
/**
34153555
* @summary Retrieves a collection by ID or name.
34163556
* @param {string} tenant <p>Tenant ID</p>
@@ -4463,6 +4603,31 @@ export class ApiApi extends BaseAPI {
44634603
)(this.fetch, this.basePath);
44644604
}
44654605

4606+
/**
4607+
* @summary Forks an existing collection.
4608+
* @param {string} tenant <p>Tenant ID</p>
4609+
* @param {string} database <p>Database name</p>
4610+
* @param {string} collectionId <p>UUID of the collection to update</p>
4611+
* @param {Api.ForkCollectionPayload} request
4612+
* @param {RequestInit} [options] Override http request option.
4613+
* @throws {RequiredError}
4614+
*/
4615+
public forkCollection(
4616+
tenant: string,
4617+
database: string,
4618+
collectionId: string,
4619+
request: Api.ForkCollectionPayload,
4620+
options?: RequestInit,
4621+
) {
4622+
return ApiApiFp(this.configuration).forkCollection(
4623+
tenant,
4624+
database,
4625+
collectionId,
4626+
request,
4627+
options,
4628+
)(this.fetch, this.basePath);
4629+
}
4630+
44664631
/**
44674632
* @summary Retrieves a collection by ID or name.
44684633
* @param {string} tenant <p>Tenant ID</p>

0 commit comments

Comments
 (0)