From 8183d96088551d77e8db18cd7f92e7f96153b876 Mon Sep 17 00:00:00 2001 From: Neil O'Toole Date: Fri, 2 Sep 2016 06:49:39 -0600 Subject: [PATCH] #3690 adding RequestURL, Method, Operation and Payload fields to APIResponse --- .../codegen/languages/GoClientCodegen.java | 3 +- .../src/main/resources/go/api.mustache | 18 +- .../main/resources/go/api_response.mustache | 14 +- .../additional_properties_class.go | 30 ++ .../client/petstore/go/go-petstore/animal.go | 30 ++ .../petstore/go/go-petstore/animal_farm.go | 26 ++ .../petstore/go/go-petstore/api_response.go | 14 +- .../array_of_array_of_number_only.go | 28 ++ .../go/go-petstore/array_of_number_only.go | 28 ++ .../petstore/go/go-petstore/array_test.go | 32 ++ samples/client/petstore/go/go-petstore/cat.go | 32 ++ .../client/petstore/go/go-petstore/client.go | 28 ++ .../docs/AdditionalPropertiesClass.md | 11 + .../petstore/go/go-petstore/docs/Animal.md | 11 + .../go/go-petstore/docs/AnimalFarm.md | 9 + .../docs/ArrayOfArrayOfNumberOnly.md | 10 + .../go/go-petstore/docs/ArrayOfNumberOnly.md | 10 + .../petstore/go/go-petstore/docs/ArrayTest.md | 12 + .../petstore/go/go-petstore/docs/Cat.md | 12 + .../petstore/go/go-petstore/docs/Client.md | 10 + .../petstore/go/go-petstore/docs/Dog.md | 12 + .../go/go-petstore/docs/EnumArrays.md | 11 + .../petstore/go/go-petstore/docs/EnumClass.md | 9 + .../petstore/go/go-petstore/docs/EnumTest.md | 12 + .../petstore/go/go-petstore/docs/FakeApi.md | 113 +++++++ .../go/go-petstore/docs/FormatTest.md | 22 ++ .../go/go-petstore/docs/HasOnlyReadOnly.md | 11 + .../petstore/go/go-petstore/docs/List.md | 10 + .../petstore/go/go-petstore/docs/MapTest.md | 11 + ...dPropertiesAndAdditionalPropertiesClass.md | 12 + .../go/go-petstore/docs/Model200Response.md | 11 + .../go/go-petstore/docs/ModelReturn.md | 10 + .../petstore/go/go-petstore/docs/Name.md | 13 + .../go/go-petstore/docs/NumberOnly.md | 10 + .../go/go-petstore/docs/ReadOnlyFirst.md | 11 + .../go/go-petstore/docs/SpecialModelName.md | 10 + samples/client/petstore/go/go-petstore/dog.go | 32 ++ .../petstore/go/go-petstore/enum_arrays.go | 30 ++ .../petstore/go/go-petstore/enum_class.go | 26 ++ .../petstore/go/go-petstore/enum_test.go | 32 ++ .../petstore/go/go-petstore/fake_api.go | 294 ++++++++++++++++++ .../petstore/go/go-petstore/format_test.go | 56 ++++ .../go/go-petstore/has_only_read_only.go | 30 ++ .../client/petstore/go/go-petstore/list.go | 28 ++ .../petstore/go/go-petstore/map_test.go | 30 ++ ...perties_and_additional_properties_class.go | 36 +++ .../go/go-petstore/model_200_response.go | 31 ++ .../petstore/go/go-petstore/model_return.go | 29 ++ .../client/petstore/go/go-petstore/name.go | 35 +++ .../petstore/go/go-petstore/number_only.go | 28 ++ .../client/petstore/go/go-petstore/pet_api.go | 138 ++++++-- .../go/go-petstore/read_only_first.go | 30 ++ .../go/go-petstore/special_model_name.go | 28 ++ .../petstore/go/go-petstore/store_api.go | 70 ++++- .../petstore/go/go-petstore/user_api.go | 138 ++++++-- 55 files changed, 1686 insertions(+), 91 deletions(-) create mode 100644 samples/client/petstore/go/go-petstore/additional_properties_class.go create mode 100644 samples/client/petstore/go/go-petstore/animal.go create mode 100644 samples/client/petstore/go/go-petstore/animal_farm.go create mode 100644 samples/client/petstore/go/go-petstore/array_of_array_of_number_only.go create mode 100644 samples/client/petstore/go/go-petstore/array_of_number_only.go create mode 100644 samples/client/petstore/go/go-petstore/array_test.go create mode 100644 samples/client/petstore/go/go-petstore/cat.go create mode 100644 samples/client/petstore/go/go-petstore/client.go create mode 100644 samples/client/petstore/go/go-petstore/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/go/go-petstore/docs/Animal.md create mode 100644 samples/client/petstore/go/go-petstore/docs/AnimalFarm.md create mode 100644 samples/client/petstore/go/go-petstore/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/go/go-petstore/docs/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/go/go-petstore/docs/ArrayTest.md create mode 100644 samples/client/petstore/go/go-petstore/docs/Cat.md create mode 100644 samples/client/petstore/go/go-petstore/docs/Client.md create mode 100644 samples/client/petstore/go/go-petstore/docs/Dog.md create mode 100644 samples/client/petstore/go/go-petstore/docs/EnumArrays.md create mode 100644 samples/client/petstore/go/go-petstore/docs/EnumClass.md create mode 100644 samples/client/petstore/go/go-petstore/docs/EnumTest.md create mode 100644 samples/client/petstore/go/go-petstore/docs/FakeApi.md create mode 100644 samples/client/petstore/go/go-petstore/docs/FormatTest.md create mode 100644 samples/client/petstore/go/go-petstore/docs/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/go/go-petstore/docs/List.md create mode 100644 samples/client/petstore/go/go-petstore/docs/MapTest.md create mode 100644 samples/client/petstore/go/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/go/go-petstore/docs/Model200Response.md create mode 100644 samples/client/petstore/go/go-petstore/docs/ModelReturn.md create mode 100644 samples/client/petstore/go/go-petstore/docs/Name.md create mode 100644 samples/client/petstore/go/go-petstore/docs/NumberOnly.md create mode 100644 samples/client/petstore/go/go-petstore/docs/ReadOnlyFirst.md create mode 100644 samples/client/petstore/go/go-petstore/docs/SpecialModelName.md create mode 100644 samples/client/petstore/go/go-petstore/dog.go create mode 100644 samples/client/petstore/go/go-petstore/enum_arrays.go create mode 100644 samples/client/petstore/go/go-petstore/enum_class.go create mode 100644 samples/client/petstore/go/go-petstore/enum_test.go create mode 100644 samples/client/petstore/go/go-petstore/fake_api.go create mode 100644 samples/client/petstore/go/go-petstore/format_test.go create mode 100644 samples/client/petstore/go/go-petstore/has_only_read_only.go create mode 100644 samples/client/petstore/go/go-petstore/list.go create mode 100644 samples/client/petstore/go/go-petstore/map_test.go create mode 100644 samples/client/petstore/go/go-petstore/mixed_properties_and_additional_properties_class.go create mode 100644 samples/client/petstore/go/go-petstore/model_200_response.go create mode 100644 samples/client/petstore/go/go-petstore/model_return.go create mode 100644 samples/client/petstore/go/go-petstore/name.go create mode 100644 samples/client/petstore/go/go-petstore/number_only.go create mode 100644 samples/client/petstore/go/go-petstore/read_only_first.go create mode 100644 samples/client/petstore/go/go-petstore/special_model_name.go diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java index 6bfd1df425f..9facbf6044b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java @@ -414,11 +414,10 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { } } - // this will only import "strings" "fmt" if there are items in pathParams + // this will only import "fmt" if there are items in pathParams for (CodegenOperation operation : operations) { if(operation.pathParams != null && operation.pathParams.size() > 0) { imports.add(createMapping("import", "fmt")); - imports.add(createMapping("import", "strings")); break; //just need to import once } } diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index 9165fb21e29..38c77384a7c 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -4,6 +4,7 @@ package {{packageName}} {{#operations}} import ( "net/url" + "strings" {{#imports}} "{{import}}" {{/imports}} ) @@ -38,7 +39,7 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}} { */ func (a {{{classname}}}) {{{nickname}}}({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{^isListContainer}}*{{/isListContainer}}{{{returnType}}}, {{/returnType}}*APIResponse, error) { - var localVarHttpMethod = "{{httpMethod}}" + var localVarHttpMethod = strings.ToUpper("{{httpMethod}}") // create path and map variables localVarPath := a.Configuration.BasePath + "{{path}}"{{#pathParams}} localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}} @@ -135,11 +136,20 @@ func (a {{{classname}}}) {{{nickname}}}({{#allParams}}{{paramName}} {{{dataType} {{/bodyParams}}{{/hasBodyParam}} {{#returnType}} var successPayload = new({{returnType}}){{/returnType}} localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "{{operationId}}", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}localVarAPIResponse, err } {{#returnType}} err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload){{/returnType}} - return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}NewAPIResponse(localVarHttpResponse.RawResponse), err + return {{#returnType}}{{#isListContainer}}*{{/isListContainer}}successPayload, {{/returnType}}localVarAPIResponse, err } {{/operation}}{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/go/api_response.mustache b/modules/swagger-codegen/src/main/resources/go/api_response.mustache index 9bacc9578e4..00ab14a5124 100644 --- a/modules/swagger-codegen/src/main/resources/go/api_response.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api_response.mustache @@ -6,8 +6,20 @@ import ( ) type APIResponse struct { - *http.Response + *http.Response `json:"-"` Message string `json:"message,omitempty"` + // Operation is the name of the swagger operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` } func NewAPIResponse(r *http.Response) *APIResponse { diff --git a/samples/client/petstore/go/go-petstore/additional_properties_class.go b/samples/client/petstore/go/go-petstore/additional_properties_class.go new file mode 100644 index 00000000000..ad768d2e478 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/additional_properties_class.go @@ -0,0 +1,30 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type AdditionalPropertiesClass struct { + + MapProperty map[string]string `json:"map_property,omitempty"` + + MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/animal.go b/samples/client/petstore/go/go-petstore/animal.go new file mode 100644 index 00000000000..bc9d8161db7 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/animal.go @@ -0,0 +1,30 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type Animal struct { + + ClassName string `json:"className,omitempty"` + + Color string `json:"color,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/animal_farm.go b/samples/client/petstore/go/go-petstore/animal_farm.go new file mode 100644 index 00000000000..a412cbcd450 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/animal_farm.go @@ -0,0 +1,26 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type AnimalFarm struct { +} diff --git a/samples/client/petstore/go/go-petstore/api_response.go b/samples/client/petstore/go/go-petstore/api_response.go index 0647a0d6b4d..2459f617a03 100644 --- a/samples/client/petstore/go/go-petstore/api_response.go +++ b/samples/client/petstore/go/go-petstore/api_response.go @@ -27,8 +27,20 @@ import ( ) type APIResponse struct { - *http.Response + *http.Response `json:"-"` Message string `json:"message,omitempty"` + // Operation is the name of the swagger operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` } func NewAPIResponse(r *http.Response) *APIResponse { diff --git a/samples/client/petstore/go/go-petstore/array_of_array_of_number_only.go b/samples/client/petstore/go/go-petstore/array_of_array_of_number_only.go new file mode 100644 index 00000000000..8fc05e77a16 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/array_of_array_of_number_only.go @@ -0,0 +1,28 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type ArrayOfArrayOfNumberOnly struct { + + ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/array_of_number_only.go b/samples/client/petstore/go/go-petstore/array_of_number_only.go new file mode 100644 index 00000000000..d9ef9a4c6d9 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/array_of_number_only.go @@ -0,0 +1,28 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type ArrayOfNumberOnly struct { + + ArrayNumber []float32 `json:"ArrayNumber,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/array_test.go b/samples/client/petstore/go/go-petstore/array_test.go new file mode 100644 index 00000000000..251f0a88efb --- /dev/null +++ b/samples/client/petstore/go/go-petstore/array_test.go @@ -0,0 +1,32 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type ArrayTest struct { + + ArrayOfString []string `json:"array_of_string,omitempty"` + + ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty"` + + ArrayArrayOfModel [][]ReadOnlyFirst `json:"array_array_of_model,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/cat.go b/samples/client/petstore/go/go-petstore/cat.go new file mode 100644 index 00000000000..f8526999824 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/cat.go @@ -0,0 +1,32 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type Cat struct { + + ClassName string `json:"className,omitempty"` + + Color string `json:"color,omitempty"` + + Declawed bool `json:"declawed,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go new file mode 100644 index 00000000000..e20c597d838 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/client.go @@ -0,0 +1,28 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type Client struct { + + Client string `json:"client,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/docs/AdditionalPropertiesClass.md b/samples/client/petstore/go/go-petstore/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..abdb42c8e01 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/AdditionalPropertiesClass.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapProperty** | **map[string]string** | | [optional] [default to null] +**MapOfMapProperty** | [**map[string]map[string]string**](map.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/Animal.md b/samples/client/petstore/go/go-petstore/docs/Animal.md new file mode 100644 index 00000000000..e7163af792c --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/Animal.md @@ -0,0 +1,11 @@ +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | [default to null] +**Color** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/AnimalFarm.md b/samples/client/petstore/go/go-petstore/docs/AnimalFarm.md new file mode 100644 index 00000000000..df6bab21dae --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/AnimalFarm.md @@ -0,0 +1,9 @@ +# AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/go/go-petstore/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..495038e58e1 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayNumber** | [**[][]float32**](array.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/ArrayOfNumberOnly.md b/samples/client/petstore/go/go-petstore/docs/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..bd7a48160d2 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayNumber** | **[]float32** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/ArrayTest.md b/samples/client/petstore/go/go-petstore/docs/ArrayTest.md new file mode 100644 index 00000000000..6cf88880292 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/ArrayTest.md @@ -0,0 +1,12 @@ +# ArrayTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayOfString** | **[]string** | | [optional] [default to null] +**ArrayArrayOfInteger** | [**[][]int64**](array.md) | | [optional] [default to null] +**ArrayArrayOfModel** | [**[][]ReadOnlyFirst**](array.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/Cat.md b/samples/client/petstore/go/go-petstore/docs/Cat.md new file mode 100644 index 00000000000..3a49c3ca62e --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/Cat.md @@ -0,0 +1,12 @@ +# Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | [default to null] +**Color** | **string** | | [optional] [default to null] +**Declawed** | **bool** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/Client.md b/samples/client/petstore/go/go-petstore/docs/Client.md new file mode 100644 index 00000000000..d8edb814853 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/Client.md @@ -0,0 +1,10 @@ +# Client + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Client** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/Dog.md b/samples/client/petstore/go/go-petstore/docs/Dog.md new file mode 100644 index 00000000000..7178972d5dc --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/Dog.md @@ -0,0 +1,12 @@ +# Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | [default to null] +**Color** | **string** | | [optional] [default to null] +**Breed** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/EnumArrays.md b/samples/client/petstore/go/go-petstore/docs/EnumArrays.md new file mode 100644 index 00000000000..2ca85fdd1fb --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/EnumArrays.md @@ -0,0 +1,11 @@ +# EnumArrays + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustSymbol** | **string** | | [optional] [default to null] +**ArrayEnum** | **[]string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/EnumClass.md b/samples/client/petstore/go/go-petstore/docs/EnumClass.md new file mode 100644 index 00000000000..67f017becd0 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/EnumClass.md @@ -0,0 +1,9 @@ +# EnumClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/EnumTest.md b/samples/client/petstore/go/go-petstore/docs/EnumTest.md new file mode 100644 index 00000000000..fe6ca0cb32d --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/EnumTest.md @@ -0,0 +1,12 @@ +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumString** | **string** | | [optional] [default to null] +**EnumInteger** | **int32** | | [optional] [default to null] +**EnumNumber** | **float64** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/client/petstore/go/go-petstore/docs/FakeApi.md new file mode 100644 index 00000000000..63e7fb728fb --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/FakeApi.md @@ -0,0 +1,113 @@ +# \FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestClientModel**](FakeApi.md#TestClientModel) | **Patch** /fake | To test \"client\" model +[**TestEndpointParameters**](FakeApi.md#TestEndpointParameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**TestEnumParameters**](FakeApi.md#TestEnumParameters) | **Get** /fake | To test enum parameters + + +# **TestClientModel** +> Client TestClientModel($body) + +To test \"client\" model + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestEndpointParameters** +> TestEndpointParameters($number, $double, $patternWithoutDelimiter, $byte_, $integer, $int32_, $int64_, $float, $string_, $binary, $date, $dateTime, $password) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **float32**| None | + **double** | **float64**| None | + **patternWithoutDelimiter** | **string**| None | + **byte_** | **string**| None | + **integer** | **int32**| None | [optional] + **int32_** | **int32**| None | [optional] + **int64_** | **int64**| None | [optional] + **float** | **float32**| None | [optional] + **string_** | **string**| None | [optional] + **binary** | **string**| None | [optional] + **date** | **time.Time**| None | [optional] + **dateTime** | **time.Time**| None | [optional] + **password** | **string**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8 + - **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TestEnumParameters** +> TestEnumParameters($enumFormStringArray, $enumFormString, $enumHeaderStringArray, $enumHeaderString, $enumQueryStringArray, $enumQueryString, $enumQueryInteger, $enumQueryDouble) + +To test enum parameters + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumFormStringArray** | [**[]string**](string.md)| Form parameter enum test (string array) | [optional] + **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] + **enumHeaderStringArray** | [**[]string**](string.md)| Header parameter enum test (string array) | [optional] + **enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg] + **enumQueryStringArray** | [**[]string**](string.md)| Query parameter enum test (string array) | [optional] + **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] + **enumQueryInteger** | **float32**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **float64**| Query parameter enum test (double) | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/go/go-petstore/docs/FormatTest.md b/samples/client/petstore/go/go-petstore/docs/FormatTest.md new file mode 100644 index 00000000000..05f41a8039f --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/FormatTest.md @@ -0,0 +1,22 @@ +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | **int32** | | [optional] [default to null] +**Int32_** | **int32** | | [optional] [default to null] +**Int64_** | **int64** | | [optional] [default to null] +**Number** | **float32** | | [default to null] +**Float** | **float32** | | [optional] [default to null] +**Double** | **float64** | | [optional] [default to null] +**String_** | **string** | | [optional] [default to null] +**Byte_** | **string** | | [default to null] +**Binary** | **string** | | [optional] [default to null] +**Date** | [**time.Time**](time.Time.md) | | [default to null] +**DateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Uuid** | **string** | | [optional] [default to null] +**Password** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/HasOnlyReadOnly.md b/samples/client/petstore/go/go-petstore/docs/HasOnlyReadOnly.md new file mode 100644 index 00000000000..32dfdedcfe7 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ +# HasOnlyReadOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [default to null] +**Foo** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/List.md b/samples/client/petstore/go/go-petstore/docs/List.md new file mode 100644 index 00000000000..54fd3876c26 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/List.md @@ -0,0 +1,10 @@ +# List + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Var123List** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/MapTest.md b/samples/client/petstore/go/go-petstore/docs/MapTest.md new file mode 100644 index 00000000000..6b70bf448e8 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/MapTest.md @@ -0,0 +1,11 @@ +# MapTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MapMapOfString** | [**map[string]map[string]string**](map.md) | | [optional] [default to null] +**MapOfEnumString** | **map[string]string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/go/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..b4de97169dd --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,12 @@ +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Uuid** | **string** | | [optional] [default to null] +**DateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Map_** | [**map[string]Animal**](Animal.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/Model200Response.md b/samples/client/petstore/go/go-petstore/docs/Model200Response.md new file mode 100644 index 00000000000..8b4bb38033d --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/Model200Response.md @@ -0,0 +1,11 @@ +# Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **int32** | | [optional] [default to null] +**Class** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/ModelReturn.md b/samples/client/petstore/go/go-petstore/docs/ModelReturn.md new file mode 100644 index 00000000000..86350d4310c --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/ModelReturn.md @@ -0,0 +1,10 @@ +# ModelReturn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Return_** | **int32** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/Name.md b/samples/client/petstore/go/go-petstore/docs/Name.md new file mode 100644 index 00000000000..d677e60263f --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/Name.md @@ -0,0 +1,13 @@ +# Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **int32** | | [default to null] +**SnakeCase** | **int32** | | [optional] [default to null] +**Property** | **string** | | [optional] [default to null] +**Var123Number** | **int32** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/NumberOnly.md b/samples/client/petstore/go/go-petstore/docs/NumberOnly.md new file mode 100644 index 00000000000..3ebbf2f0308 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/NumberOnly.md @@ -0,0 +1,10 @@ +# NumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustNumber** | **float32** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/ReadOnlyFirst.md b/samples/client/petstore/go/go-petstore/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..3ff591d7a74 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/ReadOnlyFirst.md @@ -0,0 +1,11 @@ +# ReadOnlyFirst + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [default to null] +**Baz** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/SpecialModelName.md b/samples/client/petstore/go/go-petstore/docs/SpecialModelName.md new file mode 100644 index 00000000000..dcf601a308d --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/SpecialModelName.md @@ -0,0 +1,10 @@ +# SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SpecialPropertyName** | **int64** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/dog.go b/samples/client/petstore/go/go-petstore/dog.go new file mode 100644 index 00000000000..acf4999618e --- /dev/null +++ b/samples/client/petstore/go/go-petstore/dog.go @@ -0,0 +1,32 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type Dog struct { + + ClassName string `json:"className,omitempty"` + + Color string `json:"color,omitempty"` + + Breed string `json:"breed,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/enum_arrays.go b/samples/client/petstore/go/go-petstore/enum_arrays.go new file mode 100644 index 00000000000..3b42ad142b5 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/enum_arrays.go @@ -0,0 +1,30 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type EnumArrays struct { + + JustSymbol string `json:"just_symbol,omitempty"` + + ArrayEnum []string `json:"array_enum,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/enum_class.go b/samples/client/petstore/go/go-petstore/enum_class.go new file mode 100644 index 00000000000..4a63f179dd3 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/enum_class.go @@ -0,0 +1,26 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type EnumClass struct { +} diff --git a/samples/client/petstore/go/go-petstore/enum_test.go b/samples/client/petstore/go/go-petstore/enum_test.go new file mode 100644 index 00000000000..c2be92c6246 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/enum_test.go @@ -0,0 +1,32 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type EnumTest struct { + + EnumString string `json:"enum_string,omitempty"` + + EnumInteger int32 `json:"enum_integer,omitempty"` + + EnumNumber float64 `json:"enum_number,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/fake_api.go b/samples/client/petstore/go/go-petstore/fake_api.go new file mode 100644 index 00000000000..3777a812813 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/fake_api.go @@ -0,0 +1,294 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +import ( + "net/url" + "strings" + "time" + "encoding/json" +) + +type FakeApi struct { + Configuration *Configuration +} + +func NewFakeApi() *FakeApi { + configuration := NewConfiguration() + return &FakeApi{ + Configuration: configuration, + } +} + +func NewFakeApiWithBasePath(basePath string) *FakeApi { + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &FakeApi{ + Configuration: configuration, + } +} + +/** + * To test \"client\" model + * + * @param body client model + * @return *Client + */ +func (a FakeApi) TestClientModel(body Client) (*Client, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Patch") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + + var successPayload = new(Client) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "TestClientModel", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @param number None + * @param double None + * @param patternWithoutDelimiter None + * @param byte_ None + * @param integer None + * @param int32_ None + * @param int64_ None + * @param float None + * @param string_ None + * @param binary None + * @param date None + * @param dateTime None + * @param password None + * @return void + */ +func (a FakeApi) TestEndpointParameters(number float32, double float64, patternWithoutDelimiter string, byte_ string, integer int32, int32_ int32, int64_ int64, float float32, string_ string, binary string, date time.Time, dateTime time.Time, password string) (*APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // authentication '(http_basic_test)' required + // http basic authentication required + if a.Configuration.UserName != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + } + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/xml; charset=utf-8", "application/json; charset=utf-8", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/xml; charset=utf-8", +"application/json; charset=utf-8", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + localVarFormParams["integer"] = a.Configuration.APIClient.ParameterToString(integer, "") + localVarFormParams["int32_"] = a.Configuration.APIClient.ParameterToString(int32_, "") + localVarFormParams["int64_"] = a.Configuration.APIClient.ParameterToString(int64_, "") + localVarFormParams["number"] = a.Configuration.APIClient.ParameterToString(number, "") + localVarFormParams["float"] = a.Configuration.APIClient.ParameterToString(float, "") + localVarFormParams["double"] = a.Configuration.APIClient.ParameterToString(double, "") + localVarFormParams["string_"] = a.Configuration.APIClient.ParameterToString(string_, "") + localVarFormParams["patternWithoutDelimiter"] = a.Configuration.APIClient.ParameterToString(patternWithoutDelimiter, "") + localVarFormParams["byte_"] = a.Configuration.APIClient.ParameterToString(byte_, "") + localVarFormParams["binary"] = a.Configuration.APIClient.ParameterToString(binary, "") + localVarFormParams["date"] = a.Configuration.APIClient.ParameterToString(date, "") + localVarFormParams["dateTime"] = a.Configuration.APIClient.ParameterToString(dateTime, "") + localVarFormParams["password"] = a.Configuration.APIClient.ParameterToString(password, "") + + + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "TestEndpointParameters", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err +} + +/** + * To test enum parameters + * + * @param enumFormStringArray Form parameter enum test (string array) + * @param enumFormString Form parameter enum test (string) + * @param enumHeaderStringArray Header parameter enum test (string array) + * @param enumHeaderString Header parameter enum test (string) + * @param enumQueryStringArray Query parameter enum test (string array) + * @param enumQueryString Query parameter enum test (string) + * @param enumQueryInteger Query parameter enum test (double) + * @param enumQueryDouble Query parameter enum test (double) + * @return void + */ +func (a FakeApi) TestEnumParameters(enumFormStringArray []string, enumFormString string, enumHeaderStringArray []string, enumHeaderString string, enumQueryStringArray []string, enumQueryString string, enumQueryInteger float32, enumQueryDouble float64) (*APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/fake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + var collectionFormat = "csv" + if collectionFormat == "multi" { + for _, value := range enumQueryStringArray { + localVarQueryParams.Add("enum_query_string_array", value) + } + } else { + localVarQueryParams.Add("enum_query_string_array", a.Configuration.APIClient.ParameterToString(enumQueryStringArray, collectionFormat)) + } + localVarQueryParams.Add("enum_query_string", a.Configuration.APIClient.ParameterToString(enumQueryString, "")) + localVarQueryParams.Add("enum_query_integer", a.Configuration.APIClient.ParameterToString(enumQueryInteger, "")) + + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + + // header params "enum_header_string_array" + localVarHeaderParams["enum_header_string_array"] = a.Configuration.APIClient.ParameterToString(enumHeaderStringArray, "") + // header params "enum_header_string" + localVarHeaderParams["enum_header_string"] = a.Configuration.APIClient.ParameterToString(enumHeaderString, "") + + localVarFormParams["enumFormStringArray"] = a.Configuration.APIClient.ParameterToString(enumFormStringArray, "") + localVarFormParams["enumFormString"] = a.Configuration.APIClient.ParameterToString(enumFormString, "") + localVarFormParams["enumQueryDouble"] = a.Configuration.APIClient.ParameterToString(enumQueryDouble, "") + + + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "TestEnumParameters", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err +} + diff --git a/samples/client/petstore/go/go-petstore/format_test.go b/samples/client/petstore/go/go-petstore/format_test.go new file mode 100644 index 00000000000..fa370de4d12 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/format_test.go @@ -0,0 +1,56 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +import ( + "time" +) + +type FormatTest struct { + + Integer int32 `json:"integer,omitempty"` + + Int32_ int32 `json:"int32,omitempty"` + + Int64_ int64 `json:"int64,omitempty"` + + Number float32 `json:"number,omitempty"` + + Float float32 `json:"float,omitempty"` + + Double float64 `json:"double,omitempty"` + + String_ string `json:"string,omitempty"` + + Byte_ string `json:"byte,omitempty"` + + Binary string `json:"binary,omitempty"` + + Date time.Time `json:"date,omitempty"` + + DateTime time.Time `json:"dateTime,omitempty"` + + Uuid string `json:"uuid,omitempty"` + + Password string `json:"password,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/has_only_read_only.go b/samples/client/petstore/go/go-petstore/has_only_read_only.go new file mode 100644 index 00000000000..f95600a35bc --- /dev/null +++ b/samples/client/petstore/go/go-petstore/has_only_read_only.go @@ -0,0 +1,30 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type HasOnlyReadOnly struct { + + Bar string `json:"bar,omitempty"` + + Foo string `json:"foo,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/list.go b/samples/client/petstore/go/go-petstore/list.go new file mode 100644 index 00000000000..7fcab1a6d84 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/list.go @@ -0,0 +1,28 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type List struct { + + Var123List string `json:"123-list,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/map_test.go b/samples/client/petstore/go/go-petstore/map_test.go new file mode 100644 index 00000000000..88b060ef3c4 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/map_test.go @@ -0,0 +1,30 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type MapTest struct { + + MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty"` + + MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/mixed_properties_and_additional_properties_class.go b/samples/client/petstore/go/go-petstore/mixed_properties_and_additional_properties_class.go new file mode 100644 index 00000000000..6a34a75cefc --- /dev/null +++ b/samples/client/petstore/go/go-petstore/mixed_properties_and_additional_properties_class.go @@ -0,0 +1,36 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +import ( + "time" +) + +type MixedPropertiesAndAdditionalPropertiesClass struct { + + Uuid string `json:"uuid,omitempty"` + + DateTime time.Time `json:"dateTime,omitempty"` + + Map_ map[string]Animal `json:"map,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/model_200_response.go b/samples/client/petstore/go/go-petstore/model_200_response.go new file mode 100644 index 00000000000..6fefe4b6ab7 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/model_200_response.go @@ -0,0 +1,31 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +// Model for testing model name starting with number +type Model200Response struct { + + Name int32 `json:"name,omitempty"` + + Class string `json:"class,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/model_return.go b/samples/client/petstore/go/go-petstore/model_return.go new file mode 100644 index 00000000000..a2f3244ebf5 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/model_return.go @@ -0,0 +1,29 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +// Model for testing reserved words +type ModelReturn struct { + + Return_ int32 `json:"return,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/name.go b/samples/client/petstore/go/go-petstore/name.go new file mode 100644 index 00000000000..6bde7a16d00 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/name.go @@ -0,0 +1,35 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +// Model for testing model name same as property name +type Name struct { + + Name int32 `json:"name,omitempty"` + + SnakeCase int32 `json:"snake_case,omitempty"` + + Property string `json:"property,omitempty"` + + Var123Number int32 `json:"123Number,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/number_only.go b/samples/client/petstore/go/go-petstore/number_only.go new file mode 100644 index 00000000000..96a0d7f2133 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/number_only.go @@ -0,0 +1,28 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type NumberOnly struct { + + JustNumber float32 `json:"JustNumber,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index 04cc352d2bb..23f0380de95 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -24,11 +24,11 @@ package petstore import ( "net/url" + "strings" "os" "io/ioutil" "encoding/json" "fmt" - "strings" ) type PetApi struct { @@ -60,7 +60,7 @@ func NewPetApiWithBasePath(basePath string) *PetApi { */ func (a PetApi) AddPet(body Pet) (*APIResponse, error) { - var localVarHttpMethod = "Post" + var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables localVarPath := a.Configuration.BasePath + "/pet" @@ -105,11 +105,20 @@ func (a PetApi) AddPet(body Pet) (*APIResponse, error) { localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "AddPet", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() } - return NewAPIResponse(localVarHttpResponse.RawResponse), err +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err } /** @@ -122,7 +131,7 @@ func (a PetApi) AddPet(body Pet) (*APIResponse, error) { */ func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) { - var localVarHttpMethod = "Delete" + var localVarHttpMethod = strings.ToUpper("Delete") // create path and map variables localVarPath := a.Configuration.BasePath + "/pet/{petId}" localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) @@ -170,11 +179,20 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) { localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "DeletePet", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() } - return NewAPIResponse(localVarHttpResponse.RawResponse), err +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err } /** @@ -186,7 +204,7 @@ func (a PetApi) DeletePet(petId int64, apiKey string) (*APIResponse, error) { */ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) { - var localVarHttpMethod = "Get" + var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables localVarPath := a.Configuration.BasePath + "/pet/findByStatus" @@ -237,11 +255,20 @@ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) { var successPayload = new([]Pet) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "FindPetsByStatus", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return *successPayload, localVarAPIResponse, err } err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + return *successPayload, localVarAPIResponse, err } /** @@ -253,7 +280,7 @@ func (a PetApi) FindPetsByStatus(status []string) ([]Pet, *APIResponse, error) { */ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) { - var localVarHttpMethod = "Get" + var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables localVarPath := a.Configuration.BasePath + "/pet/findByTags" @@ -304,11 +331,20 @@ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) { var successPayload = new([]Pet) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "FindPetsByTags", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return *successPayload, localVarAPIResponse, err } err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return *successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + return *successPayload, localVarAPIResponse, err } /** @@ -320,7 +356,7 @@ func (a PetApi) FindPetsByTags(tags []string) ([]Pet, *APIResponse, error) { */ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) { - var localVarHttpMethod = "Get" + var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables localVarPath := a.Configuration.BasePath + "/pet/{petId}" localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) @@ -362,11 +398,20 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) { var successPayload = new(Pet) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "GetPetById", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return successPayload, localVarAPIResponse, err } err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + return successPayload, localVarAPIResponse, err } /** @@ -378,7 +423,7 @@ func (a PetApi) GetPetById(petId int64) (*Pet, *APIResponse, error) { */ func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) { - var localVarHttpMethod = "Put" + var localVarHttpMethod = strings.ToUpper("Put") // create path and map variables localVarPath := a.Configuration.BasePath + "/pet" @@ -423,11 +468,20 @@ func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) { localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "UpdatePet", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() } - return NewAPIResponse(localVarHttpResponse.RawResponse), err +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err } /** @@ -441,7 +495,7 @@ func (a PetApi) UpdatePet(body Pet) (*APIResponse, error) { */ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*APIResponse, error) { - var localVarHttpMethod = "Post" + var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables localVarPath := a.Configuration.BasePath + "/pet/{petId}" localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) @@ -487,11 +541,20 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*API localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "UpdatePetWithForm", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() } - return NewAPIResponse(localVarHttpResponse.RawResponse), err +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err } /** @@ -505,7 +568,7 @@ func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (*API */ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File) (*ModelApiResponse, *APIResponse, error) { - var localVarHttpMethod = "Post" + var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables localVarPath := a.Configuration.BasePath + "/pet/{petId}/uploadImage" localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1) @@ -552,10 +615,19 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File var successPayload = new(ModelApiResponse) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "UploadFile", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return successPayload, localVarAPIResponse, err } err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + return successPayload, localVarAPIResponse, err } diff --git a/samples/client/petstore/go/go-petstore/read_only_first.go b/samples/client/petstore/go/go-petstore/read_only_first.go new file mode 100644 index 00000000000..9d8e6351fdf --- /dev/null +++ b/samples/client/petstore/go/go-petstore/read_only_first.go @@ -0,0 +1,30 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type ReadOnlyFirst struct { + + Bar string `json:"bar,omitempty"` + + Baz string `json:"baz,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/special_model_name.go b/samples/client/petstore/go/go-petstore/special_model_name.go new file mode 100644 index 00000000000..7bbb2093ef4 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/special_model_name.go @@ -0,0 +1,28 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package petstore + +type SpecialModelName struct { + + SpecialPropertyName int64 `json:"$special[property.name],omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/store_api.go b/samples/client/petstore/go/go-petstore/store_api.go index 898dc59d264..9318add7d6c 100644 --- a/samples/client/petstore/go/go-petstore/store_api.go +++ b/samples/client/petstore/go/go-petstore/store_api.go @@ -24,9 +24,9 @@ package petstore import ( "net/url" + "strings" "encoding/json" "fmt" - "strings" ) type StoreApi struct { @@ -58,7 +58,7 @@ func NewStoreApiWithBasePath(basePath string) *StoreApi { */ func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) { - var localVarHttpMethod = "Delete" + var localVarHttpMethod = strings.ToUpper("Delete") // create path and map variables localVarPath := a.Configuration.BasePath + "/store/order/{orderId}" localVarPath = strings.Replace(localVarPath, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1) @@ -97,11 +97,20 @@ func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) { localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "DeleteOrder", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() } - return NewAPIResponse(localVarHttpResponse.RawResponse), err +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err } /** @@ -112,7 +121,7 @@ func (a StoreApi) DeleteOrder(orderId string) (*APIResponse, error) { */ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) { - var localVarHttpMethod = "Get" + var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables localVarPath := a.Configuration.BasePath + "/store/inventory" @@ -152,11 +161,20 @@ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) { var successPayload = new(map[string]int32) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "GetInventory", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return successPayload, localVarAPIResponse, err } err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + return successPayload, localVarAPIResponse, err } /** @@ -168,7 +186,7 @@ func (a StoreApi) GetInventory() (*map[string]int32, *APIResponse, error) { */ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) { - var localVarHttpMethod = "Get" + var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables localVarPath := a.Configuration.BasePath + "/store/order/{orderId}" localVarPath = strings.Replace(localVarPath, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1) @@ -207,11 +225,20 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) { var successPayload = new(Order) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "GetOrderById", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return successPayload, localVarAPIResponse, err } err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + return successPayload, localVarAPIResponse, err } /** @@ -223,7 +250,7 @@ func (a StoreApi) GetOrderById(orderId int64) (*Order, *APIResponse, error) { */ func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) { - var localVarHttpMethod = "Post" + var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables localVarPath := a.Configuration.BasePath + "/store/order" @@ -263,10 +290,19 @@ func (a StoreApi) PlaceOrder(body Order) (*Order, *APIResponse, error) { var successPayload = new(Order) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "PlaceOrder", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return successPayload, localVarAPIResponse, err } err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + return successPayload, localVarAPIResponse, err } diff --git a/samples/client/petstore/go/go-petstore/user_api.go b/samples/client/petstore/go/go-petstore/user_api.go index 262312d986a..04f8fe4cfe6 100644 --- a/samples/client/petstore/go/go-petstore/user_api.go +++ b/samples/client/petstore/go/go-petstore/user_api.go @@ -24,9 +24,9 @@ package petstore import ( "net/url" + "strings" "encoding/json" "fmt" - "strings" ) type UserApi struct { @@ -58,7 +58,7 @@ func NewUserApiWithBasePath(basePath string) *UserApi { */ func (a UserApi) CreateUser(body User) (*APIResponse, error) { - var localVarHttpMethod = "Post" + var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables localVarPath := a.Configuration.BasePath + "/user" @@ -98,11 +98,20 @@ func (a UserApi) CreateUser(body User) (*APIResponse, error) { localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "CreateUser", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() } - return NewAPIResponse(localVarHttpResponse.RawResponse), err +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err } /** @@ -114,7 +123,7 @@ func (a UserApi) CreateUser(body User) (*APIResponse, error) { */ func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) { - var localVarHttpMethod = "Post" + var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables localVarPath := a.Configuration.BasePath + "/user/createWithArray" @@ -154,11 +163,20 @@ func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) { localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "CreateUsersWithArrayInput", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() } - return NewAPIResponse(localVarHttpResponse.RawResponse), err +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err } /** @@ -170,7 +188,7 @@ func (a UserApi) CreateUsersWithArrayInput(body []User) (*APIResponse, error) { */ func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) { - var localVarHttpMethod = "Post" + var localVarHttpMethod = strings.ToUpper("Post") // create path and map variables localVarPath := a.Configuration.BasePath + "/user/createWithList" @@ -210,11 +228,20 @@ func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) { localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "CreateUsersWithListInput", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() } - return NewAPIResponse(localVarHttpResponse.RawResponse), err +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err } /** @@ -226,7 +253,7 @@ func (a UserApi) CreateUsersWithListInput(body []User) (*APIResponse, error) { */ func (a UserApi) DeleteUser(username string) (*APIResponse, error) { - var localVarHttpMethod = "Delete" + var localVarHttpMethod = strings.ToUpper("Delete") // create path and map variables localVarPath := a.Configuration.BasePath + "/user/{username}" localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) @@ -265,11 +292,20 @@ func (a UserApi) DeleteUser(username string) (*APIResponse, error) { localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "DeleteUser", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() } - return NewAPIResponse(localVarHttpResponse.RawResponse), err +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err } /** @@ -281,7 +317,7 @@ func (a UserApi) DeleteUser(username string) (*APIResponse, error) { */ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) { - var localVarHttpMethod = "Get" + var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables localVarPath := a.Configuration.BasePath + "/user/{username}" localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) @@ -320,11 +356,20 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) { var successPayload = new(User) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "GetUserByName", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return successPayload, localVarAPIResponse, err } err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + return successPayload, localVarAPIResponse, err } /** @@ -337,7 +382,7 @@ func (a UserApi) GetUserByName(username string) (*User, *APIResponse, error) { */ func (a UserApi) LoginUser(username string, password string) (*string, *APIResponse, error) { - var localVarHttpMethod = "Get" + var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables localVarPath := a.Configuration.BasePath + "/user/login" @@ -377,11 +422,20 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo var successPayload = new(string) localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "LoginUser", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + +if err != nil { + return successPayload, localVarAPIResponse, err } err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, NewAPIResponse(localVarHttpResponse.RawResponse), err + return successPayload, localVarAPIResponse, err } /** @@ -392,7 +446,7 @@ func (a UserApi) LoginUser(username string, password string) (*string, *APIRespo */ func (a UserApi) LogoutUser() (*APIResponse, error) { - var localVarHttpMethod = "Get" + var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables localVarPath := a.Configuration.BasePath + "/user/logout" @@ -430,11 +484,20 @@ func (a UserApi) LogoutUser() (*APIResponse, error) { localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "LogoutUser", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() } - return NewAPIResponse(localVarHttpResponse.RawResponse), err +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err } /** @@ -447,7 +510,7 @@ func (a UserApi) LogoutUser() (*APIResponse, error) { */ func (a UserApi) UpdateUser(username string, body User) (*APIResponse, error) { - var localVarHttpMethod = "Put" + var localVarHttpMethod = strings.ToUpper("Put") // create path and map variables localVarPath := a.Configuration.BasePath + "/user/{username}" localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) @@ -488,10 +551,19 @@ func (a UserApi) UpdateUser(username string, body User) (*APIResponse, error) { localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return NewAPIResponse(localVarHttpResponse.RawResponse), err + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "UpdateUser", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() } - return NewAPIResponse(localVarHttpResponse.RawResponse), err +if err != nil { + return localVarAPIResponse, err + } + + return localVarAPIResponse, err }