mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-14 16:33:56 +00:00
* [Java] Fix content for enum in addPartToMultiPartBuilder ([#19973](https://github.com/OpenAPITools/openapi-generator/issues/19973)) * [Java] Fix content for enum with restclient (#19973) * [Java] Fix content for enum with restclient (#19973) * [Java] Fix content for enum with restclient (#19973) * update samples --------- Co-authored-by: Michael Bornholdt Nielsen <michaelbornholdtnielsen@gmail.com> Co-authored-by: Michael Bornholdt Nielsen <jarryDk@users.noreply.github.com>
2.8 KiB
2.8 KiB
BasApi
All URIs are relative to http://localhost:8080
Method | HTTP request | Description |
---|---|---|
createMessage | POST /messages | Creates a new message |
createMessage
InlineObject createMessage(fileContent, idempotencyKey, dataDirection, dataChannel)
Creates a new message
Creates a new message
Example
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.BasApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:8080");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");
BasApi apiInstance = new BasApi(defaultClient);
File fileContent = new File("/path/to/file"); // File | The message payload
String idempotencyKey = "idempotencyKey_example"; // String |
DataDirection dataDirection = DataDirection.fromValue("INGOING"); // DataDirection |
DataChannel dataChannel = DataChannel.fromValue("BIKE"); // DataChannel |
try {
InlineObject result = apiInstance.createMessage(fileContent, idempotencyKey, dataDirection, dataChannel);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BasApi#createMessage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
fileContent | File | The message payload | |
idempotencyKey | String | ||
dataDirection | DataDirection | [enum: INGOING, OUTGOING] | |
dataChannel | DataChannel | [enum: BIKE, CAR, BUS, PLANE] |
Return type
Authorization
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json
HTTP response details
Status code | Description | Response headers |
---|---|---|
201 | The message was created. | - |