[GO][Client] Multipart/form-data Request Support More Than One File (#10843)

* Instead of limiting a request to a single file when
performing an upload, use a slice of files so an
arbitrary number of files can be used in the form.

* Remove commented out line of code

* Update examples for multi-form file fix for multiple files

* Convert spaces to tabs for indentation

* Updated examples to have tabs instead of spaces

* Add an example of a multipart/form-data OA3 schema
that contains two files to be uploaded
This commit is contained in:
Ian Cubbon
2021-11-22 01:27:43 -07:00
committed by GitHub
parent c244c23053
commit 6779c33b9d
38 changed files with 2422 additions and 435 deletions

View File

@@ -0,0 +1,108 @@
# ApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | Pointer to **int32** | | [optional]
**Type** | Pointer to **string** | | [optional]
**Message** | Pointer to **string** | | [optional]
## Methods
### NewApiResponse
`func NewApiResponse() *ApiResponse`
NewApiResponse instantiates a new ApiResponse object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed
### NewApiResponseWithDefaults
`func NewApiResponseWithDefaults() *ApiResponse`
NewApiResponseWithDefaults instantiates a new ApiResponse object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set
### GetCode
`func (o *ApiResponse) GetCode() int32`
GetCode returns the Code field if non-nil, zero value otherwise.
### GetCodeOk
`func (o *ApiResponse) GetCodeOk() (*int32, bool)`
GetCodeOk returns a tuple with the Code field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetCode
`func (o *ApiResponse) SetCode(v int32)`
SetCode sets Code field to given value.
### HasCode
`func (o *ApiResponse) HasCode() bool`
HasCode returns a boolean if a field has been set.
### GetType
`func (o *ApiResponse) GetType() string`
GetType returns the Type field if non-nil, zero value otherwise.
### GetTypeOk
`func (o *ApiResponse) GetTypeOk() (*string, bool)`
GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetType
`func (o *ApiResponse) SetType(v string)`
SetType sets Type field to given value.
### HasType
`func (o *ApiResponse) HasType() bool`
HasType returns a boolean if a field has been set.
### GetMessage
`func (o *ApiResponse) GetMessage() string`
GetMessage returns the Message field if non-nil, zero value otherwise.
### GetMessageOk
`func (o *ApiResponse) GetMessageOk() (*string, bool)`
GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.
### SetMessage
`func (o *ApiResponse) SetMessage(v string)`
SetMessage sets Message field to given value.
### HasMessage
`func (o *ApiResponse) HasMessage() bool`
HasMessage returns a boolean if a field has been set.
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,75 @@
# \DefaultApi
All URIs are relative to *http://example.com*
Method | HTTP request | Description
------------- | ------------- | -------------
[**UploadFiles**](DefaultApi.md#UploadFiles) | **Post** /uploadFiles | uploads two files
## UploadFiles
> ApiResponse UploadFiles(ctx).File(file).SecondFile(secondFile).Execute()
uploads two files
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
file := os.NewFile(1234, "some_file") // *os.File | file to upload (optional)
secondFile := os.NewFile(1234, "some_file") // *os.File | another file to upload (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.DefaultApi.UploadFiles(context.Background()).File(file).SecondFile(secondFile).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.UploadFiles``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UploadFiles`: ApiResponse
fmt.Fprintf(os.Stdout, "Response from `DefaultApi.UploadFiles`: %v\n", resp)
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiUploadFilesRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**file** | ***os.File** | file to upload |
**secondFile** | ***os.File** | another file to upload |
### Return type
[**ApiResponse**](ApiResponse.md)
### Authorization
No authorization required
### 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)