Skip to content

Commit e353cf1

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

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
@@ -1984,6 +1984,89 @@ export const ApiApiFetchParamCreator = function (
19841984
options: localVarRequestOptions,
19851985
};
19861986
},
1987+
/**
1988+
* @summary Forks an existing collection.
1989+
* @param {string} tenant <p>Tenant ID</p>
1990+
* @param {string} database <p>Database name</p>
1991+
* @param {string} collectionId <p>UUID of the collection to update</p>
1992+
* @param {Api.ForkCollectionPayload} request
1993+
* @param {RequestInit} [options] Override http request option.
1994+
* @throws {RequiredError}
1995+
*/
1996+
forkCollection(
1997+
tenant: string,
1998+
database: string,
1999+
collectionId: string,
2000+
request: Api.ForkCollectionPayload,
2001+
options: RequestInit = {},
2002+
): FetchArgs {
2003+
// verify required parameter 'tenant' is not null or undefined
2004+
if (tenant === null || tenant === undefined) {
2005+
throw new RequiredError(
2006+
"tenant",
2007+
"Required parameter tenant was null or undefined when calling forkCollection.",
2008+
);
2009+
}
2010+
// verify required parameter 'database' is not null or undefined
2011+
if (database === null || database === undefined) {
2012+
throw new RequiredError(
2013+
"database",
2014+
"Required parameter database was null or undefined when calling forkCollection.",
2015+
);
2016+
}
2017+
// verify required parameter 'collectionId' is not null or undefined
2018+
if (collectionId === null || collectionId === undefined) {
2019+
throw new RequiredError(
2020+
"collectionId",
2021+
"Required parameter collectionId was null or undefined when calling forkCollection.",
2022+
);
2023+
}
2024+
// verify required parameter 'request' is not null or undefined
2025+
if (request === null || request === undefined) {
2026+
throw new RequiredError(
2027+
"request",
2028+
"Required parameter request was null or undefined when calling forkCollection.",
2029+
);
2030+
}
2031+
let localVarPath =
2032+
`/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/fork`
2033+
.replace("{tenant}", encodeURIComponent(String(tenant)))
2034+
.replace("{database}", encodeURIComponent(String(database)))
2035+
.replace("{collection_id}", encodeURIComponent(String(collectionId)));
2036+
const localVarPathQueryStart = localVarPath.indexOf("?");
2037+
const localVarRequestOptions: RequestInit = Object.assign(
2038+
{ method: "POST" },
2039+
options,
2040+
);
2041+
const localVarHeaderParameter: Headers = options.headers
2042+
? new Headers(options.headers)
2043+
: new Headers();
2044+
const localVarQueryParameter = new URLSearchParams(
2045+
localVarPathQueryStart !== -1
2046+
? localVarPath.substring(localVarPathQueryStart + 1)
2047+
: "",
2048+
);
2049+
if (localVarPathQueryStart !== -1) {
2050+
localVarPath = localVarPath.substring(0, localVarPathQueryStart);
2051+
}
2052+
2053+
localVarHeaderParameter.set("Content-Type", "application/json");
2054+
2055+
localVarRequestOptions.headers = localVarHeaderParameter;
2056+
2057+
if (request !== undefined) {
2058+
localVarRequestOptions.body = JSON.stringify(request || {});
2059+
}
2060+
2061+
const localVarQueryParameterString = localVarQueryParameter.toString();
2062+
if (localVarQueryParameterString) {
2063+
localVarPath += "?" + localVarQueryParameterString;
2064+
}
2065+
return {
2066+
url: localVarPath,
2067+
options: localVarRequestOptions,
2068+
};
2069+
},
19872070
/**
19882071
* @summary Retrieves a collection by ID or name.
19892072
* @param {string} tenant <p>Tenant ID</p>
@@ -3971,6 +4054,63 @@ export const ApiApiFp = function (configuration?: Configuration) {
39714054
});
39724055
};
39734056
},
4057+
/**
4058+
* @summary Forks an existing collection.
4059+
* @param {string} tenant <p>Tenant ID</p>
4060+
* @param {string} database <p>Database name</p>
4061+
* @param {string} collectionId <p>UUID of the collection to update</p>
4062+
* @param {Api.ForkCollectionPayload} request
4063+
* @param {RequestInit} [options] Override http request option.
4064+
* @throws {RequiredError}
4065+
*/
4066+
forkCollection(
4067+
tenant: string,
4068+
database: string,
4069+
collectionId: string,
4070+
request: Api.ForkCollectionPayload,
4071+
options?: RequestInit,
4072+
): (fetch?: FetchAPI, basePath?: string) => Promise<Api.Collection> {
4073+
const localVarFetchArgs = ApiApiFetchParamCreator(
4074+
configuration,
4075+
).forkCollection(tenant, database, collectionId, request, options);
4076+
return (fetch: FetchAPI = defaultFetch, basePath: string = BASE_PATH) => {
4077+
return fetch(
4078+
basePath + localVarFetchArgs.url,
4079+
localVarFetchArgs.options,
4080+
).then((response) => {
4081+
const contentType = response.headers.get("Content-Type");
4082+
const mimeType = contentType
4083+
? contentType.replace(/;.*/, "")
4084+
: undefined;
4085+
4086+
if (response.status === 200) {
4087+
if (mimeType === "application/json") {
4088+
return response.json() as any;
4089+
}
4090+
throw response;
4091+
}
4092+
if (response.status === 401) {
4093+
if (mimeType === "application/json") {
4094+
throw response;
4095+
}
4096+
throw response;
4097+
}
4098+
if (response.status === 404) {
4099+
if (mimeType === "application/json") {
4100+
throw response;
4101+
}
4102+
throw response;
4103+
}
4104+
if (response.status === 500) {
4105+
if (mimeType === "application/json") {
4106+
throw response;
4107+
}
4108+
throw response;
4109+
}
4110+
throw response;
4111+
});
4112+
};
4113+
},
39744114
/**
39754115
* @summary Retrieves a collection by ID or name.
39764116
* @param {string} tenant <p>Tenant ID</p>
@@ -5123,6 +5263,31 @@ export class ApiApi extends BaseAPI {
51235263
)(this.fetch, this.basePath);
51245264
}
51255265

5266+
/**
5267+
* @summary Forks an existing collection.
5268+
* @param {string} tenant <p>Tenant ID</p>
5269+
* @param {string} database <p>Database name</p>
5270+
* @param {string} collectionId <p>UUID of the collection to update</p>
5271+
* @param {Api.ForkCollectionPayload} request
5272+
* @param {RequestInit} [options] Override http request option.
5273+
* @throws {RequiredError}
5274+
*/
5275+
public forkCollection(
5276+
tenant: string,
5277+
database: string,
5278+
collectionId: string,
5279+
request: Api.ForkCollectionPayload,
5280+
options?: RequestInit,
5281+
) {
5282+
return ApiApiFp(this.configuration).forkCollection(
5283+
tenant,
5284+
database,
5285+
collectionId,
5286+
request,
5287+
options,
5288+
)(this.fetch, this.basePath);
5289+
}
5290+
51265291
/**
51275292
* @summary Retrieves a collection by ID or name.
51285293
* @param {string} tenant <p>Tenant ID</p>

0 commit comments

Comments
 (0)