Skip to content

Commit 2c03b8d

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

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
@@ -1901,6 +1901,89 @@ export const ApiApiFetchParamCreator = function (
19011901
options: localVarRequestOptions,
19021902
};
19031903
},
1904+
/**
1905+
* @summary Forks an existing collection.
1906+
* @param {string} tenant <p>Tenant ID</p>
1907+
* @param {string} database <p>Database name</p>
1908+
* @param {string} collectionId <p>UUID of the collection to update</p>
1909+
* @param {Api.ForkCollectionPayload} request
1910+
* @param {RequestInit} [options] Override http request option.
1911+
* @throws {RequiredError}
1912+
*/
1913+
forkCollection(
1914+
tenant: string,
1915+
database: string,
1916+
collectionId: string,
1917+
request: Api.ForkCollectionPayload,
1918+
options: RequestInit = {},
1919+
): FetchArgs {
1920+
// verify required parameter 'tenant' is not null or undefined
1921+
if (tenant === null || tenant === undefined) {
1922+
throw new RequiredError(
1923+
"tenant",
1924+
"Required parameter tenant was null or undefined when calling forkCollection.",
1925+
);
1926+
}
1927+
// verify required parameter 'database' is not null or undefined
1928+
if (database === null || database === undefined) {
1929+
throw new RequiredError(
1930+
"database",
1931+
"Required parameter database was null or undefined when calling forkCollection.",
1932+
);
1933+
}
1934+
// verify required parameter 'collectionId' is not null or undefined
1935+
if (collectionId === null || collectionId === undefined) {
1936+
throw new RequiredError(
1937+
"collectionId",
1938+
"Required parameter collectionId was null or undefined when calling forkCollection.",
1939+
);
1940+
}
1941+
// verify required parameter 'request' is not null or undefined
1942+
if (request === null || request === undefined) {
1943+
throw new RequiredError(
1944+
"request",
1945+
"Required parameter request was null or undefined when calling forkCollection.",
1946+
);
1947+
}
1948+
let localVarPath =
1949+
`/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/fork`
1950+
.replace("{tenant}", encodeURIComponent(String(tenant)))
1951+
.replace("{database}", encodeURIComponent(String(database)))
1952+
.replace("{collection_id}", encodeURIComponent(String(collectionId)));
1953+
const localVarPathQueryStart = localVarPath.indexOf("?");
1954+
const localVarRequestOptions: RequestInit = Object.assign(
1955+
{ method: "POST" },
1956+
options,
1957+
);
1958+
const localVarHeaderParameter: Headers = options.headers
1959+
? new Headers(options.headers)
1960+
: new Headers();
1961+
const localVarQueryParameter = new URLSearchParams(
1962+
localVarPathQueryStart !== -1
1963+
? localVarPath.substring(localVarPathQueryStart + 1)
1964+
: "",
1965+
);
1966+
if (localVarPathQueryStart !== -1) {
1967+
localVarPath = localVarPath.substring(0, localVarPathQueryStart);
1968+
}
1969+
1970+
localVarHeaderParameter.set("Content-Type", "application/json");
1971+
1972+
localVarRequestOptions.headers = localVarHeaderParameter;
1973+
1974+
if (request !== undefined) {
1975+
localVarRequestOptions.body = JSON.stringify(request || {});
1976+
}
1977+
1978+
const localVarQueryParameterString = localVarQueryParameter.toString();
1979+
if (localVarQueryParameterString) {
1980+
localVarPath += "?" + localVarQueryParameterString;
1981+
}
1982+
return {
1983+
url: localVarPath,
1984+
options: localVarRequestOptions,
1985+
};
1986+
},
19041987
/**
19051988
* @summary Retrieves a collection by ID or name.
19061989
* @param {string} tenant <p>Tenant ID</p>
@@ -3831,6 +3914,63 @@ export const ApiApiFp = function (configuration?: Configuration) {
38313914
});
38323915
};
38333916
},
3917+
/**
3918+
* @summary Forks an existing collection.
3919+
* @param {string} tenant <p>Tenant ID</p>
3920+
* @param {string} database <p>Database name</p>
3921+
* @param {string} collectionId <p>UUID of the collection to update</p>
3922+
* @param {Api.ForkCollectionPayload} request
3923+
* @param {RequestInit} [options] Override http request option.
3924+
* @throws {RequiredError}
3925+
*/
3926+
forkCollection(
3927+
tenant: string,
3928+
database: string,
3929+
collectionId: string,
3930+
request: Api.ForkCollectionPayload,
3931+
options?: RequestInit,
3932+
): (fetch?: FetchAPI, basePath?: string) => Promise<Api.Collection> {
3933+
const localVarFetchArgs = ApiApiFetchParamCreator(
3934+
configuration,
3935+
).forkCollection(tenant, database, collectionId, request, options);
3936+
return (fetch: FetchAPI = defaultFetch, basePath: string = BASE_PATH) => {
3937+
return fetch(
3938+
basePath + localVarFetchArgs.url,
3939+
localVarFetchArgs.options,
3940+
).then((response) => {
3941+
const contentType = response.headers.get("Content-Type");
3942+
const mimeType = contentType
3943+
? contentType.replace(/;.*/, "")
3944+
: undefined;
3945+
3946+
if (response.status === 200) {
3947+
if (mimeType === "application/json") {
3948+
return response.json() as any;
3949+
}
3950+
throw response;
3951+
}
3952+
if (response.status === 401) {
3953+
if (mimeType === "application/json") {
3954+
throw response;
3955+
}
3956+
throw response;
3957+
}
3958+
if (response.status === 404) {
3959+
if (mimeType === "application/json") {
3960+
throw response;
3961+
}
3962+
throw response;
3963+
}
3964+
if (response.status === 500) {
3965+
if (mimeType === "application/json") {
3966+
throw response;
3967+
}
3968+
throw response;
3969+
}
3970+
throw response;
3971+
});
3972+
};
3973+
},
38343974
/**
38353975
* @summary Retrieves a collection by ID or name.
38363976
* @param {string} tenant <p>Tenant ID</p>
@@ -4958,6 +5098,31 @@ export class ApiApi extends BaseAPI {
49585098
)(this.fetch, this.basePath);
49595099
}
49605100

5101+
/**
5102+
* @summary Forks an existing collection.
5103+
* @param {string} tenant <p>Tenant ID</p>
5104+
* @param {string} database <p>Database name</p>
5105+
* @param {string} collectionId <p>UUID of the collection to update</p>
5106+
* @param {Api.ForkCollectionPayload} request
5107+
* @param {RequestInit} [options] Override http request option.
5108+
* @throws {RequiredError}
5109+
*/
5110+
public forkCollection(
5111+
tenant: string,
5112+
database: string,
5113+
collectionId: string,
5114+
request: Api.ForkCollectionPayload,
5115+
options?: RequestInit,
5116+
) {
5117+
return ApiApiFp(this.configuration).forkCollection(
5118+
tenant,
5119+
database,
5120+
collectionId,
5121+
request,
5122+
options,
5123+
)(this.fetch, this.basePath);
5124+
}
5125+
49615126
/**
49625127
* @summary Retrieves a collection by ID or name.
49635128
* @param {string} tenant <p>Tenant ID</p>

0 commit comments

Comments
 (0)