github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/java/docs/CommitsApi.md (about) 1 # CommitsApi 2 3 All URIs are relative to */api/v1* 4 5 | Method | HTTP request | Description | 6 |------------- | ------------- | -------------| 7 | [**commit**](CommitsApi.md#commit) | **POST** /repositories/{repository}/branches/{branch}/commits | create commit | 8 | [**getCommit**](CommitsApi.md#getCommit) | **GET** /repositories/{repository}/commits/{commitId} | get commit | 9 10 11 <a id="commit"></a> 12 # **commit** 13 > Commit commit(repository, branch, commitCreation).sourceMetarange(sourceMetarange).execute(); 14 15 create commit 16 17 ### Example 18 ```java 19 // Import classes: 20 import io.lakefs.clients.sdk.ApiClient; 21 import io.lakefs.clients.sdk.ApiException; 22 import io.lakefs.clients.sdk.Configuration; 23 import io.lakefs.clients.sdk.auth.*; 24 import io.lakefs.clients.sdk.models.*; 25 import io.lakefs.clients.sdk.CommitsApi; 26 27 public class Example { 28 public static void main(String[] args) { 29 ApiClient defaultClient = Configuration.getDefaultApiClient(); 30 defaultClient.setBasePath("/api/v1"); 31 32 // Configure HTTP basic authorization: basic_auth 33 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 34 basic_auth.setUsername("YOUR USERNAME"); 35 basic_auth.setPassword("YOUR PASSWORD"); 36 37 // Configure API key authorization: cookie_auth 38 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 39 cookie_auth.setApiKey("YOUR API KEY"); 40 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 41 //cookie_auth.setApiKeyPrefix("Token"); 42 43 // Configure API key authorization: oidc_auth 44 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 45 oidc_auth.setApiKey("YOUR API KEY"); 46 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 47 //oidc_auth.setApiKeyPrefix("Token"); 48 49 // Configure API key authorization: saml_auth 50 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 51 saml_auth.setApiKey("YOUR API KEY"); 52 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 53 //saml_auth.setApiKeyPrefix("Token"); 54 55 // Configure HTTP bearer authorization: jwt_token 56 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 57 jwt_token.setBearerToken("BEARER TOKEN"); 58 59 CommitsApi apiInstance = new CommitsApi(defaultClient); 60 String repository = "repository_example"; // String | 61 String branch = "branch_example"; // String | 62 CommitCreation commitCreation = new CommitCreation(); // CommitCreation | 63 String sourceMetarange = "sourceMetarange_example"; // String | The source metarange to commit. Branch must not have uncommitted changes. 64 try { 65 Commit result = apiInstance.commit(repository, branch, commitCreation) 66 .sourceMetarange(sourceMetarange) 67 .execute(); 68 System.out.println(result); 69 } catch (ApiException e) { 70 System.err.println("Exception when calling CommitsApi#commit"); 71 System.err.println("Status code: " + e.getCode()); 72 System.err.println("Reason: " + e.getResponseBody()); 73 System.err.println("Response headers: " + e.getResponseHeaders()); 74 e.printStackTrace(); 75 } 76 } 77 } 78 ``` 79 80 ### Parameters 81 82 | Name | Type | Description | Notes | 83 |------------- | ------------- | ------------- | -------------| 84 | **repository** | **String**| | | 85 | **branch** | **String**| | | 86 | **commitCreation** | [**CommitCreation**](CommitCreation.md)| | | 87 | **sourceMetarange** | **String**| The source metarange to commit. Branch must not have uncommitted changes. | [optional] | 88 89 ### Return type 90 91 [**Commit**](Commit.md) 92 93 ### Authorization 94 95 [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) 96 97 ### HTTP request headers 98 99 - **Content-Type**: application/json 100 - **Accept**: application/json 101 102 ### HTTP response details 103 | Status code | Description | Response headers | 104 |-------------|-------------|------------------| 105 | **201** | commit | - | 106 | **400** | Validation Error | - | 107 | **401** | Unauthorized | - | 108 | **403** | Forbidden | - | 109 | **404** | Resource Not Found | - | 110 | **409** | Resource Conflicts With Target | - | 111 | **412** | Precondition Failed (e.g. a pre-commit hook returned a failure) | - | 112 | **420** | too many requests | - | 113 | **0** | Internal Server Error | - | 114 115 <a id="getCommit"></a> 116 # **getCommit** 117 > Commit getCommit(repository, commitId).execute(); 118 119 get commit 120 121 ### Example 122 ```java 123 // Import classes: 124 import io.lakefs.clients.sdk.ApiClient; 125 import io.lakefs.clients.sdk.ApiException; 126 import io.lakefs.clients.sdk.Configuration; 127 import io.lakefs.clients.sdk.auth.*; 128 import io.lakefs.clients.sdk.models.*; 129 import io.lakefs.clients.sdk.CommitsApi; 130 131 public class Example { 132 public static void main(String[] args) { 133 ApiClient defaultClient = Configuration.getDefaultApiClient(); 134 defaultClient.setBasePath("/api/v1"); 135 136 // Configure HTTP basic authorization: basic_auth 137 HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); 138 basic_auth.setUsername("YOUR USERNAME"); 139 basic_auth.setPassword("YOUR PASSWORD"); 140 141 // Configure API key authorization: cookie_auth 142 ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); 143 cookie_auth.setApiKey("YOUR API KEY"); 144 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 145 //cookie_auth.setApiKeyPrefix("Token"); 146 147 // Configure API key authorization: oidc_auth 148 ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); 149 oidc_auth.setApiKey("YOUR API KEY"); 150 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 151 //oidc_auth.setApiKeyPrefix("Token"); 152 153 // Configure API key authorization: saml_auth 154 ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); 155 saml_auth.setApiKey("YOUR API KEY"); 156 // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) 157 //saml_auth.setApiKeyPrefix("Token"); 158 159 // Configure HTTP bearer authorization: jwt_token 160 HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); 161 jwt_token.setBearerToken("BEARER TOKEN"); 162 163 CommitsApi apiInstance = new CommitsApi(defaultClient); 164 String repository = "repository_example"; // String | 165 String commitId = "commitId_example"; // String | 166 try { 167 Commit result = apiInstance.getCommit(repository, commitId) 168 .execute(); 169 System.out.println(result); 170 } catch (ApiException e) { 171 System.err.println("Exception when calling CommitsApi#getCommit"); 172 System.err.println("Status code: " + e.getCode()); 173 System.err.println("Reason: " + e.getResponseBody()); 174 System.err.println("Response headers: " + e.getResponseHeaders()); 175 e.printStackTrace(); 176 } 177 } 178 } 179 ``` 180 181 ### Parameters 182 183 | Name | Type | Description | Notes | 184 |------------- | ------------- | ------------- | -------------| 185 | **repository** | **String**| | | 186 | **commitId** | **String**| | | 187 188 ### Return type 189 190 [**Commit**](Commit.md) 191 192 ### Authorization 193 194 [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) 195 196 ### HTTP request headers 197 198 - **Content-Type**: Not defined 199 - **Accept**: application/json 200 201 ### HTTP response details 202 | Status code | Description | Response headers | 203 |-------------|-------------|------------------| 204 | **200** | commit | - | 205 | **401** | Unauthorized | - | 206 | **404** | Resource Not Found | - | 207 | **420** | too many requests | - | 208 | **0** | Internal Server Error | - | 209