@@ -1154,6 +1154,89 @@ export const ApiApiFetchParamCreator = function (
1154
1154
options : localVarRequestOptions ,
1155
1155
} ;
1156
1156
} ,
1157
+ /**
1158
+ * @summary Forks an existing collection.
1159
+ * @param {string } tenant <p>Tenant ID</p>
1160
+ * @param {string } database <p>Database name</p>
1161
+ * @param {string } collectionId <p>UUID of the collection to update</p>
1162
+ * @param {Api.ForkCollectionPayload } request
1163
+ * @param {RequestInit } [options] Override http request option.
1164
+ * @throws {RequiredError }
1165
+ */
1166
+ forkCollection (
1167
+ tenant : string ,
1168
+ database : string ,
1169
+ collectionId : string ,
1170
+ request : Api . ForkCollectionPayload ,
1171
+ options : RequestInit = { } ,
1172
+ ) : FetchArgs {
1173
+ // verify required parameter 'tenant' is not null or undefined
1174
+ if ( tenant === null || tenant === undefined ) {
1175
+ throw new RequiredError (
1176
+ "tenant" ,
1177
+ "Required parameter tenant was null or undefined when calling forkCollection." ,
1178
+ ) ;
1179
+ }
1180
+ // verify required parameter 'database' is not null or undefined
1181
+ if ( database === null || database === undefined ) {
1182
+ throw new RequiredError (
1183
+ "database" ,
1184
+ "Required parameter database was null or undefined when calling forkCollection." ,
1185
+ ) ;
1186
+ }
1187
+ // verify required parameter 'collectionId' is not null or undefined
1188
+ if ( collectionId === null || collectionId === undefined ) {
1189
+ throw new RequiredError (
1190
+ "collectionId" ,
1191
+ "Required parameter collectionId was null or undefined when calling forkCollection." ,
1192
+ ) ;
1193
+ }
1194
+ // verify required parameter 'request' is not null or undefined
1195
+ if ( request === null || request === undefined ) {
1196
+ throw new RequiredError (
1197
+ "request" ,
1198
+ "Required parameter request was null or undefined when calling forkCollection." ,
1199
+ ) ;
1200
+ }
1201
+ let localVarPath =
1202
+ `/api/v2/tenants/{tenant}/databases/{database}/collections/{collection_id}/fork`
1203
+ . replace ( "{tenant}" , encodeURIComponent ( String ( tenant ) ) )
1204
+ . replace ( "{database}" , encodeURIComponent ( String ( database ) ) )
1205
+ . replace ( "{collection_id}" , encodeURIComponent ( String ( collectionId ) ) ) ;
1206
+ const localVarPathQueryStart = localVarPath . indexOf ( "?" ) ;
1207
+ const localVarRequestOptions : RequestInit = Object . assign (
1208
+ { method : "POST" } ,
1209
+ options ,
1210
+ ) ;
1211
+ const localVarHeaderParameter : Headers = options . headers
1212
+ ? new Headers ( options . headers )
1213
+ : new Headers ( ) ;
1214
+ const localVarQueryParameter = new URLSearchParams (
1215
+ localVarPathQueryStart !== - 1
1216
+ ? localVarPath . substring ( localVarPathQueryStart + 1 )
1217
+ : "" ,
1218
+ ) ;
1219
+ if ( localVarPathQueryStart !== - 1 ) {
1220
+ localVarPath = localVarPath . substring ( 0 , localVarPathQueryStart ) ;
1221
+ }
1222
+
1223
+ localVarHeaderParameter . set ( "Content-Type" , "application/json" ) ;
1224
+
1225
+ localVarRequestOptions . headers = localVarHeaderParameter ;
1226
+
1227
+ if ( request !== undefined ) {
1228
+ localVarRequestOptions . body = JSON . stringify ( request || { } ) ;
1229
+ }
1230
+
1231
+ const localVarQueryParameterString = localVarQueryParameter . toString ( ) ;
1232
+ if ( localVarQueryParameterString ) {
1233
+ localVarPath += "?" + localVarQueryParameterString ;
1234
+ }
1235
+ return {
1236
+ url : localVarPath ,
1237
+ options : localVarRequestOptions ,
1238
+ } ;
1239
+ } ,
1157
1240
/**
1158
1241
* @summary Retrieves a collection by ID or name.
1159
1242
* @param {string } tenant <p>Tenant ID</p>
@@ -2571,6 +2654,63 @@ export const ApiApiFp = function (configuration?: Configuration) {
2571
2654
} ) ;
2572
2655
} ;
2573
2656
} ,
2657
+ /**
2658
+ * @summary Forks an existing collection.
2659
+ * @param {string } tenant <p>Tenant ID</p>
2660
+ * @param {string } database <p>Database name</p>
2661
+ * @param {string } collectionId <p>UUID of the collection to update</p>
2662
+ * @param {Api.ForkCollectionPayload } request
2663
+ * @param {RequestInit } [options] Override http request option.
2664
+ * @throws {RequiredError }
2665
+ */
2666
+ forkCollection (
2667
+ tenant : string ,
2668
+ database : string ,
2669
+ collectionId : string ,
2670
+ request : Api . ForkCollectionPayload ,
2671
+ options ?: RequestInit ,
2672
+ ) : ( fetch ?: FetchAPI , basePath ?: string ) => Promise < Api . Collection > {
2673
+ const localVarFetchArgs = ApiApiFetchParamCreator (
2674
+ configuration ,
2675
+ ) . forkCollection ( tenant , database , collectionId , request , options ) ;
2676
+ return ( fetch : FetchAPI = defaultFetch , basePath : string = BASE_PATH ) => {
2677
+ return fetch (
2678
+ basePath + localVarFetchArgs . url ,
2679
+ localVarFetchArgs . options ,
2680
+ ) . then ( ( response ) => {
2681
+ const contentType = response . headers . get ( "Content-Type" ) ;
2682
+ const mimeType = contentType
2683
+ ? contentType . replace ( / ; .* / , "" )
2684
+ : undefined ;
2685
+
2686
+ if ( response . status === 200 ) {
2687
+ if ( mimeType === "application/json" ) {
2688
+ return response . json ( ) as any ;
2689
+ }
2690
+ throw response ;
2691
+ }
2692
+ if ( response . status === 401 ) {
2693
+ if ( mimeType === "application/json" ) {
2694
+ throw response ;
2695
+ }
2696
+ throw response ;
2697
+ }
2698
+ if ( response . status === 404 ) {
2699
+ if ( mimeType === "application/json" ) {
2700
+ throw response ;
2701
+ }
2702
+ throw response ;
2703
+ }
2704
+ if ( response . status === 500 ) {
2705
+ if ( mimeType === "application/json" ) {
2706
+ throw response ;
2707
+ }
2708
+ throw response ;
2709
+ }
2710
+ throw response ;
2711
+ } ) ;
2712
+ } ;
2713
+ } ,
2574
2714
/**
2575
2715
* @summary Retrieves a collection by ID or name.
2576
2716
* @param {string } tenant <p>Tenant ID</p>
@@ -3473,6 +3613,31 @@ export class ApiApi extends BaseAPI {
3473
3613
) ( this . fetch , this . basePath ) ;
3474
3614
}
3475
3615
3616
+ /**
3617
+ * @summary Forks an existing collection.
3618
+ * @param {string } tenant <p>Tenant ID</p>
3619
+ * @param {string } database <p>Database name</p>
3620
+ * @param {string } collectionId <p>UUID of the collection to update</p>
3621
+ * @param {Api.ForkCollectionPayload } request
3622
+ * @param {RequestInit } [options] Override http request option.
3623
+ * @throws {RequiredError }
3624
+ */
3625
+ public forkCollection (
3626
+ tenant : string ,
3627
+ database : string ,
3628
+ collectionId : string ,
3629
+ request : Api . ForkCollectionPayload ,
3630
+ options ?: RequestInit ,
3631
+ ) {
3632
+ return ApiApiFp ( this . configuration ) . forkCollection (
3633
+ tenant ,
3634
+ database ,
3635
+ collectionId ,
3636
+ request ,
3637
+ options ,
3638
+ ) ( this . fetch , this . basePath ) ;
3639
+ }
3640
+
3476
3641
/**
3477
3642
* @summary Retrieves a collection by ID or name.
3478
3643
* @param {string } tenant <p>Tenant ID</p>
0 commit comments