Skip to content

Commit c61c716

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

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
@@ -1818,6 +1818,89 @@ export const ApiApiFetchParamCreator = function (
18181818
options: localVarRequestOptions,
18191819
};
18201820
},
1821+
/**
1822+
* @summary Forks an existing collection.
1823+
* @param {string} tenant <p>Tenant ID</p>
1824+
* @param {string} database <p>Database name</p>
1825+
* @param {string} collectionId <p>UUID of the collection to update</p>
1826+
* @param {Api.ForkCollectionPayload} request
1827+
* @param {RequestInit} [options] Override http request option.
1828+
* @throws {RequiredError}
1829+
*/
1830+
forkCollection(
1831+
tenant: string,
1832+
database: string,
1833+
collectionId: string,
1834+
request: Api.ForkCollectionPayload,
1835+
options: RequestInit = {},
1836+
): FetchArgs {
1837+
// verify required parameter 'tenant' is not null or undefined
1838+
if (tenant === null || tenant === undefined) {
1839+
throw new RequiredError(
1840+
"tenant",
1841+
"Required parameter tenant was null or undefined when calling forkCollection.",
1842+
);
1843+
}
1844+
// verify required parameter 'database' is not null or undefined
1845+
if (database === null || database === undefined) {
1846+
throw new RequiredError(
1847+
"database",
1848+
"Required parameter database was null or undefined when calling forkCollection.",
1849+
);
1850+
}
1851+
// verify required parameter 'collectionId' is not null or undefined
1852+
if (collectionId === null || collectionId === undefined) {
1853+
throw new RequiredError(
1854+
"collectionId",
1855+
"Required parameter collectionId was null or undefined when calling forkCollection.",
1856+
);
1857+
}
1858+
// verify required parameter 'request' is not null or undefined
1859+
if (request === null || request === undefined) {
1860+
throw new RequiredError(
1861+
"request",
1862+
"Required parameter request was null or undefined when calling forkCollection.",
1863+
);
1864+
}
1865+
let localVarPath =
1866+
`/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/fork`
1867+
.replace("{tenant}", encodeURIComponent(String(tenant)))
1868+
.replace("{database}", encodeURIComponent(String(database)))
1869+
.replace("{collection_id}", encodeURIComponent(String(collectionId)));
1870+
const localVarPathQueryStart = localVarPath.indexOf("?");
1871+
const localVarRequestOptions: RequestInit = Object.assign(
1872+
{ method: "POST" },
1873+
options,
1874+
);
1875+
const localVarHeaderParameter: Headers = options.headers
1876+
? new Headers(options.headers)
1877+
: new Headers();
1878+
const localVarQueryParameter = new URLSearchParams(
1879+
localVarPathQueryStart !== -1
1880+
? localVarPath.substring(localVarPathQueryStart + 1)
1881+
: "",
1882+
);
1883+
if (localVarPathQueryStart !== -1) {
1884+
localVarPath = localVarPath.substring(0, localVarPathQueryStart);
1885+
}
1886+
1887+
localVarHeaderParameter.set("Content-Type", "application/json");
1888+
1889+
localVarRequestOptions.headers = localVarHeaderParameter;
1890+
1891+
if (request !== undefined) {
1892+
localVarRequestOptions.body = JSON.stringify(request || {});
1893+
}
1894+
1895+
const localVarQueryParameterString = localVarQueryParameter.toString();
1896+
if (localVarQueryParameterString) {
1897+
localVarPath += "?" + localVarQueryParameterString;
1898+
}
1899+
return {
1900+
url: localVarPath,
1901+
options: localVarRequestOptions,
1902+
};
1903+
},
18211904
/**
18221905
* @summary Retrieves a collection by ID or name.
18231906
* @param {string} tenant <p>Tenant ID</p>
@@ -3691,6 +3774,63 @@ export const ApiApiFp = function (configuration?: Configuration) {
36913774
});
36923775
};
36933776
},
3777+
/**
3778+
* @summary Forks an existing collection.
3779+
* @param {string} tenant <p>Tenant ID</p>
3780+
* @param {string} database <p>Database name</p>
3781+
* @param {string} collectionId <p>UUID of the collection to update</p>
3782+
* @param {Api.ForkCollectionPayload} request
3783+
* @param {RequestInit} [options] Override http request option.
3784+
* @throws {RequiredError}
3785+
*/
3786+
forkCollection(
3787+
tenant: string,
3788+
database: string,
3789+
collectionId: string,
3790+
request: Api.ForkCollectionPayload,
3791+
options?: RequestInit,
3792+
): (fetch?: FetchAPI, basePath?: string) => Promise<Api.Collection> {
3793+
const localVarFetchArgs = ApiApiFetchParamCreator(
3794+
configuration,
3795+
).forkCollection(tenant, database, collectionId, request, options);
3796+
return (fetch: FetchAPI = defaultFetch, basePath: string = BASE_PATH) => {
3797+
return fetch(
3798+
basePath + localVarFetchArgs.url,
3799+
localVarFetchArgs.options,
3800+
).then((response) => {
3801+
const contentType = response.headers.get("Content-Type");
3802+
const mimeType = contentType
3803+
? contentType.replace(/;.*/, "")
3804+
: undefined;
3805+
3806+
if (response.status === 200) {
3807+
if (mimeType === "application/json") {
3808+
return response.json() as any;
3809+
}
3810+
throw response;
3811+
}
3812+
if (response.status === 401) {
3813+
if (mimeType === "application/json") {
3814+
throw response;
3815+
}
3816+
throw response;
3817+
}
3818+
if (response.status === 404) {
3819+
if (mimeType === "application/json") {
3820+
throw response;
3821+
}
3822+
throw response;
3823+
}
3824+
if (response.status === 500) {
3825+
if (mimeType === "application/json") {
3826+
throw response;
3827+
}
3828+
throw response;
3829+
}
3830+
throw response;
3831+
});
3832+
};
3833+
},
36943834
/**
36953835
* @summary Retrieves a collection by ID or name.
36963836
* @param {string} tenant <p>Tenant ID</p>
@@ -4793,6 +4933,31 @@ export class ApiApi extends BaseAPI {
47934933
)(this.fetch, this.basePath);
47944934
}
47954935

4936+
/**
4937+
* @summary Forks an existing collection.
4938+
* @param {string} tenant <p>Tenant ID</p>
4939+
* @param {string} database <p>Database name</p>
4940+
* @param {string} collectionId <p>UUID of the collection to update</p>
4941+
* @param {Api.ForkCollectionPayload} request
4942+
* @param {RequestInit} [options] Override http request option.
4943+
* @throws {RequiredError}
4944+
*/
4945+
public forkCollection(
4946+
tenant: string,
4947+
database: string,
4948+
collectionId: string,
4949+
request: Api.ForkCollectionPayload,
4950+
options?: RequestInit,
4951+
) {
4952+
return ApiApiFp(this.configuration).forkCollection(
4953+
tenant,
4954+
database,
4955+
collectionId,
4956+
request,
4957+
options,
4958+
)(this.fetch, this.basePath);
4959+
}
4960+
47964961
/**
47974962
* @summary Retrieves a collection by ID or name.
47984963
* @param {string} tenant <p>Tenant ID</p>

0 commit comments

Comments
 (0)