[Java][retrofit2] Fix for Issue #7446 (#7659)

* [Java][retrofit2]  Fix for issue #7446:  file upload sets filename as baseName instead of a dynamic filename. The solution is to use  okhttp3.MultipartBody.Part instead of RequestBody in formParams template.

* Changes corresponding to review comments

* Petstore Samples

* Fixed tests
This commit is contained in:
Adrien CABARBAYE 2018-02-22 13:45:19 +00:00 committed by William Cheng
parent b4827beba4
commit d4543a99e3
73 changed files with 130 additions and 115 deletions

View File

@ -20,6 +20,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
{{#imports}}import {{import}}; {{#imports}}import {{import}};
{{/imports}} {{/imports}}

View File

@ -1 +1 @@
{{#isFormParam}}{{#notFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}}{{#usePlayWS}} okhttp3.MultipartBody.Part {{/usePlayWS}}{{^usePlayWS}}("{{baseName}}\"; filename=\"{{baseName}}") RequestBody {{/usePlayWS}}{{paramName}}{{/isFile}}{{/isFormParam}} {{#isFormParam}}{{#notFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}} MultipartBody.Part {{paramName}}{{/isFile}}{{/isFormParam}}

View File

@ -206,7 +206,7 @@ Get user by user name
UserApi apiInstance = new UserApi(); UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing.
try { try {
User result = apiInstance.getUserByName(username); User result = apiInstance.getUserByName(username);
System.out.println(result); System.out.println(result);
@ -220,7 +220,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | **username** | **String**| The name that needs to be fetched. Use user1 for testing. |
### Return type ### Return type

View File

@ -120,7 +120,7 @@ public interface PetApi {
@retrofit2.http.Multipart @retrofit2.http.Multipart
@POST("pet/{petId}/uploadImage") @POST("pet/{petId}/uploadImage")
F.Promise<Response<ModelApiResponse>> uploadFile( F.Promise<Response<ModelApiResponse>> uploadFile(
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part okhttp3.MultipartBody.Part file @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part MultipartBody.Part file
); );
} }

View File

@ -67,7 +67,7 @@ public interface UserApi {
/** /**
* Get user by user name * Get user by user name
* *
* @param username The name that needs to be fetched. Use user1 for testing. (required) * @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return Call&lt;User&gt; * @return Call&lt;User&gt;
*/ */
@GET("user/{username}") @GET("user/{username}")

View File

@ -1 +1 @@
2.3.1-SNAPSHOT 2.4.0-SNAPSHOT

View File

@ -98,7 +98,7 @@ ext {
retrofit_version = "2.3.0" retrofit_version = "2.3.0"
jackson_version = "2.7.8" jackson_version = "2.7.8"
play_version = "2.5.14" play_version = "2.5.14"
swagger_annotations_version = "1.5.15" swagger_annotations_version = "1.5.17"
junit_version = "4.12" junit_version = "4.12"
threetenbp_version = "1.3.5" threetenbp_version = "1.3.5"
json_fire_version = "1.8.0" json_fire_version = "1.8.0"

View File

@ -16,7 +16,7 @@ lazy val root = (project in file(".")).
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.8" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.8" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.7.8" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.8" % "compile",
"com.squareup.retrofit2" % "converter-jackson" % "2.3.0" % "compile", "com.squareup.retrofit2" % "converter-jackson" % "2.3.0" % "compile",
"io.swagger" % "swagger-annotations" % "1.5.15" % "compile", "io.swagger" % "swagger-annotations" % "1.5.17" % "compile",
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
"org.threeten" % "threetenbp" % "1.3.5" % "compile", "org.threeten" % "threetenbp" % "1.3.5" % "compile",
"io.gsonfire" % "gson-fire" % "1.8.0" % "compile", "io.gsonfire" % "gson-fire" % "1.8.0" % "compile",

View File

@ -242,7 +242,7 @@ No authorization required
<a name="testEndpointParameters"></a> <a name="testEndpointParameters"></a>
# **testEndpointParameters** # **testEndpointParameters**
> Void testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback) > testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback)
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -280,8 +280,7 @@ OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
String password = "password_example"; // String | None String password = "password_example"; // String | None
String paramCallback = "paramCallback_example"; // String | None String paramCallback = "paramCallback_example"; // String | None
try { try {
Void result = apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testEndpointParameters"); System.err.println("Exception when calling FakeApi#testEndpointParameters");
e.printStackTrace(); e.printStackTrace();
@ -309,7 +308,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization
@ -322,7 +321,7 @@ Name | Type | Description | Notes
<a name="testEnumParameters"></a> <a name="testEnumParameters"></a>
# **testEnumParameters** # **testEnumParameters**
> Void testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble) > testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble)
To test enum parameters To test enum parameters
@ -345,8 +344,7 @@ String enumQueryString = "-efg"; // String | Query parameter enum test (string)
Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double)
Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double)
try { try {
Void result = apiInstance.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); apiInstance.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testEnumParameters"); System.err.println("Exception when calling FakeApi#testEnumParameters");
e.printStackTrace(); e.printStackTrace();
@ -368,7 +366,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization
@ -381,7 +379,7 @@ No authorization required
<a name="testInlineAdditionalProperties"></a> <a name="testInlineAdditionalProperties"></a>
# **testInlineAdditionalProperties** # **testInlineAdditionalProperties**
> Void testInlineAdditionalProperties(param) > testInlineAdditionalProperties(param)
test inline additionalProperties test inline additionalProperties
@ -397,8 +395,7 @@ test inline additionalProperties
FakeApi apiInstance = new FakeApi(); FakeApi apiInstance = new FakeApi();
Object param = null; // Object | request body Object param = null; // Object | request body
try { try {
Void result = apiInstance.testInlineAdditionalProperties(param); apiInstance.testInlineAdditionalProperties(param);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties");
e.printStackTrace(); e.printStackTrace();
@ -413,7 +410,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization
@ -426,7 +423,7 @@ No authorization required
<a name="testJsonFormData"></a> <a name="testJsonFormData"></a>
# **testJsonFormData** # **testJsonFormData**
> Void testJsonFormData(param, param2) > testJsonFormData(param, param2)
test json serialization of form data test json serialization of form data
@ -443,8 +440,7 @@ FakeApi apiInstance = new FakeApi();
String param = "param_example"; // String | field1 String param = "param_example"; // String | field1
String param2 = "param2_example"; // String | field2 String param2 = "param2_example"; // String | field2
try { try {
Void result = apiInstance.testJsonFormData(param, param2); apiInstance.testJsonFormData(param, param2);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testJsonFormData"); System.err.println("Exception when calling FakeApi#testJsonFormData");
e.printStackTrace(); e.printStackTrace();
@ -460,7 +456,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization

View File

@ -16,7 +16,7 @@ Method | HTTP request | Description
<a name="addPet"></a> <a name="addPet"></a>
# **addPet** # **addPet**
> Void addPet(body) > addPet(body)
Add a new pet to the store Add a new pet to the store
@ -40,8 +40,7 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi(); PetApi apiInstance = new PetApi();
Pet body = new Pet(); // Pet | Pet object that needs to be added to the store Pet body = new Pet(); // Pet | Pet object that needs to be added to the store
try { try {
Void result = apiInstance.addPet(body); apiInstance.addPet(body);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling PetApi#addPet"); System.err.println("Exception when calling PetApi#addPet");
e.printStackTrace(); e.printStackTrace();
@ -56,7 +55,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization
@ -69,7 +68,7 @@ Name | Type | Description | Notes
<a name="deletePet"></a> <a name="deletePet"></a>
# **deletePet** # **deletePet**
> Void deletePet(petId, apiKey) > deletePet(petId, apiKey)
Deletes a pet Deletes a pet
@ -94,8 +93,7 @@ PetApi apiInstance = new PetApi();
Long petId = 789L; // Long | Pet id to delete Long petId = 789L; // Long | Pet id to delete
String apiKey = "apiKey_example"; // String | String apiKey = "apiKey_example"; // String |
try { try {
Void result = apiInstance.deletePet(petId, apiKey); apiInstance.deletePet(petId, apiKey);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling PetApi#deletePet"); System.err.println("Exception when calling PetApi#deletePet");
e.printStackTrace(); e.printStackTrace();
@ -111,7 +109,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization
@ -285,7 +283,7 @@ Name | Type | Description | Notes
<a name="updatePet"></a> <a name="updatePet"></a>
# **updatePet** # **updatePet**
> Void updatePet(body) > updatePet(body)
Update an existing pet Update an existing pet
@ -309,8 +307,7 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi(); PetApi apiInstance = new PetApi();
Pet body = new Pet(); // Pet | Pet object that needs to be added to the store Pet body = new Pet(); // Pet | Pet object that needs to be added to the store
try { try {
Void result = apiInstance.updatePet(body); apiInstance.updatePet(body);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling PetApi#updatePet"); System.err.println("Exception when calling PetApi#updatePet");
e.printStackTrace(); e.printStackTrace();
@ -325,7 +322,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization
@ -338,7 +335,7 @@ Name | Type | Description | Notes
<a name="updatePetWithForm"></a> <a name="updatePetWithForm"></a>
# **updatePetWithForm** # **updatePetWithForm**
> Void updatePetWithForm(petId, name, status) > updatePetWithForm(petId, name, status)
Updates a pet in the store with form data Updates a pet in the store with form data
@ -364,8 +361,7 @@ Long petId = 789L; // Long | ID of pet that needs to be updated
String name = "name_example"; // String | Updated name of the pet String name = "name_example"; // String | Updated name of the pet
String status = "status_example"; // String | Updated status of the pet String status = "status_example"; // String | Updated status of the pet
try { try {
Void result = apiInstance.updatePetWithForm(petId, name, status); apiInstance.updatePetWithForm(petId, name, status);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling PetApi#updatePetWithForm"); System.err.println("Exception when calling PetApi#updatePetWithForm");
e.printStackTrace(); e.printStackTrace();
@ -382,7 +378,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization

View File

@ -12,7 +12,7 @@ Method | HTTP request | Description
<a name="deleteOrder"></a> <a name="deleteOrder"></a>
# **deleteOrder** # **deleteOrder**
> Void deleteOrder(orderId) > deleteOrder(orderId)
Delete purchase order by ID Delete purchase order by ID
@ -28,8 +28,7 @@ For valid response try integer IDs with value &lt; 1000. Anything above 1000 or
StoreApi apiInstance = new StoreApi(); StoreApi apiInstance = new StoreApi();
String orderId = "orderId_example"; // String | ID of the order that needs to be deleted String orderId = "orderId_example"; // String | ID of the order that needs to be deleted
try { try {
Void result = apiInstance.deleteOrder(orderId); apiInstance.deleteOrder(orderId);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling StoreApi#deleteOrder"); System.err.println("Exception when calling StoreApi#deleteOrder");
e.printStackTrace(); e.printStackTrace();
@ -44,7 +43,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization

View File

@ -16,7 +16,7 @@ Method | HTTP request | Description
<a name="createUser"></a> <a name="createUser"></a>
# **createUser** # **createUser**
> Void createUser(body) > createUser(body)
Create user Create user
@ -32,8 +32,7 @@ This can only be done by the logged in user.
UserApi apiInstance = new UserApi(); UserApi apiInstance = new UserApi();
User body = new User(); // User | Created user object User body = new User(); // User | Created user object
try { try {
Void result = apiInstance.createUser(body); apiInstance.createUser(body);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling UserApi#createUser"); System.err.println("Exception when calling UserApi#createUser");
e.printStackTrace(); e.printStackTrace();
@ -48,7 +47,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization
@ -61,7 +60,7 @@ No authorization required
<a name="createUsersWithArrayInput"></a> <a name="createUsersWithArrayInput"></a>
# **createUsersWithArrayInput** # **createUsersWithArrayInput**
> Void createUsersWithArrayInput(body) > createUsersWithArrayInput(body)
Creates list of users with given input array Creates list of users with given input array
@ -77,8 +76,7 @@ Creates list of users with given input array
UserApi apiInstance = new UserApi(); UserApi apiInstance = new UserApi();
List<User> body = Arrays.asList(new User()); // List<User> | List of user object List<User> body = Arrays.asList(new User()); // List<User> | List of user object
try { try {
Void result = apiInstance.createUsersWithArrayInput(body); apiInstance.createUsersWithArrayInput(body);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); System.err.println("Exception when calling UserApi#createUsersWithArrayInput");
e.printStackTrace(); e.printStackTrace();
@ -93,7 +91,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization
@ -106,7 +104,7 @@ No authorization required
<a name="createUsersWithListInput"></a> <a name="createUsersWithListInput"></a>
# **createUsersWithListInput** # **createUsersWithListInput**
> Void createUsersWithListInput(body) > createUsersWithListInput(body)
Creates list of users with given input array Creates list of users with given input array
@ -122,8 +120,7 @@ Creates list of users with given input array
UserApi apiInstance = new UserApi(); UserApi apiInstance = new UserApi();
List<User> body = Arrays.asList(new User()); // List<User> | List of user object List<User> body = Arrays.asList(new User()); // List<User> | List of user object
try { try {
Void result = apiInstance.createUsersWithListInput(body); apiInstance.createUsersWithListInput(body);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling UserApi#createUsersWithListInput"); System.err.println("Exception when calling UserApi#createUsersWithListInput");
e.printStackTrace(); e.printStackTrace();
@ -138,7 +135,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization
@ -151,7 +148,7 @@ No authorization required
<a name="deleteUser"></a> <a name="deleteUser"></a>
# **deleteUser** # **deleteUser**
> Void deleteUser(username) > deleteUser(username)
Delete user Delete user
@ -167,8 +164,7 @@ This can only be done by the logged in user.
UserApi apiInstance = new UserApi(); UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The name that needs to be deleted String username = "username_example"; // String | The name that needs to be deleted
try { try {
Void result = apiInstance.deleteUser(username); apiInstance.deleteUser(username);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling UserApi#deleteUser"); System.err.println("Exception when calling UserApi#deleteUser");
e.printStackTrace(); e.printStackTrace();
@ -183,7 +179,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization
@ -210,7 +206,7 @@ Get user by user name
UserApi apiInstance = new UserApi(); UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing.
try { try {
User result = apiInstance.getUserByName(username); User result = apiInstance.getUserByName(username);
System.out.println(result); System.out.println(result);
@ -224,7 +220,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | **username** | **String**| The name that needs to be fetched. Use user1 for testing. |
### Return type ### Return type
@ -288,7 +284,7 @@ No authorization required
<a name="logoutUser"></a> <a name="logoutUser"></a>
# **logoutUser** # **logoutUser**
> Void logoutUser() > logoutUser()
Logs out current logged in user session Logs out current logged in user session
@ -303,8 +299,7 @@ Logs out current logged in user session
UserApi apiInstance = new UserApi(); UserApi apiInstance = new UserApi();
try { try {
Void result = apiInstance.logoutUser(); apiInstance.logoutUser();
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling UserApi#logoutUser"); System.err.println("Exception when calling UserApi#logoutUser");
e.printStackTrace(); e.printStackTrace();
@ -316,7 +311,7 @@ This endpoint does not need any parameter.
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization
@ -329,7 +324,7 @@ No authorization required
<a name="updateUser"></a> <a name="updateUser"></a>
# **updateUser** # **updateUser**
> Void updateUser(username, body) > updateUser(username, body)
Updated user Updated user
@ -346,8 +341,7 @@ UserApi apiInstance = new UserApi();
String username = "username_example"; // String | name that need to be deleted String username = "username_example"; // String | name that need to be deleted
User body = new User(); // User | Updated user object User body = new User(); // User | Updated user object
try { try {
Void result = apiInstance.updateUser(username, body); apiInstance.updateUser(username, body);
System.out.println(result);
} catch (ApiException e) { } catch (ApiException e) {
System.err.println("Exception when calling UserApi#updateUser"); System.err.println("Exception when calling UserApi#updateUser");
e.printStackTrace(); e.printStackTrace();
@ -363,7 +357,7 @@ Name | Type | Description | Notes
### Return type ### Return type
[**Void**](.md) null (empty response body)
### Authorization ### Authorization

View File

@ -208,7 +208,6 @@
<artifactId>converter-scalars</artifactId> <artifactId>converter-scalars</artifactId>
<version>${retrofit-version}</version> <version>${retrofit-version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.oltu.oauth2</groupId> <groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId> <artifactId>org.apache.oltu.oauth2.client</artifactId>

View File

@ -1,8 +0,0 @@
/*___Generated_by_IDEA___*/
package io.swagger.client;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}

View File

@ -1,7 +0,0 @@
/*___Generated_by_IDEA___*/
package io.swagger.client;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}

View File

@ -1,7 +0,0 @@
/*___Generated_by_IDEA___*/
package io.swagger.client;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}

View File

@ -120,7 +120,7 @@ public interface PetApi {
@retrofit2.http.Multipart @retrofit2.http.Multipart
@POST("pet/{petId}/uploadImage") @POST("pet/{petId}/uploadImage")
CompletionStage<Response<ModelApiResponse>> uploadFile( CompletionStage<Response<ModelApiResponse>> uploadFile(
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part okhttp3.MultipartBody.Part file @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part MultipartBody.Part file
); );
} }

View File

@ -67,7 +67,7 @@ public interface UserApi {
/** /**
* Get user by user name * Get user by user name
* *
* @param username The name that needs to be fetched. Use user1 for testing. (required) * @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return Call&lt;User&gt; * @return Call&lt;User&gt;
*/ */
@GET("user/{username}") @GET("user/{username}")

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import io.swagger.client.model.Animal; import io.swagger.client.model.Animal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid; import javax.validation.Valid;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;
@ -339,8 +340,8 @@ public class FormatTest {
Objects.equals(this._float, formatTest._float) && Objects.equals(this._float, formatTest._float) &&
Objects.equals(this._double, formatTest._double) && Objects.equals(this._double, formatTest._double) &&
Objects.equals(this.string, formatTest.string) && Objects.equals(this.string, formatTest.string) &&
Objects.equals(this._byte, formatTest._byte) && Arrays.equals(this._byte, formatTest._byte) &&
Objects.equals(this.binary, formatTest.binary) && Arrays.equals(this.binary, formatTest.binary) &&
Objects.equals(this.date, formatTest.date) && Objects.equals(this.date, formatTest.date) &&
Objects.equals(this.dateTime, formatTest.dateTime) && Objects.equals(this.dateTime, formatTest.dateTime) &&
Objects.equals(this.uuid, formatTest.uuid) && Objects.equals(this.uuid, formatTest.uuid) &&
@ -349,7 +350,7 @@ public class FormatTest {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), Arrays.hashCode(binary), date, dateTime, uuid, password);
} }

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid; import javax.validation.Valid;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -14,6 +14,7 @@
package io.swagger.client.model; package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;

View File

@ -206,7 +206,7 @@ Get user by user name
UserApi apiInstance = new UserApi(); UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing.
try { try {
User result = apiInstance.getUserByName(username); User result = apiInstance.getUserByName(username);
System.out.println(result); System.out.println(result);
@ -220,7 +220,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | **username** | **String**| The name that needs to be fetched. Use user1 for testing. |
### Return type ### Return type

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.Client; import io.swagger.client.model.Client;

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import java.math.BigDecimal; import java.math.BigDecimal;
import io.swagger.client.model.Client; import io.swagger.client.model.Client;

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.Client; import io.swagger.client.model.Client;

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import java.io.File; import java.io.File;
import io.swagger.client.model.ModelApiResponse; import io.swagger.client.model.ModelApiResponse;
@ -118,7 +119,7 @@ public interface PetApi {
@retrofit2.http.Multipart @retrofit2.http.Multipart
@POST("pet/{petId}/uploadImage") @POST("pet/{petId}/uploadImage")
Call<ModelApiResponse> uploadFile( Call<ModelApiResponse> uploadFile(
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file\"; filename=\"file") RequestBody file @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part MultipartBody.Part file
); );
} }

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.Order; import io.swagger.client.model.Order;

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.User; import io.swagger.client.model.User;
@ -63,7 +64,7 @@ public interface UserApi {
/** /**
* Get user by user name * Get user by user name
* *
* @param username The name that needs to be fetched. Use user1 for testing. (required) * @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return Call&lt;User&gt; * @return Call&lt;User&gt;
*/ */
@GET("user/{username}") @GET("user/{username}")

View File

@ -19,6 +19,7 @@ import retrofit2.Response;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.MultipartBody;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -139,9 +140,9 @@ public class PetApiTest {
File file = new File("hello.txt"); File file = new File("hello.txt");
BufferedWriter writer = new BufferedWriter(new FileWriter(file)); BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write("Hello world!"); writer.write("Hello world!");
writer.close(); writer.close();
final RequestBody body = RequestBody.create(MediaType.parse("text/plain"), file);
api.uploadFile(pet.getId(), null, RequestBody.create(MediaType.parse("text/plain"), file)).execute(); api.uploadFile(pet.getId(), null, MultipartBody.Part.createFormData("datafile", file.getName(), body)).execute();
} }
@Test @Test

View File

@ -206,7 +206,7 @@ Get user by user name
UserApi apiInstance = new UserApi(); UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing.
try { try {
User result = apiInstance.getUserByName(username); User result = apiInstance.getUserByName(username);
System.out.println(result); System.out.println(result);
@ -220,7 +220,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | **username** | **String**| The name that needs to be fetched. Use user1 for testing. |
### Return type ### Return type

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.Client; import io.swagger.client.model.Client;

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import java.math.BigDecimal; import java.math.BigDecimal;
import io.swagger.client.model.Client; import io.swagger.client.model.Client;

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.Client; import io.swagger.client.model.Client;

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import java.io.File; import java.io.File;
import io.swagger.client.model.ModelApiResponse; import io.swagger.client.model.ModelApiResponse;
@ -118,7 +119,7 @@ public interface PetApi {
@retrofit2.http.Multipart @retrofit2.http.Multipart
@POST("pet/{petId}/uploadImage") @POST("pet/{petId}/uploadImage")
Observable<ModelApiResponse> uploadFile( Observable<ModelApiResponse> uploadFile(
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file\"; filename=\"file") RequestBody file @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part MultipartBody.Part file
); );
} }

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.Order; import io.swagger.client.model.Order;

View File

@ -7,6 +7,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.User; import io.swagger.client.model.User;
@ -63,7 +64,7 @@ public interface UserApi {
/** /**
* Get user by user name * Get user by user name
* *
* @param username The name that needs to be fetched. Use user1 for testing. (required) * @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return Observable&lt;User&gt; * @return Observable&lt;User&gt;
*/ */
@GET("user/{username}") @GET("user/{username}")

View File

@ -14,6 +14,7 @@ import java.util.List;
import org.junit.*; import org.junit.*;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -200,8 +201,8 @@ public class PetApiTest {
Pet pet = createRandomPet(); Pet pet = createRandomPet();
api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError()); api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError());
RequestBody body = RequestBody.create(MediaType.parse("text/plain"), file); final RequestBody body = RequestBody.create(MediaType.parse("text/plain"), file);
api.uploadFile(pet.getId(), "a test file", body).subscribe(new SkeletonSubscriber<ModelApiResponse>() { api.uploadFile(pet.getId(), "a test file", MultipartBody.Part.createFormData("datafile", file.getName(), body)).subscribe(new SkeletonSubscriber<ModelApiResponse>() {
@Override @Override
public void onError(Throwable e) { public void onError(Throwable e) {
// this also yields a 400 for other tests, so I guess it's okay... // this also yields a 400 for other tests, so I guess it's okay...

View File

@ -206,7 +206,7 @@ Get user by user name
UserApi apiInstance = new UserApi(); UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing.
try { try {
User result = apiInstance.getUserByName(username); User result = apiInstance.getUserByName(username);
System.out.println(result); System.out.println(result);
@ -220,7 +220,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | **username** | **String**| The name that needs to be fetched. Use user1 for testing. |
### Return type ### Return type

View File

@ -8,6 +8,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.Client; import io.swagger.client.model.Client;

View File

@ -8,6 +8,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import java.math.BigDecimal; import java.math.BigDecimal;
import io.swagger.client.model.Client; import io.swagger.client.model.Client;

View File

@ -8,6 +8,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.Client; import io.swagger.client.model.Client;

View File

@ -8,6 +8,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import java.io.File; import java.io.File;
import io.swagger.client.model.ModelApiResponse; import io.swagger.client.model.ModelApiResponse;
@ -119,7 +120,7 @@ public interface PetApi {
@retrofit2.http.Multipart @retrofit2.http.Multipart
@POST("pet/{petId}/uploadImage") @POST("pet/{petId}/uploadImage")
Observable<ModelApiResponse> uploadFile( Observable<ModelApiResponse> uploadFile(
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file\"; filename=\"file") RequestBody file @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part MultipartBody.Part file
); );
} }

View File

@ -8,6 +8,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.Order; import io.swagger.client.model.Order;

View File

@ -8,6 +8,7 @@ import retrofit2.http.*;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import okhttp3.MultipartBody;
import io.swagger.client.model.User; import io.swagger.client.model.User;
@ -64,7 +65,7 @@ public interface UserApi {
/** /**
* Get user by user name * Get user by user name
* *
* @param username The name that needs to be fetched. Use user1 for testing. (required) * @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return Observable&lt;User&gt; * @return Observable&lt;User&gt;
*/ */
@GET("user/{username}") @GET("user/{username}")