Skip to content

Commit

Permalink
java update petstore clients
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Feb 22, 2018
1 parent d4543a9 commit e5001a0
Show file tree
Hide file tree
Showing 68 changed files with 1,007 additions and 145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface FakeClassnameTags123Api extends ApiClient.Api {

/**
* To test class name in snake case
*
* To test class name in snake case
* @param body client model (required)
* @return Client
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public interface UserApi extends ApiClient.Api {
/**
* 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 User
*/
@RequestLine("GET /user/{username}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Method | HTTP request | Description
To test class name in snake case

To test class name in snake case

### Example
```java
// Import classes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Get user by user name


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 {
User result = apiInstance.getUserByName(username);
System.out.println(result);
Expand All @@ -220,7 +220,7 @@ try {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void setApiClient(ApiClient apiClient) {
}

/**
* To test class name in snake case
* To test class name in snake case
* <p><b>200</b> - successful operation
* @param body client model
Expand All @@ -52,6 +53,7 @@ public Client testClassname(Client body) throws IOException {
}

/**
* To test class name in snake case
* To test class name in snake case
* <p><b>200</b> - successful operation
* @param body client model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public HttpResponse deleteUserForHttpResponse(String username, Map<String, Objec
* <p><b>200</b> - successful operation
* <p><b>400</b> - Invalid username supplied
* <p><b>404</b> - User not found
* @param username The name that needs to be fetched. Use user1 for testing.
* @param username The name that needs to be fetched. Use user1 for testing.
* @return User
* @throws IOException if an error occurs while attempting to invoke the API
**/
Expand All @@ -340,7 +340,7 @@ public User getUserByName(String username) throws IOException {
* <p><b>200</b> - successful operation
* <p><b>400</b> - Invalid username supplied
* <p><b>404</b> - User not found
* @param username The name that needs to be fetched. Use user1 for testing.
* @param username The name that needs to be fetched. Use user1 for testing.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return User
* @throws IOException if an error occurs while attempting to invoke the API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Method | HTTP request | Description
To test class name in snake case

To test class name in snake case

### Example
```java
// Import classes:
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/java/jersey1/docs/UserApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Get user by user name


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 {
User result = apiInstance.getUserByName(username);
System.out.println(result);
Expand All @@ -220,7 +220,7 @@ try {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void setApiClient(ApiClient apiClient) {

/**
* To test class name in snake case
*
* To test class name in snake case
* @param body client model (required)
* @return Client
* @throws ApiException if fails to make API call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public void deleteUser(String username) throws ApiException {
/**
* 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 User
* @throws ApiException if fails to make API call
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Method | HTTP request | Description
To test class name in snake case

To test class name in snake case

### Example
```java
// Import classes:
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/java/jersey2-java6/docs/UserApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Get user by user name


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 {
User result = apiInstance.getUserByName(username);
System.out.println(result);
Expand All @@ -220,7 +220,7 @@ try {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ public class ApiClient {

protected Map<String, Authentication> authentications;

protected int statusCode;
protected Map<String, List<String>> responseHeaders;

protected DateFormat dateFormat;

public ApiClient() {
Expand Down Expand Up @@ -113,22 +110,6 @@ public ApiClient setBasePath(String basePath) {
return this;
}

/**
* Gets the status code of the previous request
* @return Status code
*/
public int getStatusCode() {
return statusCode;
}

/**
* Gets the response headers of the previous request
* @return Response headers
*/
public Map<String, List<String>> getResponseHeaders() {
return responseHeaders;
}

/**
* Get authentications (key: authentication name, value: authentication).
* @return Map of authentication object
Expand Down Expand Up @@ -658,7 +639,7 @@ public File prepareDownloadFile(Response response) throws IOException {
* @return The response body in type of string
* @throws ApiException API exception
*/
public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
updateParamsForAuth(authNames, queryParams, headerParams);

// Not using `.target(this.basePath).path(path)` below,
Expand Down Expand Up @@ -713,16 +694,16 @@ public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Objec
throw new ApiException(500, "unknown method type " + method);
}

statusCode = response.getStatusInfo().getStatusCode();
responseHeaders = buildResponseHeaders(response);
int statusCode = response.getStatusInfo().getStatusCode();
Map<String, List<String>> responseHeaders = buildResponseHeaders(response);

if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) {
return null;
return new ApiResponse<>(statusCode, responseHeaders);
} else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) {
if (returnType == null)
return null;
return new ApiResponse<>(statusCode, responseHeaders);
else
return deserialize(response, returnType);
return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType));
} else {
String message = "error";
String respBody = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/


package io.swagger.client;

import java.util.List;
import java.util.Map;

/**
* API response returned by API call.
*
* @param <T> The type of data that is deserialized from response body
*/
public class ApiResponse<T> {
private final int statusCode;
private final Map<String, List<String>> headers;
private final T data;

/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
this(statusCode, headers, null);
}

/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
* @param data The object deserialized from response bod
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
this.statusCode = statusCode;
this.headers = headers;
this.data = data;
}

public int getStatusCode() {
return statusCode;
}

public Map<String, List<String>> getHeaders() {
return headers;
}

public T getData() {
return data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.swagger.client.ApiException;
import io.swagger.client.ApiClient;
import io.swagger.client.ApiResponse;
import io.swagger.client.Configuration;
import io.swagger.client.Pair;

Expand Down Expand Up @@ -42,6 +43,17 @@ public void setApiClient(ApiClient apiClient) {
* @throws ApiException if fails to make API call
*/
public Client testSpecialTags(Client body) throws ApiException {
return testSpecialTagsWithHttpInfo(body).getData();
}

/**
* To test special tags
* To test special tags
* @param body client model (required)
* @return ApiResponse&lt;Client&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Client> testSpecialTagsWithHttpInfo(Client body) throws ApiException {
Object localVarPostBody = body;

// verify the required parameter 'body' is set
Expand Down
Loading

0 comments on commit e5001a0

Please sign in to comment.