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