[go-experimental] Use builder pattern for requests (#4787)

* [go-experimental] Use builder pattern for requests
This commit is contained in:
Hippolyte HENRY 2020-01-15 15:19:23 +01:00 committed by Jim Schubert
parent 55c6c0385b
commit e09f1c9b37
35 changed files with 3935 additions and 1700 deletions

View File

@ -46,6 +46,8 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
protected String packageName = "openapi";
protected Set<String> numberTypes;
protected boolean usesOptionals = true;
public AbstractGoCodegen() {
super();
@ -400,7 +402,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
}
// import "time" if the operation has a required time parameter.
if (param.required) {
if (param.required || !usesOptionals) {
if (!addedTimeImport && "time.Time".equals(param.dataType)) {
imports.add(createMapping("import", "time"));
addedTimeImport = true;
@ -414,7 +416,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
}
// import "optionals" package if the parameter is optional
if (!param.required) {
if (!param.required && usesOptionals) {
if (!addedOptionalImport) {
imports.add(createMapping("import", "github.com/antihax/optional"));
addedOptionalImport = true;

View File

@ -36,6 +36,8 @@ public class GoClientExperimentalCodegen extends GoClientCodegen {
outputFolder = "generated-code/go-experimental";
embeddedTemplateDir = templateDir = "go-experimental";
usesOptionals = false;
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata).stability(Stability.EXPERIMENTAL).build();
}

View File

@ -18,115 +18,105 @@ var (
// {{classname}}Service {{classname}} service
type {{classname}}Service service
{{#operation}}
{{#hasOptionalParams}}
// {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts Optional parameters for the method '{{{nickname}}}'
type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts struct {
{{#allParams}}
{{^required}}
{{#isPrimitiveType}}
{{^isBinary}}
{{vendorExtensions.x-exportParamName}} optional.{{vendorExtensions.x-optionalDataType}}
{{/isBinary}}
{{#isBinary}}
{{vendorExtensions.x-exportParamName}} optional.Interface
{{/isBinary}}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{vendorExtensions.x-exportParamName}} optional.Interface
{{/isPrimitiveType}}
{{/required}}
{{/allParams}}
{{#operation}}
type api{{operationId}}Request struct {
ctx _context.Context
apiService *{{classname}}Service{{#allParams}}
{{paramName}} {{^isPathParam}}*{{/isPathParam}}{{{dataType}}}{{/allParams}}
}
{{/hasOptionalParams}}
{{#allParams}}{{^isPathParam}}
func (r api{{operationId}}Request) {{vendorExtensions.x-exportParamName}}({{paramName}} {{{dataType}}}) api{{operationId}}Request {
r.{{paramName}} = &{{paramName}}
return r
}
{{/isPathParam}}{{/allParams}}
/*
{{operationId}}{{#summary}} {{{.}}}{{/summary}}{{^summary}} Method for {{operationId}}{{/summary}}
{{#notes}}
{{notes}}
{{{unescapedNotes}}}
{{/notes}}
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
{{#allParams}}
{{#required}}
* @param {{paramName}}{{#description}} {{{.}}}{{/description}}
{{/required}}
{{/allParams}}
{{#hasOptionalParams}}
* @param optional nil or *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts - Optional Parameters:
{{#allParams}}
{{^required}}
* @param "{{vendorExtensions.x-exportParamName}}" ({{#isPrimitiveType}}{{^isBinary}}optional.{{vendorExtensions.x-optionalDataType}}{{/isBinary}}{{#isBinary}}optional.Interface of {{dataType}}{{/isBinary}}{{/isPrimitiveType}}{{^isPrimitiveType}}optional.Interface of {{dataType}}{{/isPrimitiveType}}) - {{#description}} {{{.}}}{{/description}}
{{/required}}
{{/allParams}}
{{/hasOptionalParams}}
{{#returnType}}
@return {{{returnType}}}
{{/returnType}}
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().{{#pathParams}}
* @param {{paramName}}{{#description}} {{{.}}}{{/description}}{{/pathParams}}
@return api{{operationId}}Request
*/
func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{#structPrefix}}{{&classname}}{{/structPrefix}}{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*_nethttp.Response, error) {
func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) api{{operationId}}Request {
return api{{operationId}}Request{
apiService: a,
ctx: ctx,{{#pathParams}}
{{paramName}}: {{paramName}},{{/pathParams}}
}
}
/*
Execute executes the request
{{#returnType}} @return {{{.}}}{{/returnType}}
*/
func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.Method{{httpMethod}}
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
{{#returnType}}
localVarReturnValue {{{returnType}}}
{{/returnType}}
{{#returnType}}localVarReturnValue {{{.}}}{{/returnType}}
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "{{{classname}}}Service.{{{nickname}}}")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "{{{classname}}}Service.{{{nickname}}}")
if err != nil {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "{{{path}}}"{{#pathParams}}
localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.QueryEscape(parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) , -1){{/pathParams}}
localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.QueryEscape(parameterToString(r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")) , -1){{/pathParams}}
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
{{#allParams}}
{{#required}}
{{#required}}{{^isPathParam}}
if r.{{paramName}} == nil {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} is required and must be specified")
}{{/isPathParam}}
{{#minItems}}
if len({{paramName}}) < {{minItems}} {
if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minItems}} {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minItems}} elements")
}
{{/minItems}}
{{#maxItems}}
if len({{paramName}}) > {{maxItems}} {
if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxItems}} {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxItems}} elements")
}
{{/maxItems}}
{{#minLength}}
if strlen({{paramName}}) < {{minLength}} {
if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minLength}} {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minLength}} elements")
}
{{/minLength}}
{{#maxLength}}
if strlen({{paramName}}) > {{maxLength}} {
if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxLength}} {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxLength}} elements")
}
{{/maxLength}}
{{#minimum}}
{{#isString}}
{{paramName}}Txt, err := atoi({{paramName}})
{{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}})
if {{paramName}}Txt < {{minimum}} {
{{/isString}}
{{^isString}}
if {{paramName}} < {{minimum}} {
if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} < {{minimum}} {
{{/isString}}
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be greater than {{minimum}}")
}
{{/minimum}}
{{#maximum}}
{{#isString}}
{{paramName}}Txt, err := atoi({{paramName}})
{{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}})
if {{paramName}}Txt > {{maximum}} {
{{/isString}}
{{^isString}}
if {{paramName}} > {{maximum}} {
if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} > {{maximum}} {
{{/isString}}
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be less than {{maximum}}")
}
@ -134,11 +124,10 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
{{/required}}
{{/allParams}}
{{#hasQueryParams}}
{{#queryParams}}
{{#required}}
{{#isCollectionFormatMulti}}
t:={{paramName}}
t := *r.{{paramName}}
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
for i := 0; i < s.Len(); i++ {
@ -149,13 +138,13 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
}
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
localVarQueryParams.Add("{{baseName}}", parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
{{/isCollectionFormatMulti}}
{{/required}}
{{^required}}
if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
if r.{{paramName}} != nil {
{{#isCollectionFormatMulti}}
t:=localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value()
t := *r.{{paramName}}
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
for i := 0; i < s.Len(); i++ {
@ -166,12 +155,11 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
}
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
localVarQueryParams.Add("{{baseName}}", parameterToString(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
{{/isCollectionFormatMulti}}
}
{{/required}}
{{/queryParams}}
{{/hasQueryParams}}
// to determine the Content-Type header
{{=<% %>=}}
localVarHTTPContentTypes := []string{<%#consumes%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/consumes%>}
@ -193,33 +181,26 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
{{#hasHeaderParams}}
{{#headerParams}}
{{#required}}
localVarHeaderParams["{{baseName}}"] = parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")
localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")
{{/required}}
{{^required}}
if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
localVarHeaderParams["{{baseName}}"] = parameterToString(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")
if r.{{paramName}} != nil {
localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")
}
{{/required}}
{{/headerParams}}
{{/hasHeaderParams}}
{{#hasFormParams}}
{{#formParams}}
{{#isFile}}
localVarFormFileName = "{{baseName}}"
{{#required}}
localVarFile := {{paramName}}
localVarFile := *r.{{paramName}}
{{/required}}
{{^required}}
var localVarFile {{dataType}}
if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
localVarFileOk := false
localVarFile, localVarFileOk = localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value().({{dataType}})
if !localVarFileOk {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}}")
}
if r.{{paramName}} != nil {
localVarFile = *r.{{paramName}}
}
{{/required}}
if localVarFile != nil {
@ -231,12 +212,12 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
{{/isFile}}
{{^isFile}}
{{#required}}
localVarFormParams.Add("{{baseName}}", parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
{{/required}}
{{^required}}
{{#isModel}}
if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
paramJson, err := parameterToJson(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value())
if r.{{paramName}} != nil {
paramJson, err := parameterToJson(*r.{{paramName}})
if err != nil {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err
}
@ -244,43 +225,23 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
}
{{/isModel}}
{{^isModel}}
if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
localVarFormParams.Add("{{baseName}}", parameterToString(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
if r.{{paramName}} != nil {
localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
}
{{/isModel}}
{{/required}}
{{/isFile}}
{{/formParams}}
{{/hasFormParams}}
{{#hasBodyParam}}
{{#bodyParams}}
// body params
{{#required}}
localVarPostBody = &{{paramName}}
{{/required}}
{{^required}}
if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
{{#isPrimitiveType}}
localVarPostBody = localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value()
{{/isPrimitiveType}}
{{^isPrimitiveType}}
localVarOptional{{vendorExtensions.x-exportParamName}}, localVarOptional{{vendorExtensions.x-exportParamName}}ok := localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value().({{{dataType}}})
if !localVarOptional{{vendorExtensions.x-exportParamName}}ok {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}}")
}
localVarPostBody = &localVarOptional{{vendorExtensions.x-exportParamName}}
{{/isPrimitiveType}}
}
{{/required}}
localVarPostBody = r.{{paramName}}
{{/bodyParams}}
{{/hasBodyParam}}
{{#authMethods}}
{{#isApiKey}}
{{^isKeyInCookie}}
if ctx != nil {
if r.ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := auth["{{keyParamName}}"]; ok {
var key string
if auth.Prefix != "" {
@ -300,12 +261,12 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
{{/isKeyInCookie}}
{{/isApiKey}}
{{/authMethods}}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err
}
@ -327,7 +288,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
if localVarHTTPResponse.StatusCode == {{{code}}} {
{{/wildcard}}
var v {{{dataType}}}
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr
@ -345,7 +306,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
}
{{#returnType}}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,

View File

@ -14,29 +14,28 @@ Method | HTTP request | Description
## {{{operationId}}}
> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}(ctx, {{#allParams}}{{#required}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}optional{{/hasOptionalParams}})
> {{#returnType}}{{{.}}} {{/returnType}}{{{operationId}}}(ctx{{#pathParams}}, {{paramName}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{vendorExtensions.x-exportParamName}}({{paramName}}){{/isPathParam}}{{/allParams}}.Execute()
{{{summary}}}{{#notes}}
{{{notes}}}{{/notes}}
{{{unespacedNotes}}}{{/notes}}
### Required Parameters
### Path Parameters
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#pathParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.{{/-last}}{{/allParams}}{{#allParams}}{{#required}}
**{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}}
**optional** | ***{{{nickname}}}Opts** | optional parameters | nil if no parameters
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.{{/-last}}{{/pathParams}}{{#pathParams}}
**{{paramName}}** | {{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/pathParams}}
### Optional Parameters
### Other Parameters
Optional parameters are passed through a pointer to a {{{nickname}}}Opts struct
Other parameters are passed through a pointer to a api{{{nickname}}}Request struct via the builder pattern
{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}}
{{^required}} **{{paramName}}** | {{#isFile}}**optional.Interface of {{dataType}}**{{/isFile}}{{#isPrimitiveType}}**optional.{{vendorExtensions.x-optionalDataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**optional.Interface of {{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{/hasOptionalParams}}
{{^isPathParam}} **{{paramName}}** | {{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/isPathParam}}{{/allParams}}
### Return type

View File

@ -41,7 +41,7 @@ func TestOAuth2(t *testing.T) {
PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"),
Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}})
r, err := client.PetApi.AddPet(context.Background(), newPet)
r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute()
if err != nil {
t.Fatalf("Error while adding pet: %v", err)
@ -50,7 +50,7 @@ func TestOAuth2(t *testing.T) {
t.Log(r)
}
r, err = client.PetApi.DeletePet(auth, 12992, nil)
r, err = client.PetApi.DeletePet(auth, 12992).Execute()
if err != nil {
t.Fatalf("Error while deleting pet by id: %v", err)
@ -76,7 +76,7 @@ func TestBasicAuth(t *testing.T) {
PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"),
Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}})
r, err := client.PetApi.AddPet(auth, newPet)
r, err := client.PetApi.AddPet(auth).Body(newPet).Execute()
if err != nil {
t.Fatalf("Error while adding pet: %v", err)
@ -85,7 +85,7 @@ func TestBasicAuth(t *testing.T) {
t.Log(r)
}
r, err = client.PetApi.DeletePet(auth, 12992, nil)
r, err = client.PetApi.DeletePet(auth, 12992).Execute()
if err != nil {
t.Fatalf("Error while deleting pet by id: %v", err)
@ -106,7 +106,7 @@ func TestAccessToken(t *testing.T) {
PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"),
Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}})
r, err := client.PetApi.AddPet(nil, newPet)
r, err := client.PetApi.AddPet(nil).Body(newPet).Execute()
if err != nil {
t.Fatalf("Error while adding pet: %v", err)
@ -115,7 +115,7 @@ func TestAccessToken(t *testing.T) {
t.Log(r)
}
r, err = client.PetApi.DeletePet(auth, 12992, nil)
r, err = client.PetApi.DeletePet(auth, 12992).Execute()
if err != nil {
t.Fatalf("Error while deleting pet by id: %v", err)
@ -136,7 +136,7 @@ func TestAPIKeyNoPrefix(t *testing.T) {
PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"),
Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}})
r, err := client.PetApi.AddPet(context.Background(), newPet)
r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute()
if err != nil {
t.Fatalf("Error while adding pet: %v", err)
@ -145,7 +145,7 @@ func TestAPIKeyNoPrefix(t *testing.T) {
t.Log(r)
}
_, r, err = client.PetApi.GetPetById(auth, 12992)
_, r, err = client.PetApi.GetPetById(auth, 12992).Execute()
if err != nil {
t.Fatalf("Error while deleting pet by id: %v", err)
}
@ -155,7 +155,7 @@ func TestAPIKeyNoPrefix(t *testing.T) {
t.Errorf("APIKey Authentication is missing")
}
r, err = client.PetApi.DeletePet(auth, 12992, nil)
r, err = client.PetApi.DeletePet(auth, 12992).Execute()
if err != nil {
t.Fatalf("Error while deleting pet by id: %v", err)
}
@ -171,7 +171,7 @@ func TestAPIKeyWithPrefix(t *testing.T) {
PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"),
Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}})
r, err := client.PetApi.AddPet(nil, newPet)
r, err := client.PetApi.AddPet(nil).Body(newPet).Execute()
if err != nil {
t.Fatalf("Error while adding pet: %v", err)
@ -180,7 +180,7 @@ func TestAPIKeyWithPrefix(t *testing.T) {
t.Log(r)
}
_, r, err = client.PetApi.GetPetById(auth, 12992)
_, r, err = client.PetApi.GetPetById(auth, 12992).Execute()
if err != nil {
t.Fatalf("Error while deleting pet by id: %v", err)
}
@ -190,7 +190,7 @@ func TestAPIKeyWithPrefix(t *testing.T) {
t.Errorf("APIKey Authentication is missing")
}
r, err = client.PetApi.DeletePet(auth, 12992, nil)
r, err = client.PetApi.DeletePet(auth, 12992).Execute()
if err != nil {
t.Fatalf("Error while deleting pet by id: %v", err)
}
@ -204,7 +204,7 @@ func TestDefaultHeader(t *testing.T) {
PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"),
Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}})
r, err := client.PetApi.AddPet(context.Background(), newPet)
r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute()
if err != nil {
t.Fatalf("Error while adding pet: %v", err)
@ -213,7 +213,7 @@ func TestDefaultHeader(t *testing.T) {
t.Log(r)
}
r, err = client.PetApi.DeletePet(context.Background(), 12992, nil)
r, err = client.PetApi.DeletePet(context.Background(), 12992).Execute()
if err != nil {
t.Fatalf("Error while deleting pet by id: %v", err)
@ -228,7 +228,7 @@ func TestDefaultHeader(t *testing.T) {
}
func TestHostOverride(t *testing.T) {
_, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil)
_, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute()
if err != nil {
t.Fatalf("Error while finding pets by status: %v", err)
@ -240,7 +240,7 @@ func TestHostOverride(t *testing.T) {
}
func TestSchemeOverride(t *testing.T) {
_, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil)
_, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute()
if err != nil {
t.Fatalf("Error while finding pets by status: %v", err)

View File

@ -1,10 +1,10 @@
package main
import (
"context"
"testing"
sw "./go-petstore"
"golang.org/x/net/context"
)
// TestPutBodyWithFileSchema ensures a model with the name 'File'
@ -17,7 +17,7 @@ func TestPutBodyWithFileSchema(t *testing.T) {
File: &sw.File{SourceURI: sw.PtrString("https://example.com/image.png")},
Files: &[]sw.File{{SourceURI: sw.PtrString("https://example.com/image.png")}}}
r, err := client.FakeApi.TestBodyWithFileSchema(context.Background(), schema)
r, err := client.FakeApi.TestBodyWithFileSchema(context.Background()).Body(schema).Execute()
if err != nil {
t.Fatalf("Error while adding pet: %v", err)

View File

@ -24,14 +24,36 @@ var (
// AnotherFakeApiService AnotherFakeApi service
type AnotherFakeApiService service
type apiCall123TestSpecialTagsRequest struct {
ctx _context.Context
apiService *AnotherFakeApiService
body *Client
}
func (r apiCall123TestSpecialTagsRequest) Body(body Client) apiCall123TestSpecialTagsRequest {
r.body = &body
return r
}
/*
Call123TestSpecialTags To test special tags
To test special tags and operation ID starting with number
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body client model
@return Client
@return apiCall123TestSpecialTagsRequest
*/
func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) {
func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context) apiCall123TestSpecialTagsRequest {
return apiCall123TestSpecialTagsRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return Client
*/
func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPatch
localVarPostBody interface{}
@ -41,7 +63,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod
localVarReturnValue Client
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "AnotherFakeApiService.Call123TestSpecialTags")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "AnotherFakeApiService.Call123TestSpecialTags")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -51,6 +73,10 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.body == nil {
return localVarReturnValue, nil, reportError("body is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
@ -70,13 +96,13 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &body
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.body
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -94,7 +120,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod
}
if localVarHTTPResponse.StatusCode == 200 {
var v Client
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -104,7 +130,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,

View File

@ -24,14 +24,36 @@ var (
// FakeClassnameTags123ApiService FakeClassnameTags123Api service
type FakeClassnameTags123ApiService service
type apiTestClassnameRequest struct {
ctx _context.Context
apiService *FakeClassnameTags123ApiService
body *Client
}
func (r apiTestClassnameRequest) Body(body Client) apiTestClassnameRequest {
r.body = &body
return r
}
/*
TestClassname To test class name in snake case
To test class name in snake case
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body client model
@return Client
@return apiTestClassnameRequest
*/
func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, body Client) (Client, *_nethttp.Response, error) {
func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context) apiTestClassnameRequest {
return apiTestClassnameRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return Client
*/
func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPatch
localVarPostBody interface{}
@ -41,7 +63,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod
localVarReturnValue Client
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeClassnameTags123ApiService.TestClassname")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeClassnameTags123ApiService.TestClassname")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -51,6 +73,10 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.body == nil {
return localVarReturnValue, nil, reportError("body is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
@ -70,10 +96,10 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &body
if ctx != nil {
localVarPostBody = r.body
if r.ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := auth["api_key_query"]; ok {
var key string
if auth.Prefix != "" {
@ -85,12 +111,12 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod
}
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -108,7 +134,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod
}
if localVarHTTPResponse.StatusCode == 200 {
var v Client
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -118,7 +144,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, bod
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,

View File

@ -15,7 +15,6 @@ import (
_nethttp "net/http"
_neturl "net/url"
"strings"
"github.com/antihax/optional"
"os"
)
@ -27,21 +26,45 @@ var (
// PetApiService PetApi service
type PetApiService service
type apiAddPetRequest struct {
ctx _context.Context
apiService *PetApiService
body *Pet
}
func (r apiAddPetRequest) Body(body Pet) apiAddPetRequest {
r.body = &body
return r
}
/*
AddPet Add a new pet to the store
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body Pet object that needs to be added to the store
@return apiAddPetRequest
*/
func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Response, error) {
func (a *PetApiService) AddPet(ctx _context.Context) apiAddPetRequest {
return apiAddPetRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.AddPet")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -51,6 +74,10 @@ func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Respon
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.body == nil {
return nil, reportError("body is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json", "application/xml"}
@ -70,13 +97,13 @@ func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Respon
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &body
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.body
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -97,40 +124,60 @@ func (a *PetApiService) AddPet(ctx _context.Context, body Pet) (*_nethttp.Respon
return localVarHTTPResponse, nil
}
type apiDeletePetRequest struct {
ctx _context.Context
apiService *PetApiService
petId int64
apiKey *string
}
// DeletePetOpts Optional parameters for the method 'DeletePet'
type DeletePetOpts struct {
ApiKey optional.String
func (r apiDeletePetRequest) ApiKey(apiKey string) apiDeletePetRequest {
r.apiKey = &apiKey
return r
}
/*
DeletePet Deletes a pet
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId Pet id to delete
* @param optional nil or *DeletePetOpts - Optional Parameters:
* @param "ApiKey" (optional.String) -
@return apiDeletePetRequest
*/
func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOptionals *DeletePetOpts) (*_nethttp.Response, error) {
func (a *PetApiService) DeletePet(ctx _context.Context, petId int64) apiDeletePetRequest {
return apiDeletePetRequest{
apiService: a,
ctx: ctx,
petId: petId,
}
}
/*
Execute executes the request
*/
func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.DeletePet")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -148,15 +195,15 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() {
localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "")
if r.apiKey != nil {
localVarHeaderParams["api_key"] = parameterToString(*r.apiKey, "")
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -177,15 +224,36 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt
return localVarHTTPResponse, nil
}
type apiFindPetsByStatusRequest struct {
ctx _context.Context
apiService *PetApiService
status *[]string
}
func (r apiFindPetsByStatusRequest) Status(status []string) apiFindPetsByStatusRequest {
r.status = &status
return r
}
/*
FindPetsByStatus Finds Pets by status
Multiple status values can be provided with comma separated strings
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param status Status values that need to be considered for filter
@return []Pet
@return apiFindPetsByStatusRequest
*/
func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) ([]Pet, *_nethttp.Response, error) {
func (a *PetApiService) FindPetsByStatus(ctx _context.Context) apiFindPetsByStatusRequest {
return apiFindPetsByStatusRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return []Pet
*/
func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -195,7 +263,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
localVarReturnValue []Pet
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.FindPetsByStatus")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByStatus")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -205,8 +273,12 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.status == nil {
return localVarReturnValue, nil, reportError("status is required and must be specified")
}
localVarQueryParams.Add("status", parameterToString(status, "csv"))
localVarQueryParams.Add("status", parameterToString(*r.status, "csv"))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -224,12 +296,12 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -247,7 +319,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
}
if localVarHTTPResponse.StatusCode == 200 {
var v []Pet
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -258,7 +330,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -269,15 +341,36 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiFindPetsByTagsRequest struct {
ctx _context.Context
apiService *PetApiService
tags *[]string
}
func (r apiFindPetsByTagsRequest) Tags(tags []string) apiFindPetsByTagsRequest {
r.tags = &tags
return r
}
/*
FindPetsByTags Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param tags Tags to filter by
@return []Pet
@return apiFindPetsByTagsRequest
*/
func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]Pet, *_nethttp.Response, error) {
func (a *PetApiService) FindPetsByTags(ctx _context.Context) apiFindPetsByTagsRequest {
return apiFindPetsByTagsRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return []Pet
*/
func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -287,7 +380,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
localVarReturnValue []Pet
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.FindPetsByTags")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByTags")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -297,8 +390,12 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.tags == nil {
return localVarReturnValue, nil, reportError("tags is required and must be specified")
}
localVarQueryParams.Add("tags", parameterToString(tags, "csv"))
localVarQueryParams.Add("tags", parameterToString(*r.tags, "csv"))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -316,12 +413,12 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -339,7 +436,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
}
if localVarHTTPResponse.StatusCode == 200 {
var v []Pet
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -350,7 +447,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -361,15 +458,33 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiGetPetByIdRequest struct {
ctx _context.Context
apiService *PetApiService
petId int64
}
/*
GetPetById Find pet by ID
Returns a single pet
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet to return
@return Pet
@return apiGetPetByIdRequest
*/
func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_nethttp.Response, error) {
func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) apiGetPetByIdRequest {
return apiGetPetByIdRequest{
apiService: a,
ctx: ctx,
petId: petId,
}
}
/*
Execute executes the request
@return Pet
*/
func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -379,17 +494,18 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
localVarReturnValue Pet
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.GetPetById")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.GetPetById")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -408,9 +524,9 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if ctx != nil {
if r.ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := auth["api_key"]; ok {
var key string
if auth.Prefix != "" {
@ -422,12 +538,12 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
}
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -445,7 +561,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
}
if localVarHTTPResponse.StatusCode == 200 {
var v Pet
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -456,7 +572,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -467,22 +583,45 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiUpdatePetRequest struct {
ctx _context.Context
apiService *PetApiService
body *Pet
}
func (r apiUpdatePetRequest) Body(body Pet) apiUpdatePetRequest {
r.body = &body
return r
}
/*
UpdatePet Update an existing pet
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body Pet object that needs to be added to the store
@return apiUpdatePetRequest
*/
func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Response, error) {
func (a *PetApiService) UpdatePet(ctx _context.Context) apiUpdatePetRequest {
return apiUpdatePetRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UpdatePet")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -492,6 +631,10 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Res
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.body == nil {
return nil, reportError("body is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json", "application/xml"}
@ -511,13 +654,13 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Res
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &body
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.body
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -538,42 +681,66 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, body Pet) (*_nethttp.Res
return localVarHTTPResponse, nil
}
type apiUpdatePetWithFormRequest struct {
ctx _context.Context
apiService *PetApiService
petId int64
name *string
status *string
}
// UpdatePetWithFormOpts Optional parameters for the method 'UpdatePetWithForm'
type UpdatePetWithFormOpts struct {
Name optional.String
Status optional.String
func (r apiUpdatePetWithFormRequest) Name(name string) apiUpdatePetWithFormRequest {
r.name = &name
return r
}
func (r apiUpdatePetWithFormRequest) Status(status string) apiUpdatePetWithFormRequest {
r.status = &status
return r
}
/*
UpdatePetWithForm Updates a pet in the store with form data
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet that needs to be updated
* @param optional nil or *UpdatePetWithFormOpts - Optional Parameters:
* @param "Name" (optional.String) - Updated name of the pet
* @param "Status" (optional.String) - Updated status of the pet
@return apiUpdatePetWithFormRequest
*/
func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*_nethttp.Response, error) {
func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64) apiUpdatePetWithFormRequest {
return apiUpdatePetWithFormRequest{
apiService: a,
ctx: ctx,
petId: petId,
}
}
/*
Execute executes the request
*/
func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UpdatePetWithForm")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"}
@ -591,18 +758,18 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
localVarFormParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
if r.name != nil {
localVarFormParams.Add("name", parameterToString(*r.name, ""))
}
if localVarOptionals != nil && localVarOptionals.Status.IsSet() {
localVarFormParams.Add("status", parameterToString(localVarOptionals.Status.Value(), ""))
if r.status != nil {
localVarFormParams.Add("status", parameterToString(*r.status, ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -623,23 +790,44 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc
return localVarHTTPResponse, nil
}
type apiUploadFileRequest struct {
ctx _context.Context
apiService *PetApiService
petId int64
additionalMetadata *string
file **os.File
}
// UploadFileOpts Optional parameters for the method 'UploadFile'
type UploadFileOpts struct {
AdditionalMetadata optional.String
File optional.Interface
func (r apiUploadFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileRequest {
r.additionalMetadata = &additionalMetadata
return r
}
func (r apiUploadFileRequest) File(file *os.File) apiUploadFileRequest {
r.file = &file
return r
}
/*
UploadFile uploads an image
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet to update
* @param optional nil or *UploadFileOpts - Optional Parameters:
* @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
* @param "File" (optional.Interface of *os.File) - file to upload
@return ApiResponse
@return apiUploadFileRequest
*/
func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *_nethttp.Response, error) {
func (a *PetApiService) UploadFile(ctx _context.Context, petId int64) apiUploadFileRequest {
return apiUploadFileRequest{
apiService: a,
ctx: ctx,
petId: petId,
}
}
/*
Execute executes the request
@return ApiResponse
*/
func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
@ -649,18 +837,19 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
localVarReturnValue ApiResponse
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UploadFile")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFile")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/pet/{petId}/uploadImage"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"multipart/form-data"}
@ -678,17 +867,13 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
if r.additionalMetadata != nil {
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
}
localVarFormFileName = "file"
var localVarFile *os.File
if localVarOptionals != nil && localVarOptionals.File.IsSet() {
localVarFileOk := false
localVarFile, localVarFileOk = localVarOptionals.File.Value().(*os.File)
if !localVarFileOk {
return localVarReturnValue, nil, reportError("file should be *os.File")
}
if r.file != nil {
localVarFile = *r.file
}
if localVarFile != nil {
fbs, _ := _ioutil.ReadAll(localVarFile)
@ -696,12 +881,12 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
localVarFileName = localVarFile.Name()
localVarFile.Close()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -719,7 +904,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
}
if localVarHTTPResponse.StatusCode == 200 {
var v ApiResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -729,7 +914,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -740,22 +925,44 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiUploadFileWithRequiredFileRequest struct {
ctx _context.Context
apiService *PetApiService
petId int64
requiredFile **os.File
additionalMetadata *string
}
// UploadFileWithRequiredFileOpts Optional parameters for the method 'UploadFileWithRequiredFile'
type UploadFileWithRequiredFileOpts struct {
AdditionalMetadata optional.String
func (r apiUploadFileWithRequiredFileRequest) RequiredFile(requiredFile *os.File) apiUploadFileWithRequiredFileRequest {
r.requiredFile = &requiredFile
return r
}
func (r apiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileWithRequiredFileRequest {
r.additionalMetadata = &additionalMetadata
return r
}
/*
UploadFileWithRequiredFile uploads an image (required)
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet to update
* @param requiredFile file to upload
* @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters:
* @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
@return ApiResponse
@return apiUploadFileWithRequiredFileRequest
*/
func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *_nethttp.Response, error) {
func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64) apiUploadFileWithRequiredFileRequest {
return apiUploadFileWithRequiredFileRequest{
apiService: a,
ctx: ctx,
petId: petId,
}
}
/*
Execute executes the request
@return ApiResponse
*/
func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
@ -765,18 +972,23 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i
localVarReturnValue ApiResponse
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UploadFileWithRequiredFile")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFileWithRequiredFile")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/fake/{petId}/uploadImageWithRequiredFile"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.requiredFile == nil {
return localVarReturnValue, nil, reportError("requiredFile is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"multipart/form-data"}
@ -794,23 +1006,23 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
if r.additionalMetadata != nil {
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
}
localVarFormFileName = "requiredFile"
localVarFile := requiredFile
localVarFile := *r.requiredFile
if localVarFile != nil {
fbs, _ := _ioutil.ReadAll(localVarFile)
localVarFileBytes = fbs
localVarFileName = localVarFile.Name()
localVarFile.Close()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -828,7 +1040,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i
}
if localVarHTTPResponse.StatusCode == 200 {
var v ApiResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -838,7 +1050,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,

View File

@ -25,32 +25,54 @@ var (
// StoreApiService StoreApi service
type StoreApiService service
type apiDeleteOrderRequest struct {
ctx _context.Context
apiService *StoreApiService
orderId string
}
/*
DeleteOrder Delete purchase order by ID
For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param orderId ID of the order that needs to be deleted
@return apiDeleteOrderRequest
*/
func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_nethttp.Response, error) {
func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) apiDeleteOrderRequest {
return apiDeleteOrderRequest{
apiService: a,
ctx: ctx,
orderId: orderId,
}
}
/*
Execute executes the request
*/
func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.DeleteOrder")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/store/order/{order_id}"
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(r.orderId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -69,12 +91,12 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -95,14 +117,30 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n
return localVarHTTPResponse, nil
}
type apiGetInventoryRequest struct {
ctx _context.Context
apiService *StoreApiService
}
/*
GetInventory Returns pet inventories by status
Returns a map of status codes to quantities
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return map[string]int32
@return apiGetInventoryRequest
*/
func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, *_nethttp.Response, error) {
func (a *StoreApiService) GetInventory(ctx _context.Context) apiGetInventoryRequest {
return apiGetInventoryRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return map[string]int32
*/
func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -112,7 +150,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
localVarReturnValue map[string]int32
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.GetInventory")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetInventory")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -140,9 +178,9 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if ctx != nil {
if r.ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := auth["api_key"]; ok {
var key string
if auth.Prefix != "" {
@ -154,12 +192,12 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
}
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -177,7 +215,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
}
if localVarHTTPResponse.StatusCode == 200 {
var v map[string]int32
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -187,7 +225,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -198,15 +236,33 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiGetOrderByIdRequest struct {
ctx _context.Context
apiService *StoreApiService
orderId int64
}
/*
GetOrderById Find purchase order by ID
For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param orderId ID of pet that needs to be fetched
@return Order
@return apiGetOrderByIdRequest
*/
func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Order, *_nethttp.Response, error) {
func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) apiGetOrderByIdRequest {
return apiGetOrderByIdRequest{
apiService: a,
ctx: ctx,
orderId: orderId,
}
}
/*
Execute executes the request
@return Order
*/
func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -216,21 +272,22 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
localVarReturnValue Order
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.GetOrderById")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetOrderById")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/store/order/{order_id}"
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(r.orderId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if orderId < 1 {
if r.orderId < 1 {
return localVarReturnValue, nil, reportError("orderId must be greater than 1")
}
if orderId > 5 {
if r.orderId > 5 {
return localVarReturnValue, nil, reportError("orderId must be less than 5")
}
@ -251,12 +308,12 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -274,7 +331,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
}
if localVarHTTPResponse.StatusCode == 200 {
var v Order
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -285,7 +342,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -296,14 +353,35 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiPlaceOrderRequest struct {
ctx _context.Context
apiService *StoreApiService
body *Order
}
func (r apiPlaceOrderRequest) Body(body Order) apiPlaceOrderRequest {
r.body = &body
return r
}
/*
PlaceOrder Place an order for a pet
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body order placed for purchasing the pet
@return Order
@return apiPlaceOrderRequest
*/
func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, *_nethttp.Response, error) {
func (a *StoreApiService) PlaceOrder(ctx _context.Context) apiPlaceOrderRequest {
return apiPlaceOrderRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return Order
*/
func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
@ -313,7 +391,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, *
localVarReturnValue Order
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.PlaceOrder")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.PlaceOrder")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -323,6 +401,10 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, *
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.body == nil {
return localVarReturnValue, nil, reportError("body is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -342,13 +424,13 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, *
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &body
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.body
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -366,7 +448,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, *
}
if localVarHTTPResponse.StatusCode == 200 {
var v Order
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -377,7 +459,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, body Order) (Order, *
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,

View File

@ -25,22 +25,46 @@ var (
// UserApiService UserApi service
type UserApiService service
type apiCreateUserRequest struct {
ctx _context.Context
apiService *UserApiService
body *User
}
func (r apiCreateUserRequest) Body(body User) apiCreateUserRequest {
r.body = &body
return r
}
/*
CreateUser Create user
This can only be done by the logged in user.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body Created user object
@return apiCreateUserRequest
*/
func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp.Response, error) {
func (a *UserApiService) CreateUser(ctx _context.Context) apiCreateUserRequest {
return apiCreateUserRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUser")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -50,6 +74,10 @@ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp.
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.body == nil {
return nil, reportError("body is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -69,13 +97,13 @@ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp.
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &body
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.body
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -96,22 +124,45 @@ func (a *UserApiService) CreateUser(ctx _context.Context, body User) (*_nethttp.
return localVarHTTPResponse, nil
}
type apiCreateUsersWithArrayInputRequest struct {
ctx _context.Context
apiService *UserApiService
body *[]User
}
func (r apiCreateUsersWithArrayInputRequest) Body(body []User) apiCreateUsersWithArrayInputRequest {
r.body = &body
return r
}
/*
CreateUsersWithArrayInput Creates list of users with given input array
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body List of user object
@return apiCreateUsersWithArrayInputRequest
*/
func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body []User) (*_nethttp.Response, error) {
func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context) apiCreateUsersWithArrayInputRequest {
return apiCreateUsersWithArrayInputRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUsersWithArrayInput")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -121,6 +172,10 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body []
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.body == nil {
return nil, reportError("body is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -140,13 +195,13 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body []
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &body
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.body
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -167,22 +222,45 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, body []
return localVarHTTPResponse, nil
}
type apiCreateUsersWithListInputRequest struct {
ctx _context.Context
apiService *UserApiService
body *[]User
}
func (r apiCreateUsersWithListInputRequest) Body(body []User) apiCreateUsersWithListInputRequest {
r.body = &body
return r
}
/*
CreateUsersWithListInput Creates list of users with given input array
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param body List of user object
@return apiCreateUsersWithListInputRequest
*/
func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []User) (*_nethttp.Response, error) {
func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context) apiCreateUsersWithListInputRequest {
return apiCreateUsersWithListInputRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUsersWithListInput")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -192,6 +270,10 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []U
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.body == nil {
return nil, reportError("body is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -211,13 +293,13 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []U
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &body
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.body
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -238,33 +320,54 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, body []U
return localVarHTTPResponse, nil
}
type apiDeleteUserRequest struct {
ctx _context.Context
apiService *UserApiService
username string
}
/*
DeleteUser Delete user
This can only be done by the logged in user.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username The name that needs to be deleted
@return apiDeleteUserRequest
*/
func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_nethttp.Response, error) {
func (a *UserApiService) DeleteUser(ctx _context.Context, username string) apiDeleteUserRequest {
return apiDeleteUserRequest{
apiService: a,
ctx: ctx,
username: username,
}
}
/*
Execute executes the request
*/
func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.DeleteUser")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -283,12 +386,12 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -309,14 +412,32 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne
return localVarHTTPResponse, nil
}
type apiGetUserByNameRequest struct {
ctx _context.Context
apiService *UserApiService
username string
}
/*
GetUserByName Get user by user name
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username The name that needs to be fetched. Use user1 for testing.
@return User
@return apiGetUserByNameRequest
*/
func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (User, *_nethttp.Response, error) {
func (a *UserApiService) GetUserByName(ctx _context.Context, username string) apiGetUserByNameRequest {
return apiGetUserByNameRequest{
apiService: a,
ctx: ctx,
username: username,
}
}
/*
Execute executes the request
@return User
*/
func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -326,17 +447,18 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
localVarReturnValue User
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.GetUserByName")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.GetUserByName")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -355,12 +477,12 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -378,7 +500,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
}
if localVarHTTPResponse.StatusCode == 200 {
var v User
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -389,7 +511,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -400,15 +522,41 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiLoginUserRequest struct {
ctx _context.Context
apiService *UserApiService
username *string
password *string
}
func (r apiLoginUserRequest) Username(username string) apiLoginUserRequest {
r.username = &username
return r
}
func (r apiLoginUserRequest) Password(password string) apiLoginUserRequest {
r.password = &password
return r
}
/*
LoginUser Logs user into the system
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username The user name for login
* @param password The password for login in clear text
@return string
@return apiLoginUserRequest
*/
func (a *UserApiService) LoginUser(ctx _context.Context, username string, password string) (string, *_nethttp.Response, error) {
func (a *UserApiService) LoginUser(ctx _context.Context) apiLoginUserRequest {
return apiLoginUserRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return string
*/
func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -418,7 +566,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
localVarReturnValue string
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.LoginUser")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LoginUser")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -428,9 +576,17 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.username == nil {
return localVarReturnValue, nil, reportError("username is required and must be specified")
}
if r.password == nil {
return localVarReturnValue, nil, reportError("password is required and must be specified")
}
localVarQueryParams.Add("username", parameterToString(username, ""))
localVarQueryParams.Add("password", parameterToString(password, ""))
localVarQueryParams.Add("username", parameterToString(*r.username, ""))
localVarQueryParams.Add("password", parameterToString(*r.password, ""))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -448,12 +604,12 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -471,7 +627,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
}
if localVarHTTPResponse.StatusCode == 200 {
var v string
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -482,7 +638,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -493,21 +649,39 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiLogoutUserRequest struct {
ctx _context.Context
apiService *UserApiService
}
/*
LogoutUser Logs out current logged in user session
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return apiLogoutUserRequest
*/
func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, error) {
func (a *UserApiService) LogoutUser(ctx _context.Context) apiLogoutUserRequest {
return apiLogoutUserRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.LogoutUser")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -535,12 +709,12 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -561,34 +735,64 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e
return localVarHTTPResponse, nil
}
type apiUpdateUserRequest struct {
ctx _context.Context
apiService *UserApiService
username string
body *User
}
func (r apiUpdateUserRequest) Body(body User) apiUpdateUserRequest {
r.body = &body
return r
}
/*
UpdateUser Updated user
This can only be done by the logged in user.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username name that need to be deleted
* @param body Updated user object
@return apiUpdateUserRequest
*/
func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body User) (*_nethttp.Response, error) {
func (a *UserApiService) UpdateUser(ctx _context.Context, username string) apiUpdateUserRequest {
return apiUpdateUserRequest{
apiService: a,
ctx: ctx,
username: username,
}
}
/*
Execute executes the request
*/
func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.UpdateUser")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.body == nil {
return nil, reportError("body is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -608,13 +812,13 @@ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, body
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &body
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.body
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}

View File

@ -10,19 +10,24 @@ Method | HTTP request | Description
## Call123TestSpecialTags
> Client Call123TestSpecialTags(ctx, body)
> Client Call123TestSpecialTags(ctx).Body(body).Execute()
To test special tags
To test special tags and operation ID starting with number
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiCall123TestSpecialTagsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**Client**](Client.md)| client model |
**body** | [**Client**](Client.md) | client model |
### Return type

View File

@ -23,19 +23,24 @@ Method | HTTP request | Description
## CreateXmlItem
> CreateXmlItem(ctx, xmlItem)
> CreateXmlItem(ctx).XmlItem(xmlItem).Execute()
creates an XmlItem
this route creates an XmlItem
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiCreateXmlItemRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body |
**xmlItem** | [**XmlItem**](XmlItem.md) | XmlItem Body |
### Return type
@ -57,28 +62,24 @@ No authorization required
## FakeOuterBooleanSerialize
> bool FakeOuterBooleanSerialize(ctx, optional)
> bool FakeOuterBooleanSerialize(ctx).Body(body).Execute()
Test serialization of outer boolean types
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFakeOuterBooleanSerializeRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***FakeOuterBooleanSerializeOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **optional.Bool**| Input boolean as post body |
**body** | **bool** | Input boolean as post body |
### Return type
@ -100,28 +101,24 @@ No authorization required
## FakeOuterCompositeSerialize
> OuterComposite FakeOuterCompositeSerialize(ctx, optional)
> OuterComposite FakeOuterCompositeSerialize(ctx).Body(body).Execute()
Test serialization of object with outer number type
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFakeOuterCompositeSerializeRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***FakeOuterCompositeSerializeOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a FakeOuterCompositeSerializeOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body |
**body** | [**OuterComposite**](OuterComposite.md) | Input composite as post body |
### Return type
@ -143,28 +140,24 @@ No authorization required
## FakeOuterNumberSerialize
> float32 FakeOuterNumberSerialize(ctx, optional)
> float32 FakeOuterNumberSerialize(ctx).Body(body).Execute()
Test serialization of outer number types
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFakeOuterNumberSerializeRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***FakeOuterNumberSerializeOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a FakeOuterNumberSerializeOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **optional.Float32**| Input number as post body |
**body** | **float32** | Input number as post body |
### Return type
@ -186,28 +179,24 @@ No authorization required
## FakeOuterStringSerialize
> string FakeOuterStringSerialize(ctx, optional)
> string FakeOuterStringSerialize(ctx).Body(body).Execute()
Test serialization of outer string types
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFakeOuterStringSerializeRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***FakeOuterStringSerializeOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a FakeOuterStringSerializeOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **optional.String**| Input string as post body |
**body** | **string** | Input string as post body |
### Return type
@ -229,19 +218,24 @@ No authorization required
## TestBodyWithFileSchema
> TestBodyWithFileSchema(ctx, body)
> TestBodyWithFileSchema(ctx).Body(body).Execute()
For this test, the body for this request much reference a schema named `File`.
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestBodyWithFileSchemaRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
**body** | [**FileSchemaTestClass**](FileSchemaTestClass.md) | |
### Return type
@ -263,18 +257,23 @@ No authorization required
## TestBodyWithQueryParams
> TestBodyWithQueryParams(ctx, query, body)
> TestBodyWithQueryParams(ctx).Query(query).Body(body).Execute()
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestBodyWithQueryParamsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**query** | **string**| |
**body** | [**User**](User.md)| |
**query** | **string** | |
**body** | [**User**](User.md) | |
### Return type
@ -296,19 +295,24 @@ No authorization required
## TestClientModel
> Client TestClientModel(ctx, body)
> Client TestClientModel(ctx).Body(body).Execute()
To test \"client\" model
To test \"client\" model
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestClientModelRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**Client**](Client.md)| client model |
**body** | [**Client**](Client.md) | client model |
### Return type
@ -330,45 +334,37 @@ No authorization required
## TestEndpointParameters
> TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte_, optional)
> TestEndpointParameters(ctx).Number(number).Double(double).PatternWithoutDelimiter(patternWithoutDelimiter).Byte_(byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute()
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestEndpointParametersRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**number** | **float32**| None |
**double** | **float64**| None |
**patternWithoutDelimiter** | **string**| None |
**byte_** | **string**| None |
**optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a TestEndpointParametersOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**integer** | **optional.Int32**| None |
**int32_** | **optional.Int32**| None |
**int64_** | **optional.Int64**| None |
**float** | **optional.Float32**| None |
**string_** | **optional.String**| None |
**binary** | **optional.Interface of *os.File****optional.*os.File**| None |
**date** | **optional.String**| None |
**dateTime** | **optional.Time**| None |
**password** | **optional.String**| None |
**callback** | **optional.String**| None |
**number** | **float32** | None |
**double** | **float64** | None |
**patternWithoutDelimiter** | **string** | None |
**byte_** | **string** | None |
**integer** | **int32** | None |
**int32_** | **int32** | None |
**int64_** | **int64** | None |
**float** | **float32** | None |
**string_** | **string** | None |
**binary** | ***os.File** | None |
**date** | **string** | None |
**dateTime** | **time.Time** | None |
**password** | **string** | None |
**callback** | **string** | None |
### Return type
@ -390,35 +386,31 @@ Name | Type | Description | Notes
## TestEnumParameters
> TestEnumParameters(ctx, optional)
> TestEnumParameters(ctx).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute()
To test enum parameters
To test enum parameters
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestEnumParametersRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***TestEnumParametersOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a TestEnumParametersOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**enumHeaderStringArray** | [**optional.Interface of []string**](string.md)| Header parameter enum test (string array) |
**enumHeaderString** | **optional.String**| Header parameter enum test (string) | [default to -efg]
**enumQueryStringArray** | [**optional.Interface of []string**](string.md)| Query parameter enum test (string array) |
**enumQueryString** | **optional.String**| Query parameter enum test (string) | [default to -efg]
**enumQueryInteger** | **optional.Int32**| Query parameter enum test (double) |
**enumQueryDouble** | **optional.Float64**| Query parameter enum test (double) |
**enumFormStringArray** | [**optional.Interface of []string**](string.md)| Form parameter enum test (string array) | [default to $]
**enumFormString** | **optional.String**| Form parameter enum test (string) | [default to -efg]
**enumHeaderStringArray** | [**[]string**](string.md) | Header parameter enum test (string array) |
**enumHeaderString** | **string** | Header parameter enum test (string) | [default to -efg]
**enumQueryStringArray** | [**[]string**](string.md) | Query parameter enum test (string array) |
**enumQueryString** | **string** | Query parameter enum test (string) | [default to -efg]
**enumQueryInteger** | **int32** | Query parameter enum test (double) |
**enumQueryDouble** | **float64** | Query parameter enum test (double) |
**enumFormStringArray** | [**[]string**](string.md) | Form parameter enum test (string array) | [default to $]
**enumFormString** | **string** | Form parameter enum test (string) | [default to -efg]
### Return type
@ -440,36 +432,29 @@ No authorization required
## TestGroupParameters
> TestGroupParameters(ctx, requiredStringGroup, requiredBooleanGroup, requiredInt64Group, optional)
> TestGroupParameters(ctx).RequiredStringGroup(requiredStringGroup).RequiredBooleanGroup(requiredBooleanGroup).RequiredInt64Group(requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute()
Fake endpoint to test group parameters (optional)
Fake endpoint to test group parameters (optional)
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestGroupParametersRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**requiredStringGroup** | **int32**| Required String in group parameters |
**requiredBooleanGroup** | **bool**| Required Boolean in group parameters |
**requiredInt64Group** | **int64**| Required Integer in group parameters |
**optional** | ***TestGroupParametersOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a TestGroupParametersOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**stringGroup** | **optional.Int32**| String in group parameters |
**booleanGroup** | **optional.Bool**| Boolean in group parameters |
**int64Group** | **optional.Int64**| Integer in group parameters |
**requiredStringGroup** | **int32** | Required String in group parameters |
**requiredBooleanGroup** | **bool** | Required Boolean in group parameters |
**requiredInt64Group** | **int64** | Required Integer in group parameters |
**stringGroup** | **int32** | String in group parameters |
**booleanGroup** | **bool** | Boolean in group parameters |
**int64Group** | **int64** | Integer in group parameters |
### Return type
@ -491,17 +476,22 @@ No authorization required
## TestInlineAdditionalProperties
> TestInlineAdditionalProperties(ctx, param)
> TestInlineAdditionalProperties(ctx).Param(param).Execute()
test inline additionalProperties
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestInlineAdditionalPropertiesRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**param** | [**map[string]string**](string.md)| request body |
**param** | [**map[string]string**](string.md) | request body |
### Return type
@ -523,18 +513,23 @@ No authorization required
## TestJsonFormData
> TestJsonFormData(ctx, param, param2)
> TestJsonFormData(ctx).Param(param).Param2(param2).Execute()
test json serialization of form data
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestJsonFormDataRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**param** | **string**| field1 |
**param2** | **string**| field2 |
**param** | **string** | field1 |
**param2** | **string** | field2 |
### Return type
@ -556,23 +551,28 @@ No authorization required
## TestQueryParameterCollectionFormat
> TestQueryParameterCollectionFormat(ctx, pipe, ioutil, http, url, context)
> TestQueryParameterCollectionFormat(ctx).Pipe(pipe).Ioutil(ioutil).Http(http).Url(url).Context(context).Execute()
To test the collection format in query parameters
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestQueryParameterCollectionFormatRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**pipe** | [**[]string**](string.md)| |
**ioutil** | [**[]string**](string.md)| |
**http** | [**[]string**](string.md)| |
**url** | [**[]string**](string.md)| |
**context** | [**[]string**](string.md)| |
**pipe** | [**[]string**](string.md) | |
**ioutil** | [**[]string**](string.md) | |
**http** | [**[]string**](string.md) | |
**url** | [**[]string**](string.md) | |
**context** | [**[]string**](string.md) | |
### Return type

View File

@ -10,19 +10,24 @@ Method | HTTP request | Description
## TestClassname
> Client TestClassname(ctx, body)
> Client TestClassname(ctx).Body(body).Execute()
To test class name in snake case
To test class name in snake case
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestClassnameRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**Client**](Client.md)| client model |
**body** | [**Client**](Client.md) | client model |
### Return type

View File

@ -18,17 +18,22 @@ Method | HTTP request | Description
## AddPet
> AddPet(ctx, body)
> AddPet(ctx).Body(body).Execute()
Add a new pet to the store
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiAddPetRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store |
### Return type
@ -50,28 +55,27 @@ Name | Type | Description | Notes
## DeletePet
> DeletePet(ctx, petId, optional)
> DeletePet(ctx, petId).ApiKey(apiKey).Execute()
Deletes a pet
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| Pet id to delete |
**optional** | ***DeletePetOpts** | optional parameters | nil if no parameters
**petId** | **int64** | Pet id to delete |
### Optional Parameters
### Other Parameters
Optional parameters are passed through a pointer to a DeletePetOpts struct
Other parameters are passed through a pointer to a apiDeletePetRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**apiKey** | **optional.String**| |
**apiKey** | **string** | |
### Return type
@ -93,19 +97,24 @@ Name | Type | Description | Notes
## FindPetsByStatus
> []Pet FindPetsByStatus(ctx, status)
> []Pet FindPetsByStatus(ctx).Status(status).Execute()
Finds Pets by status
Multiple status values can be provided with comma separated strings
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFindPetsByStatusRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**status** | [**[]string**](string.md)| Status values that need to be considered for filter |
**status** | [**[]string**](string.md) | Status values that need to be considered for filter |
### Return type
@ -127,19 +136,24 @@ Name | Type | Description | Notes
## FindPetsByTags
> []Pet FindPetsByTags(ctx, tags)
> []Pet FindPetsByTags(ctx).Tags(tags).Execute()
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFindPetsByTagsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**tags** | [**[]string**](string.md)| Tags to filter by |
**tags** | [**[]string**](string.md) | Tags to filter by |
### Return type
@ -161,19 +175,28 @@ Name | Type | Description | Notes
## GetPetById
> Pet GetPetById(ctx, petId)
> Pet GetPetById(ctx, petId).Execute()
Find pet by ID
Returns a single pet
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| ID of pet to return |
**petId** | **int64** | ID of pet to return |
### Other Parameters
Other parameters are passed through a pointer to a apiGetPetByIdRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
@ -195,17 +218,22 @@ Name | Type | Description | Notes
## UpdatePet
> UpdatePet(ctx, body)
> UpdatePet(ctx).Body(body).Execute()
Update an existing pet
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiUpdatePetRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store |
### Return type
@ -227,29 +255,28 @@ Name | Type | Description | Notes
## UpdatePetWithForm
> UpdatePetWithForm(ctx, petId, optional)
> UpdatePetWithForm(ctx, petId).Name(name).Status(status).Execute()
Updates a pet in the store with form data
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| ID of pet that needs to be updated |
**optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters
**petId** | **int64** | ID of pet that needs to be updated |
### Optional Parameters
### Other Parameters
Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct
Other parameters are passed through a pointer to a apiUpdatePetWithFormRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**name** | **optional.String**| Updated name of the pet |
**status** | **optional.String**| Updated status of the pet |
**name** | **string** | Updated name of the pet |
**status** | **string** | Updated status of the pet |
### Return type
@ -271,29 +298,28 @@ Name | Type | Description | Notes
## UploadFile
> ApiResponse UploadFile(ctx, petId, optional)
> ApiResponse UploadFile(ctx, petId).AdditionalMetadata(additionalMetadata).File(file).Execute()
uploads an image
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| ID of pet to update |
**optional** | ***UploadFileOpts** | optional parameters | nil if no parameters
**petId** | **int64** | ID of pet to update |
### Optional Parameters
### Other Parameters
Optional parameters are passed through a pointer to a UploadFileOpts struct
Other parameters are passed through a pointer to a apiUploadFileRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**additionalMetadata** | **optional.String**| Additional data to pass to server |
**file** | **optional.Interface of *os.File****optional.*os.File**| file to upload |
**additionalMetadata** | **string** | Additional data to pass to server |
**file** | ***os.File** | file to upload |
### Return type
@ -315,30 +341,28 @@ Name | Type | Description | Notes
## UploadFileWithRequiredFile
> ApiResponse UploadFileWithRequiredFile(ctx, petId, requiredFile, optional)
> ApiResponse UploadFileWithRequiredFile(ctx, petId).RequiredFile(requiredFile).AdditionalMetadata(additionalMetadata).Execute()
uploads an image (required)
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| ID of pet to update |
**requiredFile** | ***os.File*****os.File**| file to upload |
**optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters
**petId** | **int64** | ID of pet to update |
### Optional Parameters
### Other Parameters
Optional parameters are passed through a pointer to a UploadFileWithRequiredFileOpts struct
Other parameters are passed through a pointer to a apiUploadFileWithRequiredFileRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**additionalMetadata** | **optional.String**| Additional data to pass to server |
**requiredFile** | ***os.File** | file to upload |
**additionalMetadata** | **string** | Additional data to pass to server |
### Return type

View File

@ -13,19 +13,28 @@ Method | HTTP request | Description
## DeleteOrder
> DeleteOrder(ctx, orderId)
> DeleteOrder(ctx, orderId).Execute()
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**orderId** | **string**| ID of the order that needs to be deleted |
**orderId** | **string** | ID of the order that needs to be deleted |
### Other Parameters
Other parameters are passed through a pointer to a apiDeleteOrderRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
@ -47,16 +56,21 @@ No authorization required
## GetInventory
> map[string]int32 GetInventory(ctx, )
> map[string]int32 GetInventory(ctx).Execute()
Returns pet inventories by status
Returns a map of status codes to quantities
### Required Parameters
### Path Parameters
This endpoint does not need any parameter.
### Other Parameters
Other parameters are passed through a pointer to a apiGetInventoryRequest struct via the builder pattern
### Return type
**map[string]int32**
@ -77,19 +91,28 @@ This endpoint does not need any parameter.
## GetOrderById
> Order GetOrderById(ctx, orderId)
> Order GetOrderById(ctx, orderId).Execute()
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**orderId** | **int64**| ID of pet that needs to be fetched |
**orderId** | **int64** | ID of pet that needs to be fetched |
### Other Parameters
Other parameters are passed through a pointer to a apiGetOrderByIdRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
@ -111,17 +134,22 @@ No authorization required
## PlaceOrder
> Order PlaceOrder(ctx, body)
> Order PlaceOrder(ctx).Body(body).Execute()
Place an order for a pet
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiPlaceOrderRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
**body** | [**Order**](Order.md) | order placed for purchasing the pet |
### Return type

View File

@ -17,19 +17,24 @@ Method | HTTP request | Description
## CreateUser
> CreateUser(ctx, body)
> CreateUser(ctx).Body(body).Execute()
Create user
This can only be done by the logged in user.
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiCreateUserRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**User**](User.md)| Created user object |
**body** | [**User**](User.md) | Created user object |
### Return type
@ -51,17 +56,22 @@ No authorization required
## CreateUsersWithArrayInput
> CreateUsersWithArrayInput(ctx, body)
> CreateUsersWithArrayInput(ctx).Body(body).Execute()
Creates list of users with given input array
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiCreateUsersWithArrayInputRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**[]User**](User.md)| List of user object |
**body** | [**[]User**](User.md) | List of user object |
### Return type
@ -83,17 +93,22 @@ No authorization required
## CreateUsersWithListInput
> CreateUsersWithListInput(ctx, body)
> CreateUsersWithListInput(ctx).Body(body).Execute()
Creates list of users with given input array
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiCreateUsersWithListInputRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**body** | [**[]User**](User.md)| List of user object |
**body** | [**[]User**](User.md) | List of user object |
### Return type
@ -115,19 +130,28 @@ No authorization required
## DeleteUser
> DeleteUser(ctx, username)
> DeleteUser(ctx, username).Execute()
Delete user
This can only be done by the logged in user.
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**username** | **string**| The name that needs to be deleted |
**username** | **string** | The name that needs to be deleted |
### Other Parameters
Other parameters are passed through a pointer to a apiDeleteUserRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
@ -149,17 +173,26 @@ No authorization required
## GetUserByName
> User GetUserByName(ctx, username)
> User GetUserByName(ctx, username).Execute()
Get user by user name
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
**username** | **string** | The name that needs to be fetched. Use user1 for testing. |
### Other Parameters
Other parameters are passed through a pointer to a apiGetUserByNameRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
@ -181,18 +214,23 @@ No authorization required
## LoginUser
> string LoginUser(ctx, username, password)
> string LoginUser(ctx).Username(username).Password(password).Execute()
Logs user into the system
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiLoginUserRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**username** | **string**| The user name for login |
**password** | **string**| The password for login in clear text |
**username** | **string** | The user name for login |
**password** | **string** | The password for login in clear text |
### Return type
@ -214,14 +252,19 @@ No authorization required
## LogoutUser
> LogoutUser(ctx, )
> LogoutUser(ctx).Execute()
Logs out current logged in user session
### Required Parameters
### Path Parameters
This endpoint does not need any parameter.
### Other Parameters
Other parameters are passed through a pointer to a apiLogoutUserRequest struct via the builder pattern
### Return type
(empty response body)
@ -242,20 +285,29 @@ No authorization required
## UpdateUser
> UpdateUser(ctx, username, body)
> UpdateUser(ctx, username).Body(body).Execute()
Updated user
This can only be done by the logged in user.
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**username** | **string**| name that need to be deleted |
**body** | [**User**](User.md)| Updated user object |
**username** | **string** | name that need to be deleted |
### Other Parameters
Other parameters are passed through a pointer to a apiUpdateUserRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md) | Updated user object |
### Return type

View File

@ -6,7 +6,6 @@ import (
"os"
"testing"
"github.com/antihax/optional"
"github.com/stretchr/testify/assert"
sw "./go-petstore"
@ -32,7 +31,7 @@ func TestAddPet(t *testing.T) {
PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: sw.PtrString("pending"),
Tags: &[]sw.Tag{sw.Tag{Id: sw.PtrInt64(1), Name: sw.PtrString("tag2")}}})
r, err := client.PetApi.AddPet(context.Background(), newPet)
r, err := client.PetApi.AddPet(context.Background()).Body(newPet).Execute()
if err != nil {
t.Fatalf("Error while adding pet: %v", err)
@ -43,7 +42,7 @@ func TestAddPet(t *testing.T) {
}
func TestFindPetsByStatusWithMissingParam(t *testing.T) {
_, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil)
_, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status(nil).Execute()
if err != nil {
t.Fatalf("Error while testing TestFindPetsByStatusWithMissingParam: %v", err)
@ -58,7 +57,7 @@ func TestGetPetById(t *testing.T) {
}
func TestGetPetByIdWithInvalidID(t *testing.T) {
resp, r, err := client.PetApi.GetPetById(context.Background(), 999999999)
resp, r, err := client.PetApi.GetPetById(context.Background(), 999999999).Execute()
if r != nil && r.StatusCode == 404 {
assertedError, ok := err.(sw.GenericOpenAPIError)
a := assert.New(t)
@ -75,10 +74,7 @@ func TestGetPetByIdWithInvalidID(t *testing.T) {
}
func TestUpdatePetWithForm(t *testing.T) {
r, err := client.PetApi.UpdatePetWithForm(context.Background(), 12830, &sw.UpdatePetWithFormOpts{
Name: optional.NewString("golang"),
Status: optional.NewString("available"),
})
r, err := client.PetApi.UpdatePetWithForm(context.Background(), 12830).Name("golang").Status("available").Execute()
if err != nil {
t.Fatalf("Error while updating pet by id: %v", err)
t.Log(r)
@ -93,7 +89,7 @@ func TestUpdatePetWithForm(t *testing.T) {
func TestFindPetsByTag(t *testing.T) {
var found = false
resp, r, err := client.PetApi.FindPetsByTags(context.Background(), []string{"tag2"})
resp, r, err := client.PetApi.FindPetsByTags(context.Background()).Tags([]string{"tag2"}).Execute()
if err != nil {
t.Fatalf("Error while getting pet by tag: %v", err)
t.Log(r)
@ -122,7 +118,7 @@ func TestFindPetsByTag(t *testing.T) {
}
func TestFindPetsByStatus(t *testing.T) {
resp, r, err := client.PetApi.FindPetsByStatus(context.Background(), []string{"available"})
resp, r, err := client.PetApi.FindPetsByStatus(context.Background()).Status([]string{"available"}).Execute()
if err != nil {
t.Fatalf("Error while getting pet by id: %v", err)
t.Log(r)
@ -145,10 +141,7 @@ func TestFindPetsByStatus(t *testing.T) {
func TestUploadFile(t *testing.T) {
file, _ := os.Open("../python/testfiles/foo.png")
_, r, err := client.PetApi.UploadFile(context.Background(), 12830, &sw.UploadFileOpts{
AdditionalMetadata: optional.NewString("golang"),
File: optional.NewInterface(file),
})
_, r, err := client.PetApi.UploadFile(context.Background(), 12830).AdditionalMetadata("golang").File(file).Execute()
if err != nil {
t.Fatalf("Error while uploading file: %v", err)
@ -163,11 +156,7 @@ func TestUploadFileRequired(t *testing.T) {
return // remove when server supports this endpoint
file, _ := os.Open("../python/testfiles/foo.png")
_, r, err := client.PetApi.UploadFileWithRequiredFile(context.Background(), 12830,
file,
&sw.UploadFileWithRequiredFileOpts{
AdditionalMetadata: optional.NewString("golang"),
})
_, r, err := client.PetApi.UploadFileWithRequiredFile(context.Background(), 12830).RequiredFile(file).AdditionalMetadata("golang").Execute()
if err != nil {
t.Fatalf("Error while uploading file: %v", err)
@ -179,7 +168,7 @@ func TestUploadFileRequired(t *testing.T) {
}
func TestDeletePet(t *testing.T) {
r, err := client.PetApi.DeletePet(context.Background(), 12830, nil)
r, err := client.PetApi.DeletePet(context.Background(), 12830).Execute()
if err != nil {
t.Fatalf("Error while deleting pet by id: %v", err)
@ -269,7 +258,7 @@ func waitOnFunctions(t *testing.T, errc chan error, n int) {
}
func deletePet(t *testing.T, id int64) {
r, err := client.PetApi.DeletePet(context.Background(), id, nil)
r, err := client.PetApi.DeletePet(context.Background(), id).Execute()
if err != nil {
t.Fatalf("Error while deleting pet by id: %v", err)
@ -281,7 +270,7 @@ func deletePet(t *testing.T, id int64) {
func isPetCorrect(t *testing.T, id int64, name string, status string) {
assert := assert.New(t)
resp, r, err := client.PetApi.GetPetById(context.Background(), id)
resp, r, err := client.PetApi.GetPetById(context.Background(), id).Execute()
if err != nil {
t.Fatalf("Error while getting pet by id: %v", err)
} else {

View File

@ -18,7 +18,7 @@ func TestPlaceOrder(t *testing.T) {
Status: sw.PtrString("placed"),
Complete: sw.PtrBool(false)}
_, r, err := client.StoreApi.PlaceOrder(context.Background(), newOrder)
_, r, err := client.StoreApi.PlaceOrder(context.Background()).Body(newOrder).Execute()
if err != nil {
// Skip parsing time error due to error in Petstore Test Server

View File

@ -20,7 +20,7 @@ func TestCreateUser(t *testing.T) {
Phone: sw.PtrString("5101112222"),
UserStatus: sw.PtrInt32(1)}
apiResponse, err := client.UserApi.CreateUser(context.Background(), newUser)
apiResponse, err := client.UserApi.CreateUser(context.Background()).Body(newUser).Execute()
if err != nil {
t.Fatalf("Error while adding user: %v", err)
@ -55,7 +55,7 @@ func TestCreateUsersWithArrayInput(t *testing.T) {
},
}
apiResponse, err := client.UserApi.CreateUsersWithArrayInput(context.Background(), newUsers)
apiResponse, err := client.UserApi.CreateUsersWithArrayInput(context.Background()).Body(newUsers).Execute()
if err != nil {
t.Fatalf("Error while adding users: %v", err)
}
@ -64,13 +64,13 @@ func TestCreateUsersWithArrayInput(t *testing.T) {
}
//tear down
_, err1 := client.UserApi.DeleteUser(context.Background(), "gopher1")
_, err1 := client.UserApi.DeleteUser(context.Background(), "gopher1").Execute()
if err1 != nil {
t.Errorf("Error while deleting user")
t.Log(err1)
}
_, err2 := client.UserApi.DeleteUser(context.Background(), "gopher2")
_, err2 := client.UserApi.DeleteUser(context.Background(), "gopher2").Execute()
if err2 != nil {
t.Errorf("Error while deleting user")
t.Log(err2)
@ -80,7 +80,7 @@ func TestCreateUsersWithArrayInput(t *testing.T) {
func TestGetUserByName(t *testing.T) {
assert := assert.New(t)
resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher")
resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute()
if err != nil {
t.Fatalf("Error while getting user by id: %v", err)
} else {
@ -95,7 +95,7 @@ func TestGetUserByName(t *testing.T) {
}
func TestGetUserByNameWithInvalidID(t *testing.T) {
resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "999999999")
resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "999999999").Execute()
if apiResponse != nil && apiResponse.StatusCode == 404 {
return // This is a pass condition. API will return with a 404 error.
} else if err != nil {
@ -122,7 +122,7 @@ func TestUpdateUser(t *testing.T) {
Phone: sw.PtrString("5101112222"),
UserStatus: sw.PtrInt32(1)}
apiResponse, err := client.UserApi.UpdateUser(context.Background(), "gopher", newUser)
apiResponse, err := client.UserApi.UpdateUser(context.Background(), "gopher").Body(newUser).Execute()
if err != nil {
t.Fatalf("Error while deleting user by id: %v", err)
}
@ -131,7 +131,7 @@ func TestUpdateUser(t *testing.T) {
}
//verify changings are correct
resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher")
resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher").Execute()
if err != nil {
t.Fatalf("Error while getting user by id: %v", err)
} else {
@ -142,7 +142,7 @@ func TestUpdateUser(t *testing.T) {
}
func TestDeleteUser(t *testing.T) {
apiResponse, err := client.UserApi.DeleteUser(context.Background(), "gopher")
apiResponse, err := client.UserApi.DeleteUser(context.Background(), "gopher").Execute()
if err != nil {
t.Fatalf("Error while deleting user: %v", err)

View File

@ -24,14 +24,36 @@ var (
// AnotherFakeApiService AnotherFakeApi service
type AnotherFakeApiService service
type apiCall123TestSpecialTagsRequest struct {
ctx _context.Context
apiService *AnotherFakeApiService
client *Client
}
func (r apiCall123TestSpecialTagsRequest) Client(client Client) apiCall123TestSpecialTagsRequest {
r.client = &client
return r
}
/*
Call123TestSpecialTags To test special tags
To test special tags and operation ID starting with number
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param client client model
@return Client
@return apiCall123TestSpecialTagsRequest
*/
func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, client Client) (Client, *_nethttp.Response, error) {
func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context) apiCall123TestSpecialTagsRequest {
return apiCall123TestSpecialTagsRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return Client
*/
func (r apiCall123TestSpecialTagsRequest) Execute() (Client, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPatch
localVarPostBody interface{}
@ -41,7 +63,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, cli
localVarReturnValue Client
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "AnotherFakeApiService.Call123TestSpecialTags")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "AnotherFakeApiService.Call123TestSpecialTags")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -51,6 +73,10 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, cli
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.client == nil {
return localVarReturnValue, nil, reportError("client is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
@ -70,13 +96,13 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, cli
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &client
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.client
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -94,7 +120,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, cli
}
if localVarHTTPResponse.StatusCode == 200 {
var v Client
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -104,7 +130,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, cli
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,

View File

@ -24,12 +24,29 @@ var (
// DefaultApiService DefaultApi service
type DefaultApiService service
type apiFooGetRequest struct {
ctx _context.Context
apiService *DefaultApiService
}
/*
FooGet Method for FooGet
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return InlineResponseDefault
@return apiFooGetRequest
*/
func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault, *_nethttp.Response, error) {
func (a *DefaultApiService) FooGet(ctx _context.Context) apiFooGetRequest {
return apiFooGetRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return InlineResponseDefault
*/
func (r apiFooGetRequest) Execute() (InlineResponseDefault, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -39,7 +56,7 @@ func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault,
localVarReturnValue InlineResponseDefault
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "DefaultApiService.FooGet")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.FooGet")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -67,12 +84,12 @@ func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault,
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -89,7 +106,7 @@ func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault,
error: localVarHTTPResponse.Status,
}
var v InlineResponseDefault
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -98,7 +115,7 @@ func (a *DefaultApiService) FooGet(ctx _context.Context) (InlineResponseDefault,
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,

View File

@ -24,14 +24,36 @@ var (
// FakeClassnameTags123ApiService FakeClassnameTags123Api service
type FakeClassnameTags123ApiService service
type apiTestClassnameRequest struct {
ctx _context.Context
apiService *FakeClassnameTags123ApiService
client *Client
}
func (r apiTestClassnameRequest) Client(client Client) apiTestClassnameRequest {
r.client = &client
return r
}
/*
TestClassname To test class name in snake case
To test class name in snake case
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param client client model
@return Client
@return apiTestClassnameRequest
*/
func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, client Client) (Client, *_nethttp.Response, error) {
func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context) apiTestClassnameRequest {
return apiTestClassnameRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return Client
*/
func (r apiTestClassnameRequest) Execute() (Client, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPatch
localVarPostBody interface{}
@ -41,7 +63,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli
localVarReturnValue Client
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "FakeClassnameTags123ApiService.TestClassname")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "FakeClassnameTags123ApiService.TestClassname")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -51,6 +73,10 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.client == nil {
return localVarReturnValue, nil, reportError("client is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
@ -70,10 +96,10 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &client
if ctx != nil {
localVarPostBody = r.client
if r.ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := auth["api_key_query"]; ok {
var key string
if auth.Prefix != "" {
@ -85,12 +111,12 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli
}
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -108,7 +134,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli
}
if localVarHTTPResponse.StatusCode == 200 {
var v Client
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -118,7 +144,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx _context.Context, cli
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,

View File

@ -15,7 +15,6 @@ import (
_nethttp "net/http"
_neturl "net/url"
"strings"
"github.com/antihax/optional"
"os"
)
@ -27,21 +26,45 @@ var (
// PetApiService PetApi service
type PetApiService service
type apiAddPetRequest struct {
ctx _context.Context
apiService *PetApiService
pet *Pet
}
func (r apiAddPetRequest) Pet(pet Pet) apiAddPetRequest {
r.pet = &pet
return r
}
/*
AddPet Add a new pet to the store
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param pet Pet object that needs to be added to the store
@return apiAddPetRequest
*/
func (a *PetApiService) AddPet(ctx _context.Context, pet Pet) (*_nethttp.Response, error) {
func (a *PetApiService) AddPet(ctx _context.Context) apiAddPetRequest {
return apiAddPetRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiAddPetRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.AddPet")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.AddPet")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -51,6 +74,10 @@ func (a *PetApiService) AddPet(ctx _context.Context, pet Pet) (*_nethttp.Respons
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.pet == nil {
return nil, reportError("pet is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json", "application/xml"}
@ -70,13 +97,13 @@ func (a *PetApiService) AddPet(ctx _context.Context, pet Pet) (*_nethttp.Respons
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &pet
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.pet
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -97,40 +124,60 @@ func (a *PetApiService) AddPet(ctx _context.Context, pet Pet) (*_nethttp.Respons
return localVarHTTPResponse, nil
}
type apiDeletePetRequest struct {
ctx _context.Context
apiService *PetApiService
petId int64
apiKey *string
}
// DeletePetOpts Optional parameters for the method 'DeletePet'
type DeletePetOpts struct {
ApiKey optional.String
func (r apiDeletePetRequest) ApiKey(apiKey string) apiDeletePetRequest {
r.apiKey = &apiKey
return r
}
/*
DeletePet Deletes a pet
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId Pet id to delete
* @param optional nil or *DeletePetOpts - Optional Parameters:
* @param "ApiKey" (optional.String) -
@return apiDeletePetRequest
*/
func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOptionals *DeletePetOpts) (*_nethttp.Response, error) {
func (a *PetApiService) DeletePet(ctx _context.Context, petId int64) apiDeletePetRequest {
return apiDeletePetRequest{
apiService: a,
ctx: ctx,
petId: petId,
}
}
/*
Execute executes the request
*/
func (r apiDeletePetRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.DeletePet")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.DeletePet")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -148,15 +195,15 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() {
localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "")
if r.apiKey != nil {
localVarHeaderParams["api_key"] = parameterToString(*r.apiKey, "")
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -177,15 +224,36 @@ func (a *PetApiService) DeletePet(ctx _context.Context, petId int64, localVarOpt
return localVarHTTPResponse, nil
}
type apiFindPetsByStatusRequest struct {
ctx _context.Context
apiService *PetApiService
status *[]string
}
func (r apiFindPetsByStatusRequest) Status(status []string) apiFindPetsByStatusRequest {
r.status = &status
return r
}
/*
FindPetsByStatus Finds Pets by status
Multiple status values can be provided with comma separated strings
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param status Status values that need to be considered for filter
@return []Pet
@return apiFindPetsByStatusRequest
*/
func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string) ([]Pet, *_nethttp.Response, error) {
func (a *PetApiService) FindPetsByStatus(ctx _context.Context) apiFindPetsByStatusRequest {
return apiFindPetsByStatusRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return []Pet
*/
func (r apiFindPetsByStatusRequest) Execute() ([]Pet, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -195,7 +263,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
localVarReturnValue []Pet
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.FindPetsByStatus")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByStatus")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -205,8 +273,12 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.status == nil {
return localVarReturnValue, nil, reportError("status is required and must be specified")
}
localVarQueryParams.Add("status", parameterToString(status, "csv"))
localVarQueryParams.Add("status", parameterToString(*r.status, "csv"))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -224,12 +296,12 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -247,7 +319,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
}
if localVarHTTPResponse.StatusCode == 200 {
var v []Pet
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -258,7 +330,7 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -269,15 +341,36 @@ func (a *PetApiService) FindPetsByStatus(ctx _context.Context, status []string)
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiFindPetsByTagsRequest struct {
ctx _context.Context
apiService *PetApiService
tags *[]string
}
func (r apiFindPetsByTagsRequest) Tags(tags []string) apiFindPetsByTagsRequest {
r.tags = &tags
return r
}
/*
FindPetsByTags Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param tags Tags to filter by
@return []Pet
@return apiFindPetsByTagsRequest
*/
func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]Pet, *_nethttp.Response, error) {
func (a *PetApiService) FindPetsByTags(ctx _context.Context) apiFindPetsByTagsRequest {
return apiFindPetsByTagsRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return []Pet
*/
func (r apiFindPetsByTagsRequest) Execute() ([]Pet, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -287,7 +380,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
localVarReturnValue []Pet
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.FindPetsByTags")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.FindPetsByTags")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -297,8 +390,12 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.tags == nil {
return localVarReturnValue, nil, reportError("tags is required and must be specified")
}
localVarQueryParams.Add("tags", parameterToString(tags, "csv"))
localVarQueryParams.Add("tags", parameterToString(*r.tags, "csv"))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -316,12 +413,12 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -339,7 +436,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
}
if localVarHTTPResponse.StatusCode == 200 {
var v []Pet
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -350,7 +447,7 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -361,15 +458,33 @@ func (a *PetApiService) FindPetsByTags(ctx _context.Context, tags []string) ([]P
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiGetPetByIdRequest struct {
ctx _context.Context
apiService *PetApiService
petId int64
}
/*
GetPetById Find pet by ID
Returns a single pet
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet to return
@return Pet
@return apiGetPetByIdRequest
*/
func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_nethttp.Response, error) {
func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) apiGetPetByIdRequest {
return apiGetPetByIdRequest{
apiService: a,
ctx: ctx,
petId: petId,
}
}
/*
Execute executes the request
@return Pet
*/
func (r apiGetPetByIdRequest) Execute() (Pet, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -379,17 +494,18 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
localVarReturnValue Pet
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.GetPetById")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.GetPetById")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -408,9 +524,9 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if ctx != nil {
if r.ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := auth["api_key"]; ok {
var key string
if auth.Prefix != "" {
@ -422,12 +538,12 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
}
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -445,7 +561,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
}
if localVarHTTPResponse.StatusCode == 200 {
var v Pet
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -456,7 +572,7 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -467,22 +583,45 @@ func (a *PetApiService) GetPetById(ctx _context.Context, petId int64) (Pet, *_ne
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiUpdatePetRequest struct {
ctx _context.Context
apiService *PetApiService
pet *Pet
}
func (r apiUpdatePetRequest) Pet(pet Pet) apiUpdatePetRequest {
r.pet = &pet
return r
}
/*
UpdatePet Update an existing pet
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param pet Pet object that needs to be added to the store
@return apiUpdatePetRequest
*/
func (a *PetApiService) UpdatePet(ctx _context.Context, pet Pet) (*_nethttp.Response, error) {
func (a *PetApiService) UpdatePet(ctx _context.Context) apiUpdatePetRequest {
return apiUpdatePetRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiUpdatePetRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UpdatePet")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePet")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -492,6 +631,10 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, pet Pet) (*_nethttp.Resp
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.pet == nil {
return nil, reportError("pet is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json", "application/xml"}
@ -511,13 +654,13 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, pet Pet) (*_nethttp.Resp
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &pet
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.pet
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -538,42 +681,66 @@ func (a *PetApiService) UpdatePet(ctx _context.Context, pet Pet) (*_nethttp.Resp
return localVarHTTPResponse, nil
}
type apiUpdatePetWithFormRequest struct {
ctx _context.Context
apiService *PetApiService
petId int64
name *string
status *string
}
// UpdatePetWithFormOpts Optional parameters for the method 'UpdatePetWithForm'
type UpdatePetWithFormOpts struct {
Name optional.String
Status optional.String
func (r apiUpdatePetWithFormRequest) Name(name string) apiUpdatePetWithFormRequest {
r.name = &name
return r
}
func (r apiUpdatePetWithFormRequest) Status(status string) apiUpdatePetWithFormRequest {
r.status = &status
return r
}
/*
UpdatePetWithForm Updates a pet in the store with form data
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet that needs to be updated
* @param optional nil or *UpdatePetWithFormOpts - Optional Parameters:
* @param "Name" (optional.String) - Updated name of the pet
* @param "Status" (optional.String) - Updated status of the pet
@return apiUpdatePetWithFormRequest
*/
func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*_nethttp.Response, error) {
func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64) apiUpdatePetWithFormRequest {
return apiUpdatePetWithFormRequest{
apiService: a,
ctx: ctx,
petId: petId,
}
}
/*
Execute executes the request
*/
func (r apiUpdatePetWithFormRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UpdatePetWithForm")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UpdatePetWithForm")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/pet/{petId}"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"}
@ -591,18 +758,18 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
localVarFormParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
if r.name != nil {
localVarFormParams.Add("name", parameterToString(*r.name, ""))
}
if localVarOptionals != nil && localVarOptionals.Status.IsSet() {
localVarFormParams.Add("status", parameterToString(localVarOptionals.Status.Value(), ""))
if r.status != nil {
localVarFormParams.Add("status", parameterToString(*r.status, ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -623,23 +790,44 @@ func (a *PetApiService) UpdatePetWithForm(ctx _context.Context, petId int64, loc
return localVarHTTPResponse, nil
}
type apiUploadFileRequest struct {
ctx _context.Context
apiService *PetApiService
petId int64
additionalMetadata *string
file **os.File
}
// UploadFileOpts Optional parameters for the method 'UploadFile'
type UploadFileOpts struct {
AdditionalMetadata optional.String
File optional.Interface
func (r apiUploadFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileRequest {
r.additionalMetadata = &additionalMetadata
return r
}
func (r apiUploadFileRequest) File(file *os.File) apiUploadFileRequest {
r.file = &file
return r
}
/*
UploadFile uploads an image
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet to update
* @param optional nil or *UploadFileOpts - Optional Parameters:
* @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
* @param "File" (optional.Interface of *os.File) - file to upload
@return ApiResponse
@return apiUploadFileRequest
*/
func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *_nethttp.Response, error) {
func (a *PetApiService) UploadFile(ctx _context.Context, petId int64) apiUploadFileRequest {
return apiUploadFileRequest{
apiService: a,
ctx: ctx,
petId: petId,
}
}
/*
Execute executes the request
@return ApiResponse
*/
func (r apiUploadFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
@ -649,18 +837,19 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
localVarReturnValue ApiResponse
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UploadFile")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFile")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/pet/{petId}/uploadImage"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"multipart/form-data"}
@ -678,17 +867,13 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
if r.additionalMetadata != nil {
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
}
localVarFormFileName = "file"
var localVarFile *os.File
if localVarOptionals != nil && localVarOptionals.File.IsSet() {
localVarFileOk := false
localVarFile, localVarFileOk = localVarOptionals.File.Value().(*os.File)
if !localVarFileOk {
return localVarReturnValue, nil, reportError("file should be *os.File")
}
if r.file != nil {
localVarFile = *r.file
}
if localVarFile != nil {
fbs, _ := _ioutil.ReadAll(localVarFile)
@ -696,12 +881,12 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
localVarFileName = localVarFile.Name()
localVarFile.Close()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -719,7 +904,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
}
if localVarHTTPResponse.StatusCode == 200 {
var v ApiResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -729,7 +914,7 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -740,22 +925,44 @@ func (a *PetApiService) UploadFile(ctx _context.Context, petId int64, localVarOp
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiUploadFileWithRequiredFileRequest struct {
ctx _context.Context
apiService *PetApiService
petId int64
requiredFile **os.File
additionalMetadata *string
}
// UploadFileWithRequiredFileOpts Optional parameters for the method 'UploadFileWithRequiredFile'
type UploadFileWithRequiredFileOpts struct {
AdditionalMetadata optional.String
func (r apiUploadFileWithRequiredFileRequest) RequiredFile(requiredFile *os.File) apiUploadFileWithRequiredFileRequest {
r.requiredFile = &requiredFile
return r
}
func (r apiUploadFileWithRequiredFileRequest) AdditionalMetadata(additionalMetadata string) apiUploadFileWithRequiredFileRequest {
r.additionalMetadata = &additionalMetadata
return r
}
/*
UploadFileWithRequiredFile uploads an image (required)
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param petId ID of pet to update
* @param requiredFile file to upload
* @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters:
* @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
@return ApiResponse
@return apiUploadFileWithRequiredFileRequest
*/
func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *_nethttp.Response, error) {
func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId int64) apiUploadFileWithRequiredFileRequest {
return apiUploadFileWithRequiredFileRequest{
apiService: a,
ctx: ctx,
petId: petId,
}
}
/*
Execute executes the request
@return ApiResponse
*/
func (r apiUploadFileWithRequiredFileRequest) Execute() (ApiResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
@ -765,18 +972,23 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i
localVarReturnValue ApiResponse
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "PetApiService.UploadFileWithRequiredFile")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "PetApiService.UploadFileWithRequiredFile")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/fake/{petId}/uploadImageWithRequiredFile"
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(petId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", _neturl.QueryEscape(parameterToString(r.petId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.requiredFile == nil {
return localVarReturnValue, nil, reportError("requiredFile is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"multipart/form-data"}
@ -794,23 +1006,23 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
if r.additionalMetadata != nil {
localVarFormParams.Add("additionalMetadata", parameterToString(*r.additionalMetadata, ""))
}
localVarFormFileName = "requiredFile"
localVarFile := requiredFile
localVarFile := *r.requiredFile
if localVarFile != nil {
fbs, _ := _ioutil.ReadAll(localVarFile)
localVarFileBytes = fbs
localVarFileName = localVarFile.Name()
localVarFile.Close()
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -828,7 +1040,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i
}
if localVarHTTPResponse.StatusCode == 200 {
var v ApiResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -838,7 +1050,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx _context.Context, petId i
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,

View File

@ -25,32 +25,54 @@ var (
// StoreApiService StoreApi service
type StoreApiService service
type apiDeleteOrderRequest struct {
ctx _context.Context
apiService *StoreApiService
orderId string
}
/*
DeleteOrder Delete purchase order by ID
For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param orderId ID of the order that needs to be deleted
@return apiDeleteOrderRequest
*/
func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_nethttp.Response, error) {
func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) apiDeleteOrderRequest {
return apiDeleteOrderRequest{
apiService: a,
ctx: ctx,
orderId: orderId,
}
}
/*
Execute executes the request
*/
func (r apiDeleteOrderRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.DeleteOrder")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.DeleteOrder")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/store/order/{order_id}"
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(r.orderId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -69,12 +91,12 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -95,14 +117,30 @@ func (a *StoreApiService) DeleteOrder(ctx _context.Context, orderId string) (*_n
return localVarHTTPResponse, nil
}
type apiGetInventoryRequest struct {
ctx _context.Context
apiService *StoreApiService
}
/*
GetInventory Returns pet inventories by status
Returns a map of status codes to quantities
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return map[string]int32
@return apiGetInventoryRequest
*/
func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32, *_nethttp.Response, error) {
func (a *StoreApiService) GetInventory(ctx _context.Context) apiGetInventoryRequest {
return apiGetInventoryRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return map[string]int32
*/
func (r apiGetInventoryRequest) Execute() (map[string]int32, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -112,7 +150,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
localVarReturnValue map[string]int32
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.GetInventory")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetInventory")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -140,9 +178,9 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if ctx != nil {
if r.ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := auth["api_key"]; ok {
var key string
if auth.Prefix != "" {
@ -154,12 +192,12 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
}
}
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -177,7 +215,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
}
if localVarHTTPResponse.StatusCode == 200 {
var v map[string]int32
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -187,7 +225,7 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -198,15 +236,33 @@ func (a *StoreApiService) GetInventory(ctx _context.Context) (map[string]int32,
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiGetOrderByIdRequest struct {
ctx _context.Context
apiService *StoreApiService
orderId int64
}
/*
GetOrderById Find purchase order by ID
For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param orderId ID of pet that needs to be fetched
@return Order
@return apiGetOrderByIdRequest
*/
func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Order, *_nethttp.Response, error) {
func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) apiGetOrderByIdRequest {
return apiGetOrderByIdRequest{
apiService: a,
ctx: ctx,
orderId: orderId,
}
}
/*
Execute executes the request
@return Order
*/
func (r apiGetOrderByIdRequest) Execute() (Order, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -216,21 +272,22 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
localVarReturnValue Order
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.GetOrderById")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.GetOrderById")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/store/order/{order_id}"
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(orderId, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", _neturl.QueryEscape(parameterToString(r.orderId, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if orderId < 1 {
if r.orderId < 1 {
return localVarReturnValue, nil, reportError("orderId must be greater than 1")
}
if orderId > 5 {
if r.orderId > 5 {
return localVarReturnValue, nil, reportError("orderId must be less than 5")
}
@ -251,12 +308,12 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -274,7 +331,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
}
if localVarHTTPResponse.StatusCode == 200 {
var v Order
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -285,7 +342,7 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -296,14 +353,35 @@ func (a *StoreApiService) GetOrderById(ctx _context.Context, orderId int64) (Ord
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiPlaceOrderRequest struct {
ctx _context.Context
apiService *StoreApiService
order *Order
}
func (r apiPlaceOrderRequest) Order(order Order) apiPlaceOrderRequest {
r.order = &order
return r
}
/*
PlaceOrder Place an order for a pet
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param order order placed for purchasing the pet
@return Order
@return apiPlaceOrderRequest
*/
func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order, *_nethttp.Response, error) {
func (a *StoreApiService) PlaceOrder(ctx _context.Context) apiPlaceOrderRequest {
return apiPlaceOrderRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return Order
*/
func (r apiPlaceOrderRequest) Execute() (Order, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
@ -313,7 +391,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order,
localVarReturnValue Order
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "StoreApiService.PlaceOrder")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "StoreApiService.PlaceOrder")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -323,6 +401,10 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order,
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.order == nil {
return localVarReturnValue, nil, reportError("order is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
@ -342,13 +424,13 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order,
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &order
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.order
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -366,7 +448,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order,
}
if localVarHTTPResponse.StatusCode == 200 {
var v Order
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -377,7 +459,7 @@ func (a *StoreApiService) PlaceOrder(ctx _context.Context, order Order) (Order,
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,

View File

@ -25,22 +25,46 @@ var (
// UserApiService UserApi service
type UserApiService service
type apiCreateUserRequest struct {
ctx _context.Context
apiService *UserApiService
user *User
}
func (r apiCreateUserRequest) User(user User) apiCreateUserRequest {
r.user = &user
return r
}
/*
CreateUser Create user
This can only be done by the logged in user.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param user Created user object
@return apiCreateUserRequest
*/
func (a *UserApiService) CreateUser(ctx _context.Context, user User) (*_nethttp.Response, error) {
func (a *UserApiService) CreateUser(ctx _context.Context) apiCreateUserRequest {
return apiCreateUserRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiCreateUserRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUser")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUser")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -50,6 +74,10 @@ func (a *UserApiService) CreateUser(ctx _context.Context, user User) (*_nethttp.
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.user == nil {
return nil, reportError("user is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
@ -69,13 +97,13 @@ func (a *UserApiService) CreateUser(ctx _context.Context, user User) (*_nethttp.
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.user
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -96,22 +124,45 @@ func (a *UserApiService) CreateUser(ctx _context.Context, user User) (*_nethttp.
return localVarHTTPResponse, nil
}
type apiCreateUsersWithArrayInputRequest struct {
ctx _context.Context
apiService *UserApiService
user *[]User
}
func (r apiCreateUsersWithArrayInputRequest) User(user []User) apiCreateUsersWithArrayInputRequest {
r.user = &user
return r
}
/*
CreateUsersWithArrayInput Creates list of users with given input array
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param user List of user object
@return apiCreateUsersWithArrayInputRequest
*/
func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, user []User) (*_nethttp.Response, error) {
func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context) apiCreateUsersWithArrayInputRequest {
return apiCreateUsersWithArrayInputRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiCreateUsersWithArrayInputRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUsersWithArrayInput")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithArrayInput")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -121,6 +172,10 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, user []
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.user == nil {
return nil, reportError("user is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
@ -140,13 +195,13 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, user []
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.user
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -167,22 +222,45 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx _context.Context, user []
return localVarHTTPResponse, nil
}
type apiCreateUsersWithListInputRequest struct {
ctx _context.Context
apiService *UserApiService
user *[]User
}
func (r apiCreateUsersWithListInputRequest) User(user []User) apiCreateUsersWithListInputRequest {
r.user = &user
return r
}
/*
CreateUsersWithListInput Creates list of users with given input array
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param user List of user object
@return apiCreateUsersWithListInputRequest
*/
func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, user []User) (*_nethttp.Response, error) {
func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context) apiCreateUsersWithListInputRequest {
return apiCreateUsersWithListInputRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiCreateUsersWithListInputRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.CreateUsersWithListInput")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.CreateUsersWithListInput")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -192,6 +270,10 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, user []U
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.user == nil {
return nil, reportError("user is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
@ -211,13 +293,13 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, user []U
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.user
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -238,33 +320,54 @@ func (a *UserApiService) CreateUsersWithListInput(ctx _context.Context, user []U
return localVarHTTPResponse, nil
}
type apiDeleteUserRequest struct {
ctx _context.Context
apiService *UserApiService
username string
}
/*
DeleteUser Delete user
This can only be done by the logged in user.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username The name that needs to be deleted
@return apiDeleteUserRequest
*/
func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_nethttp.Response, error) {
func (a *UserApiService) DeleteUser(ctx _context.Context, username string) apiDeleteUserRequest {
return apiDeleteUserRequest{
apiService: a,
ctx: ctx,
username: username,
}
}
/*
Execute executes the request
*/
func (r apiDeleteUserRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.DeleteUser")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.DeleteUser")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -283,12 +386,12 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -309,14 +412,32 @@ func (a *UserApiService) DeleteUser(ctx _context.Context, username string) (*_ne
return localVarHTTPResponse, nil
}
type apiGetUserByNameRequest struct {
ctx _context.Context
apiService *UserApiService
username string
}
/*
GetUserByName Get user by user name
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username The name that needs to be fetched. Use user1 for testing.
@return User
@return apiGetUserByNameRequest
*/
func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (User, *_nethttp.Response, error) {
func (a *UserApiService) GetUserByName(ctx _context.Context, username string) apiGetUserByNameRequest {
return apiGetUserByNameRequest{
apiService: a,
ctx: ctx,
username: username,
}
}
/*
Execute executes the request
@return User
*/
func (r apiGetUserByNameRequest) Execute() (User, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -326,17 +447,18 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
localVarReturnValue User
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.GetUserByName")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.GetUserByName")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -355,12 +477,12 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -378,7 +500,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
}
if localVarHTTPResponse.StatusCode == 200 {
var v User
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -389,7 +511,7 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -400,15 +522,41 @@ func (a *UserApiService) GetUserByName(ctx _context.Context, username string) (U
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiLoginUserRequest struct {
ctx _context.Context
apiService *UserApiService
username *string
password *string
}
func (r apiLoginUserRequest) Username(username string) apiLoginUserRequest {
r.username = &username
return r
}
func (r apiLoginUserRequest) Password(password string) apiLoginUserRequest {
r.password = &password
return r
}
/*
LoginUser Logs user into the system
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username The user name for login
* @param password The password for login in clear text
@return string
@return apiLoginUserRequest
*/
func (a *UserApiService) LoginUser(ctx _context.Context, username string, password string) (string, *_nethttp.Response, error) {
func (a *UserApiService) LoginUser(ctx _context.Context) apiLoginUserRequest {
return apiLoginUserRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
@return string
*/
func (r apiLoginUserRequest) Execute() (string, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@ -418,7 +566,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
localVarReturnValue string
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.LoginUser")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LoginUser")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
@ -428,9 +576,17 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.username == nil {
return localVarReturnValue, nil, reportError("username is required and must be specified")
}
if r.password == nil {
return localVarReturnValue, nil, reportError("password is required and must be specified")
}
localVarQueryParams.Add("username", parameterToString(username, ""))
localVarQueryParams.Add("password", parameterToString(password, ""))
localVarQueryParams.Add("username", parameterToString(*r.username, ""))
localVarQueryParams.Add("password", parameterToString(*r.password, ""))
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
@ -448,12 +604,12 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -471,7 +627,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
}
if localVarHTTPResponse.StatusCode == 200 {
var v string
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
@ -482,7 +638,7 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
err = r.apiService.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
@ -493,21 +649,39 @@ func (a *UserApiService) LoginUser(ctx _context.Context, username string, passwo
return localVarReturnValue, localVarHTTPResponse, nil
}
type apiLogoutUserRequest struct {
ctx _context.Context
apiService *UserApiService
}
/*
LogoutUser Logs out current logged in user session
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return apiLogoutUserRequest
*/
func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, error) {
func (a *UserApiService) LogoutUser(ctx _context.Context) apiLogoutUserRequest {
return apiLogoutUserRequest{
apiService: a,
ctx: ctx,
}
}
/*
Execute executes the request
*/
func (r apiLogoutUserRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.LogoutUser")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.LogoutUser")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
@ -535,12 +709,12 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
@ -561,34 +735,64 @@ func (a *UserApiService) LogoutUser(ctx _context.Context) (*_nethttp.Response, e
return localVarHTTPResponse, nil
}
type apiUpdateUserRequest struct {
ctx _context.Context
apiService *UserApiService
username string
user *User
}
func (r apiUpdateUserRequest) User(user User) apiUpdateUserRequest {
r.user = &user
return r
}
/*
UpdateUser Updated user
This can only be done by the logged in user.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param username name that need to be deleted
* @param user Updated user object
@return apiUpdateUserRequest
*/
func (a *UserApiService) UpdateUser(ctx _context.Context, username string, user User) (*_nethttp.Response, error) {
func (a *UserApiService) UpdateUser(ctx _context.Context, username string) apiUpdateUserRequest {
return apiUpdateUserRequest{
apiService: a,
ctx: ctx,
username: username,
}
}
/*
Execute executes the request
*/
func (r apiUpdateUserRequest) Execute() (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(ctx, "UserApiService.UpdateUser")
localBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, "UserApiService.UpdateUser")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/user/{username}"
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(username, "")) , -1)
localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", _neturl.QueryEscape(parameterToString(r.username, "")) , -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.user == nil {
return nil, reportError("user is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
@ -608,13 +812,13 @@ func (a *UserApiService) UpdateUser(ctx _context.Context, username string, user
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = &user
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
localVarPostBody = r.user
req, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
localVarHTTPResponse, err := r.apiService.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}

View File

@ -10,19 +10,24 @@ Method | HTTP request | Description
## Call123TestSpecialTags
> Client Call123TestSpecialTags(ctx, client)
> Client Call123TestSpecialTags(ctx).Client(client).Execute()
To test special tags
To test special tags and operation ID starting with number
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiCall123TestSpecialTagsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**client** | [**Client**](Client.md)| client model |
**client** | [**Client**](Client.md) | client model |
### Return type

View File

@ -10,14 +10,19 @@ Method | HTTP request | Description
## FooGet
> InlineResponseDefault FooGet(ctx, )
> InlineResponseDefault FooGet(ctx).Execute()
### Required Parameters
### Path Parameters
This endpoint does not need any parameter.
### Other Parameters
Other parameters are passed through a pointer to a apiFooGetRequest struct via the builder pattern
### Return type
[**InlineResponseDefault**](inline_response_default.md)

View File

@ -23,14 +23,19 @@ Method | HTTP request | Description
## FakeHealthGet
> HealthCheckResult FakeHealthGet(ctx, )
> HealthCheckResult FakeHealthGet(ctx).Execute()
Health check endpoint
### Required Parameters
### Path Parameters
This endpoint does not need any parameter.
### Other Parameters
Other parameters are passed through a pointer to a apiFakeHealthGetRequest struct via the builder pattern
### Return type
[**HealthCheckResult**](HealthCheckResult.md)
@ -51,28 +56,24 @@ No authorization required
## FakeOuterBooleanSerialize
> bool FakeOuterBooleanSerialize(ctx, optional)
> bool FakeOuterBooleanSerialize(ctx).Body(body).Execute()
Test serialization of outer boolean types
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFakeOuterBooleanSerializeRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***FakeOuterBooleanSerializeOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **optional.Bool**| Input boolean as post body |
**body** | **bool** | Input boolean as post body |
### Return type
@ -94,28 +95,24 @@ No authorization required
## FakeOuterCompositeSerialize
> OuterComposite FakeOuterCompositeSerialize(ctx, optional)
> OuterComposite FakeOuterCompositeSerialize(ctx).OuterComposite(outerComposite).Execute()
Test serialization of object with outer number type
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFakeOuterCompositeSerializeRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***FakeOuterCompositeSerializeOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a FakeOuterCompositeSerializeOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**outerComposite** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body |
**outerComposite** | [**OuterComposite**](OuterComposite.md) | Input composite as post body |
### Return type
@ -137,28 +134,24 @@ No authorization required
## FakeOuterNumberSerialize
> float32 FakeOuterNumberSerialize(ctx, optional)
> float32 FakeOuterNumberSerialize(ctx).Body(body).Execute()
Test serialization of outer number types
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFakeOuterNumberSerializeRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***FakeOuterNumberSerializeOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a FakeOuterNumberSerializeOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **optional.Float32**| Input number as post body |
**body** | **float32** | Input number as post body |
### Return type
@ -180,28 +173,24 @@ No authorization required
## FakeOuterStringSerialize
> string FakeOuterStringSerialize(ctx, optional)
> string FakeOuterStringSerialize(ctx).Body(body).Execute()
Test serialization of outer string types
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFakeOuterStringSerializeRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***FakeOuterStringSerializeOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a FakeOuterStringSerializeOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **optional.String**| Input string as post body |
**body** | **string** | Input string as post body |
### Return type
@ -223,19 +212,24 @@ No authorization required
## TestBodyWithFileSchema
> TestBodyWithFileSchema(ctx, fileSchemaTestClass)
> TestBodyWithFileSchema(ctx).FileSchemaTestClass(fileSchemaTestClass).Execute()
For this test, the body for this request much reference a schema named `File`.
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestBodyWithFileSchemaRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
**fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md) | |
### Return type
@ -257,18 +251,23 @@ No authorization required
## TestBodyWithQueryParams
> TestBodyWithQueryParams(ctx, query, user)
> TestBodyWithQueryParams(ctx).Query(query).User(user).Execute()
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestBodyWithQueryParamsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**query** | **string**| |
**user** | [**User**](User.md)| |
**query** | **string** | |
**user** | [**User**](User.md) | |
### Return type
@ -290,19 +289,24 @@ No authorization required
## TestClientModel
> Client TestClientModel(ctx, client)
> Client TestClientModel(ctx).Client(client).Execute()
To test \"client\" model
To test \"client\" model
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestClientModelRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**client** | [**Client**](Client.md)| client model |
**client** | [**Client**](Client.md) | client model |
### Return type
@ -324,45 +328,37 @@ No authorization required
## TestEndpointParameters
> TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte_, optional)
> TestEndpointParameters(ctx).Number(number).Double(double).PatternWithoutDelimiter(patternWithoutDelimiter).Byte_(byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute()
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestEndpointParametersRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**number** | **float32**| None |
**double** | **float64**| None |
**patternWithoutDelimiter** | **string**| None |
**byte_** | **string**| None |
**optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a TestEndpointParametersOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**integer** | **optional.Int32**| None |
**int32_** | **optional.Int32**| None |
**int64_** | **optional.Int64**| None |
**float** | **optional.Float32**| None |
**string_** | **optional.String**| None |
**binary** | **optional.Interface of *os.File****optional.*os.File**| None |
**date** | **optional.String**| None |
**dateTime** | **optional.Time**| None |
**password** | **optional.String**| None |
**callback** | **optional.String**| None |
**number** | **float32** | None |
**double** | **float64** | None |
**patternWithoutDelimiter** | **string** | None |
**byte_** | **string** | None |
**integer** | **int32** | None |
**int32_** | **int32** | None |
**int64_** | **int64** | None |
**float** | **float32** | None |
**string_** | **string** | None |
**binary** | ***os.File** | None |
**date** | **string** | None |
**dateTime** | **time.Time** | None |
**password** | **string** | None |
**callback** | **string** | None |
### Return type
@ -384,35 +380,31 @@ Name | Type | Description | Notes
## TestEnumParameters
> TestEnumParameters(ctx, optional)
> TestEnumParameters(ctx).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute()
To test enum parameters
To test enum parameters
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestEnumParametersRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***TestEnumParametersOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a TestEnumParametersOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**enumHeaderStringArray** | [**optional.Interface of []string**](string.md)| Header parameter enum test (string array) |
**enumHeaderString** | **optional.String**| Header parameter enum test (string) | [default to -efg]
**enumQueryStringArray** | [**optional.Interface of []string**](string.md)| Query parameter enum test (string array) |
**enumQueryString** | **optional.String**| Query parameter enum test (string) | [default to -efg]
**enumQueryInteger** | **optional.Int32**| Query parameter enum test (double) |
**enumQueryDouble** | **optional.Float64**| Query parameter enum test (double) |
**enumFormStringArray** | [**optional.Interface of []string**](string.md)| Form parameter enum test (string array) | [default to $]
**enumFormString** | **optional.String**| Form parameter enum test (string) | [default to -efg]
**enumHeaderStringArray** | [**[]string**](string.md) | Header parameter enum test (string array) |
**enumHeaderString** | **string** | Header parameter enum test (string) | [default to -efg]
**enumQueryStringArray** | [**[]string**](string.md) | Query parameter enum test (string array) |
**enumQueryString** | **string** | Query parameter enum test (string) | [default to -efg]
**enumQueryInteger** | **int32** | Query parameter enum test (double) |
**enumQueryDouble** | **float64** | Query parameter enum test (double) |
**enumFormStringArray** | [**[]string**](string.md) | Form parameter enum test (string array) | [default to $]
**enumFormString** | **string** | Form parameter enum test (string) | [default to -efg]
### Return type
@ -434,36 +426,29 @@ No authorization required
## TestGroupParameters
> TestGroupParameters(ctx, requiredStringGroup, requiredBooleanGroup, requiredInt64Group, optional)
> TestGroupParameters(ctx).RequiredStringGroup(requiredStringGroup).RequiredBooleanGroup(requiredBooleanGroup).RequiredInt64Group(requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute()
Fake endpoint to test group parameters (optional)
Fake endpoint to test group parameters (optional)
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestGroupParametersRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**requiredStringGroup** | **int32**| Required String in group parameters |
**requiredBooleanGroup** | **bool**| Required Boolean in group parameters |
**requiredInt64Group** | **int64**| Required Integer in group parameters |
**optional** | ***TestGroupParametersOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a TestGroupParametersOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**stringGroup** | **optional.Int32**| String in group parameters |
**booleanGroup** | **optional.Bool**| Boolean in group parameters |
**int64Group** | **optional.Int64**| Integer in group parameters |
**requiredStringGroup** | **int32** | Required String in group parameters |
**requiredBooleanGroup** | **bool** | Required Boolean in group parameters |
**requiredInt64Group** | **int64** | Required Integer in group parameters |
**stringGroup** | **int32** | String in group parameters |
**booleanGroup** | **bool** | Boolean in group parameters |
**int64Group** | **int64** | Integer in group parameters |
### Return type
@ -485,17 +470,22 @@ Name | Type | Description | Notes
## TestInlineAdditionalProperties
> TestInlineAdditionalProperties(ctx, requestBody)
> TestInlineAdditionalProperties(ctx).RequestBody(requestBody).Execute()
test inline additionalProperties
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestInlineAdditionalPropertiesRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**requestBody** | [**map[string]string**](string.md)| request body |
**requestBody** | [**map[string]string**](string.md) | request body |
### Return type
@ -517,18 +507,23 @@ No authorization required
## TestJsonFormData
> TestJsonFormData(ctx, param, param2)
> TestJsonFormData(ctx).Param(param).Param2(param2).Execute()
test json serialization of form data
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestJsonFormDataRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**param** | **string**| field1 |
**param2** | **string**| field2 |
**param** | **string** | field1 |
**param2** | **string** | field2 |
### Return type
@ -550,23 +545,28 @@ No authorization required
## TestQueryParameterCollectionFormat
> TestQueryParameterCollectionFormat(ctx, pipe, ioutil, http, url, context)
> TestQueryParameterCollectionFormat(ctx).Pipe(pipe).Ioutil(ioutil).Http(http).Url(url).Context(context).Execute()
To test the collection format in query parameters
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestQueryParameterCollectionFormatRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**pipe** | [**[]string**](string.md)| |
**ioutil** | [**[]string**](string.md)| |
**http** | [**[]string**](string.md)| |
**url** | [**[]string**](string.md)| |
**context** | [**[]string**](string.md)| |
**pipe** | [**[]string**](string.md) | |
**ioutil** | [**[]string**](string.md) | |
**http** | [**[]string**](string.md) | |
**url** | [**[]string**](string.md) | |
**context** | [**[]string**](string.md) | |
### Return type

View File

@ -10,19 +10,24 @@ Method | HTTP request | Description
## TestClassname
> Client TestClassname(ctx, client)
> Client TestClassname(ctx).Client(client).Execute()
To test class name in snake case
To test class name in snake case
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiTestClassnameRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**client** | [**Client**](Client.md)| client model |
**client** | [**Client**](Client.md) | client model |
### Return type

View File

@ -18,17 +18,22 @@ Method | HTTP request | Description
## AddPet
> AddPet(ctx, pet)
> AddPet(ctx).Pet(pet).Execute()
Add a new pet to the store
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiAddPetRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store |
### Return type
@ -50,28 +55,27 @@ Name | Type | Description | Notes
## DeletePet
> DeletePet(ctx, petId, optional)
> DeletePet(ctx, petId).ApiKey(apiKey).Execute()
Deletes a pet
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| Pet id to delete |
**optional** | ***DeletePetOpts** | optional parameters | nil if no parameters
**petId** | **int64** | Pet id to delete |
### Optional Parameters
### Other Parameters
Optional parameters are passed through a pointer to a DeletePetOpts struct
Other parameters are passed through a pointer to a apiDeletePetRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**apiKey** | **optional.String**| |
**apiKey** | **string** | |
### Return type
@ -93,19 +97,24 @@ Name | Type | Description | Notes
## FindPetsByStatus
> []Pet FindPetsByStatus(ctx, status)
> []Pet FindPetsByStatus(ctx).Status(status).Execute()
Finds Pets by status
Multiple status values can be provided with comma separated strings
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFindPetsByStatusRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**status** | [**[]string**](string.md)| Status values that need to be considered for filter |
**status** | [**[]string**](string.md) | Status values that need to be considered for filter |
### Return type
@ -127,19 +136,24 @@ Name | Type | Description | Notes
## FindPetsByTags
> []Pet FindPetsByTags(ctx, tags)
> []Pet FindPetsByTags(ctx).Tags(tags).Execute()
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiFindPetsByTagsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**tags** | [**[]string**](string.md)| Tags to filter by |
**tags** | [**[]string**](string.md) | Tags to filter by |
### Return type
@ -161,19 +175,28 @@ Name | Type | Description | Notes
## GetPetById
> Pet GetPetById(ctx, petId)
> Pet GetPetById(ctx, petId).Execute()
Find pet by ID
Returns a single pet
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| ID of pet to return |
**petId** | **int64** | ID of pet to return |
### Other Parameters
Other parameters are passed through a pointer to a apiGetPetByIdRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
@ -195,17 +218,22 @@ Name | Type | Description | Notes
## UpdatePet
> UpdatePet(ctx, pet)
> UpdatePet(ctx).Pet(pet).Execute()
Update an existing pet
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiUpdatePetRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store |
### Return type
@ -227,29 +255,28 @@ Name | Type | Description | Notes
## UpdatePetWithForm
> UpdatePetWithForm(ctx, petId, optional)
> UpdatePetWithForm(ctx, petId).Name(name).Status(status).Execute()
Updates a pet in the store with form data
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| ID of pet that needs to be updated |
**optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters
**petId** | **int64** | ID of pet that needs to be updated |
### Optional Parameters
### Other Parameters
Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct
Other parameters are passed through a pointer to a apiUpdatePetWithFormRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**name** | **optional.String**| Updated name of the pet |
**status** | **optional.String**| Updated status of the pet |
**name** | **string** | Updated name of the pet |
**status** | **string** | Updated status of the pet |
### Return type
@ -271,29 +298,28 @@ Name | Type | Description | Notes
## UploadFile
> ApiResponse UploadFile(ctx, petId, optional)
> ApiResponse UploadFile(ctx, petId).AdditionalMetadata(additionalMetadata).File(file).Execute()
uploads an image
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| ID of pet to update |
**optional** | ***UploadFileOpts** | optional parameters | nil if no parameters
**petId** | **int64** | ID of pet to update |
### Optional Parameters
### Other Parameters
Optional parameters are passed through a pointer to a UploadFileOpts struct
Other parameters are passed through a pointer to a apiUploadFileRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**additionalMetadata** | **optional.String**| Additional data to pass to server |
**file** | **optional.Interface of *os.File****optional.*os.File**| file to upload |
**additionalMetadata** | **string** | Additional data to pass to server |
**file** | ***os.File** | file to upload |
### Return type
@ -315,30 +341,28 @@ Name | Type | Description | Notes
## UploadFileWithRequiredFile
> ApiResponse UploadFileWithRequiredFile(ctx, petId, requiredFile, optional)
> ApiResponse UploadFileWithRequiredFile(ctx, petId).RequiredFile(requiredFile).AdditionalMetadata(additionalMetadata).Execute()
uploads an image (required)
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**petId** | **int64**| ID of pet to update |
**requiredFile** | ***os.File*****os.File**| file to upload |
**optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters
**petId** | **int64** | ID of pet to update |
### Optional Parameters
### Other Parameters
Optional parameters are passed through a pointer to a UploadFileWithRequiredFileOpts struct
Other parameters are passed through a pointer to a apiUploadFileWithRequiredFileRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**additionalMetadata** | **optional.String**| Additional data to pass to server |
**requiredFile** | ***os.File** | file to upload |
**additionalMetadata** | **string** | Additional data to pass to server |
### Return type

View File

@ -13,19 +13,28 @@ Method | HTTP request | Description
## DeleteOrder
> DeleteOrder(ctx, orderId)
> DeleteOrder(ctx, orderId).Execute()
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**orderId** | **string**| ID of the order that needs to be deleted |
**orderId** | **string** | ID of the order that needs to be deleted |
### Other Parameters
Other parameters are passed through a pointer to a apiDeleteOrderRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
@ -47,16 +56,21 @@ No authorization required
## GetInventory
> map[string]int32 GetInventory(ctx, )
> map[string]int32 GetInventory(ctx).Execute()
Returns pet inventories by status
Returns a map of status codes to quantities
### Required Parameters
### Path Parameters
This endpoint does not need any parameter.
### Other Parameters
Other parameters are passed through a pointer to a apiGetInventoryRequest struct via the builder pattern
### Return type
**map[string]int32**
@ -77,19 +91,28 @@ This endpoint does not need any parameter.
## GetOrderById
> Order GetOrderById(ctx, orderId)
> Order GetOrderById(ctx, orderId).Execute()
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**orderId** | **int64**| ID of pet that needs to be fetched |
**orderId** | **int64** | ID of pet that needs to be fetched |
### Other Parameters
Other parameters are passed through a pointer to a apiGetOrderByIdRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
@ -111,17 +134,22 @@ No authorization required
## PlaceOrder
> Order PlaceOrder(ctx, order)
> Order PlaceOrder(ctx).Order(order).Execute()
Place an order for a pet
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiPlaceOrderRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
**order** | [**Order**](Order.md) | order placed for purchasing the pet |
### Return type

View File

@ -17,19 +17,24 @@ Method | HTTP request | Description
## CreateUser
> CreateUser(ctx, user)
> CreateUser(ctx).User(user).Execute()
Create user
This can only be done by the logged in user.
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiCreateUserRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**user** | [**User**](User.md)| Created user object |
**user** | [**User**](User.md) | Created user object |
### Return type
@ -51,17 +56,22 @@ No authorization required
## CreateUsersWithArrayInput
> CreateUsersWithArrayInput(ctx, user)
> CreateUsersWithArrayInput(ctx).User(user).Execute()
Creates list of users with given input array
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiCreateUsersWithArrayInputRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**user** | [**[]User**](User.md)| List of user object |
**user** | [**[]User**](User.md) | List of user object |
### Return type
@ -83,17 +93,22 @@ No authorization required
## CreateUsersWithListInput
> CreateUsersWithListInput(ctx, user)
> CreateUsersWithListInput(ctx).User(user).Execute()
Creates list of users with given input array
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiCreateUsersWithListInputRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**user** | [**[]User**](User.md)| List of user object |
**user** | [**[]User**](User.md) | List of user object |
### Return type
@ -115,19 +130,28 @@ No authorization required
## DeleteUser
> DeleteUser(ctx, username)
> DeleteUser(ctx, username).Execute()
Delete user
This can only be done by the logged in user.
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**username** | **string**| The name that needs to be deleted |
**username** | **string** | The name that needs to be deleted |
### Other Parameters
Other parameters are passed through a pointer to a apiDeleteUserRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
@ -149,17 +173,26 @@ No authorization required
## GetUserByName
> User GetUserByName(ctx, username)
> User GetUserByName(ctx, username).Execute()
Get user by user name
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
**username** | **string** | The name that needs to be fetched. Use user1 for testing. |
### Other Parameters
Other parameters are passed through a pointer to a apiGetUserByNameRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
### Return type
@ -181,18 +214,23 @@ No authorization required
## LoginUser
> string LoginUser(ctx, username, password)
> string LoginUser(ctx).Username(username).Password(password).Execute()
Logs user into the system
### Required Parameters
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiLoginUserRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**username** | **string**| The user name for login |
**password** | **string**| The password for login in clear text |
**username** | **string** | The user name for login |
**password** | **string** | The password for login in clear text |
### Return type
@ -214,14 +252,19 @@ No authorization required
## LogoutUser
> LogoutUser(ctx, )
> LogoutUser(ctx).Execute()
Logs out current logged in user session
### Required Parameters
### Path Parameters
This endpoint does not need any parameter.
### Other Parameters
Other parameters are passed through a pointer to a apiLogoutUserRequest struct via the builder pattern
### Return type
(empty response body)
@ -242,20 +285,29 @@ No authorization required
## UpdateUser
> UpdateUser(ctx, username, user)
> UpdateUser(ctx, username).User(user).Execute()
Updated user
This can only be done by the logged in user.
### Required Parameters
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**username** | **string**| name that need to be deleted |
**user** | [**User**](User.md)| Updated user object |
**username** | **string** | name that need to be deleted |
### Other Parameters
Other parameters are passed through a pointer to a apiUpdateUserRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**User**](User.md) | Updated user object |
### Return type