mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 02:55:19 +00:00
[Golang][client] fix undefined: localVarFile (#382)
* fix undefined: localVarFile * add required formData file endpoints to 2.0 and 3.0 specs * streamline api.mustache update * update sampels * update samples * update samples * update samples bin/jaxrs-cxf-client-petstore.sh * update samples * update samples * update samples run-all-petstore * update samples * update samples * Trigger CI due to race condition * update samples * update samples * Trigger CI due to previous timeout * Trigger CI due to previous Shippable timeout * Trigger CI due to previous Shippable race condition
This commit is contained in:
parent
8bddf12e05
commit
e960fe9512
@ -177,6 +177,9 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
{{#hasFormParams}}
|
||||
{{#formParams}}
|
||||
{{#isFile}}
|
||||
{{#required}}
|
||||
localVarFile := {{paramName}}
|
||||
{{/required}}
|
||||
{{^required}}
|
||||
var localVarFile {{dataType}}
|
||||
if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
|
||||
|
@ -272,6 +272,43 @@ paths:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
'/pet/{petId}/uploadImageWithRequiredFile':
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: uploads an image
|
||||
description: ''
|
||||
operationId: uploadFileWithRequiredFile
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
produces:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to update
|
||||
required: true
|
||||
type: integer
|
||||
format: int64
|
||||
- name: additionalMetadata
|
||||
in: formData
|
||||
description: Additional data to pass to server
|
||||
required: false
|
||||
type: string
|
||||
- name: file
|
||||
in: formData
|
||||
description: file to upload
|
||||
required: true
|
||||
type: file
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
schema:
|
||||
$ref: '#/definitions/ApiResponse'
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
|
@ -67,7 +67,6 @@ paths:
|
||||
description: Status values that need to be considered for filter
|
||||
required: true
|
||||
style: form
|
||||
explode: false
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
@ -112,7 +111,6 @@ paths:
|
||||
description: Tags to filter by
|
||||
required: true
|
||||
style: form
|
||||
explode: false
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
@ -267,6 +265,47 @@ paths:
|
||||
description: file to upload
|
||||
type: string
|
||||
format: binary
|
||||
'/pet/{petId}/uploadImageWithRequiredFile':
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: uploads an image
|
||||
description: ''
|
||||
operationId: uploadFileWithRequiredFile
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to update
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponse'
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
type: string
|
||||
format: binary
|
||||
required:
|
||||
- file
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
@ -436,7 +475,7 @@ paths:
|
||||
type: integer
|
||||
format: int32
|
||||
X-Expires-After:
|
||||
description: date in UTC when toekn expires
|
||||
description: date in UTC when token expires
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
@ -573,7 +612,6 @@ paths:
|
||||
parameters:
|
||||
- name: enum_header_string_array
|
||||
in: header
|
||||
explode: true
|
||||
description: Header parameter enum test (string array)
|
||||
schema:
|
||||
type: array
|
||||
@ -876,6 +914,26 @@ paths:
|
||||
type: string
|
||||
description: request body
|
||||
required: true
|
||||
/fake/body-with-query-params:
|
||||
put:
|
||||
tags:
|
||||
- fake
|
||||
operationId: testBodyWithQueryParams
|
||||
parameters:
|
||||
- name: query
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: Success
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
required: true
|
||||
/another-fake/dummy:
|
||||
patch:
|
||||
tags:
|
||||
@ -892,9 +950,6 @@ paths:
|
||||
$ref: '#/components/schemas/Client'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Client'
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: 'http://swagger.io'
|
||||
components:
|
||||
requestBodies:
|
||||
UserArray:
|
||||
@ -1394,6 +1449,7 @@ components:
|
||||
type: string
|
||||
OuterBoolean:
|
||||
type: boolean
|
||||
x-codegen-body-parameter-name: boolean_post_body
|
||||
_special_model.name_:
|
||||
properties:
|
||||
'$special[property.name]':
|
||||
|
@ -1 +1 @@
|
||||
3.0.3-SNAPSHOT
|
||||
3.0.3
|
@ -50,6 +50,7 @@ Class | Method | HTTP request | Description
|
||||
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **Put** /pet | Update an existing pet
|
||||
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **Post** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **Post** /pet/{petId}/uploadImage | uploads an image
|
||||
*PetApi* | [**UploadFileWithRequiredFile**](docs/PetApi.md#uploadfilewithrequiredfile) | **Post** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **Delete** /store/order/{order_id} | Delete purchase order by ID
|
||||
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **Get** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **Get** /store/order/{order_id} | Find purchase order by ID
|
||||
|
@ -282,6 +282,46 @@ paths:
|
||||
summary: uploads an image
|
||||
tags:
|
||||
- pet
|
||||
/pet/{petId}/uploadImageWithRequiredFile:
|
||||
post:
|
||||
operationId: uploadFileWithRequiredFile
|
||||
parameters:
|
||||
- description: ID of pet to update
|
||||
in: path
|
||||
name: petId
|
||||
required: true
|
||||
schema:
|
||||
format: int64
|
||||
type: integer
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
format: binary
|
||||
type: string
|
||||
required:
|
||||
- file
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponse'
|
||||
description: successful operation
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
summary: uploads an image
|
||||
tags:
|
||||
- pet
|
||||
/store/inventory:
|
||||
get:
|
||||
description: Returns a map of status codes to quantities
|
||||
|
@ -696,3 +696,106 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/*
|
||||
PetApiService uploads an image
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param petId ID of pet to update
|
||||
* @param file file to upload
|
||||
* @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters:
|
||||
* @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
|
||||
@return ApiResponse
|
||||
*/
|
||||
|
||||
type UploadFileWithRequiredFileOpts struct {
|
||||
AdditionalMetadata optional.String
|
||||
}
|
||||
|
||||
func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, file *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue ApiResponse
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/pet/{petId}/uploadImageWithRequiredFile"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"multipart/form-data"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
|
||||
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
|
||||
}
|
||||
localVarFile := file
|
||||
if localVarFile != nil {
|
||||
fbs, _ := ioutil.ReadAll(localVarFile)
|
||||
localVarFileBytes = fbs
|
||||
localVarFileName = localVarFile.Name()
|
||||
localVarFile.Close()
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode < 300 {
|
||||
// If we succeed, return the data, otherwise pass on to decode error.
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err == nil {
|
||||
return localVarReturnValue, localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v ApiResponse
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**UpdatePet**](PetApi.md#UpdatePet) | **Put** /pet | Update an existing pet
|
||||
[**UpdatePetWithForm**](PetApi.md#UpdatePetWithForm) | **Post** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**UploadFile**](PetApi.md#UploadFile) | **Post** /pet/{petId}/uploadImage | uploads an image
|
||||
[**UploadFileWithRequiredFile**](PetApi.md#UploadFileWithRequiredFile) | **Post** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
# **AddPet**
|
||||
@ -257,3 +258,40 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **UploadFileWithRequiredFile**
|
||||
> ApiResponse UploadFileWithRequiredFile(ctx, petId, file, optional)
|
||||
uploads an image
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**petId** | **int64**| ID of pet to update |
|
||||
**file** | ***os.File*****os.File**| file to upload |
|
||||
**optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
Optional parameters are passed through a pointer to a UploadFileWithRequiredFileOpts struct
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
|
||||
|
||||
**additionalMetadata** | **optional.String**| Additional data to pass to server |
|
||||
|
||||
### Return type
|
||||
|
||||
[**ApiResponse**](ApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -160,6 +160,26 @@ func TestUploadFile(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUploadFileRequired(t *testing.T) {
|
||||
return // remove when server supports this endpoint
|
||||
file, _ := os.Open("../python/testfiles/foo.png")
|
||||
|
||||
_, r, err := client.PetApi.UploadFileWithRequiredFile(context.Background(), 12830,
|
||||
file,
|
||||
&sw.UploadFileWithRequiredFileOpts{
|
||||
AdditionalMetadata: optional.NewString("golang"),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error while uploading file")
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
if r.StatusCode != 200 {
|
||||
t.Log(r)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeletePet(t *testing.T) {
|
||||
r, err := client.PetApi.DeletePet(context.Background(), 12830, nil)
|
||||
|
||||
|
@ -182,4 +182,19 @@ public interface PetApi extends ApiClient.Api {
|
||||
"Accept: application/json",
|
||||
})
|
||||
ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ModelApiResponse
|
||||
*/
|
||||
@RequestLine("POST /pet/{petId}/uploadImageWithRequiredFile")
|
||||
@Headers({
|
||||
"Content-Type: multipart/form-data",
|
||||
"Accept: application/json",
|
||||
})
|
||||
ModelApiResponse uploadFileWithRequiredFile(@Param("petId") Long petId, @Param("file") File file, @Param("additionalMetadata") String additionalMetadata);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -715,4 +715,93 @@ public class PetApi {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param petId ID of pet to update
|
||||
* @param file file to upload
|
||||
* @param additionalMetadata Additional data to pass to server
|
||||
* @return ModelApiResponse
|
||||
* @throws IOException if an error occurs while attempting to invoke the API
|
||||
**/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File file, String additionalMetadata) throws IOException {
|
||||
HttpResponse response = uploadFileWithRequiredFileForHttpResponse(petId, file, additionalMetadata);
|
||||
TypeReference typeRef = new TypeReference<ModelApiResponse>() {};
|
||||
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param petId ID of pet to update
|
||||
* @param file file to upload
|
||||
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
|
||||
* @return ModelApiResponse
|
||||
* @throws IOException if an error occurs while attempting to invoke the API
|
||||
**/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File file, Map<String, Object> params) throws IOException {
|
||||
HttpResponse response = uploadFileWithRequiredFileForHttpResponse(petId, file, params);
|
||||
TypeReference typeRef = new TypeReference<ModelApiResponse>() {};
|
||||
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
|
||||
}
|
||||
|
||||
public HttpResponse uploadFileWithRequiredFileForHttpResponse(Long petId, File file, String additionalMetadata) throws IOException {
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
|
||||
}// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'file' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
// create a map of path variables
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("petId", petId);
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/{petId}/uploadImageWithRequiredFile");
|
||||
|
||||
String url = uriBuilder.buildFromMap(uriVariables).toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
public HttpResponse uploadFileWithRequiredFileForHttpResponse(Long petId, File file, Map<String, Object> params) throws IOException {
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
|
||||
}// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
throw new IllegalArgumentException("Missing the required parameter 'file' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
// create a map of path variables
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("petId", petId);
|
||||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/{petId}/uploadImageWithRequiredFile");
|
||||
|
||||
// Copy the params argument if present, to allow passing in immutable maps
|
||||
Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
|
||||
|
||||
for (Map.Entry<String, Object> entry: allParams.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
|
||||
if (key != null && value != null) {
|
||||
if (value instanceof Collection) {
|
||||
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
|
||||
} else if (value instanceof Object[]) {
|
||||
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
|
||||
} else {
|
||||
uriBuilder = uriBuilder.queryParam(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String url = uriBuilder.buildFromMap(uriVariables).toString();
|
||||
GenericUrl genericUrl = new GenericUrl(url);
|
||||
|
||||
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
|
||||
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -385,6 +385,60 @@ if (status != null)
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
localVarFormParams.put("file", file);
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
|
||||
final String[] localVarContentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
|
||||
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ModelApiResponse
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'file' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/pet/{petId}/uploadImageWithRequiredFile"
|
||||
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -459,6 +459,72 @@ if (status != null)
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
localVarFormParams.put("file", file);
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
|
||||
final String[] localVarContentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
|
||||
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ModelApiResponse
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
return uploadFileWithRequiredFileWithHttpInfo(petId, file, additionalMetadata).getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ApiResponse<ModelApiResponse>
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
Object localVarPostBody = new Object();
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'file' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/pet/{petId}/uploadImageWithRequiredFile"
|
||||
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -459,6 +459,72 @@ if (status != null)
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
localVarFormParams.put("file", file);
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
|
||||
final String[] localVarContentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
|
||||
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ModelApiResponse
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
return uploadFileWithRequiredFileWithHttpInfo(petId, file, additionalMetadata).getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ApiResponse<ModelApiResponse>
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
Object localVarPostBody = new Object();
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'file' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/pet/{petId}/uploadImageWithRequiredFile"
|
||||
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -459,6 +459,72 @@ if (status != null)
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
localVarFormParams.put("file", file);
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
|
||||
final String[] localVarContentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
|
||||
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ModelApiResponse
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
return uploadFileWithRequiredFileWithHttpInfo(petId, file, additionalMetadata).getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ApiResponse<ModelApiResponse>
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
Object localVarPostBody = new Object();
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'file' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/pet/{petId}/uploadImageWithRequiredFile"
|
||||
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -1063,4 +1063,144 @@ public class PetApi {
|
||||
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||
return call;
|
||||
}
|
||||
/**
|
||||
* Build call for uploadFileWithRequiredFile
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @param progressListener Progress listener
|
||||
* @param progressRequestListener Progress request listener
|
||||
* @return Call to execute
|
||||
* @throws ApiException If fail to serialize the request body object
|
||||
*/
|
||||
public com.squareup.okhttp.Call uploadFileWithRequiredFileCall(Long petId, File file, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||
Object localVarPostBody = new Object();
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/pet/{petId}/uploadImageWithRequiredFile"
|
||||
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
|
||||
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
localVarFormParams.put("file", file);
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||
|
||||
final String[] localVarContentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||
|
||||
if(progressListener != null) {
|
||||
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||
@Override
|
||||
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||
return originalResponse.newBuilder()
|
||||
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||
.build();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private com.squareup.okhttp.Call uploadFileWithRequiredFileValidateBeforeCall(Long petId, File file, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new ApiException("Missing the required parameter 'petId' when calling uploadFileWithRequiredFile(Async)");
|
||||
}
|
||||
|
||||
// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
throw new ApiException("Missing the required parameter 'file' when calling uploadFileWithRequiredFile(Async)");
|
||||
}
|
||||
|
||||
|
||||
com.squareup.okhttp.Call call = uploadFileWithRequiredFileCall(petId, file, additionalMetadata, progressListener, progressRequestListener);
|
||||
return call;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ModelApiResponse
|
||||
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||
*/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
ApiResponse<ModelApiResponse> resp = uploadFileWithRequiredFileWithHttpInfo(petId, file, additionalMetadata);
|
||||
return resp.getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ApiResponse<ModelApiResponse>
|
||||
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||
*/
|
||||
public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
com.squareup.okhttp.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, file, additionalMetadata, null, null);
|
||||
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
|
||||
return apiClient.execute(call, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image (asynchronously)
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @param callback The callback to be executed when the API call finishes
|
||||
* @return The request call
|
||||
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||
*/
|
||||
public com.squareup.okhttp.Call uploadFileWithRequiredFileAsync(Long petId, File file, String additionalMetadata, final ApiCallback<ModelApiResponse> callback) throws ApiException {
|
||||
|
||||
ProgressResponseBody.ProgressListener progressListener = null;
|
||||
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||
|
||||
if (callback != null) {
|
||||
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||
@Override
|
||||
public void update(long bytesRead, long contentLength, boolean done) {
|
||||
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||
}
|
||||
};
|
||||
|
||||
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||
@Override
|
||||
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
com.squareup.okhttp.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, file, additionalMetadata, progressListener, progressRequestListener);
|
||||
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
|
||||
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||
return call;
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -1063,4 +1063,144 @@ public class PetApi {
|
||||
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||
return call;
|
||||
}
|
||||
/**
|
||||
* Build call for uploadFileWithRequiredFile
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @param progressListener Progress listener
|
||||
* @param progressRequestListener Progress request listener
|
||||
* @return Call to execute
|
||||
* @throws ApiException If fail to serialize the request body object
|
||||
*/
|
||||
public com.squareup.okhttp.Call uploadFileWithRequiredFileCall(Long petId, File file, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||
Object localVarPostBody = new Object();
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/pet/{petId}/uploadImageWithRequiredFile"
|
||||
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
|
||||
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
localVarFormParams.put("file", file);
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
|
||||
|
||||
final String[] localVarContentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
localVarHeaderParams.put("Content-Type", localVarContentType);
|
||||
|
||||
if(progressListener != null) {
|
||||
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
|
||||
@Override
|
||||
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
|
||||
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
|
||||
return originalResponse.newBuilder()
|
||||
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
|
||||
.build();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private com.squareup.okhttp.Call uploadFileWithRequiredFileValidateBeforeCall(Long petId, File file, String additionalMetadata, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new ApiException("Missing the required parameter 'petId' when calling uploadFileWithRequiredFile(Async)");
|
||||
}
|
||||
|
||||
// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
throw new ApiException("Missing the required parameter 'file' when calling uploadFileWithRequiredFile(Async)");
|
||||
}
|
||||
|
||||
|
||||
com.squareup.okhttp.Call call = uploadFileWithRequiredFileCall(petId, file, additionalMetadata, progressListener, progressRequestListener);
|
||||
return call;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ModelApiResponse
|
||||
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||
*/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
ApiResponse<ModelApiResponse> resp = uploadFileWithRequiredFileWithHttpInfo(petId, file, additionalMetadata);
|
||||
return resp.getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ApiResponse<ModelApiResponse>
|
||||
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
|
||||
*/
|
||||
public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
com.squareup.okhttp.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, file, additionalMetadata, null, null);
|
||||
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
|
||||
return apiClient.execute(call, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image (asynchronously)
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @param callback The callback to be executed when the API call finishes
|
||||
* @return The request call
|
||||
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
|
||||
*/
|
||||
public com.squareup.okhttp.Call uploadFileWithRequiredFileAsync(Long petId, File file, String additionalMetadata, final ApiCallback<ModelApiResponse> callback) throws ApiException {
|
||||
|
||||
ProgressResponseBody.ProgressListener progressListener = null;
|
||||
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
|
||||
|
||||
if (callback != null) {
|
||||
progressListener = new ProgressResponseBody.ProgressListener() {
|
||||
@Override
|
||||
public void update(long bytesRead, long contentLength, boolean done) {
|
||||
callback.onDownloadProgress(bytesRead, contentLength, done);
|
||||
}
|
||||
};
|
||||
|
||||
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
|
||||
@Override
|
||||
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
|
||||
callback.onUploadProgress(bytesWritten, contentLength, done);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
com.squareup.okhttp.Call call = uploadFileWithRequiredFileValidateBeforeCall(petId, file, additionalMetadata, progressListener, progressRequestListener);
|
||||
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
|
||||
apiClient.executeAsync(call, localVarReturnType, callback);
|
||||
return call;
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -345,3 +346,46 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
//import org.openapitools.client.ApiClient;
|
||||
//import io.restassured.builder.RequestSpecBuilder;
|
||||
//import io.restassured.filter.log.ErrorLoggingFilter;
|
||||
|
||||
PetApi api = ApiClient.api(ApiClient.Config.apiConfig().withReqSpecSupplier(
|
||||
() -> new RequestSpecBuilder()
|
||||
.setBaseUri("http://petstore.swagger.io:80/v2"))).pet();
|
||||
|
||||
api.uploadFileWithRequiredFile()
|
||||
.petIdPath(petId)
|
||||
.fileMultiPart(file).execute(r -> r.prettyPeek());
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -82,6 +82,10 @@ public class PetApi {
|
||||
return new UploadFileOper(reqSpec);
|
||||
}
|
||||
|
||||
public UploadFileWithRequiredFileOper uploadFileWithRequiredFile() {
|
||||
return new UploadFileWithRequiredFileOper(reqSpec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Customise request specification
|
||||
* @param consumer consumer
|
||||
@ -738,4 +742,108 @@ public class PetApi {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
*
|
||||
* @see #petIdPath ID of pet to update (required)
|
||||
* @see #fileMultiPart file to upload (required)
|
||||
* @see #additionalMetadataForm Additional data to pass to server (optional, default to null)
|
||||
* return ModelApiResponse
|
||||
*/
|
||||
public class UploadFileWithRequiredFileOper {
|
||||
|
||||
public static final String REQ_URI = "/pet/{petId}/uploadImageWithRequiredFile";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public UploadFileWithRequiredFileOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("multipart/form-data");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public UploadFileWithRequiredFileOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("multipart/form-data");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /pet/{petId}/uploadImageWithRequiredFile
|
||||
* @param handler handler
|
||||
* @param <T> type
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /pet/{petId}/uploadImageWithRequiredFile
|
||||
* @param handler handler
|
||||
* @return ModelApiResponse
|
||||
*/
|
||||
public ModelApiResponse executeAs(Function<Response, Response> handler) {
|
||||
Type type = new TypeToken<ModelApiResponse>(){}.getType();
|
||||
return execute(handler).as(type);
|
||||
}
|
||||
|
||||
public static final String PET_ID_PATH = "petId";
|
||||
|
||||
/**
|
||||
* @param petId (Long) ID of pet to update (required)
|
||||
* @return operation
|
||||
*/
|
||||
public UploadFileWithRequiredFileOper petIdPath(Object petId) {
|
||||
reqSpec.addPathParam(PET_ID_PATH, petId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public static final String ADDITIONAL_METADATA_FORM = "additionalMetadata";
|
||||
|
||||
/**
|
||||
* @param additionalMetadata (String) Additional data to pass to server (optional, default to null)
|
||||
* @return operation
|
||||
*/
|
||||
public UploadFileWithRequiredFileOper additionalMetadataForm(Object... additionalMetadata) {
|
||||
reqSpec.addFormParam(ADDITIONAL_METADATA_FORM, additionalMetadata);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* It will assume that the control name is file and the <content-type> is <application/octet-stream>
|
||||
* @see #reqSpec for customise
|
||||
* @param file (File) file to upload (required)
|
||||
* @return operation
|
||||
*/
|
||||
public UploadFileWithRequiredFileOper fileMultiPart(File file) {
|
||||
reqSpec.addMultiPart(file);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customise request specification
|
||||
* @param consumer consumer
|
||||
* @return operation
|
||||
*/
|
||||
public UploadFileWithRequiredFileOper reqSpec(Consumer<RequestSpecBuilder> consumer) {
|
||||
consumer.accept(reqSpec);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customise response specification
|
||||
* @param consumer consumer
|
||||
* @return operation
|
||||
*/
|
||||
public UploadFileWithRequiredFileOper respSpec(Consumer<ResponseSpecBuilder> consumer) {
|
||||
consumer.accept(respSpec);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -363,6 +363,59 @@ if (status != null)
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
localVarFormParams.put("file", file);
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
|
||||
final String[] localVarContentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
|
||||
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return a {@code ModelApiResponse}
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File file, String additionalMetadata) throws ApiException {
|
||||
Object localVarPostBody = new Object();
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'file' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/pet/{petId}/uploadImageWithRequiredFile".replaceAll("\\{format\\}","json")
|
||||
.replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
|
||||
|
||||
|
||||
if (additionalMetadata != null)
|
||||
localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -352,6 +352,57 @@ public class PetApi {
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param petId ID of pet to update
|
||||
* @param file file to upload
|
||||
* @param additionalMetadata Additional data to pass to server
|
||||
* @return ModelApiResponse
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File file, String additionalMetadata) throws RestClientException {
|
||||
Object postBody = new Object();
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'file' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("petId", petId);
|
||||
String path = UriComponentsBuilder.fromPath("/pet/{petId}/uploadImageWithRequiredFile").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
if (additionalMetadata != null)
|
||||
formParams.add("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
formParams.add("file", new FileSystemResource(file));
|
||||
|
||||
final String[] accepts = {
|
||||
"application/json"
|
||||
};
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -352,6 +352,57 @@ public class PetApi {
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param petId ID of pet to update
|
||||
* @param file file to upload
|
||||
* @param additionalMetadata Additional data to pass to server
|
||||
* @return ModelApiResponse
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File file, String additionalMetadata) throws RestClientException {
|
||||
Object postBody = new Object();
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'file' when calling uploadFileWithRequiredFile");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
final Map<String, Object> uriVariables = new HashMap<String, Object>();
|
||||
uriVariables.put("petId", petId);
|
||||
String path = UriComponentsBuilder.fromPath("/pet/{petId}/uploadImageWithRequiredFile").buildAndExpand(uriVariables).toUriString();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
if (additionalMetadata != null)
|
||||
formParams.add("additionalMetadata", additionalMetadata);
|
||||
if (file != null)
|
||||
formParams.add("file", new FileSystemResource(file));
|
||||
|
||||
final String[] accepts = {
|
||||
"application/json"
|
||||
};
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
|
||||
String[] authNames = new String[] { "petstore_auth" };
|
||||
|
||||
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
|
@ -222,4 +222,34 @@ public interface PetApi {
|
||||
void uploadFile(
|
||||
@retrofit.http.Path("petId") Long petId, @retrofit.http.Part("additionalMetadata") String additionalMetadata, @retrofit.http.Part("file") TypedFile file, Callback<ModelApiResponse> cb
|
||||
);
|
||||
/**
|
||||
* uploads an image
|
||||
* Sync method
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return ModelApiResponse
|
||||
*/
|
||||
|
||||
@retrofit.http.Multipart
|
||||
@POST("/pet/{petId}/uploadImageWithRequiredFile")
|
||||
ModelApiResponse uploadFileWithRequiredFile(
|
||||
@retrofit.http.Path("petId") Long petId, @retrofit.http.Part("file") TypedFile file, @retrofit.http.Part("additionalMetadata") String additionalMetadata
|
||||
);
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
* Async method
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @param cb callback method
|
||||
*/
|
||||
|
||||
@retrofit.http.Multipart
|
||||
@POST("/pet/{petId}/uploadImageWithRequiredFile")
|
||||
void uploadFileWithRequiredFile(
|
||||
@retrofit.http.Path("petId") Long petId, @retrofit.http.Part("file") TypedFile file, @retrofit.http.Part("additionalMetadata") String additionalMetadata, Callback<ModelApiResponse> cb
|
||||
);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -125,4 +125,18 @@ public interface PetApi {
|
||||
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file") MultipartBody.Part file
|
||||
);
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return Call<ModelApiResponse>
|
||||
*/
|
||||
@retrofit2.http.Multipart
|
||||
@POST("pet/{petId}/uploadImageWithRequiredFile")
|
||||
F.Promise<Response<ModelApiResponse>> uploadFileWithRequiredFile(
|
||||
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("file") MultipartBody.Part file, @retrofit2.http.Part("additionalMetadata") String additionalMetadata
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -125,4 +125,18 @@ public interface PetApi {
|
||||
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file") MultipartBody.Part file
|
||||
);
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return Call<ModelApiResponse>
|
||||
*/
|
||||
@retrofit2.http.Multipart
|
||||
@POST("pet/{petId}/uploadImageWithRequiredFile")
|
||||
CompletionStage<Response<ModelApiResponse>> uploadFileWithRequiredFile(
|
||||
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("file") MultipartBody.Part file, @retrofit2.http.Part("additionalMetadata") String additionalMetadata
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -122,4 +122,18 @@ public interface PetApi {
|
||||
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file") MultipartBody.Part file
|
||||
);
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return Call<ModelApiResponse>
|
||||
*/
|
||||
@retrofit2.http.Multipart
|
||||
@POST("pet/{petId}/uploadImageWithRequiredFile")
|
||||
Call<ModelApiResponse> uploadFileWithRequiredFile(
|
||||
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("file") MultipartBody.Part file, @retrofit2.http.Part("additionalMetadata") String additionalMetadata
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -122,4 +122,18 @@ public interface PetApi {
|
||||
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file") MultipartBody.Part file
|
||||
);
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return Observable<ModelApiResponse>
|
||||
*/
|
||||
@retrofit2.http.Multipart
|
||||
@POST("pet/{petId}/uploadImageWithRequiredFile")
|
||||
Observable<ModelApiResponse> uploadFileWithRequiredFile(
|
||||
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("file") MultipartBody.Part file, @retrofit2.http.Part("additionalMetadata") String additionalMetadata
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
File file = new File("null"); // File | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **File**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -123,4 +123,18 @@ public interface PetApi {
|
||||
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file") MultipartBody.Part file
|
||||
);
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return Observable<ModelApiResponse>
|
||||
*/
|
||||
@retrofit2.http.Multipart
|
||||
@POST("pet/{petId}/uploadImageWithRequiredFile")
|
||||
Observable<ModelApiResponse> uploadFileWithRequiredFile(
|
||||
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("file") MultipartBody.Part file, @retrofit2.http.Part("additionalMetadata") String additionalMetadata
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
<a name="addPet"></a>
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="uploadFileWithRequiredFile"></a>
|
||||
# **uploadFileWithRequiredFile**
|
||||
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```java
|
||||
// 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.api.PetApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
AsyncFile file = new AsyncFile(); // AsyncFile | file to upload
|
||||
String additionalMetadata = "null"; // String | Additional data to pass to server
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | **Long**| ID of pet to update |
|
||||
**file** | **AsyncFile**| file to upload | [default to null]
|
||||
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ModelApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
@ -27,4 +27,6 @@ public interface PetApi {
|
||||
|
||||
void uploadFile(Long petId, String additionalMetadata, AsyncFile file, Handler<AsyncResult<ModelApiResponse>> handler);
|
||||
|
||||
void uploadFileWithRequiredFile(Long petId, AsyncFile file, String additionalMetadata, Handler<AsyncResult<ModelApiResponse>> handler);
|
||||
|
||||
}
|
||||
|
@ -312,6 +312,50 @@ if (status != null) localVarFormParams.put("status", status);
|
||||
// header params
|
||||
MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap();
|
||||
|
||||
// form params
|
||||
// TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client)
|
||||
Map<String, Object> localVarFormParams = new HashMap<>();
|
||||
if (additionalMetadata != null) localVarFormParams.put("additionalMetadata", additionalMetadata);
|
||||
if (file != null) localVarFormParams.put("file", file);
|
||||
|
||||
String[] localVarAccepts = { "application/json" };
|
||||
String[] localVarContentTypes = { "multipart/form-data" };
|
||||
String[] localVarAuthNames = new String[] { "petstore_auth" };
|
||||
TypeReference<ModelApiResponse> localVarReturnType = new TypeReference<ModelApiResponse>() {};
|
||||
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, localVarReturnType, resultHandler);
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @param resultHandler Asynchronous result handler
|
||||
*/
|
||||
public void uploadFileWithRequiredFile(Long petId, AsyncFile file, String additionalMetadata, Handler<AsyncResult<ModelApiResponse>> resultHandler) {
|
||||
Object localVarBody = null;
|
||||
|
||||
// verify the required parameter 'petId' is set
|
||||
if (petId == null) {
|
||||
resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"));
|
||||
return;
|
||||
}
|
||||
|
||||
// verify the required parameter 'file' is set
|
||||
if (file == null) {
|
||||
resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'file' when calling uploadFileWithRequiredFile"));
|
||||
return;
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/pet/{petId}/uploadImageWithRequiredFile".replaceAll("\\{" + "petId" + "\\}", petId.toString());
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<>();
|
||||
|
||||
// header params
|
||||
MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap();
|
||||
|
||||
// form params
|
||||
// TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client)
|
||||
Map<String, Object> localVarFormParams = new HashMap<>();
|
||||
|
@ -201,6 +201,31 @@ public class PetApi {
|
||||
delegate.uploadFile(petId, additionalMetadata, file, fut);
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @param resultHandler Asynchronous result handler
|
||||
*/
|
||||
public void uploadFileWithRequiredFile(Long petId, AsyncFile file, String additionalMetadata, Handler<AsyncResult<ModelApiResponse>> resultHandler) {
|
||||
delegate.uploadFileWithRequiredFile(petId, file, additionalMetadata, resultHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @param petId ID of pet to update (required)
|
||||
* @param file file to upload (required)
|
||||
* @param additionalMetadata Additional data to pass to server (optional, default to null)
|
||||
* @return Asynchronous result handler (RxJava Single)
|
||||
*/
|
||||
public Single<ModelApiResponse> rxUploadFileWithRequiredFile(Long petId, AsyncFile file, String additionalMetadata) {
|
||||
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
|
||||
delegate.uploadFileWithRequiredFile(petId, file, additionalMetadata, fut);
|
||||
}));
|
||||
}
|
||||
|
||||
public static PetApi newInstance(org.openapitools.client.api.PetApi arg) {
|
||||
return arg != null ? new PetApi(arg) : null;
|
||||
|
@ -99,6 +99,7 @@ Class | Method | HTTP request | Description
|
||||
*PetApi* | [**updatePet**](docs/Api/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**updatePetWithForm**](docs/Api/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**uploadFile**](docs/Api/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*PetApi* | [**uploadFileWithRequiredFile**](docs/Api/PetApi.md#uploadfilewithrequiredfile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
*StoreApi* | [**deleteOrder**](docs/Api/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
*StoreApi* | [**getInventory**](docs/Api/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**getOrderById**](docs/Api/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
# **addPet**
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
|
||||
|
||||
# **uploadFileWithRequiredFile**
|
||||
> \OpenAPI\Client\Model\ApiResponse uploadFileWithRequiredFile($pet_id, $file, $additional_metadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```php
|
||||
<?php
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
|
||||
|
||||
$apiInstance = new OpenAPI\Client\Api\PetApi(
|
||||
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
|
||||
// This is optional, `GuzzleHttp\Client` will be used as default.
|
||||
new GuzzleHttp\Client(),
|
||||
$config
|
||||
);
|
||||
$pet_id = 56; // int | ID of pet to update
|
||||
$file = "/path/to/file.txt"; // \SplFileObject | file to upload
|
||||
$additional_metadata = 'additional_metadata_example'; // string | Additional data to pass to server
|
||||
|
||||
try {
|
||||
$result = $apiInstance->uploadFileWithRequiredFile($pet_id, $file, $additional_metadata);
|
||||
print_r($result);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling PetApi->uploadFileWithRequiredFile: ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
?>
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| ID of pet to update |
|
||||
**file** | **\SplFileObject****\SplFileObject**| file to upload |
|
||||
**additional_metadata** | **string**| Additional data to pass to server | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**\OpenAPI\Client\Model\ApiResponse**](../Model/ApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
|
||||
|
||||
|
@ -2174,6 +2174,316 @@ class PetApi
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation uploadFileWithRequiredFile
|
||||
*
|
||||
* uploads an image
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param \SplFileObject $file file to upload (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (optional)
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \OpenAPI\Client\Model\ApiResponse
|
||||
*/
|
||||
public function uploadFileWithRequiredFile($pet_id, $file, $additional_metadata = null)
|
||||
{
|
||||
list($response) = $this->uploadFileWithRequiredFileWithHttpInfo($pet_id, $file, $additional_metadata);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation uploadFileWithRequiredFileWithHttpInfo
|
||||
*
|
||||
* uploads an image
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param \SplFileObject $file file to upload (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (optional)
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings)
|
||||
*/
|
||||
public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $file, $additional_metadata = null)
|
||||
{
|
||||
$request = $this->uploadFileWithRequiredFileRequest($pet_id, $file, $additional_metadata);
|
||||
|
||||
try {
|
||||
$options = $this->createHttpClientOption();
|
||||
try {
|
||||
$response = $this->client->send($request, $options);
|
||||
} catch (RequestException $e) {
|
||||
throw new ApiException(
|
||||
"[{$e->getCode()}] {$e->getMessage()}",
|
||||
$e->getCode(),
|
||||
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
||||
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
|
||||
);
|
||||
}
|
||||
|
||||
$statusCode = $response->getStatusCode();
|
||||
|
||||
if ($statusCode < 200 || $statusCode > 299) {
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
$request->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
$response->getBody()
|
||||
);
|
||||
}
|
||||
|
||||
$responseBody = $response->getBody();
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('\OpenAPI\Client\Model\ApiResponse' === '\SplFileObject') {
|
||||
$content = $responseBody; //stream goes to serializer
|
||||
} else {
|
||||
$content = $responseBody->getContents();
|
||||
if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ApiResponse', []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
}
|
||||
|
||||
$returnType = '\OpenAPI\Client\Model\ApiResponse';
|
||||
$responseBody = $response->getBody();
|
||||
if ($returnType === '\SplFileObject') {
|
||||
$content = $responseBody; //stream goes to serializer
|
||||
} else {
|
||||
$content = $responseBody->getContents();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, $returnType, []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = ObjectSerializer::deserialize(
|
||||
$e->getResponseBody(),
|
||||
'\OpenAPI\Client\Model\ApiResponse',
|
||||
$e->getResponseHeaders()
|
||||
);
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation uploadFileWithRequiredFileAsync
|
||||
*
|
||||
* uploads an image
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param \SplFileObject $file file to upload (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (optional)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function uploadFileWithRequiredFileAsync($pet_id, $file, $additional_metadata = null)
|
||||
{
|
||||
return $this->uploadFileWithRequiredFileAsyncWithHttpInfo($pet_id, $file, $additional_metadata)
|
||||
->then(
|
||||
function ($response) {
|
||||
return $response[0];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation uploadFileWithRequiredFileAsyncWithHttpInfo
|
||||
*
|
||||
* uploads an image
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param \SplFileObject $file file to upload (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (optional)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function uploadFileWithRequiredFileAsyncWithHttpInfo($pet_id, $file, $additional_metadata = null)
|
||||
{
|
||||
$returnType = '\OpenAPI\Client\Model\ApiResponse';
|
||||
$request = $this->uploadFileWithRequiredFileRequest($pet_id, $file, $additional_metadata);
|
||||
|
||||
return $this->client
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
$responseBody = $response->getBody();
|
||||
if ($returnType === '\SplFileObject') {
|
||||
$content = $responseBody; //stream goes to serializer
|
||||
} else {
|
||||
$content = $responseBody->getContents();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, $returnType, []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
},
|
||||
function ($exception) {
|
||||
$response = $exception->getResponse();
|
||||
$statusCode = $response->getStatusCode();
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
$exception->getRequest()->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
$response->getBody()
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create request for operation 'uploadFileWithRequiredFile'
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param \SplFileObject $file file to upload (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (optional)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Psr7\Request
|
||||
*/
|
||||
protected function uploadFileWithRequiredFileRequest($pet_id, $file, $additional_metadata = null)
|
||||
{
|
||||
// verify the required parameter 'pet_id' is set
|
||||
if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Missing the required parameter $pet_id when calling uploadFileWithRequiredFile'
|
||||
);
|
||||
}
|
||||
// verify the required parameter 'file' is set
|
||||
if ($file === null || (is_array($file) && count($file) === 0)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Missing the required parameter $file when calling uploadFileWithRequiredFile'
|
||||
);
|
||||
}
|
||||
|
||||
$resourcePath = '/pet/{petId}/uploadImageWithRequiredFile';
|
||||
$formParams = [];
|
||||
$queryParams = [];
|
||||
$headerParams = [];
|
||||
$httpBody = '';
|
||||
$multipart = false;
|
||||
|
||||
|
||||
// path params
|
||||
if ($pet_id !== null) {
|
||||
$resourcePath = str_replace(
|
||||
'{' . 'petId' . '}',
|
||||
ObjectSerializer::toPathValue($pet_id),
|
||||
$resourcePath
|
||||
);
|
||||
}
|
||||
|
||||
// form params
|
||||
if ($additional_metadata !== null) {
|
||||
$formParams['additionalMetadata'] = ObjectSerializer::toFormValue($additional_metadata);
|
||||
}
|
||||
// form params
|
||||
if ($file !== null) {
|
||||
$multipart = true;
|
||||
$formParams['file'] = \GuzzleHttp\Psr7\try_fopen(ObjectSerializer::toFormValue($file), 'rb');
|
||||
}
|
||||
// body params
|
||||
$_tempBody = null;
|
||||
|
||||
if ($multipart) {
|
||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
||||
['application/json']
|
||||
);
|
||||
} else {
|
||||
$headers = $this->headerSelector->selectHeaders(
|
||||
['application/json'],
|
||||
['multipart/form-data']
|
||||
);
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($_tempBody)) {
|
||||
// $_tempBody is the method argument, if present
|
||||
$httpBody = $_tempBody;
|
||||
// \stdClass has no __toString(), so we should encode it manually
|
||||
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
|
||||
$httpBody = \GuzzleHttp\json_encode($httpBody);
|
||||
}
|
||||
} elseif (count($formParams) > 0) {
|
||||
if ($multipart) {
|
||||
$multipartContents = [];
|
||||
foreach ($formParams as $formParamName => $formParamValue) {
|
||||
$multipartContents[] = [
|
||||
'name' => $formParamName,
|
||||
'contents' => $formParamValue
|
||||
];
|
||||
}
|
||||
// for HTTP post (form)
|
||||
$httpBody = new MultipartStream($multipartContents);
|
||||
|
||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||
|
||||
} else {
|
||||
// for HTTP post (form)
|
||||
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
|
||||
}
|
||||
}
|
||||
|
||||
// this endpoint requires OAuth (access token)
|
||||
if ($this->config->getAccessToken() !== null) {
|
||||
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
||||
}
|
||||
|
||||
$defaultHeaders = [];
|
||||
if ($this->config->getUserAgent()) {
|
||||
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
||||
}
|
||||
|
||||
$headers = array_merge(
|
||||
$defaultHeaders,
|
||||
$headerParams,
|
||||
$headers
|
||||
);
|
||||
|
||||
$query = \GuzzleHttp\Psr7\build_query($queryParams);
|
||||
return new Request(
|
||||
'POST',
|
||||
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
|
||||
$headers,
|
||||
$httpBody
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create http client option
|
||||
*
|
||||
|
@ -150,4 +150,14 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function testUploadFile()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for uploadFileWithRequiredFile
|
||||
*
|
||||
* uploads an image.
|
||||
*
|
||||
*/
|
||||
public function testUploadFileWithRequiredFile()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +93,7 @@ Class | Method | HTTP request | Description
|
||||
*Petstore::PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet
|
||||
*Petstore::PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*Petstore::PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*Petstore::PetApi* | [**upload_file_with_required_file**](docs/PetApi.md#upload_file_with_required_file) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
*Petstore::StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
*Petstore::StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*Petstore::StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet
|
||||
[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**upload_file_with_required_file**](PetApi.md#upload_file_with_required_file) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
# **add_pet**
|
||||
@ -418,3 +419,57 @@ Name | Type | Description | Notes
|
||||
|
||||
|
||||
|
||||
# **upload_file_with_required_file**
|
||||
> ApiResponse upload_file_with_required_file(pet_id, file, opts)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
pet_id = 56 # Integer | ID of pet to update
|
||||
file = File.new('/path/to/file') # File | file to upload
|
||||
opts = {
|
||||
additional_metadata: 'additional_metadata_example' # String | Additional data to pass to server
|
||||
}
|
||||
|
||||
begin
|
||||
#uploads an image
|
||||
result = api_instance.upload_file_with_required_file(pet_id, file, opts)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling PetApi->upload_file_with_required_file: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **Integer**| ID of pet to update |
|
||||
**file** | **File**| file to upload |
|
||||
**additional_metadata** | **String**| Additional data to pass to server | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ApiResponse**](ApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
|
||||
|
@ -438,5 +438,67 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
# uploads an image
|
||||
# @param pet_id ID of pet to update
|
||||
# @param file file to upload
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @return [ApiResponse]
|
||||
def upload_file_with_required_file(pet_id, file, opts = {})
|
||||
data, _status_code, _headers = upload_file_with_required_file_with_http_info(pet_id, file, opts)
|
||||
data
|
||||
end
|
||||
|
||||
# uploads an image
|
||||
# @param pet_id ID of pet to update
|
||||
# @param file file to upload
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @return [Array<(ApiResponse, Fixnum, Hash)>] ApiResponse data, response status code and response headers
|
||||
def upload_file_with_required_file_with_http_info(pet_id, file, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug 'Calling API: PetApi.upload_file_with_required_file ...'
|
||||
end
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if @api_client.config.client_side_validation && pet_id.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.upload_file_with_required_file"
|
||||
end
|
||||
# verify the required parameter 'file' is set
|
||||
if @api_client.config.client_side_validation && file.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'file' when calling PetApi.upload_file_with_required_file"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = '/pet/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params['file'] = file
|
||||
form_params['additionalMetadata'] = opts[:'additional_metadata'] if !opts[:'additional_metadata'].nil?
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'ApiResponse')
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#upload_file_with_required_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -84,6 +84,7 @@ Class | Method | HTTP request | Description
|
||||
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/Api/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
|
||||
*FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
|
||||
*FakeApi* | [**fakeOuterStringSerialize**](docs/Api/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
|
||||
*FakeApi* | [**testBodyWithQueryParams**](docs/Api/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params |
|
||||
*FakeApi* | [**testClientModel**](docs/Api/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
|
||||
*FakeApi* | [**testEndpointParameters**](docs/Api/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*FakeApi* | [**testEnumParameters**](docs/Api/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters
|
||||
@ -98,6 +99,7 @@ Class | Method | HTTP request | Description
|
||||
*PetApi* | [**updatePet**](docs/Api/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**updatePetWithForm**](docs/Api/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**uploadFile**](docs/Api/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*PetApi* | [**uploadFileWithRequiredFile**](docs/Api/PetApi.md#uploadfilewithrequiredfile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
*StoreApi* | [**deleteOrder**](docs/Api/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
*StoreApi* | [**getInventory**](docs/Api/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**getOrderById**](docs/Api/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
|
@ -8,6 +8,7 @@ Method | HTTP request | Description
|
||||
[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
|
||||
[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
|
||||
[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
|
||||
[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
|
||||
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||
@ -211,6 +212,54 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
|
||||
|
||||
# **testBodyWithQueryParams**
|
||||
> testBodyWithQueryParams($query, $user)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```php
|
||||
<?php
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
$apiInstance = new OpenAPI\Client\Api\FakeApi(
|
||||
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
|
||||
// This is optional, `GuzzleHttp\Client` will be used as default.
|
||||
new GuzzleHttp\Client()
|
||||
);
|
||||
$query = 'query_example'; // string |
|
||||
$user = new \OpenAPI\Client\Model\User(); // \OpenAPI\Client\Model\User |
|
||||
|
||||
try {
|
||||
$apiInstance->testBodyWithQueryParams($query, $user);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling FakeApi->testBodyWithQueryParams: ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
?>
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**query** | **string**| |
|
||||
**user** | [**\OpenAPI\Client\Model\User**](../Model/User.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
|
||||
|
||||
# **testClientModel**
|
||||
> \OpenAPI\Client\Model\Client testClientModel($client)
|
||||
|
||||
|
@ -12,6 +12,7 @@ Method | HTTP request | Description
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /pet/{petId}/uploadImageWithRequiredFile | uploads an image
|
||||
|
||||
|
||||
# **addPet**
|
||||
@ -436,3 +437,58 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
|
||||
|
||||
# **uploadFileWithRequiredFile**
|
||||
> \OpenAPI\Client\Model\ApiResponse uploadFileWithRequiredFile($pet_id, $file, $additional_metadata)
|
||||
|
||||
uploads an image
|
||||
|
||||
### Example
|
||||
```php
|
||||
<?php
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
|
||||
|
||||
$apiInstance = new OpenAPI\Client\Api\PetApi(
|
||||
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
|
||||
// This is optional, `GuzzleHttp\Client` will be used as default.
|
||||
new GuzzleHttp\Client(),
|
||||
$config
|
||||
);
|
||||
$pet_id = 56; // int | ID of pet to update
|
||||
$file = "/path/to/file.txt"; // \SplFileObject | file to upload
|
||||
$additional_metadata = 'additional_metadata_example'; // string | Additional data to pass to server
|
||||
|
||||
try {
|
||||
$result = $apiInstance->uploadFileWithRequiredFile($pet_id, $file, $additional_metadata);
|
||||
print_r($result);
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling PetApi->uploadFileWithRequiredFile: ', $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
?>
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| ID of pet to update |
|
||||
**file** | **\SplFileObject****\SplFileObject**| file to upload |
|
||||
**additional_metadata** | **string**| Additional data to pass to server | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**\OpenAPI\Client\Model\ApiResponse**](../Model/ApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../../README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
|
||||
|
||||
|
@ -1151,6 +1151,236 @@ class FakeApi
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testBodyWithQueryParams
|
||||
*
|
||||
* @param string $query query (required)
|
||||
* @param \OpenAPI\Client\Model\User $user user (required)
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return void
|
||||
*/
|
||||
public function testBodyWithQueryParams($query, $user)
|
||||
{
|
||||
$this->testBodyWithQueryParamsWithHttpInfo($query, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testBodyWithQueryParamsWithHttpInfo
|
||||
*
|
||||
* @param string $query (required)
|
||||
* @param \OpenAPI\Client\Model\User $user (required)
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return array of null, HTTP status code, HTTP response headers (array of strings)
|
||||
*/
|
||||
public function testBodyWithQueryParamsWithHttpInfo($query, $user)
|
||||
{
|
||||
$request = $this->testBodyWithQueryParamsRequest($query, $user);
|
||||
|
||||
try {
|
||||
$options = $this->createHttpClientOption();
|
||||
try {
|
||||
$response = $this->client->send($request, $options);
|
||||
} catch (RequestException $e) {
|
||||
throw new ApiException(
|
||||
"[{$e->getCode()}] {$e->getMessage()}",
|
||||
$e->getCode(),
|
||||
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
||||
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
|
||||
);
|
||||
}
|
||||
|
||||
$statusCode = $response->getStatusCode();
|
||||
|
||||
if ($statusCode < 200 || $statusCode > 299) {
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
$request->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
$response->getBody()
|
||||
);
|
||||
}
|
||||
|
||||
return [null, $statusCode, $response->getHeaders()];
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testBodyWithQueryParamsAsync
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param string $query (required)
|
||||
* @param \OpenAPI\Client\Model\User $user (required)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function testBodyWithQueryParamsAsync($query, $user)
|
||||
{
|
||||
return $this->testBodyWithQueryParamsAsyncWithHttpInfo($query, $user)
|
||||
->then(
|
||||
function ($response) {
|
||||
return $response[0];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testBodyWithQueryParamsAsyncWithHttpInfo
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param string $query (required)
|
||||
* @param \OpenAPI\Client\Model\User $user (required)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function testBodyWithQueryParamsAsyncWithHttpInfo($query, $user)
|
||||
{
|
||||
$returnType = '';
|
||||
$request = $this->testBodyWithQueryParamsRequest($query, $user);
|
||||
|
||||
return $this->client
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
return [null, $response->getStatusCode(), $response->getHeaders()];
|
||||
},
|
||||
function ($exception) {
|
||||
$response = $exception->getResponse();
|
||||
$statusCode = $response->getStatusCode();
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
$exception->getRequest()->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
$response->getBody()
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create request for operation 'testBodyWithQueryParams'
|
||||
*
|
||||
* @param string $query (required)
|
||||
* @param \OpenAPI\Client\Model\User $user (required)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Psr7\Request
|
||||
*/
|
||||
protected function testBodyWithQueryParamsRequest($query, $user)
|
||||
{
|
||||
// verify the required parameter 'query' is set
|
||||
if ($query === null || (is_array($query) && count($query) === 0)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Missing the required parameter $query when calling testBodyWithQueryParams'
|
||||
);
|
||||
}
|
||||
// verify the required parameter 'user' is set
|
||||
if ($user === null || (is_array($user) && count($user) === 0)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Missing the required parameter $user when calling testBodyWithQueryParams'
|
||||
);
|
||||
}
|
||||
|
||||
$resourcePath = '/fake/body-with-query-params';
|
||||
$formParams = [];
|
||||
$queryParams = [];
|
||||
$headerParams = [];
|
||||
$httpBody = '';
|
||||
$multipart = false;
|
||||
|
||||
// query params
|
||||
if ($query !== null) {
|
||||
$queryParams['query'] = ObjectSerializer::toQueryValue($query);
|
||||
}
|
||||
|
||||
|
||||
// body params
|
||||
$_tempBody = null;
|
||||
if (isset($user)) {
|
||||
$_tempBody = $user;
|
||||
}
|
||||
|
||||
if ($multipart) {
|
||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
||||
[]
|
||||
);
|
||||
} else {
|
||||
$headers = $this->headerSelector->selectHeaders(
|
||||
[],
|
||||
['application/json']
|
||||
);
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($_tempBody)) {
|
||||
// $_tempBody is the method argument, if present
|
||||
$httpBody = $_tempBody;
|
||||
// \stdClass has no __toString(), so we should encode it manually
|
||||
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
|
||||
$httpBody = \GuzzleHttp\json_encode($httpBody);
|
||||
}
|
||||
} elseif (count($formParams) > 0) {
|
||||
if ($multipart) {
|
||||
$multipartContents = [];
|
||||
foreach ($formParams as $formParamName => $formParamValue) {
|
||||
$multipartContents[] = [
|
||||
'name' => $formParamName,
|
||||
'contents' => $formParamValue
|
||||
];
|
||||
}
|
||||
// for HTTP post (form)
|
||||
$httpBody = new MultipartStream($multipartContents);
|
||||
|
||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||
|
||||
} else {
|
||||
// for HTTP post (form)
|
||||
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$defaultHeaders = [];
|
||||
if ($this->config->getUserAgent()) {
|
||||
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
||||
}
|
||||
|
||||
$headers = array_merge(
|
||||
$defaultHeaders,
|
||||
$headerParams,
|
||||
$headers
|
||||
);
|
||||
|
||||
$query = \GuzzleHttp\Psr7\build_query($queryParams);
|
||||
return new Request(
|
||||
'PUT',
|
||||
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
|
||||
$headers,
|
||||
$httpBody
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testClientModel
|
||||
*
|
||||
|
@ -756,7 +756,7 @@ class PetApi
|
||||
|
||||
// query params
|
||||
if (is_array($status)) {
|
||||
$status = ObjectSerializer::serializeCollection($status, 'csv', true);
|
||||
$status = ObjectSerializer::serializeCollection($status, 'multi', true);
|
||||
}
|
||||
if ($status !== null) {
|
||||
$queryParams['status'] = ObjectSerializer::toQueryValue($status);
|
||||
@ -1040,7 +1040,7 @@ class PetApi
|
||||
|
||||
// query params
|
||||
if (is_array($tags)) {
|
||||
$tags = ObjectSerializer::serializeCollection($tags, 'csv', true);
|
||||
$tags = ObjectSerializer::serializeCollection($tags, 'multi', true);
|
||||
}
|
||||
if ($tags !== null) {
|
||||
$queryParams['tags'] = ObjectSerializer::toQueryValue($tags);
|
||||
@ -2174,6 +2174,316 @@ class PetApi
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation uploadFileWithRequiredFile
|
||||
*
|
||||
* uploads an image
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param \SplFileObject $file file to upload (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (optional)
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \OpenAPI\Client\Model\ApiResponse
|
||||
*/
|
||||
public function uploadFileWithRequiredFile($pet_id, $file, $additional_metadata = null)
|
||||
{
|
||||
list($response) = $this->uploadFileWithRequiredFileWithHttpInfo($pet_id, $file, $additional_metadata);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation uploadFileWithRequiredFileWithHttpInfo
|
||||
*
|
||||
* uploads an image
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param \SplFileObject $file file to upload (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (optional)
|
||||
*
|
||||
* @throws \OpenAPI\Client\ApiException on non-2xx response
|
||||
* @throws \InvalidArgumentException
|
||||
* @return array of \OpenAPI\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings)
|
||||
*/
|
||||
public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $file, $additional_metadata = null)
|
||||
{
|
||||
$request = $this->uploadFileWithRequiredFileRequest($pet_id, $file, $additional_metadata);
|
||||
|
||||
try {
|
||||
$options = $this->createHttpClientOption();
|
||||
try {
|
||||
$response = $this->client->send($request, $options);
|
||||
} catch (RequestException $e) {
|
||||
throw new ApiException(
|
||||
"[{$e->getCode()}] {$e->getMessage()}",
|
||||
$e->getCode(),
|
||||
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
|
||||
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
|
||||
);
|
||||
}
|
||||
|
||||
$statusCode = $response->getStatusCode();
|
||||
|
||||
if ($statusCode < 200 || $statusCode > 299) {
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
$request->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
$response->getBody()
|
||||
);
|
||||
}
|
||||
|
||||
$responseBody = $response->getBody();
|
||||
switch($statusCode) {
|
||||
case 200:
|
||||
if ('\OpenAPI\Client\Model\ApiResponse' === '\SplFileObject') {
|
||||
$content = $responseBody; //stream goes to serializer
|
||||
} else {
|
||||
$content = $responseBody->getContents();
|
||||
if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ApiResponse', []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
}
|
||||
|
||||
$returnType = '\OpenAPI\Client\Model\ApiResponse';
|
||||
$responseBody = $response->getBody();
|
||||
if ($returnType === '\SplFileObject') {
|
||||
$content = $responseBody; //stream goes to serializer
|
||||
} else {
|
||||
$content = $responseBody->getContents();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, $returnType, []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = ObjectSerializer::deserialize(
|
||||
$e->getResponseBody(),
|
||||
'\OpenAPI\Client\Model\ApiResponse',
|
||||
$e->getResponseHeaders()
|
||||
);
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation uploadFileWithRequiredFileAsync
|
||||
*
|
||||
* uploads an image
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param \SplFileObject $file file to upload (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (optional)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function uploadFileWithRequiredFileAsync($pet_id, $file, $additional_metadata = null)
|
||||
{
|
||||
return $this->uploadFileWithRequiredFileAsyncWithHttpInfo($pet_id, $file, $additional_metadata)
|
||||
->then(
|
||||
function ($response) {
|
||||
return $response[0];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation uploadFileWithRequiredFileAsyncWithHttpInfo
|
||||
*
|
||||
* uploads an image
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param \SplFileObject $file file to upload (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (optional)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Promise\PromiseInterface
|
||||
*/
|
||||
public function uploadFileWithRequiredFileAsyncWithHttpInfo($pet_id, $file, $additional_metadata = null)
|
||||
{
|
||||
$returnType = '\OpenAPI\Client\Model\ApiResponse';
|
||||
$request = $this->uploadFileWithRequiredFileRequest($pet_id, $file, $additional_metadata);
|
||||
|
||||
return $this->client
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
->then(
|
||||
function ($response) use ($returnType) {
|
||||
$responseBody = $response->getBody();
|
||||
if ($returnType === '\SplFileObject') {
|
||||
$content = $responseBody; //stream goes to serializer
|
||||
} else {
|
||||
$content = $responseBody->getContents();
|
||||
if ($returnType !== 'string') {
|
||||
$content = json_decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
ObjectSerializer::deserialize($content, $returnType, []),
|
||||
$response->getStatusCode(),
|
||||
$response->getHeaders()
|
||||
];
|
||||
},
|
||||
function ($exception) {
|
||||
$response = $exception->getResponse();
|
||||
$statusCode = $response->getStatusCode();
|
||||
throw new ApiException(
|
||||
sprintf(
|
||||
'[%d] Error connecting to the API (%s)',
|
||||
$statusCode,
|
||||
$exception->getRequest()->getUri()
|
||||
),
|
||||
$statusCode,
|
||||
$response->getHeaders(),
|
||||
$response->getBody()
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create request for operation 'uploadFileWithRequiredFile'
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
* @param \SplFileObject $file file to upload (required)
|
||||
* @param string $additional_metadata Additional data to pass to server (optional)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return \GuzzleHttp\Psr7\Request
|
||||
*/
|
||||
protected function uploadFileWithRequiredFileRequest($pet_id, $file, $additional_metadata = null)
|
||||
{
|
||||
// verify the required parameter 'pet_id' is set
|
||||
if ($pet_id === null || (is_array($pet_id) && count($pet_id) === 0)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Missing the required parameter $pet_id when calling uploadFileWithRequiredFile'
|
||||
);
|
||||
}
|
||||
// verify the required parameter 'file' is set
|
||||
if ($file === null || (is_array($file) && count($file) === 0)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Missing the required parameter $file when calling uploadFileWithRequiredFile'
|
||||
);
|
||||
}
|
||||
|
||||
$resourcePath = '/pet/{petId}/uploadImageWithRequiredFile';
|
||||
$formParams = [];
|
||||
$queryParams = [];
|
||||
$headerParams = [];
|
||||
$httpBody = '';
|
||||
$multipart = false;
|
||||
|
||||
|
||||
// path params
|
||||
if ($pet_id !== null) {
|
||||
$resourcePath = str_replace(
|
||||
'{' . 'petId' . '}',
|
||||
ObjectSerializer::toPathValue($pet_id),
|
||||
$resourcePath
|
||||
);
|
||||
}
|
||||
|
||||
// form params
|
||||
if ($additional_metadata !== null) {
|
||||
$formParams['additionalMetadata'] = ObjectSerializer::toFormValue($additional_metadata);
|
||||
}
|
||||
// form params
|
||||
if ($file !== null) {
|
||||
$multipart = true;
|
||||
$formParams['file'] = \GuzzleHttp\Psr7\try_fopen(ObjectSerializer::toFormValue($file), 'rb');
|
||||
}
|
||||
// body params
|
||||
$_tempBody = null;
|
||||
|
||||
if ($multipart) {
|
||||
$headers = $this->headerSelector->selectHeadersForMultipart(
|
||||
['application/json']
|
||||
);
|
||||
} else {
|
||||
$headers = $this->headerSelector->selectHeaders(
|
||||
['application/json'],
|
||||
['multipart/form-data']
|
||||
);
|
||||
}
|
||||
|
||||
// for model (json/xml)
|
||||
if (isset($_tempBody)) {
|
||||
// $_tempBody is the method argument, if present
|
||||
$httpBody = $_tempBody;
|
||||
// \stdClass has no __toString(), so we should encode it manually
|
||||
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
|
||||
$httpBody = \GuzzleHttp\json_encode($httpBody);
|
||||
}
|
||||
} elseif (count($formParams) > 0) {
|
||||
if ($multipart) {
|
||||
$multipartContents = [];
|
||||
foreach ($formParams as $formParamName => $formParamValue) {
|
||||
$multipartContents[] = [
|
||||
'name' => $formParamName,
|
||||
'contents' => $formParamValue
|
||||
];
|
||||
}
|
||||
// for HTTP post (form)
|
||||
$httpBody = new MultipartStream($multipartContents);
|
||||
|
||||
} elseif ($headers['Content-Type'] === 'application/json') {
|
||||
$httpBody = \GuzzleHttp\json_encode($formParams);
|
||||
|
||||
} else {
|
||||
// for HTTP post (form)
|
||||
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
|
||||
}
|
||||
}
|
||||
|
||||
// this endpoint requires OAuth (access token)
|
||||
if ($this->config->getAccessToken() !== null) {
|
||||
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
|
||||
}
|
||||
|
||||
$defaultHeaders = [];
|
||||
if ($this->config->getUserAgent()) {
|
||||
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
|
||||
}
|
||||
|
||||
$headers = array_merge(
|
||||
$defaultHeaders,
|
||||
$headerParams,
|
||||
$headers
|
||||
);
|
||||
|
||||
$query = \GuzzleHttp\Psr7\build_query($queryParams);
|
||||
return new Request(
|
||||
'POST',
|
||||
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
|
||||
$headers,
|
||||
$httpBody
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create http client option
|
||||
*
|
||||
|
@ -111,6 +111,16 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testBodyWithQueryParams
|
||||
*
|
||||
* .
|
||||
*
|
||||
*/
|
||||
public function testTestBodyWithQueryParams()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for testClientModel
|
||||
*
|
||||
|
@ -150,4 +150,14 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function testUploadFile()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for uploadFileWithRequiredFile
|
||||
*
|
||||
* uploads an image.
|
||||
*
|
||||
*/
|
||||
public function testUploadFileWithRequiredFile()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -134,9 +134,22 @@ public interface PetApi {
|
||||
@Path("/pet/{petId}/uploadImage")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "uploads an image", tags={ "pet" })
|
||||
@ApiOperation(value = "uploads an image", tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail);
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
*/
|
||||
@POST
|
||||
@Path("/pet/{petId}/uploadImageWithRequiredFile")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "uploads an image", tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public ModelApiResponse uploadFileWithRequiredFile(@PathParam("petId") Long petId, @Multipart(value = "file" ) Attachment fileDetail, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata);
|
||||
}
|
||||
|
||||
|
@ -111,5 +111,15 @@ public class PetApiServiceImpl implements PetApi {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
*/
|
||||
public ModelApiResponse uploadFileWithRequiredFile(Long petId, Attachment fileDetail, String additionalMetadata) {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI 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
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -47,7 +47,7 @@ import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI 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
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -54,7 +54,7 @@ import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
@ -84,8 +84,8 @@ public class FakeApiTest {
|
||||
*/
|
||||
@Test
|
||||
public void fakeOuterBooleanSerializeTest() {
|
||||
Boolean booleanPostBody = null;
|
||||
//Boolean response = api.fakeOuterBooleanSerialize(booleanPostBody);
|
||||
Boolean body = null;
|
||||
//Boolean response = api.fakeOuterBooleanSerialize(body);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
|
||||
@ -231,7 +231,7 @@ public class FakeApiTest {
|
||||
*/
|
||||
@Test
|
||||
public void testInlineAdditionalPropertiesTest() {
|
||||
String requestBody = null;
|
||||
Map<String, String> requestBody = null;
|
||||
//api.testInlineAdditionalProperties(requestBody);
|
||||
|
||||
// TODO: test validations
|
||||
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI 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
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -47,7 +47,7 @@ import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI 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
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -49,7 +49,7 @@ import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
@ -212,4 +212,22 @@ public class PetApiTest {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void uploadFileWithRequiredFileTest() {
|
||||
Long petId = null;
|
||||
org.apache.cxf.jaxrs.ext.multipart.Attachment file = null;
|
||||
String additionalMetadata = null;
|
||||
//ModelApiResponse response = api.uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI 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
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -48,7 +48,7 @@ import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI 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
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -48,7 +48,7 @@ import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
|
@ -208,4 +208,25 @@ public class PetApi {
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFile(petId,additionalMetadata,fileInputStream, fileDetail,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/{petId}/uploadImageWithRequiredFile")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public Response uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId
|
||||
,
|
||||
@FormDataParam("file") InputStream fileInputStream,
|
||||
@FormDataParam("file") FormDataContentDisposition fileDetail
|
||||
,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata
|
||||
,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFileWithRequiredFile(petId,fileInputStream, fileDetail,additionalMetadata,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -27,4 +27,5 @@ public abstract class PetApiService {
|
||||
public abstract Response updatePet(Pet pet,SecurityContext securityContext) throws NotFoundException;
|
||||
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) throws NotFoundException;
|
||||
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream fileInputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext) throws NotFoundException;
|
||||
public abstract Response uploadFileWithRequiredFile(Long petId,InputStream fileInputStream, FormDataContentDisposition fileDetail,String additionalMetadata,SecurityContext securityContext) throws NotFoundException;
|
||||
}
|
||||
|
@ -59,4 +59,9 @@ public class PetApiServiceImpl extends PetApiService {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response uploadFileWithRequiredFile(Long petId, InputStream fileInputStream, FormDataContentDisposition fileDetail, String additionalMetadata, SecurityContext securityContext) throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
}
|
||||
|
@ -118,9 +118,24 @@ public interface PetApi {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
ModelApiResponse uploadFile(@PathParam("petId") @ApiParam("ID of pet to update") Long petId,@FormParam(value = "additionalMetadata") String additionalMetadata, @FormParam(value = "file") InputStream fileInputStream,
|
||||
@FormParam(value = "file") Attachment fileDetail);
|
||||
|
||||
@POST
|
||||
@Path("/{petId}/uploadImageWithRequiredFile")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "uploads an image", notes = "", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
ModelApiResponse uploadFileWithRequiredFile(@PathParam("petId") @ApiParam("ID of pet to update") Long petId, @FormParam(value = "file") InputStream fileInputStream,
|
||||
@FormParam(value = "file") Attachment fileDetail,@FormParam(value = "additionalMetadata") String additionalMetadata);
|
||||
}
|
||||
|
@ -298,6 +298,48 @@ paths:
|
||||
- pet
|
||||
x-tags:
|
||||
- tag: pet
|
||||
/pet/{petId}/uploadImageWithRequiredFile:
|
||||
post:
|
||||
operationId: uploadFileWithRequiredFile
|
||||
parameters:
|
||||
- description: ID of pet to update
|
||||
in: path
|
||||
name: petId
|
||||
required: true
|
||||
schema:
|
||||
format: int64
|
||||
type: integer
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
format: binary
|
||||
type: string
|
||||
required:
|
||||
- file
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponse'
|
||||
description: successful operation
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
summary: uploads an image
|
||||
tags:
|
||||
- pet
|
||||
x-tags:
|
||||
- tag: pet
|
||||
/store/inventory:
|
||||
get:
|
||||
description: Returns a map of status codes to quantities
|
||||
|
@ -139,7 +139,7 @@ public class PetApi {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class)
|
||||
})
|
||||
@ -147,4 +147,22 @@ public class PetApi {
|
||||
@FormParam(value = "file") Attachment fileDetail) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/{petId}/uploadImageWithRequiredFile")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class)
|
||||
})
|
||||
public Response uploadFileWithRequiredFile(@PathParam("petId") @ApiParam("ID of pet to update") Long petId, @FormParam(value = "file") InputStream fileInputStream,
|
||||
@FormParam(value = "file") Attachment fileDetail,@FormParam(value = "additionalMetadata") String additionalMetadata) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
}
|
||||
|
@ -298,6 +298,48 @@ paths:
|
||||
- pet
|
||||
x-tags:
|
||||
- tag: pet
|
||||
/pet/{petId}/uploadImageWithRequiredFile:
|
||||
post:
|
||||
operationId: uploadFileWithRequiredFile
|
||||
parameters:
|
||||
- description: ID of pet to update
|
||||
in: path
|
||||
name: petId
|
||||
required: true
|
||||
schema:
|
||||
format: int64
|
||||
type: integer
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
format: binary
|
||||
type: string
|
||||
required:
|
||||
- file
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponse'
|
||||
description: successful operation
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
summary: uploads an image
|
||||
tags:
|
||||
- pet
|
||||
x-tags:
|
||||
- tag: pet
|
||||
/store/inventory:
|
||||
get:
|
||||
description: Returns a map of status codes to quantities
|
||||
|
@ -177,7 +177,7 @@ public class PetApi {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
}, tags={ "pet", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public Response uploadFile(
|
||||
@ -189,4 +189,25 @@ public class PetApi {
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFile(petId,additionalMetadata,inputStream, fileDetail,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public Response uploadFileWithRequiredFile(
|
||||
@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId,
|
||||
@FormDataParam("file") InputStream inputStream,
|
||||
@FormDataParam("file") FormDataContentDisposition fileDetail,
|
||||
@FormDataParam("additionalMetadata") String additionalMetadata,
|
||||
@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFileWithRequiredFile(petId,inputStream, fileDetail,additionalMetadata,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -38,4 +38,6 @@ public abstract class PetApiService {
|
||||
throws NotFoundException;
|
||||
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream fileInputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response uploadFileWithRequiredFile(Long petId,InputStream fileInputStream, FormDataContentDisposition fileDetail,String additionalMetadata,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
}
|
||||
|
@ -70,4 +70,10 @@ public class PetApiServiceImpl extends PetApiService {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response uploadFileWithRequiredFile(Long petId, InputStream fileInputStream, FormDataContentDisposition fileDetail, String additionalMetadata, SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public class PetApi {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
}, tags={ "pet", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public Response uploadFile(
|
||||
@ -189,4 +189,25 @@ public class PetApi {
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFile(petId,additionalMetadata,inputStream, fileDetail,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/{petId}/uploadImageWithRequiredFile")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public Response uploadFileWithRequiredFile(
|
||||
@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId,
|
||||
@FormDataParam("file") InputStream inputStream,
|
||||
@FormDataParam("file") FormDataContentDisposition fileDetail,
|
||||
@FormDataParam("additionalMetadata") String additionalMetadata,
|
||||
@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFileWithRequiredFile(petId,inputStream, fileDetail,additionalMetadata,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -38,4 +38,6 @@ public abstract class PetApiService {
|
||||
throws NotFoundException;
|
||||
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream fileInputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response uploadFileWithRequiredFile(Long petId,InputStream fileInputStream, FormDataContentDisposition fileDetail,String additionalMetadata,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
}
|
||||
|
@ -70,4 +70,10 @@ public class PetApiServiceImpl extends PetApiService {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response uploadFileWithRequiredFile(Long petId, InputStream fileInputStream, FormDataContentDisposition fileDetail, String additionalMetadata, SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
}
|
||||
|
@ -208,4 +208,25 @@ public class PetApi {
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFile(petId,additionalMetadata,fileInputStream, fileDetail,securityContext);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public Response uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId
|
||||
,
|
||||
@FormDataParam("file") InputStream fileInputStream,
|
||||
@FormDataParam("file") FormDataContentDisposition fileDetail
|
||||
,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata
|
||||
,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFileWithRequiredFile(petId,fileInputStream, fileDetail,additionalMetadata,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -27,4 +27,5 @@ public abstract class PetApiService {
|
||||
public abstract Response updatePet(Pet pet,SecurityContext securityContext) throws NotFoundException;
|
||||
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) throws NotFoundException;
|
||||
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream fileInputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext) throws NotFoundException;
|
||||
public abstract Response uploadFileWithRequiredFile(Long petId,InputStream fileInputStream, FormDataContentDisposition fileDetail,String additionalMetadata,SecurityContext securityContext) throws NotFoundException;
|
||||
}
|
||||
|
@ -59,4 +59,9 @@ public class PetApiServiceImpl extends PetApiService {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response uploadFileWithRequiredFile(Long petId, InputStream fileInputStream, FormDataContentDisposition fileDetail, String additionalMetadata, SecurityContext securityContext) throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
}
|
||||
|
@ -208,4 +208,25 @@ public class PetApi {
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFile(petId,additionalMetadata,fileInputStream, fileDetail,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/{petId}/uploadImageWithRequiredFile")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public Response uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId
|
||||
,
|
||||
@FormDataParam("file") InputStream fileInputStream,
|
||||
@FormDataParam("file") FormDataContentDisposition fileDetail
|
||||
,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata
|
||||
,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFileWithRequiredFile(petId,fileInputStream, fileDetail,additionalMetadata,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -27,4 +27,5 @@ public abstract class PetApiService {
|
||||
public abstract Response updatePet(Pet pet,SecurityContext securityContext) throws NotFoundException;
|
||||
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) throws NotFoundException;
|
||||
public abstract Response uploadFile(Long petId,String additionalMetadata,InputStream fileInputStream, FormDataContentDisposition fileDetail,SecurityContext securityContext) throws NotFoundException;
|
||||
public abstract Response uploadFileWithRequiredFile(Long petId,InputStream fileInputStream, FormDataContentDisposition fileDetail,String additionalMetadata,SecurityContext securityContext) throws NotFoundException;
|
||||
}
|
||||
|
@ -59,4 +59,9 @@ public class PetApiServiceImpl extends PetApiService {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response uploadFileWithRequiredFile(Long petId, InputStream fileInputStream, FormDataContentDisposition fileDetail, String additionalMetadata, SecurityContext securityContext) throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
}
|
||||
|
@ -202,4 +202,24 @@ class PetApi extends Controller
|
||||
|
||||
return response('How about implementing uploadFile as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation uploadFileWithRequiredFile
|
||||
*
|
||||
* uploads an image.
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function uploadFileWithRequiredFile($pet_id)
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing uploadFileWithRequiredFile as a post method ?');
|
||||
}
|
||||
}
|
||||
|
@ -161,6 +161,13 @@ $app->post('/v2/pet/{petId}', 'PetApi@updatePetWithForm');
|
||||
* Output-Formats: [application/json]
|
||||
*/
|
||||
$app->post('/v2/pet/{petId}/uploadImage', 'PetApi@uploadFile');
|
||||
/**
|
||||
* post uploadFileWithRequiredFile
|
||||
* Summary: uploads an image
|
||||
* Notes:
|
||||
* Output-Formats: [application/json]
|
||||
*/
|
||||
$app->post('/v2/pet/{petId}/uploadImageWithRequiredFile', 'PetApi@uploadFileWithRequiredFile');
|
||||
/**
|
||||
* get getInventory
|
||||
* Summary: Returns pet inventories by status
|
||||
|
@ -293,6 +293,21 @@ $app->POST('/v2/pet/{petId}/uploadImage', function($request, $response, $args) {
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* POST uploadFileWithRequiredFile
|
||||
* Summary: uploads an image
|
||||
* Notes:
|
||||
* Output-Formats: [application/json]
|
||||
*/
|
||||
$app->POST('/v2/pet/{petId}/uploadImageWithRequiredFile', function($request, $response, $args) {
|
||||
$petId = $args['petId'];
|
||||
$additionalMetadata = $request->getParsedBodyParam('additionalMetadata');
|
||||
$file = (key_exists('file', $request->getUploadedFiles())) ? $request->getUploadedFiles()['file'] : null;
|
||||
$response->write('How about implementing uploadFileWithRequiredFile as a POST method ?');
|
||||
return $response;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* GET getInventory
|
||||
* Summary: Returns pet inventories by status
|
||||
|
@ -39,6 +39,7 @@ Articus\PathHandler\Router\FastRouteAnnotation:
|
||||
- App\Handler\PetFindByTags
|
||||
- App\Handler\PetPetId
|
||||
- App\Handler\PetPetIdUploadImage
|
||||
- App\Handler\PetPetIdUploadImageWithRequiredFile
|
||||
- App\Handler\StoreInventory
|
||||
- App\Handler\StoreOrder
|
||||
- App\Handler\StoreOrderOrderId
|
||||
@ -65,6 +66,7 @@ Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory:
|
||||
App\Handler\PetFindByTags: []
|
||||
App\Handler\PetPetId: []
|
||||
App\Handler\PetPetIdUploadImage: []
|
||||
App\Handler\PetPetIdUploadImageWithRequiredFile: []
|
||||
App\Handler\StoreInventory: []
|
||||
App\Handler\StoreOrder: []
|
||||
App\Handler\StoreOrderOrderId: []
|
||||
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Handler;
|
||||
|
||||
use Articus\PathHandler\Operation;
|
||||
use Articus\PathHandler\Annotation as PHA;
|
||||
use Articus\PathHandler\Consumer as PHConsumer;
|
||||
use Articus\PathHandler\Producer as PHProducer;
|
||||
use Articus\PathHandler\Attribute as PHAttribute;
|
||||
use Articus\PathHandler\Exception as PHException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
/**
|
||||
* @PHA\Route(pattern="/pet/{petId}/uploadImageWithRequiredFile")
|
||||
*/
|
||||
class PetPetIdUploadImageWithRequiredFile implements Operation\PostInterface
|
||||
{
|
||||
/**
|
||||
* uploads an image
|
||||
* TODO check if producer is valid, if it has correct priority and if it can be moved to class annotation
|
||||
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="application/json")
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
*
|
||||
* @return \App\DTO\ApiResponse
|
||||
*/
|
||||
public function handlePost(ServerRequestInterface $request)
|
||||
{
|
||||
//TODO implement method
|
||||
throw new PHException\HttpCode(500, "Not implemented");
|
||||
}
|
||||
}
|
@ -228,4 +228,32 @@ public interface PetApi {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "uploads an image", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
@RequestMapping(value = "/pet/{petId}/uploadImageWithRequiredFile",
|
||||
produces = { "application/json" },
|
||||
consumes = { "multipart/form-data" },
|
||||
method = RequestMethod.POST)
|
||||
default CompletableFuture<ResponseEntity<ModelApiResponse>> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) {
|
||||
return CompletableFuture.supplyAsync(()-> {
|
||||
getRequest().ifPresent(request -> {
|
||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
}, Runnable::run);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -219,4 +219,30 @@ public interface PetApi {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "uploads an image", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
@RequestMapping(value = "/pet/{petId}/uploadImageWithRequiredFile",
|
||||
produces = { "application/json" },
|
||||
consumes = { "multipart/form-data" },
|
||||
method = RequestMethod.POST)
|
||||
default ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) {
|
||||
getRequest().ifPresent(request -> {
|
||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -143,4 +143,19 @@ public interface PetApi {
|
||||
method = RequestMethod.POST)
|
||||
ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file);
|
||||
|
||||
|
||||
@ApiOperation(value = "uploads an image", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
@RequestMapping(value = "/pet/{petId}/uploadImageWithRequiredFile",
|
||||
produces = { "application/json" },
|
||||
consumes = { "multipart/form-data" },
|
||||
method = RequestMethod.POST)
|
||||
ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata);
|
||||
|
||||
}
|
||||
|
@ -109,4 +109,15 @@ public class PetApiController implements PetApi {
|
||||
|
||||
}
|
||||
|
||||
public ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) {
|
||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -143,4 +143,19 @@ public interface PetApi {
|
||||
method = RequestMethod.POST)
|
||||
ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file);
|
||||
|
||||
|
||||
@ApiOperation(value = "uploads an image", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
@RequestMapping(value = "/pet/{petId}/uploadImageWithRequiredFile",
|
||||
produces = { "application/json" },
|
||||
consumes = { "multipart/form-data" },
|
||||
method = RequestMethod.POST)
|
||||
ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata);
|
||||
|
||||
}
|
||||
|
@ -109,4 +109,15 @@ public class PetApiController implements PetApi {
|
||||
|
||||
}
|
||||
|
||||
public ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) {
|
||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -163,4 +163,21 @@ public interface PetApi {
|
||||
return getDelegate().uploadFile(petId, additionalMetadata, file);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "uploads an image", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
@RequestMapping(value = "/pet/{petId}/uploadImageWithRequiredFile",
|
||||
produces = { "application/json" },
|
||||
consumes = { "multipart/form-data" },
|
||||
method = RequestMethod.POST)
|
||||
default ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) {
|
||||
return getDelegate().uploadFileWithRequiredFile(petId, file, additionalMetadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user