github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/java/docs/RefsApi.md (about) 1 # RefsApi 2 3 All URIs are relative to */api/v1* 4 5 | Method | HTTP request | Description | 6 |------------- | ------------- | -------------| 7 | [**diffRefs**](RefsApi.md#diffRefs) | **GET** /repositories/{repository}/refs/{leftRef}/diff/{rightRef} | diff references | 8 | [**findMergeBase**](RefsApi.md#findMergeBase) | **GET** /repositories/{repository}/refs/{sourceRef}/merge/{destinationBranch} | find the merge base for 2 references | 9 | [**logCommits**](RefsApi.md#logCommits) | **GET** /repositories/{repository}/refs/{ref}/commits | get commit log from ref. If both objects and prefixes are empty, return all commits. | 10 | [**mergeIntoBranch**](RefsApi.md#mergeIntoBranch) | **POST** /repositories/{repository}/refs/{sourceRef}/merge/{destinationBranch} | merge references | 11 12 13 <a id="diffRefs"></a> 14 # **diffRefs** 15 > DiffList diffRefs(repository, leftRef, rightRef).after(after).amount(amount).prefix(prefix).delimiter(delimiter).type(type).execute(); 16 17 diff references 18 19 ### Example 20 ```java 21 // Import classes: 22 import io.lakefs.clients.sdk.ApiClient; 23 import io.lakefs.clients.sdk.ApiException; 24 import io.lakefs.clients.sdk.Configuration; 25 import io.lakefs.clients.sdk.auth.*; 26 import io.lakefs.clients.sdk.models.*; 27 import io.lakefs.clients.sdk.RefsApi; 28 29 public class Example { 30 public static void main(String[] args) { 31 ApiClient defaultClient = Configuration.getDefaultApiClient(); 32 defaultClient.setBasePath("/api/v1"); 33 34 // Configure HTTP basic authorization: basic_auth 35 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 36 basic_auth.setUsername("YOUR USERNAME"); 37 basic_auth.setPassword("YOUR PASSWORD"); 38 39 // Configure API key authorization: cookie_auth 40 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 41 cookie_auth.setApiKey("YOUR API KEY"); 42 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 43 //cookie_auth.setApiKeyPrefix("Token"); 44 45 // Configure API key authorization: oidc_auth 46 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 47 oidc_auth.setApiKey("YOUR API KEY"); 48 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 49 //oidc_auth.setApiKeyPrefix("Token"); 50 51 // Configure API key authorization: saml_auth 52 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 53 saml_auth.setApiKey("YOUR API KEY"); 54 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 55 //saml_auth.setApiKeyPrefix("Token"); 56 57 // Configure HTTP bearer authorization: jwt_token 58 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 59 jwt_token.setBearerToken("BEARER TOKEN"); 60 61 RefsApi apiInstance = new RefsApi(defaultClient); 62 String repository = "repository_example"; // String | 63 String leftRef = "leftRef_example"; // String | a reference (could be either a branch or a commit ID) 64 String rightRef = "rightRef_example"; // String | a reference (could be either a branch or a commit ID) to compare against 65 String after = "after_example"; // String | return items after this value 66 Integer amount = 100; // Integer | how many items to return 67 String prefix = "prefix_example"; // String | return items prefixed with this value 68 String delimiter = "delimiter_example"; // String | delimiter used to group common prefixes by 69 String type = "two_dot"; // String | 70 try { 71 DiffList result = apiInstance.diffRefs(repository, leftRef, rightRef) 72 .after(after) 73 .amount(amount) 74 .prefix(prefix) 75 .delimiter(delimiter) 76 .type(type) 77 .execute(); 78 System.out.println(result); 79 } catch (ApiException e) { 80 System.err.println("Exception when calling RefsApi#diffRefs"); 81 System.err.println("Status code: " + e.getCode()); 82 System.err.println("Reason: " + e.getResponseBody()); 83 System.err.println("Response headers: " + e.getResponseHeaders()); 84 e.printStackTrace(); 85 } 86 } 87 } 88 ``` 89 90 ### Parameters 91 92 | Name | Type | Description | Notes | 93 |------------- | ------------- | ------------- | -------------| 94 | **repository** | **String**| | | 95 | **leftRef** | **String**| a reference (could be either a branch or a commit ID) | | 96 | **rightRef** | **String**| a reference (could be either a branch or a commit ID) to compare against | | 97 | **after** | **String**| return items after this value | [optional] | 98 | **amount** | **Integer**| how many items to return | [optional] [default to 100] | 99 | **prefix** | **String**| return items prefixed with this value | [optional] | 100 | **delimiter** | **String**| delimiter used to group common prefixes by | [optional] | 101 | **type** | **String**| | [optional] [default to three_dot] [enum: two_dot, three_dot] | 102 103 ### Return type 104 105 [**DiffList**](DiffList.md) 106 107 ### Authorization 108 109 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 110 111 ### HTTP request headers 112 113 - **Content-Type**: Not defined 114 - **Accept**: application/json 115 116 ### HTTP response details 117 | Status code | Description | Response headers | 118 |-------------|-------------|------------------| 119 | **200** | diff between refs | - | 120 | **401** | Unauthorized | - | 121 | **404** | Resource Not Found | - | 122 | **420** | too many requests | - | 123 | **0** | Internal Server Error | - | 124 125 <a id="findMergeBase"></a> 126 # **findMergeBase** 127 > FindMergeBaseResult findMergeBase(repository, sourceRef, destinationBranch).execute(); 128 129 find the merge base for 2 references 130 131 ### Example 132 ```java 133 // Import classes: 134 import io.lakefs.clients.sdk.ApiClient; 135 import io.lakefs.clients.sdk.ApiException; 136 import io.lakefs.clients.sdk.Configuration; 137 import io.lakefs.clients.sdk.auth.*; 138 import io.lakefs.clients.sdk.models.*; 139 import io.lakefs.clients.sdk.RefsApi; 140 141 public class Example { 142 public static void main(String[] args) { 143 ApiClient defaultClient = Configuration.getDefaultApiClient(); 144 defaultClient.setBasePath("/api/v1"); 145 146 // Configure HTTP basic authorization: basic_auth 147 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 148 basic_auth.setUsername("YOUR USERNAME"); 149 basic_auth.setPassword("YOUR PASSWORD"); 150 151 // Configure API key authorization: cookie_auth 152 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 153 cookie_auth.setApiKey("YOUR API KEY"); 154 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 155 //cookie_auth.setApiKeyPrefix("Token"); 156 157 // Configure API key authorization: oidc_auth 158 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 159 oidc_auth.setApiKey("YOUR API KEY"); 160 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 161 //oidc_auth.setApiKeyPrefix("Token"); 162 163 // Configure API key authorization: saml_auth 164 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 165 saml_auth.setApiKey("YOUR API KEY"); 166 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 167 //saml_auth.setApiKeyPrefix("Token"); 168 169 // Configure HTTP bearer authorization: jwt_token 170 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 171 jwt_token.setBearerToken("BEARER TOKEN"); 172 173 RefsApi apiInstance = new RefsApi(defaultClient); 174 String repository = "repository_example"; // String | 175 String sourceRef = "sourceRef_example"; // String | source ref 176 String destinationBranch = "destinationBranch_example"; // String | destination branch name 177 try { 178 FindMergeBaseResult result = apiInstance.findMergeBase(repository, sourceRef, destinationBranch) 179 .execute(); 180 System.out.println(result); 181 } catch (ApiException e) { 182 System.err.println("Exception when calling RefsApi#findMergeBase"); 183 System.err.println("Status code: " + e.getCode()); 184 System.err.println("Reason: " + e.getResponseBody()); 185 System.err.println("Response headers: " + e.getResponseHeaders()); 186 e.printStackTrace(); 187 } 188 } 189 } 190 ``` 191 192 ### Parameters 193 194 | Name | Type | Description | Notes | 195 |------------- | ------------- | ------------- | -------------| 196 | **repository** | **String**| | | 197 | **sourceRef** | **String**| source ref | | 198 | **destinationBranch** | **String**| destination branch name | | 199 200 ### Return type 201 202 [**FindMergeBaseResult**](FindMergeBaseResult.md) 203 204 ### Authorization 205 206 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 207 208 ### HTTP request headers 209 210 - **Content-Type**: Not defined 211 - **Accept**: application/json 212 213 ### HTTP response details 214 | Status code | Description | Response headers | 215 |-------------|-------------|------------------| 216 | **200** | Found the merge base | - | 217 | **400** | Validation Error | - | 218 | **401** | Unauthorized | - | 219 | **404** | Resource Not Found | - | 220 | **420** | too many requests | - | 221 | **0** | Internal Server Error | - | 222 223 <a id="logCommits"></a> 224 # **logCommits** 225 > CommitList logCommits(repository, ref).after(after).amount(amount).objects(objects).prefixes(prefixes).limit(limit).firstParent(firstParent).since(since).stopAt(stopAt).execute(); 226 227 get commit log from ref. If both objects and prefixes are empty, return all commits. 228 229 ### Example 230 ```java 231 // Import classes: 232 import io.lakefs.clients.sdk.ApiClient; 233 import io.lakefs.clients.sdk.ApiException; 234 import io.lakefs.clients.sdk.Configuration; 235 import io.lakefs.clients.sdk.auth.*; 236 import io.lakefs.clients.sdk.models.*; 237 import io.lakefs.clients.sdk.RefsApi; 238 239 public class Example { 240 public static void main(String[] args) { 241 ApiClient defaultClient = Configuration.getDefaultApiClient(); 242 defaultClient.setBasePath("/api/v1"); 243 244 // Configure HTTP basic authorization: basic_auth 245 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 246 basic_auth.setUsername("YOUR USERNAME"); 247 basic_auth.setPassword("YOUR PASSWORD"); 248 249 // Configure API key authorization: cookie_auth 250 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 251 cookie_auth.setApiKey("YOUR API KEY"); 252 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 253 //cookie_auth.setApiKeyPrefix("Token"); 254 255 // Configure API key authorization: oidc_auth 256 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 257 oidc_auth.setApiKey("YOUR API KEY"); 258 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 259 //oidc_auth.setApiKeyPrefix("Token"); 260 261 // Configure API key authorization: saml_auth 262 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 263 saml_auth.setApiKey("YOUR API KEY"); 264 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 265 //saml_auth.setApiKeyPrefix("Token"); 266 267 // Configure HTTP bearer authorization: jwt_token 268 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 269 jwt_token.setBearerToken("BEARER TOKEN"); 270 271 RefsApi apiInstance = new RefsApi(defaultClient); 272 String repository = "repository_example"; // String | 273 String ref = "ref_example"; // String | 274 String after = "after_example"; // String | return items after this value 275 Integer amount = 100; // Integer | how many items to return 276 List<String> objects = Arrays.asList(); // List<String> | list of paths, each element is a path of a specific object 277 List<String> prefixes = Arrays.asList(); // List<String> | list of paths, each element is a path of a prefix 278 Boolean limit = true; // Boolean | limit the number of items in return to 'amount'. Without further indication on actual number of items. 279 Boolean firstParent = true; // Boolean | if set to true, follow only the first parent upon reaching a merge commit 280 OffsetDateTime since = OffsetDateTime.now(); // OffsetDateTime | Show commits more recent than a specific date-time. In case used with stop_at parameter, will stop at the first commit that meets any of the conditions. 281 String stopAt = "stopAt_example"; // String | A reference to stop at. In case used with since parameter, will stop at the first commit that meets any of the conditions. 282 try { 283 CommitList result = apiInstance.logCommits(repository, ref) 284 .after(after) 285 .amount(amount) 286 .objects(objects) 287 .prefixes(prefixes) 288 .limit(limit) 289 .firstParent(firstParent) 290 .since(since) 291 .stopAt(stopAt) 292 .execute(); 293 System.out.println(result); 294 } catch (ApiException e) { 295 System.err.println("Exception when calling RefsApi#logCommits"); 296 System.err.println("Status code: " + e.getCode()); 297 System.err.println("Reason: " + e.getResponseBody()); 298 System.err.println("Response headers: " + e.getResponseHeaders()); 299 e.printStackTrace(); 300 } 301 } 302 } 303 ``` 304 305 ### Parameters 306 307 | Name | Type | Description | Notes | 308 |------------- | ------------- | ------------- | -------------| 309 | **repository** | **String**| | | 310 | **ref** | **String**| | | 311 | **after** | **String**| return items after this value | [optional] | 312 | **amount** | **Integer**| how many items to return | [optional] [default to 100] | 313 | **objects** | [**List<String>**](String.md)| list of paths, each element is a path of a specific object | [optional] | 314 | **prefixes** | [**List<String>**](String.md)| list of paths, each element is a path of a prefix | [optional] | 315 | **limit** | **Boolean**| limit the number of items in return to 'amount'. Without further indication on actual number of items. | [optional] | 316 | **firstParent** | **Boolean**| if set to true, follow only the first parent upon reaching a merge commit | [optional] | 317 | **since** | **OffsetDateTime**| Show commits more recent than a specific date-time. In case used with stop_at parameter, will stop at the first commit that meets any of the conditions. | [optional] | 318 | **stopAt** | **String**| A reference to stop at. In case used with since parameter, will stop at the first commit that meets any of the conditions. | [optional] | 319 320 ### Return type 321 322 [**CommitList**](CommitList.md) 323 324 ### Authorization 325 326 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 327 328 ### HTTP request headers 329 330 - **Content-Type**: Not defined 331 - **Accept**: application/json 332 333 ### HTTP response details 334 | Status code | Description | Response headers | 335 |-------------|-------------|------------------| 336 | **200** | commit log | - | 337 | **401** | Unauthorized | - | 338 | **404** | Resource Not Found | - | 339 | **420** | too many requests | - | 340 | **0** | Internal Server Error | - | 341 342 <a id="mergeIntoBranch"></a> 343 # **mergeIntoBranch** 344 > MergeResult mergeIntoBranch(repository, sourceRef, destinationBranch).merge(merge).execute(); 345 346 merge references 347 348 ### Example 349 ```java 350 // Import classes: 351 import io.lakefs.clients.sdk.ApiClient; 352 import io.lakefs.clients.sdk.ApiException; 353 import io.lakefs.clients.sdk.Configuration; 354 import io.lakefs.clients.sdk.auth.*; 355 import io.lakefs.clients.sdk.models.*; 356 import io.lakefs.clients.sdk.RefsApi; 357 358 public class Example { 359 public static void main(String[] args) { 360 ApiClient defaultClient = Configuration.getDefaultApiClient(); 361 defaultClient.setBasePath("/api/v1"); 362 363 // Configure HTTP basic authorization: basic_auth 364 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 365 basic_auth.setUsername("YOUR USERNAME"); 366 basic_auth.setPassword("YOUR PASSWORD"); 367 368 // Configure API key authorization: cookie_auth 369 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 370 cookie_auth.setApiKey("YOUR API KEY"); 371 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 372 //cookie_auth.setApiKeyPrefix("Token"); 373 374 // Configure API key authorization: oidc_auth 375 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 376 oidc_auth.setApiKey("YOUR API KEY"); 377 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 378 //oidc_auth.setApiKeyPrefix("Token"); 379 380 // Configure API key authorization: saml_auth 381 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 382 saml_auth.setApiKey("YOUR API KEY"); 383 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 384 //saml_auth.setApiKeyPrefix("Token"); 385 386 // Configure HTTP bearer authorization: jwt_token 387 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 388 jwt_token.setBearerToken("BEARER TOKEN"); 389 390 RefsApi apiInstance = new RefsApi(defaultClient); 391 String repository = "repository_example"; // String | 392 String sourceRef = "sourceRef_example"; // String | source ref 393 String destinationBranch = "destinationBranch_example"; // String | destination branch name 394 Merge merge = new Merge(); // Merge | 395 try { 396 MergeResult result = apiInstance.mergeIntoBranch(repository, sourceRef, destinationBranch) 397 .merge(merge) 398 .execute(); 399 System.out.println(result); 400 } catch (ApiException e) { 401 System.err.println("Exception when calling RefsApi#mergeIntoBranch"); 402 System.err.println("Status code: " + e.getCode()); 403 System.err.println("Reason: " + e.getResponseBody()); 404 System.err.println("Response headers: " + e.getResponseHeaders()); 405 e.printStackTrace(); 406 } 407 } 408 } 409 ``` 410 411 ### Parameters 412 413 | Name | Type | Description | Notes | 414 |------------- | ------------- | ------------- | -------------| 415 | **repository** | **String**| | | 416 | **sourceRef** | **String**| source ref | | 417 | **destinationBranch** | **String**| destination branch name | | 418 | **merge** | [**Merge**](Merge.md)| | [optional] | 419 420 ### Return type 421 422 [**MergeResult**](MergeResult.md) 423 424 ### Authorization 425 426 [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token) 427 428 ### HTTP request headers 429 430 - **Content-Type**: application/json 431 - **Accept**: application/json 432 433 ### HTTP response details 434 | Status code | Description | Response headers | 435 |-------------|-------------|------------------| 436 | **200** | merge completed | - | 437 | **400** | Validation Error | - | 438 | **401** | Unauthorized | - | 439 | **403** | Forbidden | - | 440 | **404** | Resource Not Found | - | 441 | **409** | Conflict Deprecated: content schema will return Error format and not an empty MergeResult | - | 442 | **412** | precondition failed (e.g. a pre-merge hook returned a failure) | - | 443 | **420** | too many requests | - | 444 | **0** | Internal Server Error | - | 445