forked from loafle/openapi-generator-original
[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:
parent
c244c23053
commit
6779c33b9d
@ -109,9 +109,7 @@ func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&class
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.Method{{httpMethod}}
|
localVarHTTPMethod = _nethttp.Method{{httpMethod}}
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
{{#returnType}}
|
{{#returnType}}
|
||||||
localVarReturnValue {{{.}}}
|
localVarReturnValue {{{.}}}
|
||||||
{{/returnType}}
|
{{/returnType}}
|
||||||
@ -251,22 +249,28 @@ func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&class
|
|||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
{{#formParams}}
|
{{#formParams}}
|
||||||
{{#isFile}}
|
{{#isFile}}
|
||||||
localVarFormFileName = "{{baseName}}"
|
var {{paramName}}LocalVarFormFileName string
|
||||||
|
var {{paramName}}LocalVarFileName string
|
||||||
|
var {{paramName}}LocalVarFileBytes []byte
|
||||||
|
|
||||||
|
{{paramName}}LocalVarFormFileName = "{{baseName}}"
|
||||||
|
|
||||||
{{#required}}
|
{{#required}}
|
||||||
localVarFile := *r.{{paramName}}
|
{{paramName}}LocalVarFile := *r.{{paramName}}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
{{^required}}
|
{{^required}}
|
||||||
var localVarFile {{dataType}}
|
var {{paramName}}LocalVarFile {{dataType}}
|
||||||
if r.{{paramName}} != nil {
|
if r.{{paramName}} != nil {
|
||||||
localVarFile = *r.{{paramName}}
|
{{paramName}}LocalVarFile = *r.{{paramName}}
|
||||||
}
|
}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
if localVarFile != nil {
|
if {{paramName}}LocalVarFile != nil {
|
||||||
fbs, _ := _ioutil.ReadAll(localVarFile)
|
fbs, _ := _ioutil.ReadAll({{paramName}}LocalVarFile)
|
||||||
localVarFileBytes = fbs
|
{{paramName}}LocalVarFileBytes = fbs
|
||||||
localVarFileName = localVarFile.Name()
|
{{paramName}}LocalVarFileName = {{paramName}}LocalVarFile.Name()
|
||||||
localVarFile.Close()
|
{{paramName}}LocalVarFile.Close()
|
||||||
}
|
}
|
||||||
|
formFiles = append(formFiles, formFile{fileBytes: {{paramName}}LocalVarFileBytes, fileName: {{paramName}}LocalVarFileName, formFileName: {{paramName}}LocalVarFormFileName})
|
||||||
{{/isFile}}
|
{{/isFile}}
|
||||||
{{^isFile}}
|
{{^isFile}}
|
||||||
{{#required}}
|
{{#required}}
|
||||||
@ -330,7 +334,7 @@ func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&class
|
|||||||
{{/isKeyInCookie}}
|
{{/isKeyInCookie}}
|
||||||
{{/isApiKey}}
|
{{/isApiKey}}
|
||||||
{{/authMethods}}
|
{{/authMethods}}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err
|
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err
|
||||||
}
|
}
|
||||||
|
@ -196,6 +196,12 @@ func (c *APIClient) GetConfig() *Configuration {
|
|||||||
return c.cfg
|
return c.cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type formFile struct {
|
||||||
|
fileBytes []byte
|
||||||
|
fileName string
|
||||||
|
formFileName string
|
||||||
|
}
|
||||||
|
|
||||||
// prepareRequest build the request
|
// prepareRequest build the request
|
||||||
func (c *APIClient) prepareRequest(
|
func (c *APIClient) prepareRequest(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
@ -204,9 +210,7 @@ func (c *APIClient) prepareRequest(
|
|||||||
headerParams map[string]string,
|
headerParams map[string]string,
|
||||||
queryParams url.Values,
|
queryParams url.Values,
|
||||||
formParams url.Values,
|
formParams url.Values,
|
||||||
formFileName string,
|
formFiles []formFile) (localVarRequest *http.Request, err error) {
|
||||||
fileName string,
|
|
||||||
fileBytes []byte) (localVarRequest *http.Request, err error) {
|
|
||||||
|
|
||||||
var body *bytes.Buffer
|
var body *bytes.Buffer
|
||||||
|
|
||||||
@ -225,7 +229,7 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add form parameters and file if available.
|
// add form parameters and file if available.
|
||||||
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
|
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) {
|
||||||
if body != nil {
|
if body != nil {
|
||||||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||||
}
|
}
|
||||||
@ -244,18 +248,19 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(fileBytes) > 0 && fileName != "" {
|
for _, formFile := range formFiles {
|
||||||
|
if len(formFile.fileBytes) > 0 && formFile.fileName != "" {
|
||||||
w.Boundary()
|
w.Boundary()
|
||||||
//_, fileNm := filepath.Split(fileName)
|
part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName))
|
||||||
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
_, err = part.Write(fileBytes)
|
_, err = part.Write(formFile.fileBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the Boundary in the Content-Type
|
// Set the Boundary in the Content-Type
|
||||||
headerParams["Content-Type"] = w.FormDataContentType()
|
headerParams["Content-Type"] = w.FormDataContentType()
|
||||||
|
@ -80,9 +80,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTagsExecute(r ApiCall123TestSp
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPatch
|
localVarHTTPMethod = _nethttp.MethodPatch
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Client
|
localVarReturnValue Client
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -119,7 +117,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTagsExecute(r ApiCall123TestSp
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
|
@ -252,9 +252,7 @@ func (a *FakeApiService) CreateXmlItemExecute(r ApiCreateXmlItemRequest) (*_neth
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.CreateXmlItem")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.CreateXmlItem")
|
||||||
@ -290,7 +288,7 @@ func (a *FakeApiService) CreateXmlItemExecute(r ApiCreateXmlItemRequest) (*_neth
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.xmlItem
|
localVarPostBody = r.xmlItem
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -355,9 +353,7 @@ func (a *FakeApiService) FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanS
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue bool
|
localVarReturnValue bool
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -391,7 +387,7 @@ func (a *FakeApiService) FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanS
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -465,9 +461,7 @@ func (a *FakeApiService) FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompos
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue OuterComposite
|
localVarReturnValue OuterComposite
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -501,7 +495,7 @@ func (a *FakeApiService) FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompos
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -575,9 +569,7 @@ func (a *FakeApiService) FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSer
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue float32
|
localVarReturnValue float32
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -611,7 +603,7 @@ func (a *FakeApiService) FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSer
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -685,9 +677,7 @@ func (a *FakeApiService) FakeOuterStringSerializeExecute(r ApiFakeOuterStringSer
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue string
|
localVarReturnValue string
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -721,7 +711,7 @@ func (a *FakeApiService) FakeOuterStringSerializeExecute(r ApiFakeOuterStringSer
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -793,9 +783,7 @@ func (a *FakeApiService) TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSche
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPut
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema")
|
||||||
@ -831,7 +819,7 @@ func (a *FakeApiService) TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSche
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -897,9 +885,7 @@ func (a *FakeApiService) TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryPa
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPut
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams")
|
||||||
@ -939,7 +925,7 @@ func (a *FakeApiService) TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryPa
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1004,9 +990,7 @@ func (a *FakeApiService) TestClientModelExecute(r ApiTestClientModelRequest) (Cl
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPatch
|
localVarHTTPMethod = _nethttp.MethodPatch
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Client
|
localVarReturnValue Client
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1043,7 +1027,7 @@ func (a *FakeApiService) TestClientModelExecute(r ApiTestClientModelRequest) (Cl
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -1197,9 +1181,7 @@ func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParamete
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters")
|
||||||
@ -1273,17 +1255,23 @@ func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParamete
|
|||||||
}
|
}
|
||||||
localVarFormParams.Add("pattern_without_delimiter", parameterToString(*r.patternWithoutDelimiter, ""))
|
localVarFormParams.Add("pattern_without_delimiter", parameterToString(*r.patternWithoutDelimiter, ""))
|
||||||
localVarFormParams.Add("byte", parameterToString(*r.byte_, ""))
|
localVarFormParams.Add("byte", parameterToString(*r.byte_, ""))
|
||||||
localVarFormFileName = "binary"
|
var binaryLocalVarFormFileName string
|
||||||
var localVarFile *os.File
|
var binaryLocalVarFileName string
|
||||||
|
var binaryLocalVarFileBytes []byte
|
||||||
|
|
||||||
|
binaryLocalVarFormFileName = "binary"
|
||||||
|
|
||||||
|
var binaryLocalVarFile *os.File
|
||||||
if r.binary != nil {
|
if r.binary != nil {
|
||||||
localVarFile = *r.binary
|
binaryLocalVarFile = *r.binary
|
||||||
}
|
}
|
||||||
if localVarFile != nil {
|
if binaryLocalVarFile != nil {
|
||||||
fbs, _ := _ioutil.ReadAll(localVarFile)
|
fbs, _ := _ioutil.ReadAll(binaryLocalVarFile)
|
||||||
localVarFileBytes = fbs
|
binaryLocalVarFileBytes = fbs
|
||||||
localVarFileName = localVarFile.Name()
|
binaryLocalVarFileName = binaryLocalVarFile.Name()
|
||||||
localVarFile.Close()
|
binaryLocalVarFile.Close()
|
||||||
}
|
}
|
||||||
|
formFiles = append(formFiles, formFile{fileBytes: binaryLocalVarFileBytes, fileName: binaryLocalVarFileName, formFileName: binaryLocalVarFormFileName})
|
||||||
if r.date != nil {
|
if r.date != nil {
|
||||||
localVarFormParams.Add("date", parameterToString(*r.date, ""))
|
localVarFormParams.Add("date", parameterToString(*r.date, ""))
|
||||||
}
|
}
|
||||||
@ -1296,7 +1284,7 @@ func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParamete
|
|||||||
if r.callback != nil {
|
if r.callback != nil {
|
||||||
localVarFormParams.Add("callback", parameterToString(*r.callback, ""))
|
localVarFormParams.Add("callback", parameterToString(*r.callback, ""))
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1402,9 +1390,7 @@ func (a *FakeApiService) TestEnumParametersExecute(r ApiTestEnumParametersReques
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters")
|
||||||
@ -1459,7 +1445,7 @@ func (a *FakeApiService) TestEnumParametersExecute(r ApiTestEnumParametersReques
|
|||||||
if r.enumFormString != nil {
|
if r.enumFormString != nil {
|
||||||
localVarFormParams.Add("enum_form_string", parameterToString(*r.enumFormString, ""))
|
localVarFormParams.Add("enum_form_string", parameterToString(*r.enumFormString, ""))
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1553,9 +1539,7 @@ func (a *FakeApiService) TestGroupParametersExecute(r ApiTestGroupParametersRequ
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodDelete
|
localVarHTTPMethod = _nethttp.MethodDelete
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters")
|
||||||
@ -1607,7 +1591,7 @@ func (a *FakeApiService) TestGroupParametersExecute(r ApiTestGroupParametersRequ
|
|||||||
if r.booleanGroup != nil {
|
if r.booleanGroup != nil {
|
||||||
localVarHeaderParams["boolean_group"] = parameterToString(*r.booleanGroup, "")
|
localVarHeaderParams["boolean_group"] = parameterToString(*r.booleanGroup, "")
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1669,9 +1653,7 @@ func (a *FakeApiService) TestInlineAdditionalPropertiesExecute(r ApiTestInlineAd
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties")
|
||||||
@ -1707,7 +1689,7 @@ func (a *FakeApiService) TestInlineAdditionalPropertiesExecute(r ApiTestInlineAd
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.param
|
localVarPostBody = r.param
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1775,9 +1757,7 @@ func (a *FakeApiService) TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) (
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData")
|
||||||
@ -1816,7 +1796,7 @@ func (a *FakeApiService) TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) (
|
|||||||
}
|
}
|
||||||
localVarFormParams.Add("param", parameterToString(*r.param, ""))
|
localVarFormParams.Add("param", parameterToString(*r.param, ""))
|
||||||
localVarFormParams.Add("param2", parameterToString(*r.param2, ""))
|
localVarFormParams.Add("param2", parameterToString(*r.param2, ""))
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1899,9 +1879,7 @@ func (a *FakeApiService) TestQueryParameterCollectionFormatExecute(r ApiTestQuer
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPut
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat")
|
||||||
@ -1962,7 +1940,7 @@ func (a *FakeApiService) TestQueryParameterCollectionFormatExecute(r ApiTestQuer
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,7 @@ func (a *FakeClassnameTags123ApiService) TestClassnameExecute(r ApiTestClassname
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPatch
|
localVarHTTPMethod = _nethttp.MethodPatch
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Client
|
localVarReturnValue Client
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -133,7 +131,7 @@ func (a *FakeClassnameTags123ApiService) TestClassnameExecute(r ApiTestClassname
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
|
@ -183,9 +183,7 @@ func (a *PetApiService) AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, e
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet")
|
||||||
@ -221,7 +219,7 @@ func (a *PetApiService) AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, e
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -285,9 +283,7 @@ func (a *PetApiService) DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Respo
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodDelete
|
localVarHTTPMethod = _nethttp.MethodDelete
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet")
|
||||||
@ -322,7 +318,7 @@ func (a *PetApiService) DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Respo
|
|||||||
if r.apiKey != nil {
|
if r.apiKey != nil {
|
||||||
localVarHeaderParams["api_key"] = parameterToString(*r.apiKey, "")
|
localVarHeaderParams["api_key"] = parameterToString(*r.apiKey, "")
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -387,9 +383,7 @@ func (a *PetApiService) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue []Pet
|
localVarReturnValue []Pet
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -425,7 +419,7 @@ func (a *PetApiService) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -502,9 +496,7 @@ func (a *PetApiService) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue []Pet
|
localVarReturnValue []Pet
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -540,7 +532,7 @@ func (a *PetApiService) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -611,9 +603,7 @@ func (a *PetApiService) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethtt
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Pet
|
localVarReturnValue Pet
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -660,7 +650,7 @@ func (a *PetApiService) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethtt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -731,9 +721,7 @@ func (a *PetApiService) UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Respo
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPut
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet")
|
||||||
@ -769,7 +757,7 @@ func (a *PetApiService) UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Respo
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -840,9 +828,7 @@ func (a *PetApiService) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest)
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm")
|
||||||
@ -880,7 +866,7 @@ func (a *PetApiService) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest)
|
|||||||
if r.status != nil {
|
if r.status != nil {
|
||||||
localVarFormParams.Add("status", parameterToString(*r.status, ""))
|
localVarFormParams.Add("status", parameterToString(*r.status, ""))
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -952,9 +938,7 @@ func (a *PetApiService) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse,
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue ApiResponse
|
localVarReturnValue ApiResponse
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -990,18 +974,24 @@ func (a *PetApiService) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse,
|
|||||||
if r.additionalMetadata != nil {
|
if r.additionalMetadata != nil {
|
||||||
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
|
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
|
||||||
}
|
}
|
||||||
localVarFormFileName = "file"
|
var fileLocalVarFormFileName string
|
||||||
var localVarFile *os.File
|
var fileLocalVarFileName string
|
||||||
|
var fileLocalVarFileBytes []byte
|
||||||
|
|
||||||
|
fileLocalVarFormFileName = "file"
|
||||||
|
|
||||||
|
var fileLocalVarFile *os.File
|
||||||
if r.file != nil {
|
if r.file != nil {
|
||||||
localVarFile = *r.file
|
fileLocalVarFile = *r.file
|
||||||
}
|
}
|
||||||
if localVarFile != nil {
|
if fileLocalVarFile != nil {
|
||||||
fbs, _ := _ioutil.ReadAll(localVarFile)
|
fbs, _ := _ioutil.ReadAll(fileLocalVarFile)
|
||||||
localVarFileBytes = fbs
|
fileLocalVarFileBytes = fbs
|
||||||
localVarFileName = localVarFile.Name()
|
fileLocalVarFileName = fileLocalVarFile.Name()
|
||||||
localVarFile.Close()
|
fileLocalVarFile.Close()
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
formFiles = append(formFiles, formFile{fileBytes: fileLocalVarFileBytes, fileName: fileLocalVarFileName, formFileName: fileLocalVarFormFileName})
|
||||||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -1082,9 +1072,7 @@ func (a *PetApiService) UploadFileWithRequiredFileExecute(r ApiUploadFileWithReq
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue ApiResponse
|
localVarReturnValue ApiResponse
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1123,15 +1111,21 @@ func (a *PetApiService) UploadFileWithRequiredFileExecute(r ApiUploadFileWithReq
|
|||||||
if r.additionalMetadata != nil {
|
if r.additionalMetadata != nil {
|
||||||
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
|
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
|
||||||
}
|
}
|
||||||
localVarFormFileName = "requiredFile"
|
var requiredFileLocalVarFormFileName string
|
||||||
localVarFile := *r.requiredFile
|
var requiredFileLocalVarFileName string
|
||||||
if localVarFile != nil {
|
var requiredFileLocalVarFileBytes []byte
|
||||||
fbs, _ := _ioutil.ReadAll(localVarFile)
|
|
||||||
localVarFileBytes = fbs
|
requiredFileLocalVarFormFileName = "requiredFile"
|
||||||
localVarFileName = localVarFile.Name()
|
|
||||||
localVarFile.Close()
|
requiredFileLocalVarFile := *r.requiredFile
|
||||||
|
if requiredFileLocalVarFile != nil {
|
||||||
|
fbs, _ := _ioutil.ReadAll(requiredFileLocalVarFile)
|
||||||
|
requiredFileLocalVarFileBytes = fbs
|
||||||
|
requiredFileLocalVarFileName = requiredFileLocalVarFile.Name()
|
||||||
|
requiredFileLocalVarFile.Close()
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
formFiles = append(formFiles, formFile{fileBytes: requiredFileLocalVarFileBytes, fileName: requiredFileLocalVarFileName, formFileName: requiredFileLocalVarFormFileName})
|
||||||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
|
@ -118,9 +118,7 @@ func (a *StoreApiService) DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodDelete
|
localVarHTTPMethod = _nethttp.MethodDelete
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder")
|
||||||
@ -152,7 +150,7 @@ func (a *StoreApiService) DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -211,9 +209,7 @@ func (a *StoreApiService) GetInventoryExecute(r ApiGetInventoryRequest) (map[str
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue map[string]int32
|
localVarReturnValue map[string]int32
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -259,7 +255,7 @@ func (a *StoreApiService) GetInventoryExecute(r ApiGetInventoryRequest) (map[str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -330,9 +326,7 @@ func (a *StoreApiService) GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order,
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Order
|
localVarReturnValue Order
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -371,7 +365,7 @@ func (a *StoreApiService) GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order,
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -443,9 +437,7 @@ func (a *StoreApiService) PlaceOrderExecute(r ApiPlaceOrderRequest) (Order, *_ne
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Order
|
localVarReturnValue Order
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -482,7 +474,7 @@ func (a *StoreApiService) PlaceOrderExecute(r ApiPlaceOrderRequest) (Order, *_ne
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
|
@ -165,9 +165,7 @@ func (a *UserApiService) CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Re
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser")
|
||||||
@ -203,7 +201,7 @@ func (a *UserApiService) CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Re
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -265,9 +263,7 @@ func (a *UserApiService) CreateUsersWithArrayInputExecute(r ApiCreateUsersWithAr
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput")
|
||||||
@ -303,7 +299,7 @@ func (a *UserApiService) CreateUsersWithArrayInputExecute(r ApiCreateUsersWithAr
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -365,9 +361,7 @@ func (a *UserApiService) CreateUsersWithListInputExecute(r ApiCreateUsersWithLis
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput")
|
||||||
@ -403,7 +397,7 @@ func (a *UserApiService) CreateUsersWithListInputExecute(r ApiCreateUsersWithLis
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -464,9 +458,7 @@ func (a *UserApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Re
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodDelete
|
localVarHTTPMethod = _nethttp.MethodDelete
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser")
|
||||||
@ -498,7 +490,7 @@ func (a *UserApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Re
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -558,9 +550,7 @@ func (a *UserApiService) GetUserByNameExecute(r ApiGetUserByNameRequest) (User,
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue User
|
localVarReturnValue User
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -593,7 +583,7 @@ func (a *UserApiService) GetUserByNameExecute(r ApiGetUserByNameRequest) (User,
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -671,9 +661,7 @@ func (a *UserApiService) LoginUserExecute(r ApiLoginUserRequest) (string, *_neth
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue string
|
localVarReturnValue string
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -713,7 +701,7 @@ func (a *UserApiService) LoginUserExecute(r ApiLoginUserRequest) (string, *_neth
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -778,9 +766,7 @@ func (a *UserApiService) LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Re
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser")
|
||||||
@ -811,7 +797,7 @@ func (a *UserApiService) LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Re
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -878,9 +864,7 @@ func (a *UserApiService) UpdateUserExecute(r ApiUpdateUserRequest) (*_nethttp.Re
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPut
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser")
|
||||||
@ -917,7 +901,7 @@ func (a *UserApiService) UpdateUserExecute(r ApiUpdateUserRequest) (*_nethttp.Re
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -204,6 +204,12 @@ func (c *APIClient) GetConfig() *Configuration {
|
|||||||
return c.cfg
|
return c.cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type formFile struct {
|
||||||
|
fileBytes []byte
|
||||||
|
fileName string
|
||||||
|
formFileName string
|
||||||
|
}
|
||||||
|
|
||||||
// prepareRequest build the request
|
// prepareRequest build the request
|
||||||
func (c *APIClient) prepareRequest(
|
func (c *APIClient) prepareRequest(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
@ -212,9 +218,7 @@ func (c *APIClient) prepareRequest(
|
|||||||
headerParams map[string]string,
|
headerParams map[string]string,
|
||||||
queryParams url.Values,
|
queryParams url.Values,
|
||||||
formParams url.Values,
|
formParams url.Values,
|
||||||
formFileName string,
|
formFiles []formFile) (localVarRequest *http.Request, err error) {
|
||||||
fileName string,
|
|
||||||
fileBytes []byte) (localVarRequest *http.Request, err error) {
|
|
||||||
|
|
||||||
var body *bytes.Buffer
|
var body *bytes.Buffer
|
||||||
|
|
||||||
@ -233,7 +237,7 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add form parameters and file if available.
|
// add form parameters and file if available.
|
||||||
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
|
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) {
|
||||||
if body != nil {
|
if body != nil {
|
||||||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||||
}
|
}
|
||||||
@ -252,18 +256,19 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(fileBytes) > 0 && fileName != "" {
|
for _, formFile := range formFiles {
|
||||||
|
if len(formFile.fileBytes) > 0 && formFile.fileName != "" {
|
||||||
w.Boundary()
|
w.Boundary()
|
||||||
//_, fileNm := filepath.Split(fileName)
|
part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName))
|
||||||
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
_, err = part.Write(fileBytes)
|
_, err = part.Write(formFile.fileBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the Boundary in the Content-Type
|
// Set the Boundary in the Content-Type
|
||||||
headerParams["Content-Type"] = w.FormDataContentType()
|
headerParams["Content-Type"] = w.FormDataContentType()
|
||||||
|
@ -57,9 +57,7 @@ func (a *UsageApiService) AnyKeyExecute(r ApiAnyKeyRequest) (map[string]interfac
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue map[string]interface{}
|
localVarReturnValue map[string]interface{}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -119,7 +117,7 @@ func (a *UsageApiService) AnyKeyExecute(r ApiAnyKeyRequest) (map[string]interfac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -187,9 +185,7 @@ func (a *UsageApiService) BothKeysExecute(r ApiBothKeysRequest) (map[string]inte
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue map[string]interface{}
|
localVarReturnValue map[string]interface{}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -249,7 +245,7 @@ func (a *UsageApiService) BothKeysExecute(r ApiBothKeysRequest) (map[string]inte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -317,9 +313,7 @@ func (a *UsageApiService) KeyInHeaderExecute(r ApiKeyInHeaderRequest) (map[strin
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue map[string]interface{}
|
localVarReturnValue map[string]interface{}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -365,7 +359,7 @@ func (a *UsageApiService) KeyInHeaderExecute(r ApiKeyInHeaderRequest) (map[strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -433,9 +427,7 @@ func (a *UsageApiService) KeyInQueryExecute(r ApiKeyInQueryRequest) (map[string]
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue map[string]interface{}
|
localVarReturnValue map[string]interface{}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -481,7 +473,7 @@ func (a *UsageApiService) KeyInQueryExecute(r ApiKeyInQueryRequest) (map[string]
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
|
@ -189,6 +189,12 @@ func (c *APIClient) GetConfig() *Configuration {
|
|||||||
return c.cfg
|
return c.cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type formFile struct {
|
||||||
|
fileBytes []byte
|
||||||
|
fileName string
|
||||||
|
formFileName string
|
||||||
|
}
|
||||||
|
|
||||||
// prepareRequest build the request
|
// prepareRequest build the request
|
||||||
func (c *APIClient) prepareRequest(
|
func (c *APIClient) prepareRequest(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
@ -197,9 +203,7 @@ func (c *APIClient) prepareRequest(
|
|||||||
headerParams map[string]string,
|
headerParams map[string]string,
|
||||||
queryParams url.Values,
|
queryParams url.Values,
|
||||||
formParams url.Values,
|
formParams url.Values,
|
||||||
formFileName string,
|
formFiles []formFile) (localVarRequest *http.Request, err error) {
|
||||||
fileName string,
|
|
||||||
fileBytes []byte) (localVarRequest *http.Request, err error) {
|
|
||||||
|
|
||||||
var body *bytes.Buffer
|
var body *bytes.Buffer
|
||||||
|
|
||||||
@ -218,7 +222,7 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add form parameters and file if available.
|
// add form parameters and file if available.
|
||||||
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
|
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) {
|
||||||
if body != nil {
|
if body != nil {
|
||||||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||||
}
|
}
|
||||||
@ -237,18 +241,19 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(fileBytes) > 0 && fileName != "" {
|
for _, formFile := range formFiles {
|
||||||
|
if len(formFile.fileBytes) > 0 && formFile.fileName != "" {
|
||||||
w.Boundary()
|
w.Boundary()
|
||||||
//_, fileNm := filepath.Split(fileName)
|
part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName))
|
||||||
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
_, err = part.Write(fileBytes)
|
_, err = part.Write(formFile.fileBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the Boundary in the Content-Type
|
// Set the Boundary in the Content-Type
|
||||||
headerParams["Content-Type"] = w.FormDataContentType()
|
headerParams["Content-Type"] = w.FormDataContentType()
|
||||||
|
24
samples/openapi3/client/features/mulitple-data-in-forms/.gitignore
vendored
Normal file
24
samples/openapi3/client/features/mulitple-data-in-forms/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Folders
|
||||||
|
_obj
|
||||||
|
_test
|
||||||
|
|
||||||
|
# Architecture specific extensions/prefixes
|
||||||
|
*.[568vq]
|
||||||
|
[568vq].out
|
||||||
|
|
||||||
|
*.cgo1.go
|
||||||
|
*.cgo2.c
|
||||||
|
_cgo_defun.c
|
||||||
|
_cgo_gotypes.go
|
||||||
|
_cgo_export.*
|
||||||
|
|
||||||
|
_testmain.go
|
||||||
|
|
||||||
|
*.exe
|
||||||
|
*.test
|
||||||
|
*.prof
|
@ -0,0 +1,23 @@
|
|||||||
|
# OpenAPI Generator Ignore
|
||||||
|
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
@ -0,0 +1,16 @@
|
|||||||
|
.gitignore
|
||||||
|
.openapi-generator-ignore
|
||||||
|
.travis.yml
|
||||||
|
README.md
|
||||||
|
api/openapi.yaml
|
||||||
|
api_default.go
|
||||||
|
client.go
|
||||||
|
configuration.go
|
||||||
|
docs/ApiResponse.md
|
||||||
|
docs/DefaultApi.md
|
||||||
|
git_push.sh
|
||||||
|
go.mod
|
||||||
|
go.sum
|
||||||
|
model_api_response.go
|
||||||
|
response.go
|
||||||
|
utils.go
|
@ -0,0 +1 @@
|
|||||||
|
5.3.1-SNAPSHOT
|
@ -0,0 +1,8 @@
|
|||||||
|
language: go
|
||||||
|
|
||||||
|
install:
|
||||||
|
- go get -d -v .
|
||||||
|
|
||||||
|
script:
|
||||||
|
- go build -v ./
|
||||||
|
|
@ -0,0 +1,113 @@
|
|||||||
|
# Go API client for openapi
|
||||||
|
|
||||||
|
This is a sample server with a single endpoint that accepts two files via a multipart/form-data POST request.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
|
||||||
|
|
||||||
|
- API version: 1.0.0
|
||||||
|
- Package version: 1.0.0
|
||||||
|
- Build package: org.openapitools.codegen.languages.GoClientCodegen
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install the following dependencies:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
go get github.com/stretchr/testify/assert
|
||||||
|
go get golang.org/x/oauth2
|
||||||
|
go get golang.org/x/net/context
|
||||||
|
```
|
||||||
|
|
||||||
|
Put the package under your project folder and add the following in import:
|
||||||
|
|
||||||
|
```golang
|
||||||
|
import sw "./openapi"
|
||||||
|
```
|
||||||
|
|
||||||
|
To use a proxy, set the environment variable `HTTP_PROXY`:
|
||||||
|
|
||||||
|
```golang
|
||||||
|
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration of Server URL
|
||||||
|
|
||||||
|
Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.
|
||||||
|
|
||||||
|
### Select Server Configuration
|
||||||
|
|
||||||
|
For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
|
||||||
|
|
||||||
|
```golang
|
||||||
|
ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Templated Server URL
|
||||||
|
|
||||||
|
Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
|
||||||
|
|
||||||
|
```golang
|
||||||
|
ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
|
||||||
|
"basePath": "v2",
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Note, enum values are always validated and all unused variables are silently ignored.
|
||||||
|
|
||||||
|
### URLs Configuration per Operation
|
||||||
|
|
||||||
|
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
||||||
|
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
||||||
|
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
|
||||||
|
|
||||||
|
```
|
||||||
|
ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
|
||||||
|
"{classname}Service.{nickname}": 2,
|
||||||
|
})
|
||||||
|
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
|
||||||
|
"{classname}Service.{nickname}": {
|
||||||
|
"port": "8443",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *http://example.com*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*DefaultApi* | [**UploadFiles**](docs/DefaultApi.md#uploadfiles) | **Post** /uploadFiles | uploads two files
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation For Models
|
||||||
|
|
||||||
|
- [ApiResponse](docs/ApiResponse.md)
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation For Authorization
|
||||||
|
|
||||||
|
Endpoints do not require authorization.
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation for Utility Methods
|
||||||
|
|
||||||
|
Due to the fact that model structure members are all pointers, this package contains
|
||||||
|
a number of utility functions to easily obtain pointers to values of basic types.
|
||||||
|
Each of these functions takes a value of the given basic type and returns a pointer to it:
|
||||||
|
|
||||||
|
* `PtrBool`
|
||||||
|
* `PtrInt`
|
||||||
|
* `PtrInt32`
|
||||||
|
* `PtrInt64`
|
||||||
|
* `PtrFloat`
|
||||||
|
* `PtrFloat32`
|
||||||
|
* `PtrFloat64`
|
||||||
|
* `PtrString`
|
||||||
|
* `PtrTime`
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
info:
|
||||||
|
description: This is a sample server with a single endpoint that accepts two files
|
||||||
|
via a multipart/form-data POST request.
|
||||||
|
license:
|
||||||
|
name: Apache-2.0
|
||||||
|
url: https://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
title: Multiple Files via form-data
|
||||||
|
version: 1.0.0
|
||||||
|
servers:
|
||||||
|
- url: http://example.com
|
||||||
|
paths:
|
||||||
|
/uploadFiles:
|
||||||
|
post:
|
||||||
|
operationId: uploadFiles
|
||||||
|
requestBody:
|
||||||
|
$ref: '#/components/requestBodies/inline_object'
|
||||||
|
content:
|
||||||
|
multipart/form-data:
|
||||||
|
schema:
|
||||||
|
properties:
|
||||||
|
file:
|
||||||
|
description: file to upload
|
||||||
|
format: binary
|
||||||
|
type: string
|
||||||
|
secondFile:
|
||||||
|
description: another file to upload
|
||||||
|
format: binary
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ApiResponse'
|
||||||
|
description: successful operation
|
||||||
|
summary: uploads two files
|
||||||
|
components:
|
||||||
|
requestBodies:
|
||||||
|
inline_object:
|
||||||
|
content:
|
||||||
|
multipart/form-data:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/inline_object'
|
||||||
|
schemas:
|
||||||
|
ApiResponse:
|
||||||
|
description: Describes the result of uploading files
|
||||||
|
example:
|
||||||
|
code: 0
|
||||||
|
type: type
|
||||||
|
message: message
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
format: int32
|
||||||
|
type: integer
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
title: An uploaded response
|
||||||
|
type: object
|
||||||
|
inline_object:
|
||||||
|
properties:
|
||||||
|
file:
|
||||||
|
description: file to upload
|
||||||
|
format: binary
|
||||||
|
type: string
|
||||||
|
secondFile:
|
||||||
|
description: another file to upload
|
||||||
|
format: binary
|
||||||
|
type: string
|
||||||
|
type: object
|
@ -0,0 +1,172 @@
|
|||||||
|
/*
|
||||||
|
Multiple Files via form-data
|
||||||
|
|
||||||
|
This is a sample server with a single endpoint that accepts two files via a multipart/form-data POST request.
|
||||||
|
|
||||||
|
API version: 1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||||
|
|
||||||
|
package openapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
_context "context"
|
||||||
|
_ioutil "io/ioutil"
|
||||||
|
_nethttp "net/http"
|
||||||
|
_neturl "net/url"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Linger please
|
||||||
|
var (
|
||||||
|
_ _context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
// DefaultApiService DefaultApi service
|
||||||
|
type DefaultApiService service
|
||||||
|
|
||||||
|
type ApiUploadFilesRequest struct {
|
||||||
|
ctx _context.Context
|
||||||
|
ApiService *DefaultApiService
|
||||||
|
file **os.File
|
||||||
|
secondFile **os.File
|
||||||
|
}
|
||||||
|
|
||||||
|
// file to upload
|
||||||
|
func (r ApiUploadFilesRequest) File(file *os.File) ApiUploadFilesRequest {
|
||||||
|
r.file = &file
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
// another file to upload
|
||||||
|
func (r ApiUploadFilesRequest) SecondFile(secondFile *os.File) ApiUploadFilesRequest {
|
||||||
|
r.secondFile = &secondFile
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r ApiUploadFilesRequest) Execute() (ApiResponse, *_nethttp.Response, error) {
|
||||||
|
return r.ApiService.UploadFilesExecute(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
UploadFiles uploads two files
|
||||||
|
|
||||||
|
@param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||||
|
@return ApiUploadFilesRequest
|
||||||
|
*/
|
||||||
|
func (a *DefaultApiService) UploadFiles(ctx _context.Context) ApiUploadFilesRequest {
|
||||||
|
return ApiUploadFilesRequest{
|
||||||
|
ApiService: a,
|
||||||
|
ctx: ctx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute executes the request
|
||||||
|
// @return ApiResponse
|
||||||
|
func (a *DefaultApiService) UploadFilesExecute(r ApiUploadFilesRequest) (ApiResponse, *_nethttp.Response, error) {
|
||||||
|
var (
|
||||||
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
|
localVarPostBody interface{}
|
||||||
|
formFiles []formFile
|
||||||
|
localVarReturnValue ApiResponse
|
||||||
|
)
|
||||||
|
|
||||||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UploadFiles")
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarPath := localBasePath + "/uploadFiles"
|
||||||
|
|
||||||
|
localVarHeaderParams := make(map[string]string)
|
||||||
|
localVarQueryParams := _neturl.Values{}
|
||||||
|
localVarFormParams := _neturl.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
|
||||||
|
}
|
||||||
|
var fileLocalVarFormFileName string
|
||||||
|
var fileLocalVarFileName string
|
||||||
|
var fileLocalVarFileBytes []byte
|
||||||
|
|
||||||
|
fileLocalVarFormFileName = "file"
|
||||||
|
|
||||||
|
var fileLocalVarFile *os.File
|
||||||
|
if r.file != nil {
|
||||||
|
fileLocalVarFile = *r.file
|
||||||
|
}
|
||||||
|
if fileLocalVarFile != nil {
|
||||||
|
fbs, _ := _ioutil.ReadAll(fileLocalVarFile)
|
||||||
|
fileLocalVarFileBytes = fbs
|
||||||
|
fileLocalVarFileName = fileLocalVarFile.Name()
|
||||||
|
fileLocalVarFile.Close()
|
||||||
|
}
|
||||||
|
formFiles = append(formFiles, formFile{fileBytes: fileLocalVarFileBytes, fileName: fileLocalVarFileName, formFileName: fileLocalVarFormFileName})
|
||||||
|
var secondFileLocalVarFormFileName string
|
||||||
|
var secondFileLocalVarFileName string
|
||||||
|
var secondFileLocalVarFileBytes []byte
|
||||||
|
|
||||||
|
secondFileLocalVarFormFileName = "secondFile"
|
||||||
|
|
||||||
|
var secondFileLocalVarFile *os.File
|
||||||
|
if r.secondFile != nil {
|
||||||
|
secondFileLocalVarFile = *r.secondFile
|
||||||
|
}
|
||||||
|
if secondFileLocalVarFile != nil {
|
||||||
|
fbs, _ := _ioutil.ReadAll(secondFileLocalVarFile)
|
||||||
|
secondFileLocalVarFileBytes = fbs
|
||||||
|
secondFileLocalVarFileName = secondFileLocalVarFile.Name()
|
||||||
|
secondFileLocalVarFile.Close()
|
||||||
|
}
|
||||||
|
formFiles = append(formFiles, formFile{fileBytes: secondFileLocalVarFileBytes, fileName: secondFileLocalVarFileName, formFileName: secondFileLocalVarFormFileName})
|
||||||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||||
|
if err != nil || localVarHTTPResponse == nil {
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||||
|
localVarHTTPResponse.Body.Close()
|
||||||
|
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
|
||||||
|
if err != nil {
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: localVarHTTPResponse.Status,
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||||
|
if err != nil {
|
||||||
|
newErr := GenericOpenAPIError{
|
||||||
|
body: localVarBody,
|
||||||
|
error: err.Error(),
|
||||||
|
}
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||||||
|
}
|
@ -0,0 +1,553 @@
|
|||||||
|
/*
|
||||||
|
Multiple Files via form-data
|
||||||
|
|
||||||
|
This is a sample server with a single endpoint that accepts two files via a multipart/form-data POST request.
|
||||||
|
|
||||||
|
API version: 1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||||
|
|
||||||
|
package openapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"encoding/xml"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"mime/multipart"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httputil"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"regexp"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
|
||||||
|
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
|
||||||
|
)
|
||||||
|
|
||||||
|
// APIClient manages communication with the Multiple Files via form-data API v1.0.0
|
||||||
|
// In most cases there should be only one, shared, APIClient.
|
||||||
|
type APIClient struct {
|
||||||
|
cfg *Configuration
|
||||||
|
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||||
|
|
||||||
|
// API Services
|
||||||
|
|
||||||
|
DefaultApi *DefaultApiService
|
||||||
|
}
|
||||||
|
|
||||||
|
type service struct {
|
||||||
|
client *APIClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
|
||||||
|
// optionally a custom http.Client to allow for advanced features such as caching.
|
||||||
|
func NewAPIClient(cfg *Configuration) *APIClient {
|
||||||
|
if cfg.HTTPClient == nil {
|
||||||
|
cfg.HTTPClient = http.DefaultClient
|
||||||
|
}
|
||||||
|
|
||||||
|
c := &APIClient{}
|
||||||
|
c.cfg = cfg
|
||||||
|
c.common.client = c
|
||||||
|
|
||||||
|
// API Services
|
||||||
|
c.DefaultApi = (*DefaultApiService)(&c.common)
|
||||||
|
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func atoi(in string) (int, error) {
|
||||||
|
return strconv.Atoi(in)
|
||||||
|
}
|
||||||
|
|
||||||
|
// selectHeaderContentType select a content type from the available list.
|
||||||
|
func selectHeaderContentType(contentTypes []string) string {
|
||||||
|
if len(contentTypes) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if contains(contentTypes, "application/json") {
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||||
|
}
|
||||||
|
|
||||||
|
// selectHeaderAccept join all accept types and return
|
||||||
|
func selectHeaderAccept(accepts []string) string {
|
||||||
|
if len(accepts) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if contains(accepts, "application/json") {
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(accepts, ",")
|
||||||
|
}
|
||||||
|
|
||||||
|
// contains is a case insensitive match, finding needle in a haystack
|
||||||
|
func contains(haystack []string, needle string) bool {
|
||||||
|
for _, a := range haystack {
|
||||||
|
if strings.ToLower(a) == strings.ToLower(needle) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify optional parameters are of the correct type.
|
||||||
|
func typeCheckParameter(obj interface{}, expected string, name string) error {
|
||||||
|
// Make sure there is an object.
|
||||||
|
if obj == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the type is as expected.
|
||||||
|
if reflect.TypeOf(obj).String() != expected {
|
||||||
|
return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
|
||||||
|
func parameterToString(obj interface{}, collectionFormat string) string {
|
||||||
|
var delimiter string
|
||||||
|
|
||||||
|
switch collectionFormat {
|
||||||
|
case "pipes":
|
||||||
|
delimiter = "|"
|
||||||
|
case "ssv":
|
||||||
|
delimiter = " "
|
||||||
|
case "tsv":
|
||||||
|
delimiter = "\t"
|
||||||
|
case "csv":
|
||||||
|
delimiter = ","
|
||||||
|
}
|
||||||
|
|
||||||
|
if reflect.TypeOf(obj).Kind() == reflect.Slice {
|
||||||
|
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
|
||||||
|
} else if t, ok := obj.(time.Time); ok {
|
||||||
|
return t.Format(time.RFC3339)
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("%v", obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
// helper for converting interface{} parameters to json strings
|
||||||
|
func parameterToJson(obj interface{}) (string, error) {
|
||||||
|
jsonBuf, err := json.Marshal(obj)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return string(jsonBuf), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// callAPI do the request.
|
||||||
|
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||||
|
if c.cfg.Debug {
|
||||||
|
dump, err := httputil.DumpRequestOut(request, true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
log.Printf("\n%s\n", string(dump))
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := c.cfg.HTTPClient.Do(request)
|
||||||
|
if err != nil {
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.cfg.Debug {
|
||||||
|
dump, err := httputil.DumpResponse(resp, true)
|
||||||
|
if err != nil {
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
log.Printf("\n%s\n", string(dump))
|
||||||
|
}
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow modification of underlying config for alternate implementations and testing
|
||||||
|
// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior
|
||||||
|
func (c *APIClient) GetConfig() *Configuration {
|
||||||
|
return c.cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
type formFile struct {
|
||||||
|
fileBytes []byte
|
||||||
|
fileName string
|
||||||
|
formFileName string
|
||||||
|
}
|
||||||
|
|
||||||
|
// prepareRequest build the request
|
||||||
|
func (c *APIClient) prepareRequest(
|
||||||
|
ctx context.Context,
|
||||||
|
path string, method string,
|
||||||
|
postBody interface{},
|
||||||
|
headerParams map[string]string,
|
||||||
|
queryParams url.Values,
|
||||||
|
formParams url.Values,
|
||||||
|
formFiles []formFile) (localVarRequest *http.Request, err error) {
|
||||||
|
|
||||||
|
var body *bytes.Buffer
|
||||||
|
|
||||||
|
// Detect postBody type and post.
|
||||||
|
if postBody != nil {
|
||||||
|
contentType := headerParams["Content-Type"]
|
||||||
|
if contentType == "" {
|
||||||
|
contentType = detectContentType(postBody)
|
||||||
|
headerParams["Content-Type"] = contentType
|
||||||
|
}
|
||||||
|
|
||||||
|
body, err = setBody(postBody, contentType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// add form parameters and file if available.
|
||||||
|
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) {
|
||||||
|
if body != nil {
|
||||||
|
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||||
|
}
|
||||||
|
body = &bytes.Buffer{}
|
||||||
|
w := multipart.NewWriter(body)
|
||||||
|
|
||||||
|
for k, v := range formParams {
|
||||||
|
for _, iv := range v {
|
||||||
|
if strings.HasPrefix(k, "@") { // file
|
||||||
|
err = addFile(w, k[1:], iv)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else { // form value
|
||||||
|
w.WriteField(k, iv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, formFile := range formFiles {
|
||||||
|
if len(formFile.fileBytes) > 0 && formFile.fileName != "" {
|
||||||
|
w.Boundary()
|
||||||
|
part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_, err = part.Write(formFile.fileBytes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the Boundary in the Content-Type
|
||||||
|
headerParams["Content-Type"] = w.FormDataContentType()
|
||||||
|
|
||||||
|
// Set Content-Length
|
||||||
|
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||||
|
w.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
|
||||||
|
if body != nil {
|
||||||
|
return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.")
|
||||||
|
}
|
||||||
|
body = &bytes.Buffer{}
|
||||||
|
body.WriteString(formParams.Encode())
|
||||||
|
// Set Content-Length
|
||||||
|
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup path and query parameters
|
||||||
|
url, err := url.Parse(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override request host, if applicable
|
||||||
|
if c.cfg.Host != "" {
|
||||||
|
url.Host = c.cfg.Host
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override request scheme, if applicable
|
||||||
|
if c.cfg.Scheme != "" {
|
||||||
|
url.Scheme = c.cfg.Scheme
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adding Query Param
|
||||||
|
query := url.Query()
|
||||||
|
for k, v := range queryParams {
|
||||||
|
for _, iv := range v {
|
||||||
|
query.Add(k, iv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encode the parameters.
|
||||||
|
url.RawQuery = query.Encode()
|
||||||
|
|
||||||
|
// Generate a new request
|
||||||
|
if body != nil {
|
||||||
|
localVarRequest, err = http.NewRequest(method, url.String(), body)
|
||||||
|
} else {
|
||||||
|
localVarRequest, err = http.NewRequest(method, url.String(), nil)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// add header parameters, if any
|
||||||
|
if len(headerParams) > 0 {
|
||||||
|
headers := http.Header{}
|
||||||
|
for h, v := range headerParams {
|
||||||
|
headers.Set(h, v)
|
||||||
|
}
|
||||||
|
localVarRequest.Header = headers
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the user agent to the request.
|
||||||
|
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||||
|
|
||||||
|
if ctx != nil {
|
||||||
|
// add context to the request
|
||||||
|
localVarRequest = localVarRequest.WithContext(ctx)
|
||||||
|
|
||||||
|
// Walk through any authentication.
|
||||||
|
|
||||||
|
// OAuth2 authentication
|
||||||
|
if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
|
||||||
|
// We were able to grab an oauth2 token from the context
|
||||||
|
var latestToken *oauth2.Token
|
||||||
|
if latestToken, err = tok.Token(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
latestToken.SetAuthHeader(localVarRequest)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Basic HTTP Authentication
|
||||||
|
if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
|
||||||
|
localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AccessToken Authentication
|
||||||
|
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
|
||||||
|
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for header, value := range c.cfg.DefaultHeader {
|
||||||
|
localVarRequest.Header.Add(header, value)
|
||||||
|
}
|
||||||
|
return localVarRequest, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||||
|
if len(b) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if s, ok := v.(*string); ok {
|
||||||
|
*s = string(b)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if f, ok := v.(**os.File); ok {
|
||||||
|
*f, err = ioutil.TempFile("", "HttpClientFile")
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, err = (*f).Write(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, err = (*f).Seek(0, io.SeekStart)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if xmlCheck.MatchString(contentType) {
|
||||||
|
if err = xml.Unmarshal(b, v); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if jsonCheck.MatchString(contentType) {
|
||||||
|
if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
|
||||||
|
if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
|
||||||
|
if err = unmarshalObj.UnmarshalJSON(b); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined")
|
||||||
|
}
|
||||||
|
} else if err = json.Unmarshal(b, v); err != nil { // simple model
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return errors.New("undefined response type")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a file to the multipart request
|
||||||
|
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = io.Copy(part, file)
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent trying to import "fmt"
|
||||||
|
func reportError(format string, a ...interface{}) error {
|
||||||
|
return fmt.Errorf(format, a...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set request body from an interface{}
|
||||||
|
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
|
||||||
|
if bodyBuf == nil {
|
||||||
|
bodyBuf = &bytes.Buffer{}
|
||||||
|
}
|
||||||
|
|
||||||
|
if reader, ok := body.(io.Reader); ok {
|
||||||
|
_, err = bodyBuf.ReadFrom(reader)
|
||||||
|
} else if fp, ok := body.(**os.File); ok {
|
||||||
|
_, err = bodyBuf.ReadFrom(*fp)
|
||||||
|
} else if b, ok := body.([]byte); ok {
|
||||||
|
_, err = bodyBuf.Write(b)
|
||||||
|
} else if s, ok := body.(string); ok {
|
||||||
|
_, err = bodyBuf.WriteString(s)
|
||||||
|
} else if s, ok := body.(*string); ok {
|
||||||
|
_, err = bodyBuf.WriteString(*s)
|
||||||
|
} else if jsonCheck.MatchString(contentType) {
|
||||||
|
err = json.NewEncoder(bodyBuf).Encode(body)
|
||||||
|
} else if xmlCheck.MatchString(contentType) {
|
||||||
|
err = xml.NewEncoder(bodyBuf).Encode(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if bodyBuf.Len() == 0 {
|
||||||
|
err = fmt.Errorf("Invalid body type %s\n", contentType)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return bodyBuf, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// detectContentType method is used to figure out `Request.Body` content type for request header
|
||||||
|
func detectContentType(body interface{}) string {
|
||||||
|
contentType := "text/plain; charset=utf-8"
|
||||||
|
kind := reflect.TypeOf(body).Kind()
|
||||||
|
|
||||||
|
switch kind {
|
||||||
|
case reflect.Struct, reflect.Map, reflect.Ptr:
|
||||||
|
contentType = "application/json; charset=utf-8"
|
||||||
|
case reflect.String:
|
||||||
|
contentType = "text/plain; charset=utf-8"
|
||||||
|
default:
|
||||||
|
if b, ok := body.([]byte); ok {
|
||||||
|
contentType = http.DetectContentType(b)
|
||||||
|
} else if kind == reflect.Slice {
|
||||||
|
contentType = "application/json; charset=utf-8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return contentType
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||||
|
type cacheControl map[string]string
|
||||||
|
|
||||||
|
func parseCacheControl(headers http.Header) cacheControl {
|
||||||
|
cc := cacheControl{}
|
||||||
|
ccHeader := headers.Get("Cache-Control")
|
||||||
|
for _, part := range strings.Split(ccHeader, ",") {
|
||||||
|
part = strings.Trim(part, " ")
|
||||||
|
if part == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if strings.ContainsRune(part, '=') {
|
||||||
|
keyval := strings.Split(part, "=")
|
||||||
|
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
|
||||||
|
} else {
|
||||||
|
cc[part] = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cc
|
||||||
|
}
|
||||||
|
|
||||||
|
// CacheExpires helper function to determine remaining time before repeating a request.
|
||||||
|
func CacheExpires(r *http.Response) time.Time {
|
||||||
|
// Figure out when the cache expires.
|
||||||
|
var expires time.Time
|
||||||
|
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||||
|
if err != nil {
|
||||||
|
return time.Now()
|
||||||
|
}
|
||||||
|
respCacheControl := parseCacheControl(r.Header)
|
||||||
|
|
||||||
|
if maxAge, ok := respCacheControl["max-age"]; ok {
|
||||||
|
lifetime, err := time.ParseDuration(maxAge + "s")
|
||||||
|
if err != nil {
|
||||||
|
expires = now
|
||||||
|
} else {
|
||||||
|
expires = now.Add(lifetime)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
expiresHeader := r.Header.Get("Expires")
|
||||||
|
if expiresHeader != "" {
|
||||||
|
expires, err = time.Parse(time.RFC1123, expiresHeader)
|
||||||
|
if err != nil {
|
||||||
|
expires = now
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return expires
|
||||||
|
}
|
||||||
|
|
||||||
|
func strlen(s string) int {
|
||||||
|
return utf8.RuneCountInString(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GenericOpenAPIError Provides access to the body, error and model on returned errors.
|
||||||
|
type GenericOpenAPIError struct {
|
||||||
|
body []byte
|
||||||
|
error string
|
||||||
|
model interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error returns non-empty string if there was an error.
|
||||||
|
func (e GenericOpenAPIError) Error() string {
|
||||||
|
return e.error
|
||||||
|
}
|
||||||
|
|
||||||
|
// Body returns the raw bytes of the response
|
||||||
|
func (e GenericOpenAPIError) Body() []byte {
|
||||||
|
return e.body
|
||||||
|
}
|
||||||
|
|
||||||
|
// Model returns the unpacked model of the error
|
||||||
|
func (e GenericOpenAPIError) Model() interface{} {
|
||||||
|
return e.model
|
||||||
|
}
|
@ -0,0 +1,230 @@
|
|||||||
|
/*
|
||||||
|
Multiple Files via form-data
|
||||||
|
|
||||||
|
This is a sample server with a single endpoint that accepts two files via a multipart/form-data POST request.
|
||||||
|
|
||||||
|
API version: 1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||||
|
|
||||||
|
package openapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// contextKeys are used to identify the type of value in the context.
|
||||||
|
// Since these are string, it is possible to get a short description of the
|
||||||
|
// context key for logging and debugging using key.String().
|
||||||
|
|
||||||
|
type contextKey string
|
||||||
|
|
||||||
|
func (c contextKey) String() string {
|
||||||
|
return "auth " + string(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
|
||||||
|
ContextOAuth2 = contextKey("token")
|
||||||
|
|
||||||
|
// ContextBasicAuth takes BasicAuth as authentication for the request.
|
||||||
|
ContextBasicAuth = contextKey("basic")
|
||||||
|
|
||||||
|
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
|
||||||
|
ContextAccessToken = contextKey("accesstoken")
|
||||||
|
|
||||||
|
// ContextAPIKeys takes a string apikey as authentication for the request
|
||||||
|
ContextAPIKeys = contextKey("apiKeys")
|
||||||
|
|
||||||
|
// ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request.
|
||||||
|
ContextHttpSignatureAuth = contextKey("httpsignature")
|
||||||
|
|
||||||
|
// ContextServerIndex uses a server configuration from the index.
|
||||||
|
ContextServerIndex = contextKey("serverIndex")
|
||||||
|
|
||||||
|
// ContextOperationServerIndices uses a server configuration from the index mapping.
|
||||||
|
ContextOperationServerIndices = contextKey("serverOperationIndices")
|
||||||
|
|
||||||
|
// ContextServerVariables overrides a server configuration variables.
|
||||||
|
ContextServerVariables = contextKey("serverVariables")
|
||||||
|
|
||||||
|
// ContextOperationServerVariables overrides a server configuration variables using operation specific values.
|
||||||
|
ContextOperationServerVariables = contextKey("serverOperationVariables")
|
||||||
|
)
|
||||||
|
|
||||||
|
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
|
||||||
|
type BasicAuth struct {
|
||||||
|
UserName string `json:"userName,omitempty"`
|
||||||
|
Password string `json:"password,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
|
||||||
|
type APIKey struct {
|
||||||
|
Key string
|
||||||
|
Prefix string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerVariable stores the information about a server variable
|
||||||
|
type ServerVariable struct {
|
||||||
|
Description string
|
||||||
|
DefaultValue string
|
||||||
|
EnumValues []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerConfiguration stores the information about a server
|
||||||
|
type ServerConfiguration struct {
|
||||||
|
URL string
|
||||||
|
Description string
|
||||||
|
Variables map[string]ServerVariable
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerConfigurations stores multiple ServerConfiguration items
|
||||||
|
type ServerConfigurations []ServerConfiguration
|
||||||
|
|
||||||
|
// Configuration stores the configuration of the API client
|
||||||
|
type Configuration struct {
|
||||||
|
Host string `json:"host,omitempty"`
|
||||||
|
Scheme string `json:"scheme,omitempty"`
|
||||||
|
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||||
|
UserAgent string `json:"userAgent,omitempty"`
|
||||||
|
Debug bool `json:"debug,omitempty"`
|
||||||
|
Servers ServerConfigurations
|
||||||
|
OperationServers map[string]ServerConfigurations
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewConfiguration returns a new Configuration object
|
||||||
|
func NewConfiguration() *Configuration {
|
||||||
|
cfg := &Configuration{
|
||||||
|
DefaultHeader: make(map[string]string),
|
||||||
|
UserAgent: "OpenAPI-Generator/1.0.0/go",
|
||||||
|
Debug: false,
|
||||||
|
Servers: ServerConfigurations{
|
||||||
|
{
|
||||||
|
URL: "http://example.com",
|
||||||
|
Description: "No description provided",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
OperationServers: map[string]ServerConfigurations{
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddDefaultHeader adds a new HTTP header to the default header in the request
|
||||||
|
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
||||||
|
c.DefaultHeader[key] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// URL formats template on a index using given variables
|
||||||
|
func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) {
|
||||||
|
if index < 0 || len(sc) <= index {
|
||||||
|
return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1)
|
||||||
|
}
|
||||||
|
server := sc[index]
|
||||||
|
url := server.URL
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for name, variable := range server.Variables {
|
||||||
|
if value, ok := variables[name]; ok {
|
||||||
|
found := bool(len(variable.EnumValues) == 0)
|
||||||
|
for _, enumValue := range variable.EnumValues {
|
||||||
|
if value == enumValue {
|
||||||
|
found = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues)
|
||||||
|
}
|
||||||
|
url = strings.Replace(url, "{"+name+"}", value, -1)
|
||||||
|
} else {
|
||||||
|
url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerURL returns URL based on server settings
|
||||||
|
func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) {
|
||||||
|
return c.Servers.URL(index, variables)
|
||||||
|
}
|
||||||
|
|
||||||
|
func getServerIndex(ctx context.Context) (int, error) {
|
||||||
|
si := ctx.Value(ContextServerIndex)
|
||||||
|
if si != nil {
|
||||||
|
if index, ok := si.(int); ok {
|
||||||
|
return index, nil
|
||||||
|
}
|
||||||
|
return 0, reportError("Invalid type %T should be int", si)
|
||||||
|
}
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) {
|
||||||
|
osi := ctx.Value(ContextOperationServerIndices)
|
||||||
|
if osi != nil {
|
||||||
|
if operationIndices, ok := osi.(map[string]int); !ok {
|
||||||
|
return 0, reportError("Invalid type %T should be map[string]int", osi)
|
||||||
|
} else {
|
||||||
|
index, ok := operationIndices[endpoint]
|
||||||
|
if ok {
|
||||||
|
return index, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getServerIndex(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func getServerVariables(ctx context.Context) (map[string]string, error) {
|
||||||
|
sv := ctx.Value(ContextServerVariables)
|
||||||
|
if sv != nil {
|
||||||
|
if variables, ok := sv.(map[string]string); ok {
|
||||||
|
return variables, nil
|
||||||
|
}
|
||||||
|
return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv)
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) {
|
||||||
|
osv := ctx.Value(ContextOperationServerVariables)
|
||||||
|
if osv != nil {
|
||||||
|
if operationVariables, ok := osv.(map[string]map[string]string); !ok {
|
||||||
|
return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv)
|
||||||
|
} else {
|
||||||
|
variables, ok := operationVariables[endpoint]
|
||||||
|
if ok {
|
||||||
|
return variables, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getServerVariables(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerURLWithContext returns a new server URL given an endpoint
|
||||||
|
func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) {
|
||||||
|
sc, ok := c.OperationServers[endpoint]
|
||||||
|
if !ok {
|
||||||
|
sc = c.Servers
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx == nil {
|
||||||
|
return sc.URL(0, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
index, err := getServerOperationIndex(ctx, endpoint)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
variables, err := getServerOperationVariables(ctx, endpoint)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return sc.URL(index, variables)
|
||||||
|
}
|
@ -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)
|
||||||
|
|
||||||
|
|
@ -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)
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
|
#
|
||||||
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||||
|
|
||||||
|
git_user_id=$1
|
||||||
|
git_repo_id=$2
|
||||||
|
release_note=$3
|
||||||
|
git_host=$4
|
||||||
|
|
||||||
|
if [ "$git_host" = "" ]; then
|
||||||
|
git_host="github.com"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_user_id" = "" ]; then
|
||||||
|
git_user_id="GIT_USER_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_repo_id" = "" ]; then
|
||||||
|
git_repo_id="GIT_REPO_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$release_note" = "" ]; then
|
||||||
|
release_note="Minor update"
|
||||||
|
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize the local directory as a Git repository
|
||||||
|
git init
|
||||||
|
|
||||||
|
# Adds the files in the local repository and stages them for commit.
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||||
|
git commit -m "$release_note"
|
||||||
|
|
||||||
|
# Sets the new remote
|
||||||
|
git_remote=$(git remote)
|
||||||
|
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||||
|
|
||||||
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
|
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
|
else
|
||||||
|
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
git pull origin master
|
||||||
|
|
||||||
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
|
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||||
|
git push origin master 2>&1 | grep -v 'To https'
|
@ -0,0 +1,7 @@
|
|||||||
|
module github.com/GIT_USER_ID/GIT_REPO_ID
|
||||||
|
|
||||||
|
go 1.13
|
||||||
|
|
||||||
|
require (
|
||||||
|
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99
|
||||||
|
)
|
@ -0,0 +1,13 @@
|
|||||||
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||||
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
@ -0,0 +1,187 @@
|
|||||||
|
/*
|
||||||
|
Multiple Files via form-data
|
||||||
|
|
||||||
|
This is a sample server with a single endpoint that accepts two files via a multipart/form-data POST request.
|
||||||
|
|
||||||
|
API version: 1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||||
|
|
||||||
|
package openapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ApiResponse Describes the result of uploading files
|
||||||
|
type ApiResponse struct {
|
||||||
|
Code *int32 `json:"code,omitempty"`
|
||||||
|
Type *string `json:"type,omitempty"`
|
||||||
|
Message *string `json:"message,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
func NewApiResponse() *ApiResponse {
|
||||||
|
this := ApiResponse{}
|
||||||
|
return &this
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
func NewApiResponseWithDefaults() *ApiResponse {
|
||||||
|
this := ApiResponse{}
|
||||||
|
return &this
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCode returns the Code field value if set, zero value otherwise.
|
||||||
|
func (o *ApiResponse) GetCode() int32 {
|
||||||
|
if o == nil || o.Code == nil {
|
||||||
|
var ret int32
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
return *o.Code
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCodeOk returns a tuple with the Code field value if set, nil otherwise
|
||||||
|
// and a boolean to check if the value has been set.
|
||||||
|
func (o *ApiResponse) GetCodeOk() (*int32, bool) {
|
||||||
|
if o == nil || o.Code == nil {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
return o.Code, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// HasCode returns a boolean if a field has been set.
|
||||||
|
func (o *ApiResponse) HasCode() bool {
|
||||||
|
if o != nil && o.Code != nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCode gets a reference to the given int32 and assigns it to the Code field.
|
||||||
|
func (o *ApiResponse) SetCode(v int32) {
|
||||||
|
o.Code = &v
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetType returns the Type field value if set, zero value otherwise.
|
||||||
|
func (o *ApiResponse) GetType() string {
|
||||||
|
if o == nil || o.Type == nil {
|
||||||
|
var ret string
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
return *o.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
|
||||||
|
// and a boolean to check if the value has been set.
|
||||||
|
func (o *ApiResponse) GetTypeOk() (*string, bool) {
|
||||||
|
if o == nil || o.Type == nil {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
return o.Type, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// HasType returns a boolean if a field has been set.
|
||||||
|
func (o *ApiResponse) HasType() bool {
|
||||||
|
if o != nil && o.Type != nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetType gets a reference to the given string and assigns it to the Type field.
|
||||||
|
func (o *ApiResponse) SetType(v string) {
|
||||||
|
o.Type = &v
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMessage returns the Message field value if set, zero value otherwise.
|
||||||
|
func (o *ApiResponse) GetMessage() string {
|
||||||
|
if o == nil || o.Message == nil {
|
||||||
|
var ret string
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
return *o.Message
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMessageOk returns a tuple with the Message field value if set, nil otherwise
|
||||||
|
// and a boolean to check if the value has been set.
|
||||||
|
func (o *ApiResponse) GetMessageOk() (*string, bool) {
|
||||||
|
if o == nil || o.Message == nil {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
return o.Message, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// HasMessage returns a boolean if a field has been set.
|
||||||
|
func (o *ApiResponse) HasMessage() bool {
|
||||||
|
if o != nil && o.Message != nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetMessage gets a reference to the given string and assigns it to the Message field.
|
||||||
|
func (o *ApiResponse) SetMessage(v string) {
|
||||||
|
o.Message = &v
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o ApiResponse) MarshalJSON() ([]byte, error) {
|
||||||
|
toSerialize := map[string]interface{}{}
|
||||||
|
if o.Code != nil {
|
||||||
|
toSerialize["code"] = o.Code
|
||||||
|
}
|
||||||
|
if o.Type != nil {
|
||||||
|
toSerialize["type"] = o.Type
|
||||||
|
}
|
||||||
|
if o.Message != nil {
|
||||||
|
toSerialize["message"] = o.Message
|
||||||
|
}
|
||||||
|
return json.Marshal(toSerialize)
|
||||||
|
}
|
||||||
|
|
||||||
|
type NullableApiResponse struct {
|
||||||
|
value *ApiResponse
|
||||||
|
isSet bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableApiResponse) Get() *ApiResponse {
|
||||||
|
return v.value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableApiResponse) Set(val *ApiResponse) {
|
||||||
|
v.value = val
|
||||||
|
v.isSet = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableApiResponse) IsSet() bool {
|
||||||
|
return v.isSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableApiResponse) Unset() {
|
||||||
|
v.value = nil
|
||||||
|
v.isSet = false
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNullableApiResponse(val *ApiResponse) *NullableApiResponse {
|
||||||
|
return &NullableApiResponse{value: val, isSet: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableApiResponse) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableApiResponse) UnmarshalJSON(src []byte) error {
|
||||||
|
v.isSet = true
|
||||||
|
return json.Unmarshal(src, &v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,52 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
servers:
|
||||||
|
- url: "http://example.com"
|
||||||
|
info:
|
||||||
|
description: >-
|
||||||
|
This is a sample server with a single endpoint that accepts two files via a multipart/form-data POST request.
|
||||||
|
version: 1.0.0
|
||||||
|
title: Multiple Files via form-data
|
||||||
|
license:
|
||||||
|
name: Apache-2.0
|
||||||
|
url: "https://www.apache.org/licenses/LICENSE-2.0.html"
|
||||||
|
paths:
|
||||||
|
"/uploadFiles":
|
||||||
|
post:
|
||||||
|
summary: uploads two files
|
||||||
|
description: ""
|
||||||
|
operationId: uploadFiles
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/ApiResponse"
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
multipart/form-data:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
file:
|
||||||
|
description: file to upload
|
||||||
|
type: string
|
||||||
|
format: binary
|
||||||
|
secondFile:
|
||||||
|
description: another file to upload
|
||||||
|
type: string
|
||||||
|
format: binary
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
ApiResponse:
|
||||||
|
title: An uploaded response
|
||||||
|
description: Describes the result of uploading files
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
message:
|
||||||
|
type: string
|
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
Multiple Files via form-data
|
||||||
|
|
||||||
|
This is a sample server with a single endpoint that accepts two files via a multipart/form-data POST request.
|
||||||
|
|
||||||
|
API version: 1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||||
|
|
||||||
|
package openapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// APIResponse stores the API response returned by the server.
|
||||||
|
type APIResponse struct {
|
||||||
|
*http.Response `json:"-"`
|
||||||
|
Message string `json:"message,omitempty"`
|
||||||
|
// Operation is the name of the OpenAPI operation.
|
||||||
|
Operation string `json:"operation,omitempty"`
|
||||||
|
// RequestURL is the request URL. This value is always available, even if the
|
||||||
|
// embedded *http.Response is nil.
|
||||||
|
RequestURL string `json:"url,omitempty"`
|
||||||
|
// Method is the HTTP method used for the request. This value is always
|
||||||
|
// available, even if the embedded *http.Response is nil.
|
||||||
|
Method string `json:"method,omitempty"`
|
||||||
|
// Payload holds the contents of the response body (which may be nil or empty).
|
||||||
|
// This is provided here as the raw response.Body() reader will have already
|
||||||
|
// been drained.
|
||||||
|
Payload []byte `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAPIResponse returns a new APIResponse object.
|
||||||
|
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||||
|
|
||||||
|
response := &APIResponse{Response: r}
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAPIResponseWithError returns a new APIResponse object with the provided error message.
|
||||||
|
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
||||||
|
|
||||||
|
response := &APIResponse{Message: errorMessage}
|
||||||
|
return response
|
||||||
|
}
|
328
samples/openapi3/client/features/mulitple-data-in-forms/utils.go
Normal file
328
samples/openapi3/client/features/mulitple-data-in-forms/utils.go
Normal file
@ -0,0 +1,328 @@
|
|||||||
|
/*
|
||||||
|
Multiple Files via form-data
|
||||||
|
|
||||||
|
This is a sample server with a single endpoint that accepts two files via a multipart/form-data POST request.
|
||||||
|
|
||||||
|
API version: 1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||||
|
|
||||||
|
package openapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PtrBool is a helper routine that returns a pointer to given boolean value.
|
||||||
|
func PtrBool(v bool) *bool { return &v }
|
||||||
|
|
||||||
|
// PtrInt is a helper routine that returns a pointer to given integer value.
|
||||||
|
func PtrInt(v int) *int { return &v }
|
||||||
|
|
||||||
|
// PtrInt32 is a helper routine that returns a pointer to given integer value.
|
||||||
|
func PtrInt32(v int32) *int32 { return &v }
|
||||||
|
|
||||||
|
// PtrInt64 is a helper routine that returns a pointer to given integer value.
|
||||||
|
func PtrInt64(v int64) *int64 { return &v }
|
||||||
|
|
||||||
|
// PtrFloat32 is a helper routine that returns a pointer to given float value.
|
||||||
|
func PtrFloat32(v float32) *float32 { return &v }
|
||||||
|
|
||||||
|
// PtrFloat64 is a helper routine that returns a pointer to given float value.
|
||||||
|
func PtrFloat64(v float64) *float64 { return &v }
|
||||||
|
|
||||||
|
// PtrString is a helper routine that returns a pointer to given string value.
|
||||||
|
func PtrString(v string) *string { return &v }
|
||||||
|
|
||||||
|
// PtrTime is helper routine that returns a pointer to given Time value.
|
||||||
|
func PtrTime(v time.Time) *time.Time { return &v }
|
||||||
|
|
||||||
|
type NullableBool struct {
|
||||||
|
value *bool
|
||||||
|
isSet bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableBool) Get() *bool {
|
||||||
|
return v.value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableBool) Set(val *bool) {
|
||||||
|
v.value = val
|
||||||
|
v.isSet = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableBool) IsSet() bool {
|
||||||
|
return v.isSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableBool) Unset() {
|
||||||
|
v.value = nil
|
||||||
|
v.isSet = false
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNullableBool(val *bool) *NullableBool {
|
||||||
|
return &NullableBool{value: val, isSet: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableBool) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableBool) UnmarshalJSON(src []byte) error {
|
||||||
|
v.isSet = true
|
||||||
|
return json.Unmarshal(src, &v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
type NullableInt struct {
|
||||||
|
value *int
|
||||||
|
isSet bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableInt) Get() *int {
|
||||||
|
return v.value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableInt) Set(val *int) {
|
||||||
|
v.value = val
|
||||||
|
v.isSet = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableInt) IsSet() bool {
|
||||||
|
return v.isSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableInt) Unset() {
|
||||||
|
v.value = nil
|
||||||
|
v.isSet = false
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNullableInt(val *int) *NullableInt {
|
||||||
|
return &NullableInt{value: val, isSet: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableInt) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableInt) UnmarshalJSON(src []byte) error {
|
||||||
|
v.isSet = true
|
||||||
|
return json.Unmarshal(src, &v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
type NullableInt32 struct {
|
||||||
|
value *int32
|
||||||
|
isSet bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableInt32) Get() *int32 {
|
||||||
|
return v.value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableInt32) Set(val *int32) {
|
||||||
|
v.value = val
|
||||||
|
v.isSet = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableInt32) IsSet() bool {
|
||||||
|
return v.isSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableInt32) Unset() {
|
||||||
|
v.value = nil
|
||||||
|
v.isSet = false
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNullableInt32(val *int32) *NullableInt32 {
|
||||||
|
return &NullableInt32{value: val, isSet: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableInt32) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableInt32) UnmarshalJSON(src []byte) error {
|
||||||
|
v.isSet = true
|
||||||
|
return json.Unmarshal(src, &v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
type NullableInt64 struct {
|
||||||
|
value *int64
|
||||||
|
isSet bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableInt64) Get() *int64 {
|
||||||
|
return v.value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableInt64) Set(val *int64) {
|
||||||
|
v.value = val
|
||||||
|
v.isSet = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableInt64) IsSet() bool {
|
||||||
|
return v.isSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableInt64) Unset() {
|
||||||
|
v.value = nil
|
||||||
|
v.isSet = false
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNullableInt64(val *int64) *NullableInt64 {
|
||||||
|
return &NullableInt64{value: val, isSet: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableInt64) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableInt64) UnmarshalJSON(src []byte) error {
|
||||||
|
v.isSet = true
|
||||||
|
return json.Unmarshal(src, &v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
type NullableFloat32 struct {
|
||||||
|
value *float32
|
||||||
|
isSet bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableFloat32) Get() *float32 {
|
||||||
|
return v.value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableFloat32) Set(val *float32) {
|
||||||
|
v.value = val
|
||||||
|
v.isSet = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableFloat32) IsSet() bool {
|
||||||
|
return v.isSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableFloat32) Unset() {
|
||||||
|
v.value = nil
|
||||||
|
v.isSet = false
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNullableFloat32(val *float32) *NullableFloat32 {
|
||||||
|
return &NullableFloat32{value: val, isSet: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableFloat32) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableFloat32) UnmarshalJSON(src []byte) error {
|
||||||
|
v.isSet = true
|
||||||
|
return json.Unmarshal(src, &v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
type NullableFloat64 struct {
|
||||||
|
value *float64
|
||||||
|
isSet bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableFloat64) Get() *float64 {
|
||||||
|
return v.value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableFloat64) Set(val *float64) {
|
||||||
|
v.value = val
|
||||||
|
v.isSet = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableFloat64) IsSet() bool {
|
||||||
|
return v.isSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableFloat64) Unset() {
|
||||||
|
v.value = nil
|
||||||
|
v.isSet = false
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNullableFloat64(val *float64) *NullableFloat64 {
|
||||||
|
return &NullableFloat64{value: val, isSet: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableFloat64) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableFloat64) UnmarshalJSON(src []byte) error {
|
||||||
|
v.isSet = true
|
||||||
|
return json.Unmarshal(src, &v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
type NullableString struct {
|
||||||
|
value *string
|
||||||
|
isSet bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableString) Get() *string {
|
||||||
|
return v.value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableString) Set(val *string) {
|
||||||
|
v.value = val
|
||||||
|
v.isSet = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableString) IsSet() bool {
|
||||||
|
return v.isSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableString) Unset() {
|
||||||
|
v.value = nil
|
||||||
|
v.isSet = false
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNullableString(val *string) *NullableString {
|
||||||
|
return &NullableString{value: val, isSet: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableString) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableString) UnmarshalJSON(src []byte) error {
|
||||||
|
v.isSet = true
|
||||||
|
return json.Unmarshal(src, &v.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
type NullableTime struct {
|
||||||
|
value *time.Time
|
||||||
|
isSet bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableTime) Get() *time.Time {
|
||||||
|
return v.value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableTime) Set(val *time.Time) {
|
||||||
|
v.value = val
|
||||||
|
v.isSet = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableTime) IsSet() bool {
|
||||||
|
return v.isSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableTime) Unset() {
|
||||||
|
v.value = nil
|
||||||
|
v.isSet = false
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNullableTime(val *time.Time) *NullableTime {
|
||||||
|
return &NullableTime{value: val, isSet: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v NullableTime) MarshalJSON() ([]byte, error) {
|
||||||
|
return v.value.MarshalJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v *NullableTime) UnmarshalJSON(src []byte) error {
|
||||||
|
v.isSet = true
|
||||||
|
return json.Unmarshal(src, &v.value)
|
||||||
|
}
|
@ -80,9 +80,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTagsExecute(r ApiCall123TestSp
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPatch
|
localVarHTTPMethod = _nethttp.MethodPatch
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Client
|
localVarReturnValue Client
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -119,7 +117,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTagsExecute(r ApiCall123TestSp
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.client
|
localVarPostBody = r.client
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,7 @@ func (a *DefaultApiService) FooGetExecute(r ApiFooGetRequest) (InlineResponseDef
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue InlineResponseDefault
|
localVarReturnValue InlineResponseDefault
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -104,7 +102,7 @@ func (a *DefaultApiService) FooGetExecute(r ApiFooGetRequest) (InlineResponseDef
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
|
@ -259,9 +259,7 @@ func (a *FakeApiService) FakeHealthGetExecute(r ApiFakeHealthGetRequest) (Health
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue HealthCheckResult
|
localVarReturnValue HealthCheckResult
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -293,7 +291,7 @@ func (a *FakeApiService) FakeHealthGetExecute(r ApiFakeHealthGetRequest) (Health
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -367,9 +365,7 @@ func (a *FakeApiService) FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanS
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue bool
|
localVarReturnValue bool
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -403,7 +399,7 @@ func (a *FakeApiService) FakeOuterBooleanSerializeExecute(r ApiFakeOuterBooleanS
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -477,9 +473,7 @@ func (a *FakeApiService) FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompos
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue OuterComposite
|
localVarReturnValue OuterComposite
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -513,7 +507,7 @@ func (a *FakeApiService) FakeOuterCompositeSerializeExecute(r ApiFakeOuterCompos
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.outerComposite
|
localVarPostBody = r.outerComposite
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -587,9 +581,7 @@ func (a *FakeApiService) FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSer
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue float32
|
localVarReturnValue float32
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -623,7 +615,7 @@ func (a *FakeApiService) FakeOuterNumberSerializeExecute(r ApiFakeOuterNumberSer
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -697,9 +689,7 @@ func (a *FakeApiService) FakeOuterStringSerializeExecute(r ApiFakeOuterStringSer
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue string
|
localVarReturnValue string
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -733,7 +723,7 @@ func (a *FakeApiService) FakeOuterStringSerializeExecute(r ApiFakeOuterStringSer
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.body
|
localVarPostBody = r.body
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -805,9 +795,7 @@ func (a *FakeApiService) TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSche
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPut
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithFileSchema")
|
||||||
@ -843,7 +831,7 @@ func (a *FakeApiService) TestBodyWithFileSchemaExecute(r ApiTestBodyWithFileSche
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.fileSchemaTestClass
|
localVarPostBody = r.fileSchemaTestClass
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -909,9 +897,7 @@ func (a *FakeApiService) TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryPa
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPut
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestBodyWithQueryParams")
|
||||||
@ -951,7 +937,7 @@ func (a *FakeApiService) TestBodyWithQueryParamsExecute(r ApiTestBodyWithQueryPa
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.user
|
localVarPostBody = r.user
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1016,9 +1002,7 @@ func (a *FakeApiService) TestClientModelExecute(r ApiTestClientModelRequest) (Cl
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPatch
|
localVarHTTPMethod = _nethttp.MethodPatch
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Client
|
localVarReturnValue Client
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1055,7 +1039,7 @@ func (a *FakeApiService) TestClientModelExecute(r ApiTestClientModelRequest) (Cl
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.client
|
localVarPostBody = r.client
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -1210,9 +1194,7 @@ func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParamete
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEndpointParameters")
|
||||||
@ -1286,17 +1268,23 @@ func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParamete
|
|||||||
}
|
}
|
||||||
localVarFormParams.Add("pattern_without_delimiter", parameterToString(*r.patternWithoutDelimiter, ""))
|
localVarFormParams.Add("pattern_without_delimiter", parameterToString(*r.patternWithoutDelimiter, ""))
|
||||||
localVarFormParams.Add("byte", parameterToString(*r.byte_, ""))
|
localVarFormParams.Add("byte", parameterToString(*r.byte_, ""))
|
||||||
localVarFormFileName = "binary"
|
var binaryLocalVarFormFileName string
|
||||||
var localVarFile *os.File
|
var binaryLocalVarFileName string
|
||||||
|
var binaryLocalVarFileBytes []byte
|
||||||
|
|
||||||
|
binaryLocalVarFormFileName = "binary"
|
||||||
|
|
||||||
|
var binaryLocalVarFile *os.File
|
||||||
if r.binary != nil {
|
if r.binary != nil {
|
||||||
localVarFile = *r.binary
|
binaryLocalVarFile = *r.binary
|
||||||
}
|
}
|
||||||
if localVarFile != nil {
|
if binaryLocalVarFile != nil {
|
||||||
fbs, _ := _ioutil.ReadAll(localVarFile)
|
fbs, _ := _ioutil.ReadAll(binaryLocalVarFile)
|
||||||
localVarFileBytes = fbs
|
binaryLocalVarFileBytes = fbs
|
||||||
localVarFileName = localVarFile.Name()
|
binaryLocalVarFileName = binaryLocalVarFile.Name()
|
||||||
localVarFile.Close()
|
binaryLocalVarFile.Close()
|
||||||
}
|
}
|
||||||
|
formFiles = append(formFiles, formFile{fileBytes: binaryLocalVarFileBytes, fileName: binaryLocalVarFileName, formFileName: binaryLocalVarFormFileName})
|
||||||
if r.date != nil {
|
if r.date != nil {
|
||||||
localVarFormParams.Add("date", parameterToString(*r.date, ""))
|
localVarFormParams.Add("date", parameterToString(*r.date, ""))
|
||||||
}
|
}
|
||||||
@ -1309,7 +1297,7 @@ func (a *FakeApiService) TestEndpointParametersExecute(r ApiTestEndpointParamete
|
|||||||
if r.callback != nil {
|
if r.callback != nil {
|
||||||
localVarFormParams.Add("callback", parameterToString(*r.callback, ""))
|
localVarFormParams.Add("callback", parameterToString(*r.callback, ""))
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1415,9 +1403,7 @@ func (a *FakeApiService) TestEnumParametersExecute(r ApiTestEnumParametersReques
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestEnumParameters")
|
||||||
@ -1480,7 +1466,7 @@ func (a *FakeApiService) TestEnumParametersExecute(r ApiTestEnumParametersReques
|
|||||||
if r.enumFormString != nil {
|
if r.enumFormString != nil {
|
||||||
localVarFormParams.Add("enum_form_string", parameterToString(*r.enumFormString, ""))
|
localVarFormParams.Add("enum_form_string", parameterToString(*r.enumFormString, ""))
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1574,9 +1560,7 @@ func (a *FakeApiService) TestGroupParametersExecute(r ApiTestGroupParametersRequ
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodDelete
|
localVarHTTPMethod = _nethttp.MethodDelete
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestGroupParameters")
|
||||||
@ -1628,7 +1612,7 @@ func (a *FakeApiService) TestGroupParametersExecute(r ApiTestGroupParametersRequ
|
|||||||
if r.booleanGroup != nil {
|
if r.booleanGroup != nil {
|
||||||
localVarHeaderParams["boolean_group"] = parameterToString(*r.booleanGroup, "")
|
localVarHeaderParams["boolean_group"] = parameterToString(*r.booleanGroup, "")
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1690,9 +1674,7 @@ func (a *FakeApiService) TestInlineAdditionalPropertiesExecute(r ApiTestInlineAd
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestInlineAdditionalProperties")
|
||||||
@ -1728,7 +1710,7 @@ func (a *FakeApiService) TestInlineAdditionalPropertiesExecute(r ApiTestInlineAd
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.requestBody
|
localVarPostBody = r.requestBody
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1796,9 +1778,7 @@ func (a *FakeApiService) TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) (
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestJsonFormData")
|
||||||
@ -1837,7 +1817,7 @@ func (a *FakeApiService) TestJsonFormDataExecute(r ApiTestJsonFormDataRequest) (
|
|||||||
}
|
}
|
||||||
localVarFormParams.Add("param", parameterToString(*r.param, ""))
|
localVarFormParams.Add("param", parameterToString(*r.param, ""))
|
||||||
localVarFormParams.Add("param2", parameterToString(*r.param2, ""))
|
localVarFormParams.Add("param2", parameterToString(*r.param2, ""))
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1920,9 +1900,7 @@ func (a *FakeApiService) TestQueryParameterCollectionFormatExecute(r ApiTestQuer
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPut
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestQueryParameterCollectionFormat")
|
||||||
@ -1993,7 +1971,7 @@ func (a *FakeApiService) TestQueryParameterCollectionFormatExecute(r ApiTestQuer
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -2062,9 +2040,7 @@ func (a *FakeApiService) TestUniqueItemsHeaderAndQueryParameterCollectionFormatE
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPut
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue []Pet
|
localVarReturnValue []Pet
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2114,7 +2090,7 @@ func (a *FakeApiService) TestUniqueItemsHeaderAndQueryParameterCollectionFormatE
|
|||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
localVarHeaderParams["headerUnique"] = parameterToString(*r.headerUnique, "csv")
|
localVarHeaderParams["headerUnique"] = parameterToString(*r.headerUnique, "csv")
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,7 @@ func (a *FakeClassnameTags123ApiService) TestClassnameExecute(r ApiTestClassname
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPatch
|
localVarHTTPMethod = _nethttp.MethodPatch
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Client
|
localVarReturnValue Client
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -133,7 +131,7 @@ func (a *FakeClassnameTags123ApiService) TestClassnameExecute(r ApiTestClassname
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
|
@ -183,9 +183,7 @@ func (a *PetApiService) AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, e
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet")
|
||||||
@ -221,7 +219,7 @@ func (a *PetApiService) AddPetExecute(r ApiAddPetRequest) (*_nethttp.Response, e
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.pet
|
localVarPostBody = r.pet
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -285,9 +283,7 @@ func (a *PetApiService) DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Respo
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodDelete
|
localVarHTTPMethod = _nethttp.MethodDelete
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet")
|
||||||
@ -322,7 +318,7 @@ func (a *PetApiService) DeletePetExecute(r ApiDeletePetRequest) (*_nethttp.Respo
|
|||||||
if r.apiKey != nil {
|
if r.apiKey != nil {
|
||||||
localVarHeaderParams["api_key"] = parameterToString(*r.apiKey, "")
|
localVarHeaderParams["api_key"] = parameterToString(*r.apiKey, "")
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -388,9 +384,7 @@ func (a *PetApiService) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue []Pet
|
localVarReturnValue []Pet
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -426,7 +420,7 @@ func (a *PetApiService) FindPetsByStatusExecute(r ApiFindPetsByStatusRequest) ([
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -503,9 +497,7 @@ func (a *PetApiService) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue []Pet
|
localVarReturnValue []Pet
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -541,7 +533,7 @@ func (a *PetApiService) FindPetsByTagsExecute(r ApiFindPetsByTagsRequest) ([]Pet
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -612,9 +604,7 @@ func (a *PetApiService) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethtt
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Pet
|
localVarReturnValue Pet
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -661,7 +651,7 @@ func (a *PetApiService) GetPetByIdExecute(r ApiGetPetByIdRequest) (Pet, *_nethtt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -732,9 +722,7 @@ func (a *PetApiService) UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Respo
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPut
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet")
|
||||||
@ -770,7 +758,7 @@ func (a *PetApiService) UpdatePetExecute(r ApiUpdatePetRequest) (*_nethttp.Respo
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.pet
|
localVarPostBody = r.pet
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -841,9 +829,7 @@ func (a *PetApiService) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest)
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm")
|
||||||
@ -881,7 +867,7 @@ func (a *PetApiService) UpdatePetWithFormExecute(r ApiUpdatePetWithFormRequest)
|
|||||||
if r.status != nil {
|
if r.status != nil {
|
||||||
localVarFormParams.Add("status", parameterToString(*r.status, ""))
|
localVarFormParams.Add("status", parameterToString(*r.status, ""))
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -953,9 +939,7 @@ func (a *PetApiService) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse,
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue ApiResponse
|
localVarReturnValue ApiResponse
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -991,18 +975,24 @@ func (a *PetApiService) UploadFileExecute(r ApiUploadFileRequest) (ApiResponse,
|
|||||||
if r.additionalMetadata != nil {
|
if r.additionalMetadata != nil {
|
||||||
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
|
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
|
||||||
}
|
}
|
||||||
localVarFormFileName = "file"
|
var fileLocalVarFormFileName string
|
||||||
var localVarFile *os.File
|
var fileLocalVarFileName string
|
||||||
|
var fileLocalVarFileBytes []byte
|
||||||
|
|
||||||
|
fileLocalVarFormFileName = "file"
|
||||||
|
|
||||||
|
var fileLocalVarFile *os.File
|
||||||
if r.file != nil {
|
if r.file != nil {
|
||||||
localVarFile = *r.file
|
fileLocalVarFile = *r.file
|
||||||
}
|
}
|
||||||
if localVarFile != nil {
|
if fileLocalVarFile != nil {
|
||||||
fbs, _ := _ioutil.ReadAll(localVarFile)
|
fbs, _ := _ioutil.ReadAll(fileLocalVarFile)
|
||||||
localVarFileBytes = fbs
|
fileLocalVarFileBytes = fbs
|
||||||
localVarFileName = localVarFile.Name()
|
fileLocalVarFileName = fileLocalVarFile.Name()
|
||||||
localVarFile.Close()
|
fileLocalVarFile.Close()
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
formFiles = append(formFiles, formFile{fileBytes: fileLocalVarFileBytes, fileName: fileLocalVarFileName, formFileName: fileLocalVarFormFileName})
|
||||||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -1083,9 +1073,7 @@ func (a *PetApiService) UploadFileWithRequiredFileExecute(r ApiUploadFileWithReq
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue ApiResponse
|
localVarReturnValue ApiResponse
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1124,15 +1112,21 @@ func (a *PetApiService) UploadFileWithRequiredFileExecute(r ApiUploadFileWithReq
|
|||||||
if r.additionalMetadata != nil {
|
if r.additionalMetadata != nil {
|
||||||
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
|
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
|
||||||
}
|
}
|
||||||
localVarFormFileName = "requiredFile"
|
var requiredFileLocalVarFormFileName string
|
||||||
localVarFile := *r.requiredFile
|
var requiredFileLocalVarFileName string
|
||||||
if localVarFile != nil {
|
var requiredFileLocalVarFileBytes []byte
|
||||||
fbs, _ := _ioutil.ReadAll(localVarFile)
|
|
||||||
localVarFileBytes = fbs
|
requiredFileLocalVarFormFileName = "requiredFile"
|
||||||
localVarFileName = localVarFile.Name()
|
|
||||||
localVarFile.Close()
|
requiredFileLocalVarFile := *r.requiredFile
|
||||||
|
if requiredFileLocalVarFile != nil {
|
||||||
|
fbs, _ := _ioutil.ReadAll(requiredFileLocalVarFile)
|
||||||
|
requiredFileLocalVarFileBytes = fbs
|
||||||
|
requiredFileLocalVarFileName = requiredFileLocalVarFile.Name()
|
||||||
|
requiredFileLocalVarFile.Close()
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
formFiles = append(formFiles, formFile{fileBytes: requiredFileLocalVarFileBytes, fileName: requiredFileLocalVarFileName, formFileName: requiredFileLocalVarFormFileName})
|
||||||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
|
@ -118,9 +118,7 @@ func (a *StoreApiService) DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodDelete
|
localVarHTTPMethod = _nethttp.MethodDelete
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder")
|
||||||
@ -152,7 +150,7 @@ func (a *StoreApiService) DeleteOrderExecute(r ApiDeleteOrderRequest) (*_nethttp
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -211,9 +209,7 @@ func (a *StoreApiService) GetInventoryExecute(r ApiGetInventoryRequest) (map[str
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue map[string]int32
|
localVarReturnValue map[string]int32
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -259,7 +255,7 @@ func (a *StoreApiService) GetInventoryExecute(r ApiGetInventoryRequest) (map[str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -330,9 +326,7 @@ func (a *StoreApiService) GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order,
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Order
|
localVarReturnValue Order
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -371,7 +365,7 @@ func (a *StoreApiService) GetOrderByIdExecute(r ApiGetOrderByIdRequest) (Order,
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -443,9 +437,7 @@ func (a *StoreApiService) PlaceOrderExecute(r ApiPlaceOrderRequest) (Order, *_ne
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue Order
|
localVarReturnValue Order
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -482,7 +474,7 @@ func (a *StoreApiService) PlaceOrderExecute(r ApiPlaceOrderRequest) (Order, *_ne
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.order
|
localVarPostBody = r.order
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
|
@ -165,9 +165,7 @@ func (a *UserApiService) CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Re
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser")
|
||||||
@ -203,7 +201,7 @@ func (a *UserApiService) CreateUserExecute(r ApiCreateUserRequest) (*_nethttp.Re
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.user
|
localVarPostBody = r.user
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -265,9 +263,7 @@ func (a *UserApiService) CreateUsersWithArrayInputExecute(r ApiCreateUsersWithAr
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput")
|
||||||
@ -303,7 +299,7 @@ func (a *UserApiService) CreateUsersWithArrayInputExecute(r ApiCreateUsersWithAr
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.user
|
localVarPostBody = r.user
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -365,9 +361,7 @@ func (a *UserApiService) CreateUsersWithListInputExecute(r ApiCreateUsersWithLis
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPost
|
localVarHTTPMethod = _nethttp.MethodPost
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput")
|
||||||
@ -403,7 +397,7 @@ func (a *UserApiService) CreateUsersWithListInputExecute(r ApiCreateUsersWithLis
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.user
|
localVarPostBody = r.user
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -464,9 +458,7 @@ func (a *UserApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Re
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodDelete
|
localVarHTTPMethod = _nethttp.MethodDelete
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser")
|
||||||
@ -498,7 +490,7 @@ func (a *UserApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*_nethttp.Re
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -558,9 +550,7 @@ func (a *UserApiService) GetUserByNameExecute(r ApiGetUserByNameRequest) (User,
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue User
|
localVarReturnValue User
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -593,7 +583,7 @@ func (a *UserApiService) GetUserByNameExecute(r ApiGetUserByNameRequest) (User,
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -671,9 +661,7 @@ func (a *UserApiService) LoginUserExecute(r ApiLoginUserRequest) (string, *_neth
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
localVarReturnValue string
|
localVarReturnValue string
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -713,7 +701,7 @@ func (a *UserApiService) LoginUserExecute(r ApiLoginUserRequest) (string, *_neth
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return localVarReturnValue, nil, err
|
return localVarReturnValue, nil, err
|
||||||
}
|
}
|
||||||
@ -778,9 +766,7 @@ func (a *UserApiService) LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Re
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodGet
|
localVarHTTPMethod = _nethttp.MethodGet
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser")
|
||||||
@ -811,7 +797,7 @@ func (a *UserApiService) LogoutUserExecute(r ApiLogoutUserRequest) (*_nethttp.Re
|
|||||||
if localVarHTTPHeaderAccept != "" {
|
if localVarHTTPHeaderAccept != "" {
|
||||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||||
}
|
}
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -878,9 +864,7 @@ func (a *UserApiService) UpdateUserExecute(r ApiUpdateUserRequest) (*_nethttp.Re
|
|||||||
var (
|
var (
|
||||||
localVarHTTPMethod = _nethttp.MethodPut
|
localVarHTTPMethod = _nethttp.MethodPut
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFormFileName string
|
formFiles []formFile
|
||||||
localVarFileName string
|
|
||||||
localVarFileBytes []byte
|
|
||||||
)
|
)
|
||||||
|
|
||||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser")
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser")
|
||||||
@ -917,7 +901,7 @@ func (a *UserApiService) UpdateUserExecute(r ApiUpdateUserRequest) (*_nethttp.Re
|
|||||||
}
|
}
|
||||||
// body params
|
// body params
|
||||||
localVarPostBody = r.user
|
localVarPostBody = r.user
|
||||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -207,6 +207,12 @@ func (c *APIClient) GetConfig() *Configuration {
|
|||||||
return c.cfg
|
return c.cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type formFile struct {
|
||||||
|
fileBytes []byte
|
||||||
|
fileName string
|
||||||
|
formFileName string
|
||||||
|
}
|
||||||
|
|
||||||
// prepareRequest build the request
|
// prepareRequest build the request
|
||||||
func (c *APIClient) prepareRequest(
|
func (c *APIClient) prepareRequest(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
@ -215,9 +221,7 @@ func (c *APIClient) prepareRequest(
|
|||||||
headerParams map[string]string,
|
headerParams map[string]string,
|
||||||
queryParams url.Values,
|
queryParams url.Values,
|
||||||
formParams url.Values,
|
formParams url.Values,
|
||||||
formFileName string,
|
formFiles []formFile) (localVarRequest *http.Request, err error) {
|
||||||
fileName string,
|
|
||||||
fileBytes []byte) (localVarRequest *http.Request, err error) {
|
|
||||||
|
|
||||||
var body *bytes.Buffer
|
var body *bytes.Buffer
|
||||||
|
|
||||||
@ -236,7 +240,7 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add form parameters and file if available.
|
// add form parameters and file if available.
|
||||||
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
|
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) {
|
||||||
if body != nil {
|
if body != nil {
|
||||||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||||
}
|
}
|
||||||
@ -255,18 +259,19 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(fileBytes) > 0 && fileName != "" {
|
for _, formFile := range formFiles {
|
||||||
|
if len(formFile.fileBytes) > 0 && formFile.fileName != "" {
|
||||||
w.Boundary()
|
w.Boundary()
|
||||||
//_, fileNm := filepath.Split(fileName)
|
part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName))
|
||||||
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
_, err = part.Write(fileBytes)
|
_, err = part.Write(formFile.fileBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the Boundary in the Content-Type
|
// Set the Boundary in the Content-Type
|
||||||
headerParams["Content-Type"] = w.FormDataContentType()
|
headerParams["Content-Type"] = w.FormDataContentType()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user