diff --git a/bin/configs/go-echo-external-refs-test.yaml b/bin/configs/go-echo-external-refs-test.yaml new file mode 100644 index 00000000000..b4145a26d48 --- /dev/null +++ b/bin/configs/go-echo-external-refs-test.yaml @@ -0,0 +1,6 @@ +generatorName: go +outputDir: samples/client/echo_api/go-external-refs +inputSpec: modules/openapi-generator/src/test/resources/3_0/external-refs/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/go +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/modules/openapi-generator/src/test/resources/3_0/external-refs/components/paths/string.yaml b/modules/openapi-generator/src/test/resources/3_0/external-refs/components/paths/string.yaml new file mode 100644 index 00000000000..4f7c0eff6b2 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/external-refs/components/paths/string.yaml @@ -0,0 +1,46 @@ +get: + description: Test path parameter(s) + operationId: "tests/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}" + parameters: + - explode: false + in: path + name: path_string + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: path_integer + required: true + schema: + type: integer + style: simple + - explode: false + in: path + name: enum_nonref_string_path + required: true + schema: + enum: + - success + - failure + - unclassified + type: string + style: simple + - explode: false + in: path + name: enum_ref_string_path + required: true + schema: + $ref: "../schemas/StringEnumRef.yaml" + style: simple + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test path parameter(s) + tags: + - path diff --git a/modules/openapi-generator/src/test/resources/3_0/external-refs/components/schemas/StringEnumRef.yaml b/modules/openapi-generator/src/test/resources/3_0/external-refs/components/schemas/StringEnumRef.yaml new file mode 100644 index 00000000000..7f33c7d2412 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/external-refs/components/schemas/StringEnumRef.yaml @@ -0,0 +1,5 @@ +type: string +enum: + - success + - failure + - unclassified diff --git a/modules/openapi-generator/src/test/resources/3_0/external-refs/echo_api.yaml b/modules/openapi-generator/src/test/resources/3_0/external-refs/echo_api.yaml new file mode 100644 index 00000000000..34446927b27 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/external-refs/echo_api.yaml @@ -0,0 +1,837 @@ +openapi: 3.0.3 +info: + contact: + email: team@openapitools.org + description: Echo Server API + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: Echo Server API + version: 0.1.0 +servers: + - url: http://localhost:3000/ +paths: + ? /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} + : $ref: "./components/paths/string.yaml" + /form/integer/boolean/string: + post: + description: Test form parameter(s) + operationId: test/form/integer/boolean/string + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/test_form_integer_boolean_string_request" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test form parameter(s) + tags: + - form + /form/oneof: + post: + description: Test form parameter(s) for oneOf schema + operationId: test/form/oneof + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/test_form_oneof_request" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test form parameter(s) for oneOf schema + tags: + - form + /header/integer/boolean/string/enums: + get: + description: Test header parameter(s) + operationId: test/header/integer/boolean/string/enums + parameters: + - explode: true + in: header + name: integer_header + required: false + schema: + type: integer + style: form + - explode: true + in: header + name: boolean_header + required: false + schema: + type: boolean + style: form + - explode: true + in: header + name: string_header + required: false + schema: + type: string + style: form + - explode: true + in: header + name: enum_nonref_string_header + required: false + schema: + enum: + - success + - failure + - unclassified + type: string + style: form + - explode: true + in: header + name: enum_ref_string_header + required: false + schema: + $ref: "#/components/schemas/StringEnumRef" + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test header parameter(s) + tags: + - header + /query/enum_ref_string: + get: + description: Test query parameter(s) + operationId: test/enum_ref_string + parameters: + - explode: true + in: query + name: enum_nonref_string_query + required: false + schema: + enum: + - success + - failure + - unclassified + type: string + style: form + - explode: true + in: query + name: enum_ref_string_query + required: false + schema: + $ref: "#/components/schemas/StringEnumRef" + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/datetime/date/string: + get: + description: Test query parameter(s) + operationId: test/query/datetime/date/string + parameters: + - explode: true + in: query + name: datetime_query + required: false + schema: + format: date-time + type: string + style: form + - explode: true + in: query + name: date_query + required: false + schema: + format: date + type: string + style: form + - explode: true + in: query + name: string_query + required: false + schema: + type: string + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/integer/boolean/string: + get: + description: Test query parameter(s) + operationId: test/query/integer/boolean/string + parameters: + - explode: true + in: query + name: integer_query + required: false + schema: + type: integer + style: form + - explode: true + in: query + name: boolean_query + required: false + schema: + type: boolean + style: form + - explode: true + in: query + name: string_query + required: false + schema: + type: string + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_form/explode_true/array_string: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/array_string + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: "#/components/schemas/test_query_style_form_explode_true_array_string_query_object_parameter" + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_form/explode_false/array_integer: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_false/array_integer + parameters: + - explode: false + in: query + name: query_object + required: false + schema: + items: + type: integer + type: array + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_form/explode_false/array_string: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_false/array_string + parameters: + - explode: false + in: query + name: query_object + required: false + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_form/explode_true/object: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/object + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: "#/components/schemas/Pet" + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_form/explode_true/object/allOf: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/object/allOf + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: "#/components/schemas/DataQuery" + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_deepObject/explode_true/object: + get: + description: Test query parameter(s) + operationId: test/query/style_deepObject/explode_true/object + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: "#/components/schemas/Pet" + style: deepObject + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_deepObject/explode_true/object/allOf: + get: + description: Test query parameter(s) + operationId: test/query/style_deepObject/explode_true/object/allOf + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: "#/components/schemas/test_query_style_deepObject_explode_true_object_allOf_query_object_parameter" + style: deepObject + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /body/application/octetstream/binary: + post: + description: Test body parameter(s) + operationId: test/body/application/octetstream/binary + requestBody: + content: + application/octet-stream: + schema: + format: binary + type: string + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test body parameter(s) + tags: + - body + /echo/body/Pet: + post: + description: Test body parameter(s) + operationId: test/echo/body/Pet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: Successful operation + summary: Test body parameter(s) + tags: + - body + /echo/body/allOf/Pet: + post: + description: Test body parameter(s) + operationId: test/echo/body/allOf/Pet + requestBody: + $ref: "#/components/requestBodies/AllOfPet" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: Successful operation + summary: Test body parameter(s) + tags: + - body + /echo/body/Pet/response_string: + post: + description: Test empty response body + operationId: test/echo/body/Pet/response_string + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test empty response body + tags: + - body + /echo/body/Tag/response_string: + post: + description: Test empty json (request body) + operationId: test/echo/body/Tag/response_string + requestBody: + $ref: "#/components/requestBodies/Tag" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test empty json (request body) + tags: + - body + /echo/body/FreeFormObject/response_string: + post: + description: Test free form object + operationId: test/echo/body/FreeFormObject/response_string + requestBody: + content: + application/json: + schema: + type: object + description: Free form object + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test free form object + tags: + - body + /binary/gif: + post: + description: Test binary (gif) response body + operationId: test/binary/gif + responses: + "200": + content: + image/gif: + schema: + format: binary + type: string + description: Successful operation + summary: Test binary (gif) response body + tags: + - body + /body/application/octetstream/single_binary: + post: + description: Test single binary in multipart mime + operationId: test/body/multipart/formdata/single_binary + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/test_body_multipart_formdata_single_binary_request" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test single binary in multipart mime + tags: + - body + /body/application/octetstream/array_of_binary: + post: + description: Test array of binary in multipart mime + operationId: test/body/multipart/formdata/array_of_binary + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/test_body_multipart_formdata_array_of_binary_request" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test array of binary in multipart mime + tags: + - body + /auth/http/basic: + post: + description: To test HTTP basic authentication + operationId: test/auth/http/basic + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + security: + - http_auth: [] + summary: To test HTTP basic authentication + tags: + - auth + /auth/http/bearer: + post: + description: To test HTTP bearer authentication + operationId: test/auth/http/bearer + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + security: + - http_bearer_auth: [] + summary: To test HTTP bearer authentication + tags: + - auth +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + AllOfPet: + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + Tag: + content: + application/json: + schema: + $ref: "#/components/schemas/Tag" + description: Tag object + schemas: + Category: + example: + name: Dogs + id: 1 + properties: + id: + example: 1 + format: int64 + type: integer + name: + example: Dogs + type: string + type: object + xml: + name: category + Tag: + example: + name: name + id: 0 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 10 + category: + name: Dogs + id: 1 + tags: + - name: name + id: 0 + - name: name + id: 0 + status: available + properties: + id: + example: 10 + format: int64 + type: integer + name: + example: doggie + type: string + category: + $ref: "#/components/schemas/Category" + photoUrls: + items: + type: string + xml: + name: photoUrl + type: array + xml: + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: pet + StringEnumRef: + $ref: "./components/schemas/StringEnumRef.yaml" + DefaultValue: + description: to test the default value of properties + properties: + array_string_enum_ref_default: + default: + - success + - failure + items: + $ref: "./components/schemas/StringEnumRef.yaml" + type: array + array_string_enum_default: + default: + - success + - failure + items: + enum: + - success + - failure + - unclassified + type: string + type: array + array_string_default: + default: + - failure + - skipped + items: + type: string + type: array + array_integer_default: + default: + - 1 + - 3 + items: + type: integer + type: array + array_string: + items: + type: string + type: array + array_string_nullable: + items: + type: string + nullable: true + type: array + array_string_extension_nullable: + items: + type: string + type: array + x-nullable: true + string_nullable: + nullable: true + type: string + type: object + Bird: + properties: + size: + type: string + color: + type: string + type: object + Query: + properties: + id: + description: Query + format: int64 + type: integer + outcomes: + default: + - SUCCESS + - FAILURE + items: + enum: + - SUCCESS + - FAILURE + - SKIPPED + type: string + type: array + type: object + x-parent: true + DataQuery: + allOf: + - properties: + suffix: + description: test suffix + type: string + text: + description: Some text containing white spaces + example: Some text + type: string + date: + description: A date + format: date-time + type: string + type: object + - $ref: "#/components/schemas/Query" + NumberPropertiesOnly: + properties: + number: + type: number + float: + format: float + type: number + double: + format: double + maximum: 50.2 + minimum: 0.8 + type: number + type: object + test_form_integer_boolean_string_request: + properties: + integer_form: + type: integer + boolean_form: + type: boolean + string_form: + type: string + type: object + test_form_oneof_request_oneOf: + properties: + form1: + type: string + form2: + type: integer + type: object + test_form_oneof_request_oneOf_1: + properties: + form3: + type: string + form4: + type: boolean + type: object + test_form_oneof_request: + oneOf: + - $ref: "#/components/schemas/test_form_oneof_request_oneOf" + - $ref: "#/components/schemas/test_form_oneof_request_oneOf_1" + - $ref: "#/components/schemas/Tag" + type: object + test_query_style_form_explode_true_array_string_query_object_parameter: + properties: + values: + items: + type: string + type: array + type: object + ? test_query_style_deepObject_explode_true_object_allOf_query_object_parameter + : allOf: + - $ref: "#/components/schemas/Bird" + - $ref: "#/components/schemas/Category" + test_body_multipart_formdata_single_binary_request: + properties: + my-file: + format: binary + type: string + type: object + test_body_multipart_formdata_array_of_binary_request: + properties: + files: + items: + format: binary + type: string + type: array + required: + - files + type: object + securitySchemes: + http_auth: + scheme: basic + type: http + http_bearer_auth: + scheme: bearer + type: http diff --git a/samples/client/echo_api/go-external-refs/.gitignore b/samples/client/echo_api/go-external-refs/.gitignore new file mode 100644 index 00000000000..daf913b1b34 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/samples/client/echo_api/go-external-refs/.openapi-generator-ignore b/samples/client/echo_api/go-external-refs/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/echo_api/go-external-refs/.openapi-generator/FILES b/samples/client/echo_api/go-external-refs/.openapi-generator/FILES new file mode 100644 index 00000000000..f1b5917aafd --- /dev/null +++ b/samples/client/echo_api/go-external-refs/.openapi-generator/FILES @@ -0,0 +1,45 @@ +.gitignore +.travis.yml +README.md +api/openapi.yaml +api_auth.go +api_body.go +api_form.go +api_header.go +api_path.go +api_query.go +client.go +configuration.go +docs/AuthAPI.md +docs/Bird.md +docs/BodyAPI.md +docs/Category.md +docs/DataQuery.md +docs/DefaultValue.md +docs/FormAPI.md +docs/HeaderAPI.md +docs/NumberPropertiesOnly.md +docs/PathAPI.md +docs/Pet.md +docs/Query.md +docs/QueryAPI.md +docs/StringEnumRef.md +docs/Tag.md +docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md +docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md +git_push.sh +go.mod +go.sum +model_bird.go +model_category.go +model_data_query.go +model_default_value.go +model_number_properties_only.go +model_pet.go +model_query.go +model_string_enum_ref.go +model_tag.go +model_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.go +model_test_query_style_form_explode_true_array_string_query_object_parameter.go +response.go +utils.go diff --git a/samples/client/echo_api/go-external-refs/.openapi-generator/VERSION b/samples/client/echo_api/go-external-refs/.openapi-generator/VERSION new file mode 100644 index 00000000000..fff4bdd7ab5 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/echo_api/go-external-refs/.travis.yml b/samples/client/echo_api/go-external-refs/.travis.yml new file mode 100644 index 00000000000..f5cb2ce9a5a --- /dev/null +++ b/samples/client/echo_api/go-external-refs/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/samples/client/echo_api/go-external-refs/README.md b/samples/client/echo_api/go-external-refs/README.md new file mode 100644 index 00000000000..8baafbcbe1e --- /dev/null +++ b/samples/client/echo_api/go-external-refs/README.md @@ -0,0 +1,171 @@ +# Go API client for openapi + +Echo Server API + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 0.1.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: + +```sh +go get github.com/stretchr/testify/assert +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```go +import openapi "github.com/GIT_USER_ID/GIT_REPO_ID" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```go +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `openapi.ContextServerIndex` of type `int`. + +```go +ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `openapi.ContextServerVariables` of type `map[string]string`. + +```go +ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `openapi.ContextOperationServerIndices` and `openapi.ContextOperationServerVariables` context maps. + +```go +ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AuthAPI* | [**TestAuthHttpBasic**](docs/AuthAPI.md#testauthhttpbasic) | **Post** /auth/http/basic | To test HTTP basic authentication +*AuthAPI* | [**TestAuthHttpBearer**](docs/AuthAPI.md#testauthhttpbearer) | **Post** /auth/http/bearer | To test HTTP bearer authentication +*BodyAPI* | [**TestBinaryGif**](docs/BodyAPI.md#testbinarygif) | **Post** /binary/gif | Test binary (gif) response body +*BodyAPI* | [**TestBodyApplicationOctetstreamBinary**](docs/BodyAPI.md#testbodyapplicationoctetstreambinary) | **Post** /body/application/octetstream/binary | Test body parameter(s) +*BodyAPI* | [**TestBodyMultipartFormdataArrayOfBinary**](docs/BodyAPI.md#testbodymultipartformdataarrayofbinary) | **Post** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +*BodyAPI* | [**TestBodyMultipartFormdataSingleBinary**](docs/BodyAPI.md#testbodymultipartformdatasinglebinary) | **Post** /body/application/octetstream/single_binary | Test single binary in multipart mime +*BodyAPI* | [**TestEchoBodyAllOfPet**](docs/BodyAPI.md#testechobodyallofpet) | **Post** /echo/body/allOf/Pet | Test body parameter(s) +*BodyAPI* | [**TestEchoBodyFreeFormObjectResponseString**](docs/BodyAPI.md#testechobodyfreeformobjectresponsestring) | **Post** /echo/body/FreeFormObject/response_string | Test free form object +*BodyAPI* | [**TestEchoBodyPet**](docs/BodyAPI.md#testechobodypet) | **Post** /echo/body/Pet | Test body parameter(s) +*BodyAPI* | [**TestEchoBodyPetResponseString**](docs/BodyAPI.md#testechobodypetresponsestring) | **Post** /echo/body/Pet/response_string | Test empty response body +*BodyAPI* | [**TestEchoBodyTagResponseString**](docs/BodyAPI.md#testechobodytagresponsestring) | **Post** /echo/body/Tag/response_string | Test empty json (request body) +*FormAPI* | [**TestFormIntegerBooleanString**](docs/FormAPI.md#testformintegerbooleanstring) | **Post** /form/integer/boolean/string | Test form parameter(s) +*FormAPI* | [**TestFormOneof**](docs/FormAPI.md#testformoneof) | **Post** /form/oneof | Test form parameter(s) for oneOf schema +*HeaderAPI* | [**TestHeaderIntegerBooleanStringEnums**](docs/HeaderAPI.md#testheaderintegerbooleanstringenums) | **Get** /header/integer/boolean/string/enums | Test header parameter(s) +*PathAPI* | [**TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/PathAPI.md#testspathstringpathstringintegerpathintegerenumnonrefstringpathenumrefstringpath) | **Get** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) +*QueryAPI* | [**TestEnumRefString**](docs/QueryAPI.md#testenumrefstring) | **Get** /query/enum_ref_string | Test query parameter(s) +*QueryAPI* | [**TestQueryDatetimeDateString**](docs/QueryAPI.md#testquerydatetimedatestring) | **Get** /query/datetime/date/string | Test query parameter(s) +*QueryAPI* | [**TestQueryIntegerBooleanString**](docs/QueryAPI.md#testqueryintegerbooleanstring) | **Get** /query/integer/boolean/string | Test query parameter(s) +*QueryAPI* | [**TestQueryStyleDeepObjectExplodeTrueObject**](docs/QueryAPI.md#testquerystyledeepobjectexplodetrueobject) | **Get** /query/style_deepObject/explode_true/object | Test query parameter(s) +*QueryAPI* | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOf**](docs/QueryAPI.md#testquerystyledeepobjectexplodetrueobjectallof) | **Get** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) +*QueryAPI* | [**TestQueryStyleFormExplodeFalseArrayInteger**](docs/QueryAPI.md#testquerystyleformexplodefalsearrayinteger) | **Get** /query/style_form/explode_false/array_integer | Test query parameter(s) +*QueryAPI* | [**TestQueryStyleFormExplodeFalseArrayString**](docs/QueryAPI.md#testquerystyleformexplodefalsearraystring) | **Get** /query/style_form/explode_false/array_string | Test query parameter(s) +*QueryAPI* | [**TestQueryStyleFormExplodeTrueArrayString**](docs/QueryAPI.md#testquerystyleformexplodetruearraystring) | **Get** /query/style_form/explode_true/array_string | Test query parameter(s) +*QueryAPI* | [**TestQueryStyleFormExplodeTrueObject**](docs/QueryAPI.md#testquerystyleformexplodetrueobject) | **Get** /query/style_form/explode_true/object | Test query parameter(s) +*QueryAPI* | [**TestQueryStyleFormExplodeTrueObjectAllOf**](docs/QueryAPI.md#testquerystyleformexplodetrueobjectallof) | **Get** /query/style_form/explode_true/object/allOf | Test query parameter(s) + + +## Documentation For Models + + - [Bird](docs/Bird.md) + - [Category](docs/Category.md) + - [DataQuery](docs/DataQuery.md) + - [DefaultValue](docs/DefaultValue.md) + - [NumberPropertiesOnly](docs/NumberPropertiesOnly.md) + - [Pet](docs/Pet.md) + - [Query](docs/Query.md) + - [StringEnumRef](docs/StringEnumRef.md) + - [Tag](docs/Tag.md) + - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) + - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### http_auth + +- **Type**: HTTP basic authentication + +Example + +```go +auth := context.WithValue(context.Background(), openapi.ContextBasicAuth, openapi.BasicAuth{ + UserName: "username", + Password: "password", +}) +r, err := client.Service.Operation(auth, args) +``` + +### http_bearer_auth + +- **Type**: HTTP Bearer token authentication + +Example + +```go +auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "BEARER_TOKEN_STRING") +r, err := client.Service.Operation(auth, args) +``` + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + +team@openapitools.org + diff --git a/samples/client/echo_api/go-external-refs/api/openapi.yaml b/samples/client/echo_api/go-external-refs/api/openapi.yaml new file mode 100644 index 00000000000..749b73a2d79 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/api/openapi.yaml @@ -0,0 +1,886 @@ +openapi: 3.0.3 +info: + contact: + email: team@openapitools.org + description: Echo Server API + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: Echo Server API + version: 0.1.0 +servers: +- url: http://localhost:3000/ +paths: + /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}: + get: + description: Test path parameter(s) + operationId: "tests/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}" + parameters: + - explode: false + in: path + name: path_string + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: path_integer + required: true + schema: + type: integer + style: simple + - explode: false + in: path + name: enum_nonref_string_path + required: true + schema: + enum: + - success + - failure + - unclassified + type: string + style: simple + - explode: false + in: path + name: enum_ref_string_path + required: true + schema: + $ref: '#/components/schemas/StringEnumRef' + style: simple + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test path parameter(s) + tags: + - path + /form/integer/boolean/string: + post: + description: Test form parameter(s) + operationId: test/form/integer/boolean/string + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/test_form_integer_boolean_string_request' + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test form parameter(s) + tags: + - form + /form/oneof: + post: + description: Test form parameter(s) for oneOf schema + operationId: test/form/oneof + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/test_form_oneof_request' + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test form parameter(s) for oneOf schema + tags: + - form + /header/integer/boolean/string/enums: + get: + description: Test header parameter(s) + operationId: test/header/integer/boolean/string/enums + parameters: + - explode: true + in: header + name: integer_header + required: false + schema: + type: integer + style: form + - explode: true + in: header + name: boolean_header + required: false + schema: + type: boolean + style: form + - explode: true + in: header + name: string_header + required: false + schema: + type: string + style: form + - explode: true + in: header + name: enum_nonref_string_header + required: false + schema: + enum: + - success + - failure + - unclassified + type: string + style: form + - explode: true + in: header + name: enum_ref_string_header + required: false + schema: + $ref: '#/components/schemas/StringEnumRef' + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test header parameter(s) + tags: + - header + /query/enum_ref_string: + get: + description: Test query parameter(s) + operationId: test/enum_ref_string + parameters: + - explode: true + in: query + name: enum_nonref_string_query + required: false + schema: + enum: + - success + - failure + - unclassified + type: string + style: form + - explode: true + in: query + name: enum_ref_string_query + required: false + schema: + $ref: '#/components/schemas/StringEnumRef' + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/datetime/date/string: + get: + description: Test query parameter(s) + operationId: test/query/datetime/date/string + parameters: + - explode: true + in: query + name: datetime_query + required: false + schema: + format: date-time + type: string + style: form + - explode: true + in: query + name: date_query + required: false + schema: + format: date + type: string + style: form + - explode: true + in: query + name: string_query + required: false + schema: + type: string + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/integer/boolean/string: + get: + description: Test query parameter(s) + operationId: test/query/integer/boolean/string + parameters: + - explode: true + in: query + name: integer_query + required: false + schema: + type: integer + style: form + - explode: true + in: query + name: boolean_query + required: false + schema: + type: boolean + style: form + - explode: true + in: query + name: string_query + required: false + schema: + type: string + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_form/explode_true/array_string: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/array_string + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: '#/components/schemas/test_query_style_form_explode_true_array_string_query_object_parameter' + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_form/explode_false/array_integer: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_false/array_integer + parameters: + - explode: false + in: query + name: query_object + required: false + schema: + items: + type: integer + type: array + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_form/explode_false/array_string: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_false/array_string + parameters: + - explode: false + in: query + name: query_object + required: false + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_form/explode_true/object: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/object + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: '#/components/schemas/Pet' + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_form/explode_true/object/allOf: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/object/allOf + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: '#/components/schemas/DataQuery' + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_deepObject/explode_true/object: + get: + description: Test query parameter(s) + operationId: test/query/style_deepObject/explode_true/object + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: '#/components/schemas/Pet' + style: deepObject + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /query/style_deepObject/explode_true/object/allOf: + get: + description: Test query parameter(s) + operationId: test/query/style_deepObject/explode_true/object/allOf + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: '#/components/schemas/test_query_style_deepObject_explode_true_object_allOf_query_object_parameter' + style: deepObject + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + /body/application/octetstream/binary: + post: + description: Test body parameter(s) + operationId: test/body/application/octetstream/binary + requestBody: + content: + application/octet-stream: + schema: + format: binary + type: string + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test body parameter(s) + tags: + - body + /echo/body/Pet: + post: + description: Test body parameter(s) + operationId: test/echo/body/Pet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: Successful operation + summary: Test body parameter(s) + tags: + - body + /echo/body/allOf/Pet: + post: + description: Test body parameter(s) + operationId: test/echo/body/allOf/Pet + requestBody: + $ref: '#/components/requestBodies/AllOfPet' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: Successful operation + summary: Test body parameter(s) + tags: + - body + /echo/body/Pet/response_string: + post: + description: Test empty response body + operationId: test/echo/body/Pet/response_string + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test empty response body + tags: + - body + /echo/body/Tag/response_string: + post: + description: Test empty json (request body) + operationId: test/echo/body/Tag/response_string + requestBody: + $ref: '#/components/requestBodies/Tag' + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test empty json (request body) + tags: + - body + /echo/body/FreeFormObject/response_string: + post: + description: Test free form object + operationId: test/echo/body/FreeFormObject/response_string + requestBody: + content: + application/json: + schema: + type: object + description: Free form object + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test free form object + tags: + - body + /binary/gif: + post: + description: Test binary (gif) response body + operationId: test/binary/gif + responses: + "200": + content: + image/gif: + schema: + format: binary + type: string + description: Successful operation + summary: Test binary (gif) response body + tags: + - body + /body/application/octetstream/single_binary: + post: + description: Test single binary in multipart mime + operationId: test/body/multipart/formdata/single_binary + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/test_body_multipart_formdata_single_binary_request' + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test single binary in multipart mime + tags: + - body + /body/application/octetstream/array_of_binary: + post: + description: Test array of binary in multipart mime + operationId: test/body/multipart/formdata/array_of_binary + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/test_body_multipart_formdata_array_of_binary_request' + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test array of binary in multipart mime + tags: + - body + /auth/http/basic: + post: + description: To test HTTP basic authentication + operationId: test/auth/http/basic + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + security: + - http_auth: [] + summary: To test HTTP basic authentication + tags: + - auth + /auth/http/bearer: + post: + description: To test HTTP bearer authentication + operationId: test/auth/http/bearer + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + security: + - http_bearer_auth: [] + summary: To test HTTP bearer authentication + tags: + - auth +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + AllOfPet: + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + Tag: + content: + application/json: + schema: + $ref: '#/components/schemas/Tag' + description: Tag object + schemas: + Category: + example: + name: Dogs + id: 1 + properties: + id: + example: 1 + format: int64 + type: integer + name: + example: Dogs + type: string + type: object + xml: + name: category + Tag: + example: + name: name + id: 0 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 10 + category: + name: Dogs + id: 1 + tags: + - name: name + id: 0 + - name: name + id: 0 + status: available + properties: + id: + example: 10 + format: int64 + type: integer + name: + example: doggie + type: string + category: + $ref: '#/components/schemas/Category' + photoUrls: + items: + type: string + xml: + name: photoUrl + type: array + xml: + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: pet + StringEnumRef: + enum: + - success + - failure + - unclassified + type: string + DefaultValue: + description: to test the default value of properties + properties: + array_string_enum_ref_default: + default: + - success + - failure + items: + $ref: '#/components/schemas/StringEnumRef' + type: array + array_string_enum_default: + default: + - success + - failure + items: + enum: + - success + - failure + - unclassified + type: string + type: array + array_string_default: + default: + - failure + - skipped + items: + type: string + type: array + array_integer_default: + default: + - 1 + - 3 + items: + type: integer + type: array + array_string: + items: + type: string + type: array + array_string_nullable: + items: + type: string + nullable: true + type: array + array_string_extension_nullable: + items: + type: string + type: array + x-nullable: true + string_nullable: + nullable: true + type: string + type: object + Bird: + properties: + size: + type: string + color: + type: string + type: object + Query: + properties: + id: + description: Query + format: int64 + type: integer + outcomes: + default: + - SUCCESS + - FAILURE + items: + enum: + - SUCCESS + - FAILURE + - SKIPPED + type: string + type: array + type: object + x-parent: true + DataQuery: + allOf: + - properties: + suffix: + description: test suffix + type: string + text: + description: Some text containing white spaces + example: Some text + type: string + date: + description: A date + format: date-time + type: string + type: object + - $ref: '#/components/schemas/Query' + NumberPropertiesOnly: + properties: + number: + type: number + float: + format: float + type: number + double: + format: double + maximum: 50.2 + minimum: 0.8 + type: number + type: object + test_form_integer_boolean_string_request: + properties: + integer_form: + type: integer + boolean_form: + type: boolean + string_form: + type: string + type: object + test_form_oneof_request_oneOf: + properties: + form1: + type: string + form2: + type: integer + type: object + test_form_oneof_request_oneOf_1: + properties: + form3: + type: string + form4: + type: boolean + type: object + test_form_oneof_request: + oneOf: + - $ref: '#/components/schemas/test_form_oneof_request_oneOf' + - $ref: '#/components/schemas/test_form_oneof_request_oneOf_1' + - $ref: '#/components/schemas/Tag' + type: object + test_query_style_form_explode_true_array_string_query_object_parameter: + properties: + values: + items: + type: string + type: array + type: object + test_query_style_deepObject_explode_true_object_allOf_query_object_parameter: + allOf: + - $ref: '#/components/schemas/Bird' + - $ref: '#/components/schemas/Category' + test_body_multipart_formdata_single_binary_request: + properties: + my-file: + format: binary + type: string + type: object + test_body_multipart_formdata_array_of_binary_request: + properties: + files: + items: + format: binary + type: string + type: array + required: + - files + type: object + securitySchemes: + http_auth: + scheme: basic + type: http + http_bearer_auth: + scheme: bearer + type: http diff --git a/samples/client/echo_api/go-external-refs/api_auth.go b/samples/client/echo_api/go-external-refs/api_auth.go new file mode 100644 index 00000000000..d14f693e51f --- /dev/null +++ b/samples/client/echo_api/go-external-refs/api_auth.go @@ -0,0 +1,222 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + + +// AuthAPIService AuthAPI service +type AuthAPIService service + +type ApiTestAuthHttpBasicRequest struct { + ctx context.Context + ApiService *AuthAPIService +} + +func (r ApiTestAuthHttpBasicRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestAuthHttpBasicExecute(r) +} + +/* +TestAuthHttpBasic To test HTTP basic authentication + +To test HTTP basic authentication + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestAuthHttpBasicRequest +*/ +func (a *AuthAPIService) TestAuthHttpBasic(ctx context.Context) ApiTestAuthHttpBasicRequest { + return ApiTestAuthHttpBasicRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *AuthAPIService) TestAuthHttpBasicExecute(r ApiTestAuthHttpBasicRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthAPIService.TestAuthHttpBasic") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/auth/http/basic" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestAuthHttpBearerRequest struct { + ctx context.Context + ApiService *AuthAPIService +} + +func (r ApiTestAuthHttpBearerRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestAuthHttpBearerExecute(r) +} + +/* +TestAuthHttpBearer To test HTTP bearer authentication + +To test HTTP bearer authentication + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestAuthHttpBearerRequest +*/ +func (a *AuthAPIService) TestAuthHttpBearer(ctx context.Context) ApiTestAuthHttpBearerRequest { + return ApiTestAuthHttpBearerRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *AuthAPIService) TestAuthHttpBearerExecute(r ApiTestAuthHttpBearerRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthAPIService.TestAuthHttpBearer") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/auth/http/bearer" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/client/echo_api/go-external-refs/api_body.go b/samples/client/echo_api/go-external-refs/api_body.go new file mode 100644 index 00000000000..7c4f82522d7 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/api_body.go @@ -0,0 +1,1017 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "os" +) + + +// BodyAPIService BodyAPI service +type BodyAPIService service + +type ApiTestBinaryGifRequest struct { + ctx context.Context + ApiService *BodyAPIService +} + +func (r ApiTestBinaryGifRequest) Execute() (*os.File, *http.Response, error) { + return r.ApiService.TestBinaryGifExecute(r) +} + +/* +TestBinaryGif Test binary (gif) response body + +Test binary (gif) response body + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestBinaryGifRequest +*/ +func (a *BodyAPIService) TestBinaryGif(ctx context.Context) ApiTestBinaryGifRequest { + return ApiTestBinaryGifRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return *os.File +func (a *BodyAPIService) TestBinaryGifExecute(r ApiTestBinaryGifRequest) (*os.File, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *os.File + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestBinaryGif") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/binary/gif" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"image/gif"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestBodyApplicationOctetstreamBinaryRequest struct { + ctx context.Context + ApiService *BodyAPIService + body *os.File +} + +func (r ApiTestBodyApplicationOctetstreamBinaryRequest) Body(body *os.File) ApiTestBodyApplicationOctetstreamBinaryRequest { + r.body = body + return r +} + +func (r ApiTestBodyApplicationOctetstreamBinaryRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestBodyApplicationOctetstreamBinaryExecute(r) +} + +/* +TestBodyApplicationOctetstreamBinary Test body parameter(s) + +Test body parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestBodyApplicationOctetstreamBinaryRequest +*/ +func (a *BodyAPIService) TestBodyApplicationOctetstreamBinary(ctx context.Context) ApiTestBodyApplicationOctetstreamBinaryRequest { + return ApiTestBodyApplicationOctetstreamBinaryRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *BodyAPIService) TestBodyApplicationOctetstreamBinaryExecute(r ApiTestBodyApplicationOctetstreamBinaryRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestBodyApplicationOctetstreamBinary") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/body/application/octetstream/binary" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/octet-stream"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestBodyMultipartFormdataArrayOfBinaryRequest struct { + ctx context.Context + ApiService *BodyAPIService + files []*os.File +} + +func (r ApiTestBodyMultipartFormdataArrayOfBinaryRequest) Files(files []*os.File) ApiTestBodyMultipartFormdataArrayOfBinaryRequest { + r.files = files + return r +} + +func (r ApiTestBodyMultipartFormdataArrayOfBinaryRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestBodyMultipartFormdataArrayOfBinaryExecute(r) +} + +/* +TestBodyMultipartFormdataArrayOfBinary Test array of binary in multipart mime + +Test array of binary in multipart mime + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestBodyMultipartFormdataArrayOfBinaryRequest +*/ +func (a *BodyAPIService) TestBodyMultipartFormdataArrayOfBinary(ctx context.Context) ApiTestBodyMultipartFormdataArrayOfBinaryRequest { + return ApiTestBodyMultipartFormdataArrayOfBinaryRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *BodyAPIService) TestBodyMultipartFormdataArrayOfBinaryExecute(r ApiTestBodyMultipartFormdataArrayOfBinaryRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestBodyMultipartFormdataArrayOfBinary") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/body/application/octetstream/array_of_binary" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.files == nil { + return localVarReturnValue, nil, reportError("files is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"multipart/form-data"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + var filesLocalVarFormFileName string + var filesLocalVarFileName string + var filesLocalVarFileBytes []byte + + filesLocalVarFormFileName = "files" + filesLocalVarFile := r.files + + if filesLocalVarFile != nil { + // loop through the array to prepare multiple files upload + for _, filesLocalVarFileValue := range filesLocalVarFile { + fbs, _ := io.ReadAll(filesLocalVarFileValue) + + filesLocalVarFileBytes = fbs + filesLocalVarFileName = filesLocalVarFileValue.Name() + filesLocalVarFileValue.Close() + formFiles = append(formFiles, formFile{fileBytes: filesLocalVarFileBytes, fileName: filesLocalVarFileName, formFileName: filesLocalVarFormFileName}) + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestBodyMultipartFormdataSingleBinaryRequest struct { + ctx context.Context + ApiService *BodyAPIService + myFile *os.File +} + +func (r ApiTestBodyMultipartFormdataSingleBinaryRequest) MyFile(myFile *os.File) ApiTestBodyMultipartFormdataSingleBinaryRequest { + r.myFile = myFile + return r +} + +func (r ApiTestBodyMultipartFormdataSingleBinaryRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestBodyMultipartFormdataSingleBinaryExecute(r) +} + +/* +TestBodyMultipartFormdataSingleBinary Test single binary in multipart mime + +Test single binary in multipart mime + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestBodyMultipartFormdataSingleBinaryRequest +*/ +func (a *BodyAPIService) TestBodyMultipartFormdataSingleBinary(ctx context.Context) ApiTestBodyMultipartFormdataSingleBinaryRequest { + return ApiTestBodyMultipartFormdataSingleBinaryRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *BodyAPIService) TestBodyMultipartFormdataSingleBinaryExecute(r ApiTestBodyMultipartFormdataSingleBinaryRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestBodyMultipartFormdataSingleBinary") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/body/application/octetstream/single_binary" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"multipart/form-data"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + var myFileLocalVarFormFileName string + var myFileLocalVarFileName string + var myFileLocalVarFileBytes []byte + + myFileLocalVarFormFileName = "my-file" + myFileLocalVarFile := r.myFile + + if myFileLocalVarFile != nil { + fbs, _ := io.ReadAll(myFileLocalVarFile) + + myFileLocalVarFileBytes = fbs + myFileLocalVarFileName = myFileLocalVarFile.Name() + myFileLocalVarFile.Close() + formFiles = append(formFiles, formFile{fileBytes: myFileLocalVarFileBytes, fileName: myFileLocalVarFileName, formFileName: myFileLocalVarFormFileName}) + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestEchoBodyAllOfPetRequest struct { + ctx context.Context + ApiService *BodyAPIService + pet *Pet +} + +// Pet object that needs to be added to the store +func (r ApiTestEchoBodyAllOfPetRequest) Pet(pet Pet) ApiTestEchoBodyAllOfPetRequest { + r.pet = &pet + return r +} + +func (r ApiTestEchoBodyAllOfPetRequest) Execute() (*Pet, *http.Response, error) { + return r.ApiService.TestEchoBodyAllOfPetExecute(r) +} + +/* +TestEchoBodyAllOfPet Test body parameter(s) + +Test body parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestEchoBodyAllOfPetRequest +*/ +func (a *BodyAPIService) TestEchoBodyAllOfPet(ctx context.Context) ApiTestEchoBodyAllOfPetRequest { + return ApiTestEchoBodyAllOfPetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return Pet +func (a *BodyAPIService) TestEchoBodyAllOfPetExecute(r ApiTestEchoBodyAllOfPetRequest) (*Pet, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Pet + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestEchoBodyAllOfPet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/echo/body/allOf/Pet" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.pet + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestEchoBodyFreeFormObjectResponseStringRequest struct { + ctx context.Context + ApiService *BodyAPIService + body *map[string]interface{} +} + +// Free form object +func (r ApiTestEchoBodyFreeFormObjectResponseStringRequest) Body(body map[string]interface{}) ApiTestEchoBodyFreeFormObjectResponseStringRequest { + r.body = &body + return r +} + +func (r ApiTestEchoBodyFreeFormObjectResponseStringRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestEchoBodyFreeFormObjectResponseStringExecute(r) +} + +/* +TestEchoBodyFreeFormObjectResponseString Test free form object + +Test free form object + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestEchoBodyFreeFormObjectResponseStringRequest +*/ +func (a *BodyAPIService) TestEchoBodyFreeFormObjectResponseString(ctx context.Context) ApiTestEchoBodyFreeFormObjectResponseStringRequest { + return ApiTestEchoBodyFreeFormObjectResponseStringRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *BodyAPIService) TestEchoBodyFreeFormObjectResponseStringExecute(r ApiTestEchoBodyFreeFormObjectResponseStringRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestEchoBodyFreeFormObjectResponseString") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/echo/body/FreeFormObject/response_string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestEchoBodyPetRequest struct { + ctx context.Context + ApiService *BodyAPIService + pet *Pet +} + +// Pet object that needs to be added to the store +func (r ApiTestEchoBodyPetRequest) Pet(pet Pet) ApiTestEchoBodyPetRequest { + r.pet = &pet + return r +} + +func (r ApiTestEchoBodyPetRequest) Execute() (*Pet, *http.Response, error) { + return r.ApiService.TestEchoBodyPetExecute(r) +} + +/* +TestEchoBodyPet Test body parameter(s) + +Test body parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestEchoBodyPetRequest +*/ +func (a *BodyAPIService) TestEchoBodyPet(ctx context.Context) ApiTestEchoBodyPetRequest { + return ApiTestEchoBodyPetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return Pet +func (a *BodyAPIService) TestEchoBodyPetExecute(r ApiTestEchoBodyPetRequest) (*Pet, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Pet + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestEchoBodyPet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/echo/body/Pet" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.pet + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestEchoBodyPetResponseStringRequest struct { + ctx context.Context + ApiService *BodyAPIService + pet *Pet +} + +// Pet object that needs to be added to the store +func (r ApiTestEchoBodyPetResponseStringRequest) Pet(pet Pet) ApiTestEchoBodyPetResponseStringRequest { + r.pet = &pet + return r +} + +func (r ApiTestEchoBodyPetResponseStringRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestEchoBodyPetResponseStringExecute(r) +} + +/* +TestEchoBodyPetResponseString Test empty response body + +Test empty response body + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestEchoBodyPetResponseStringRequest +*/ +func (a *BodyAPIService) TestEchoBodyPetResponseString(ctx context.Context) ApiTestEchoBodyPetResponseStringRequest { + return ApiTestEchoBodyPetResponseStringRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *BodyAPIService) TestEchoBodyPetResponseStringExecute(r ApiTestEchoBodyPetResponseStringRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestEchoBodyPetResponseString") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/echo/body/Pet/response_string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.pet + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestEchoBodyTagResponseStringRequest struct { + ctx context.Context + ApiService *BodyAPIService + tag *Tag +} + +// Tag object +func (r ApiTestEchoBodyTagResponseStringRequest) Tag(tag Tag) ApiTestEchoBodyTagResponseStringRequest { + r.tag = &tag + return r +} + +func (r ApiTestEchoBodyTagResponseStringRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestEchoBodyTagResponseStringExecute(r) +} + +/* +TestEchoBodyTagResponseString Test empty json (request body) + +Test empty json (request body) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestEchoBodyTagResponseStringRequest +*/ +func (a *BodyAPIService) TestEchoBodyTagResponseString(ctx context.Context) ApiTestEchoBodyTagResponseStringRequest { + return ApiTestEchoBodyTagResponseStringRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *BodyAPIService) TestEchoBodyTagResponseStringExecute(r ApiTestEchoBodyTagResponseStringRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestEchoBodyTagResponseString") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/echo/body/Tag/response_string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.tag + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/client/echo_api/go-external-refs/api_form.go b/samples/client/echo_api/go-external-refs/api_form.go new file mode 100644 index 00000000000..4aa3386dc97 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/api_form.go @@ -0,0 +1,303 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + + +// FormAPIService FormAPI service +type FormAPIService service + +type ApiTestFormIntegerBooleanStringRequest struct { + ctx context.Context + ApiService *FormAPIService + integerForm *int32 + booleanForm *bool + stringForm *string +} + +func (r ApiTestFormIntegerBooleanStringRequest) IntegerForm(integerForm int32) ApiTestFormIntegerBooleanStringRequest { + r.integerForm = &integerForm + return r +} + +func (r ApiTestFormIntegerBooleanStringRequest) BooleanForm(booleanForm bool) ApiTestFormIntegerBooleanStringRequest { + r.booleanForm = &booleanForm + return r +} + +func (r ApiTestFormIntegerBooleanStringRequest) StringForm(stringForm string) ApiTestFormIntegerBooleanStringRequest { + r.stringForm = &stringForm + return r +} + +func (r ApiTestFormIntegerBooleanStringRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestFormIntegerBooleanStringExecute(r) +} + +/* +TestFormIntegerBooleanString Test form parameter(s) + +Test form parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestFormIntegerBooleanStringRequest +*/ +func (a *FormAPIService) TestFormIntegerBooleanString(ctx context.Context) ApiTestFormIntegerBooleanStringRequest { + return ApiTestFormIntegerBooleanStringRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *FormAPIService) TestFormIntegerBooleanStringExecute(r ApiTestFormIntegerBooleanStringRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FormAPIService.TestFormIntegerBooleanString") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/form/integer/boolean/string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.integerForm != nil { + parameterAddToHeaderOrQuery(localVarFormParams, "integer_form", r.integerForm, "") + } + if r.booleanForm != nil { + parameterAddToHeaderOrQuery(localVarFormParams, "boolean_form", r.booleanForm, "") + } + if r.stringForm != nil { + parameterAddToHeaderOrQuery(localVarFormParams, "string_form", r.stringForm, "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestFormOneofRequest struct { + ctx context.Context + ApiService *FormAPIService + form1 *string + form2 *int32 + form3 *string + form4 *bool + id *int64 + name *string +} + +func (r ApiTestFormOneofRequest) Form1(form1 string) ApiTestFormOneofRequest { + r.form1 = &form1 + return r +} + +func (r ApiTestFormOneofRequest) Form2(form2 int32) ApiTestFormOneofRequest { + r.form2 = &form2 + return r +} + +func (r ApiTestFormOneofRequest) Form3(form3 string) ApiTestFormOneofRequest { + r.form3 = &form3 + return r +} + +func (r ApiTestFormOneofRequest) Form4(form4 bool) ApiTestFormOneofRequest { + r.form4 = &form4 + return r +} + +func (r ApiTestFormOneofRequest) Id(id int64) ApiTestFormOneofRequest { + r.id = &id + return r +} + +func (r ApiTestFormOneofRequest) Name(name string) ApiTestFormOneofRequest { + r.name = &name + return r +} + +func (r ApiTestFormOneofRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestFormOneofExecute(r) +} + +/* +TestFormOneof Test form parameter(s) for oneOf schema + +Test form parameter(s) for oneOf schema + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestFormOneofRequest +*/ +func (a *FormAPIService) TestFormOneof(ctx context.Context) ApiTestFormOneofRequest { + return ApiTestFormOneofRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *FormAPIService) TestFormOneofExecute(r ApiTestFormOneofRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FormAPIService.TestFormOneof") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/form/oneof" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.form1 != nil { + parameterAddToHeaderOrQuery(localVarFormParams, "form1", r.form1, "") + } + if r.form2 != nil { + parameterAddToHeaderOrQuery(localVarFormParams, "form2", r.form2, "") + } + if r.form3 != nil { + parameterAddToHeaderOrQuery(localVarFormParams, "form3", r.form3, "") + } + if r.form4 != nil { + parameterAddToHeaderOrQuery(localVarFormParams, "form4", r.form4, "") + } + if r.id != nil { + parameterAddToHeaderOrQuery(localVarFormParams, "id", r.id, "") + } + if r.name != nil { + parameterAddToHeaderOrQuery(localVarFormParams, "name", r.name, "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/client/echo_api/go-external-refs/api_header.go b/samples/client/echo_api/go-external-refs/api_header.go new file mode 100644 index 00000000000..364bd3c5ea3 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/api_header.go @@ -0,0 +1,168 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + + +// HeaderAPIService HeaderAPI service +type HeaderAPIService service + +type ApiTestHeaderIntegerBooleanStringEnumsRequest struct { + ctx context.Context + ApiService *HeaderAPIService + integerHeader *int32 + booleanHeader *bool + stringHeader *string + enumNonrefStringHeader *string + enumRefStringHeader *StringEnumRef +} + +func (r ApiTestHeaderIntegerBooleanStringEnumsRequest) IntegerHeader(integerHeader int32) ApiTestHeaderIntegerBooleanStringEnumsRequest { + r.integerHeader = &integerHeader + return r +} + +func (r ApiTestHeaderIntegerBooleanStringEnumsRequest) BooleanHeader(booleanHeader bool) ApiTestHeaderIntegerBooleanStringEnumsRequest { + r.booleanHeader = &booleanHeader + return r +} + +func (r ApiTestHeaderIntegerBooleanStringEnumsRequest) StringHeader(stringHeader string) ApiTestHeaderIntegerBooleanStringEnumsRequest { + r.stringHeader = &stringHeader + return r +} + +func (r ApiTestHeaderIntegerBooleanStringEnumsRequest) EnumNonrefStringHeader(enumNonrefStringHeader string) ApiTestHeaderIntegerBooleanStringEnumsRequest { + r.enumNonrefStringHeader = &enumNonrefStringHeader + return r +} + +func (r ApiTestHeaderIntegerBooleanStringEnumsRequest) EnumRefStringHeader(enumRefStringHeader StringEnumRef) ApiTestHeaderIntegerBooleanStringEnumsRequest { + r.enumRefStringHeader = &enumRefStringHeader + return r +} + +func (r ApiTestHeaderIntegerBooleanStringEnumsRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestHeaderIntegerBooleanStringEnumsExecute(r) +} + +/* +TestHeaderIntegerBooleanStringEnums Test header parameter(s) + +Test header parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestHeaderIntegerBooleanStringEnumsRequest +*/ +func (a *HeaderAPIService) TestHeaderIntegerBooleanStringEnums(ctx context.Context) ApiTestHeaderIntegerBooleanStringEnumsRequest { + return ApiTestHeaderIntegerBooleanStringEnumsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *HeaderAPIService) TestHeaderIntegerBooleanStringEnumsExecute(r ApiTestHeaderIntegerBooleanStringEnumsRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HeaderAPIService.TestHeaderIntegerBooleanStringEnums") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/header/integer/boolean/string/enums" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.integerHeader != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "integer_header", r.integerHeader, "") + } + if r.booleanHeader != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "boolean_header", r.booleanHeader, "") + } + if r.stringHeader != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "string_header", r.stringHeader, "") + } + if r.enumNonrefStringHeader != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "enum_nonref_string_header", r.enumNonrefStringHeader, "") + } + if r.enumRefStringHeader != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "enum_ref_string_header", r.enumRefStringHeader, "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/client/echo_api/go-external-refs/api_path.go b/samples/client/echo_api/go-external-refs/api_path.go new file mode 100644 index 00000000000..095605512a0 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/api_path.go @@ -0,0 +1,140 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +// PathAPIService PathAPI service +type PathAPIService service + +type ApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest struct { + ctx context.Context + ApiService *PathAPIService + pathString string + pathInteger int32 + enumNonrefStringPath string + enumRefStringPath StringEnumRef +} + +func (r ApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathExecute(r) +} + +/* +TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath Test path parameter(s) + +Test path parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param pathString + @param pathInteger + @param enumNonrefStringPath + @param enumRefStringPath + @return ApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest +*/ +func (a *PathAPIService) TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(ctx context.Context, pathString string, pathInteger int32, enumNonrefStringPath string, enumRefStringPath StringEnumRef) ApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest { + return ApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest{ + ApiService: a, + ctx: ctx, + pathString: pathString, + pathInteger: pathInteger, + enumNonrefStringPath: enumNonrefStringPath, + enumRefStringPath: enumRefStringPath, + } +} + +// Execute executes the request +// @return string +func (a *PathAPIService) TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathExecute(r ApiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PathAPIService.TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}" + localVarPath = strings.Replace(localVarPath, "{"+"path_string"+"}", url.PathEscape(parameterValueToString(r.pathString, "pathString")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path_integer"+"}", url.PathEscape(parameterValueToString(r.pathInteger, "pathInteger")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"enum_nonref_string_path"+"}", url.PathEscape(parameterValueToString(r.enumNonrefStringPath, "enumNonrefStringPath")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"enum_ref_string_path"+"}", url.PathEscape(parameterValueToString(r.enumRefStringPath, "enumRefStringPath")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/client/echo_api/go-external-refs/api_query.go b/samples/client/echo_api/go-external-refs/api_query.go new file mode 100644 index 00000000000..2e45bf16b6d --- /dev/null +++ b/samples/client/echo_api/go-external-refs/api_query.go @@ -0,0 +1,1150 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "time" +) + + +// QueryAPIService QueryAPI service +type QueryAPIService service + +type ApiTestEnumRefStringRequest struct { + ctx context.Context + ApiService *QueryAPIService + enumNonrefStringQuery *string + enumRefStringQuery *StringEnumRef +} + +func (r ApiTestEnumRefStringRequest) EnumNonrefStringQuery(enumNonrefStringQuery string) ApiTestEnumRefStringRequest { + r.enumNonrefStringQuery = &enumNonrefStringQuery + return r +} + +func (r ApiTestEnumRefStringRequest) EnumRefStringQuery(enumRefStringQuery StringEnumRef) ApiTestEnumRefStringRequest { + r.enumRefStringQuery = &enumRefStringQuery + return r +} + +func (r ApiTestEnumRefStringRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestEnumRefStringExecute(r) +} + +/* +TestEnumRefString Test query parameter(s) + +Test query parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestEnumRefStringRequest +*/ +func (a *QueryAPIService) TestEnumRefString(ctx context.Context) ApiTestEnumRefStringRequest { + return ApiTestEnumRefStringRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *QueryAPIService) TestEnumRefStringExecute(r ApiTestEnumRefStringRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestEnumRefString") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query/enum_ref_string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.enumNonrefStringQuery != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "enum_nonref_string_query", r.enumNonrefStringQuery, "") + } + if r.enumRefStringQuery != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "enum_ref_string_query", r.enumRefStringQuery, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestQueryDatetimeDateStringRequest struct { + ctx context.Context + ApiService *QueryAPIService + datetimeQuery *time.Time + dateQuery *string + stringQuery *string +} + +func (r ApiTestQueryDatetimeDateStringRequest) DatetimeQuery(datetimeQuery time.Time) ApiTestQueryDatetimeDateStringRequest { + r.datetimeQuery = &datetimeQuery + return r +} + +func (r ApiTestQueryDatetimeDateStringRequest) DateQuery(dateQuery string) ApiTestQueryDatetimeDateStringRequest { + r.dateQuery = &dateQuery + return r +} + +func (r ApiTestQueryDatetimeDateStringRequest) StringQuery(stringQuery string) ApiTestQueryDatetimeDateStringRequest { + r.stringQuery = &stringQuery + return r +} + +func (r ApiTestQueryDatetimeDateStringRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestQueryDatetimeDateStringExecute(r) +} + +/* +TestQueryDatetimeDateString Test query parameter(s) + +Test query parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestQueryDatetimeDateStringRequest +*/ +func (a *QueryAPIService) TestQueryDatetimeDateString(ctx context.Context) ApiTestQueryDatetimeDateStringRequest { + return ApiTestQueryDatetimeDateStringRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *QueryAPIService) TestQueryDatetimeDateStringExecute(r ApiTestQueryDatetimeDateStringRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryDatetimeDateString") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query/datetime/date/string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.datetimeQuery != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "datetime_query", r.datetimeQuery, "") + } + if r.dateQuery != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "date_query", r.dateQuery, "") + } + if r.stringQuery != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "string_query", r.stringQuery, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestQueryIntegerBooleanStringRequest struct { + ctx context.Context + ApiService *QueryAPIService + integerQuery *int32 + booleanQuery *bool + stringQuery *string +} + +func (r ApiTestQueryIntegerBooleanStringRequest) IntegerQuery(integerQuery int32) ApiTestQueryIntegerBooleanStringRequest { + r.integerQuery = &integerQuery + return r +} + +func (r ApiTestQueryIntegerBooleanStringRequest) BooleanQuery(booleanQuery bool) ApiTestQueryIntegerBooleanStringRequest { + r.booleanQuery = &booleanQuery + return r +} + +func (r ApiTestQueryIntegerBooleanStringRequest) StringQuery(stringQuery string) ApiTestQueryIntegerBooleanStringRequest { + r.stringQuery = &stringQuery + return r +} + +func (r ApiTestQueryIntegerBooleanStringRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestQueryIntegerBooleanStringExecute(r) +} + +/* +TestQueryIntegerBooleanString Test query parameter(s) + +Test query parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestQueryIntegerBooleanStringRequest +*/ +func (a *QueryAPIService) TestQueryIntegerBooleanString(ctx context.Context) ApiTestQueryIntegerBooleanStringRequest { + return ApiTestQueryIntegerBooleanStringRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *QueryAPIService) TestQueryIntegerBooleanStringExecute(r ApiTestQueryIntegerBooleanStringRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryIntegerBooleanString") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query/integer/boolean/string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.integerQuery != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "integer_query", r.integerQuery, "") + } + if r.booleanQuery != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "boolean_query", r.booleanQuery, "") + } + if r.stringQuery != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "string_query", r.stringQuery, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest struct { + ctx context.Context + ApiService *QueryAPIService + queryObject *Pet +} + +func (r ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest) QueryObject(queryObject Pet) ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest { + r.queryObject = &queryObject + return r +} + +func (r ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestQueryStyleDeepObjectExplodeTrueObjectExecute(r) +} + +/* +TestQueryStyleDeepObjectExplodeTrueObject Test query parameter(s) + +Test query parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest +*/ +func (a *QueryAPIService) TestQueryStyleDeepObjectExplodeTrueObject(ctx context.Context) ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest { + return ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *QueryAPIService) TestQueryStyleDeepObjectExplodeTrueObjectExecute(r ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleDeepObjectExplodeTrueObject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query/style_deepObject/explode_true/object" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.queryObject != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest struct { + ctx context.Context + ApiService *QueryAPIService + queryObject *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter +} + +func (r ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest) QueryObject(queryObject TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest { + r.queryObject = &queryObject + return r +} + +func (r ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestQueryStyleDeepObjectExplodeTrueObjectAllOfExecute(r) +} + +/* +TestQueryStyleDeepObjectExplodeTrueObjectAllOf Test query parameter(s) + +Test query parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest +*/ +func (a *QueryAPIService) TestQueryStyleDeepObjectExplodeTrueObjectAllOf(ctx context.Context) ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest { + return ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *QueryAPIService) TestQueryStyleDeepObjectExplodeTrueObjectAllOfExecute(r ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleDeepObjectExplodeTrueObjectAllOf") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query/style_deepObject/explode_true/object/allOf" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.queryObject != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestQueryStyleFormExplodeFalseArrayIntegerRequest struct { + ctx context.Context + ApiService *QueryAPIService + queryObject *[]int32 +} + +func (r ApiTestQueryStyleFormExplodeFalseArrayIntegerRequest) QueryObject(queryObject []int32) ApiTestQueryStyleFormExplodeFalseArrayIntegerRequest { + r.queryObject = &queryObject + return r +} + +func (r ApiTestQueryStyleFormExplodeFalseArrayIntegerRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestQueryStyleFormExplodeFalseArrayIntegerExecute(r) +} + +/* +TestQueryStyleFormExplodeFalseArrayInteger Test query parameter(s) + +Test query parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestQueryStyleFormExplodeFalseArrayIntegerRequest +*/ +func (a *QueryAPIService) TestQueryStyleFormExplodeFalseArrayInteger(ctx context.Context) ApiTestQueryStyleFormExplodeFalseArrayIntegerRequest { + return ApiTestQueryStyleFormExplodeFalseArrayIntegerRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *QueryAPIService) TestQueryStyleFormExplodeFalseArrayIntegerExecute(r ApiTestQueryStyleFormExplodeFalseArrayIntegerRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleFormExplodeFalseArrayInteger") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query/style_form/explode_false/array_integer" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.queryObject != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestQueryStyleFormExplodeFalseArrayStringRequest struct { + ctx context.Context + ApiService *QueryAPIService + queryObject *[]string +} + +func (r ApiTestQueryStyleFormExplodeFalseArrayStringRequest) QueryObject(queryObject []string) ApiTestQueryStyleFormExplodeFalseArrayStringRequest { + r.queryObject = &queryObject + return r +} + +func (r ApiTestQueryStyleFormExplodeFalseArrayStringRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestQueryStyleFormExplodeFalseArrayStringExecute(r) +} + +/* +TestQueryStyleFormExplodeFalseArrayString Test query parameter(s) + +Test query parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestQueryStyleFormExplodeFalseArrayStringRequest +*/ +func (a *QueryAPIService) TestQueryStyleFormExplodeFalseArrayString(ctx context.Context) ApiTestQueryStyleFormExplodeFalseArrayStringRequest { + return ApiTestQueryStyleFormExplodeFalseArrayStringRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *QueryAPIService) TestQueryStyleFormExplodeFalseArrayStringExecute(r ApiTestQueryStyleFormExplodeFalseArrayStringRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleFormExplodeFalseArrayString") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query/style_form/explode_false/array_string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.queryObject != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "csv") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestQueryStyleFormExplodeTrueArrayStringRequest struct { + ctx context.Context + ApiService *QueryAPIService + queryObject *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +} + +func (r ApiTestQueryStyleFormExplodeTrueArrayStringRequest) QueryObject(queryObject TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) ApiTestQueryStyleFormExplodeTrueArrayStringRequest { + r.queryObject = &queryObject + return r +} + +func (r ApiTestQueryStyleFormExplodeTrueArrayStringRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestQueryStyleFormExplodeTrueArrayStringExecute(r) +} + +/* +TestQueryStyleFormExplodeTrueArrayString Test query parameter(s) + +Test query parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestQueryStyleFormExplodeTrueArrayStringRequest +*/ +func (a *QueryAPIService) TestQueryStyleFormExplodeTrueArrayString(ctx context.Context) ApiTestQueryStyleFormExplodeTrueArrayStringRequest { + return ApiTestQueryStyleFormExplodeTrueArrayStringRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *QueryAPIService) TestQueryStyleFormExplodeTrueArrayStringExecute(r ApiTestQueryStyleFormExplodeTrueArrayStringRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleFormExplodeTrueArrayString") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query/style_form/explode_true/array_string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.queryObject != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestQueryStyleFormExplodeTrueObjectRequest struct { + ctx context.Context + ApiService *QueryAPIService + queryObject *Pet +} + +func (r ApiTestQueryStyleFormExplodeTrueObjectRequest) QueryObject(queryObject Pet) ApiTestQueryStyleFormExplodeTrueObjectRequest { + r.queryObject = &queryObject + return r +} + +func (r ApiTestQueryStyleFormExplodeTrueObjectRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestQueryStyleFormExplodeTrueObjectExecute(r) +} + +/* +TestQueryStyleFormExplodeTrueObject Test query parameter(s) + +Test query parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestQueryStyleFormExplodeTrueObjectRequest +*/ +func (a *QueryAPIService) TestQueryStyleFormExplodeTrueObject(ctx context.Context) ApiTestQueryStyleFormExplodeTrueObjectRequest { + return ApiTestQueryStyleFormExplodeTrueObjectRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *QueryAPIService) TestQueryStyleFormExplodeTrueObjectExecute(r ApiTestQueryStyleFormExplodeTrueObjectRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleFormExplodeTrueObject") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query/style_form/explode_true/object" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.queryObject != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest struct { + ctx context.Context + ApiService *QueryAPIService + queryObject *DataQuery +} + +func (r ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest) QueryObject(queryObject DataQuery) ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest { + r.queryObject = &queryObject + return r +} + +func (r ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest) Execute() (string, *http.Response, error) { + return r.ApiService.TestQueryStyleFormExplodeTrueObjectAllOfExecute(r) +} + +/* +TestQueryStyleFormExplodeTrueObjectAllOf Test query parameter(s) + +Test query parameter(s) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest +*/ +func (a *QueryAPIService) TestQueryStyleFormExplodeTrueObjectAllOf(ctx context.Context) ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest { + return ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *QueryAPIService) TestQueryStyleFormExplodeTrueObjectAllOfExecute(r ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleFormExplodeTrueObjectAllOf") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query/style_form/explode_true/object/allOf" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.queryObject != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/client/echo_api/go-external-refs/client.go b/samples/client/echo_api/go-external-refs/client.go new file mode 100644 index 00000000000..fba23f94074 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/client.go @@ -0,0 +1,686 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) +) + +// APIClient manages communication with the Echo Server API API v0.1.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + AuthAPI *AuthAPIService + + BodyAPI *BodyAPIService + + FormAPI *FormAPIService + + HeaderAPI *HeaderAPIService + + PathAPI *PathAPIService + + QueryAPI *QueryAPIService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.AuthAPI = (*AuthAPIService)(&c.common) + c.BodyAPI = (*BodyAPIService)(&c.common) + c.FormAPI = (*FormAPIService)(&c.common) + c.HeaderAPI = (*HeaderAPIService)(&c.common) + c.PathAPI = (*PathAPIService)(&c.common) + c.QueryAPI = (*QueryAPIService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString( obj interface{}, key string ) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param,ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap,err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t,ok := obj.(MappedNullable); ok { + dataMap,err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i:=0;i 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/samples/client/echo_api/go-external-refs/configuration.go b/samples/client/echo_api/go-external-refs/configuration.go new file mode 100644 index 00000000000..f0a872b3152 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/configuration.go @@ -0,0 +1,222 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "http://localhost:3000", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{ + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/samples/client/echo_api/go-external-refs/docs/AuthAPI.md b/samples/client/echo_api/go-external-refs/docs/AuthAPI.md new file mode 100644 index 00000000000..046104c5053 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/AuthAPI.md @@ -0,0 +1,132 @@ +# \AuthAPI + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestAuthHttpBasic**](AuthAPI.md#TestAuthHttpBasic) | **Post** /auth/http/basic | To test HTTP basic authentication +[**TestAuthHttpBearer**](AuthAPI.md#TestAuthHttpBearer) | **Post** /auth/http/bearer | To test HTTP bearer authentication + + + +## TestAuthHttpBasic + +> string TestAuthHttpBasic(ctx).Execute() + +To test HTTP basic authentication + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthAPI.TestAuthHttpBasic(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthAPI.TestAuthHttpBasic``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestAuthHttpBasic`: string + fmt.Fprintf(os.Stdout, "Response from `AuthAPI.TestAuthHttpBasic`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestAuthHttpBasicRequest struct via the builder pattern + + +### Return type + +**string** + +### Authorization + +[http_auth](../README.md#http_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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) + + +## TestAuthHttpBearer + +> string TestAuthHttpBearer(ctx).Execute() + +To test HTTP bearer authentication + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthAPI.TestAuthHttpBearer(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthAPI.TestAuthHttpBearer``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestAuthHttpBearer`: string + fmt.Fprintf(os.Stdout, "Response from `AuthAPI.TestAuthHttpBearer`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestAuthHttpBearerRequest struct via the builder pattern + + +### Return type + +**string** + +### Authorization + +[http_bearer_auth](../README.md#http_bearer_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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/echo_api/go-external-refs/docs/Bird.md b/samples/client/echo_api/go-external-refs/docs/Bird.md new file mode 100644 index 00000000000..c98b8240e1e --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/Bird.md @@ -0,0 +1,82 @@ +# Bird + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | Pointer to **string** | | [optional] +**Color** | Pointer to **string** | | [optional] + +## Methods + +### NewBird + +`func NewBird() *Bird` + +NewBird instantiates a new Bird object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBirdWithDefaults + +`func NewBirdWithDefaults() *Bird` + +NewBirdWithDefaults instantiates a new Bird object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetSize + +`func (o *Bird) GetSize() string` + +GetSize returns the Size field if non-nil, zero value otherwise. + +### GetSizeOk + +`func (o *Bird) GetSizeOk() (*string, bool)` + +GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSize + +`func (o *Bird) SetSize(v string)` + +SetSize sets Size field to given value. + +### HasSize + +`func (o *Bird) HasSize() bool` + +HasSize returns a boolean if a field has been set. + +### GetColor + +`func (o *Bird) GetColor() string` + +GetColor returns the Color field if non-nil, zero value otherwise. + +### GetColorOk + +`func (o *Bird) GetColorOk() (*string, bool)` + +GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetColor + +`func (o *Bird) SetColor(v string)` + +SetColor sets Color field to given value. + +### HasColor + +`func (o *Bird) HasColor() bool` + +HasColor returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/go-external-refs/docs/BodyAPI.md b/samples/client/echo_api/go-external-refs/docs/BodyAPI.md new file mode 100644 index 00000000000..7fafe50f258 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/BodyAPI.md @@ -0,0 +1,606 @@ +# \BodyAPI + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestBinaryGif**](BodyAPI.md#TestBinaryGif) | **Post** /binary/gif | Test binary (gif) response body +[**TestBodyApplicationOctetstreamBinary**](BodyAPI.md#TestBodyApplicationOctetstreamBinary) | **Post** /body/application/octetstream/binary | Test body parameter(s) +[**TestBodyMultipartFormdataArrayOfBinary**](BodyAPI.md#TestBodyMultipartFormdataArrayOfBinary) | **Post** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +[**TestBodyMultipartFormdataSingleBinary**](BodyAPI.md#TestBodyMultipartFormdataSingleBinary) | **Post** /body/application/octetstream/single_binary | Test single binary in multipart mime +[**TestEchoBodyAllOfPet**](BodyAPI.md#TestEchoBodyAllOfPet) | **Post** /echo/body/allOf/Pet | Test body parameter(s) +[**TestEchoBodyFreeFormObjectResponseString**](BodyAPI.md#TestEchoBodyFreeFormObjectResponseString) | **Post** /echo/body/FreeFormObject/response_string | Test free form object +[**TestEchoBodyPet**](BodyAPI.md#TestEchoBodyPet) | **Post** /echo/body/Pet | Test body parameter(s) +[**TestEchoBodyPetResponseString**](BodyAPI.md#TestEchoBodyPetResponseString) | **Post** /echo/body/Pet/response_string | Test empty response body +[**TestEchoBodyTagResponseString**](BodyAPI.md#TestEchoBodyTagResponseString) | **Post** /echo/body/Tag/response_string | Test empty json (request body) + + + +## TestBinaryGif + +> *os.File TestBinaryGif(ctx).Execute() + +Test binary (gif) response body + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.BodyAPI.TestBinaryGif(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestBinaryGif``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestBinaryGif`: *os.File + fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestBinaryGif`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestBinaryGifRequest struct via the builder pattern + + +### Return type + +[***os.File**](*os.File.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: image/gif + +[[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) + + +## TestBodyApplicationOctetstreamBinary + +> string TestBodyApplicationOctetstreamBinary(ctx).Body(body).Execute() + +Test body parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + body := os.NewFile(1234, "some_file") // *os.File | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.BodyAPI.TestBodyApplicationOctetstreamBinary(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestBodyApplicationOctetstreamBinary``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestBodyApplicationOctetstreamBinary`: string + fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestBodyApplicationOctetstreamBinary`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestBodyApplicationOctetstreamBinaryRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | ***os.File** | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/octet-stream +- **Accept**: text/plain + +[[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) + + +## TestBodyMultipartFormdataArrayOfBinary + +> string TestBodyMultipartFormdataArrayOfBinary(ctx).Files(files).Execute() + +Test array of binary in multipart mime + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + files := []*os.File{"TODO"} // []*os.File | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.BodyAPI.TestBodyMultipartFormdataArrayOfBinary(context.Background()).Files(files).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestBodyMultipartFormdataArrayOfBinary``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestBodyMultipartFormdataArrayOfBinary`: string + fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestBodyMultipartFormdataArrayOfBinary`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestBodyMultipartFormdataArrayOfBinaryRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **files** | **[]*os.File** | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: text/plain + +[[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) + + +## TestBodyMultipartFormdataSingleBinary + +> string TestBodyMultipartFormdataSingleBinary(ctx).MyFile(myFile).Execute() + +Test single binary in multipart mime + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + myFile := os.NewFile(1234, "some_file") // *os.File | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.BodyAPI.TestBodyMultipartFormdataSingleBinary(context.Background()).MyFile(myFile).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestBodyMultipartFormdataSingleBinary``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestBodyMultipartFormdataSingleBinary`: string + fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestBodyMultipartFormdataSingleBinary`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestBodyMultipartFormdataSingleBinaryRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **myFile** | ***os.File** | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: text/plain + +[[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) + + +## TestEchoBodyAllOfPet + +> Pet TestEchoBodyAllOfPet(ctx).Pet(pet).Execute() + +Test body parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + pet := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | Pet object that needs to be added to the store (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.BodyAPI.TestEchoBodyAllOfPet(context.Background()).Pet(pet).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestEchoBodyAllOfPet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestEchoBodyAllOfPet`: Pet + fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestEchoBodyAllOfPet`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEchoBodyAllOfPetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | + +### Return type + +[**Pet**](Pet.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) + + +## TestEchoBodyFreeFormObjectResponseString + +> string TestEchoBodyFreeFormObjectResponseString(ctx).Body(body).Execute() + +Test free form object + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + body := map[string]interface{}{ ... } // map[string]interface{} | Free form object (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.BodyAPI.TestEchoBodyFreeFormObjectResponseString(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestEchoBodyFreeFormObjectResponseString``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestEchoBodyFreeFormObjectResponseString`: string + fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestEchoBodyFreeFormObjectResponseString`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEchoBodyFreeFormObjectResponseStringRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **map[string]interface{}** | Free form object | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: text/plain + +[[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) + + +## TestEchoBodyPet + +> Pet TestEchoBodyPet(ctx).Pet(pet).Execute() + +Test body parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + pet := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | Pet object that needs to be added to the store (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.BodyAPI.TestEchoBodyPet(context.Background()).Pet(pet).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestEchoBodyPet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestEchoBodyPet`: Pet + fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestEchoBodyPet`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEchoBodyPetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | + +### Return type + +[**Pet**](Pet.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) + + +## TestEchoBodyPetResponseString + +> string TestEchoBodyPetResponseString(ctx).Pet(pet).Execute() + +Test empty response body + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + pet := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | Pet object that needs to be added to the store (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.BodyAPI.TestEchoBodyPetResponseString(context.Background()).Pet(pet).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestEchoBodyPetResponseString``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestEchoBodyPetResponseString`: string + fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestEchoBodyPetResponseString`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEchoBodyPetResponseStringRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: text/plain + +[[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) + + +## TestEchoBodyTagResponseString + +> string TestEchoBodyTagResponseString(ctx).Tag(tag).Execute() + +Test empty json (request body) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + tag := *openapiclient.NewTag() // Tag | Tag object (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.BodyAPI.TestEchoBodyTagResponseString(context.Background()).Tag(tag).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestEchoBodyTagResponseString``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestEchoBodyTagResponseString`: string + fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestEchoBodyTagResponseString`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEchoBodyTagResponseStringRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag** | [**Tag**](Tag.md) | Tag object | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: text/plain + +[[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/echo_api/go-external-refs/docs/Category.md b/samples/client/echo_api/go-external-refs/docs/Category.md new file mode 100644 index 00000000000..9bedc96c534 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/Category.md @@ -0,0 +1,82 @@ +# Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | | [optional] +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewCategory + +`func NewCategory() *Category` + +NewCategory instantiates a new Category object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewCategoryWithDefaults + +`func NewCategoryWithDefaults() *Category` + +NewCategoryWithDefaults instantiates a new Category object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *Category) GetId() int64` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Category) GetIdOk() (*int64, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Category) SetId(v int64)` + +SetId sets Id field to given value. + +### HasId + +`func (o *Category) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetName + +`func (o *Category) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Category) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *Category) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *Category) HasName() bool` + +HasName returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/go-external-refs/docs/DataQuery.md b/samples/client/echo_api/go-external-refs/docs/DataQuery.md new file mode 100644 index 00000000000..d33748bc126 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/DataQuery.md @@ -0,0 +1,108 @@ +# DataQuery + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Suffix** | Pointer to **string** | test suffix | [optional] +**Text** | Pointer to **string** | Some text containing white spaces | [optional] +**Date** | Pointer to **time.Time** | A date | [optional] + +## Methods + +### NewDataQuery + +`func NewDataQuery() *DataQuery` + +NewDataQuery instantiates a new DataQuery object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewDataQueryWithDefaults + +`func NewDataQueryWithDefaults() *DataQuery` + +NewDataQueryWithDefaults instantiates a new DataQuery object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetSuffix + +`func (o *DataQuery) GetSuffix() string` + +GetSuffix returns the Suffix field if non-nil, zero value otherwise. + +### GetSuffixOk + +`func (o *DataQuery) GetSuffixOk() (*string, bool)` + +GetSuffixOk returns a tuple with the Suffix field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSuffix + +`func (o *DataQuery) SetSuffix(v string)` + +SetSuffix sets Suffix field to given value. + +### HasSuffix + +`func (o *DataQuery) HasSuffix() bool` + +HasSuffix returns a boolean if a field has been set. + +### GetText + +`func (o *DataQuery) GetText() string` + +GetText returns the Text field if non-nil, zero value otherwise. + +### GetTextOk + +`func (o *DataQuery) GetTextOk() (*string, bool)` + +GetTextOk returns a tuple with the Text field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetText + +`func (o *DataQuery) SetText(v string)` + +SetText sets Text field to given value. + +### HasText + +`func (o *DataQuery) HasText() bool` + +HasText returns a boolean if a field has been set. + +### GetDate + +`func (o *DataQuery) GetDate() time.Time` + +GetDate returns the Date field if non-nil, zero value otherwise. + +### GetDateOk + +`func (o *DataQuery) GetDateOk() (*time.Time, bool)` + +GetDateOk returns a tuple with the Date field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDate + +`func (o *DataQuery) SetDate(v time.Time)` + +SetDate sets Date field to given value. + +### HasDate + +`func (o *DataQuery) HasDate() bool` + +HasDate returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/go-external-refs/docs/DefaultValue.md b/samples/client/echo_api/go-external-refs/docs/DefaultValue.md new file mode 100644 index 00000000000..c6469d1db9a --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/DefaultValue.md @@ -0,0 +1,268 @@ +# DefaultValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayStringEnumRefDefault** | Pointer to [**[]StringEnumRef**](StringEnumRef.md) | | [optional] [default to ["success","failure"]] +**ArrayStringEnumDefault** | Pointer to **[]string** | | [optional] [default to ["success","failure"]] +**ArrayStringDefault** | Pointer to **[]string** | | [optional] [default to ["failure","skipped"]] +**ArrayIntegerDefault** | Pointer to **[]int32** | | [optional] [default to [1,3]] +**ArrayString** | Pointer to **[]string** | | [optional] +**ArrayStringNullable** | Pointer to **[]string** | | [optional] +**ArrayStringExtensionNullable** | Pointer to **[]string** | | [optional] +**StringNullable** | Pointer to **NullableString** | | [optional] + +## Methods + +### NewDefaultValue + +`func NewDefaultValue() *DefaultValue` + +NewDefaultValue instantiates a new DefaultValue object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewDefaultValueWithDefaults + +`func NewDefaultValueWithDefaults() *DefaultValue` + +NewDefaultValueWithDefaults instantiates a new DefaultValue object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetArrayStringEnumRefDefault + +`func (o *DefaultValue) GetArrayStringEnumRefDefault() []StringEnumRef` + +GetArrayStringEnumRefDefault returns the ArrayStringEnumRefDefault field if non-nil, zero value otherwise. + +### GetArrayStringEnumRefDefaultOk + +`func (o *DefaultValue) GetArrayStringEnumRefDefaultOk() (*[]StringEnumRef, bool)` + +GetArrayStringEnumRefDefaultOk returns a tuple with the ArrayStringEnumRefDefault field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayStringEnumRefDefault + +`func (o *DefaultValue) SetArrayStringEnumRefDefault(v []StringEnumRef)` + +SetArrayStringEnumRefDefault sets ArrayStringEnumRefDefault field to given value. + +### HasArrayStringEnumRefDefault + +`func (o *DefaultValue) HasArrayStringEnumRefDefault() bool` + +HasArrayStringEnumRefDefault returns a boolean if a field has been set. + +### GetArrayStringEnumDefault + +`func (o *DefaultValue) GetArrayStringEnumDefault() []string` + +GetArrayStringEnumDefault returns the ArrayStringEnumDefault field if non-nil, zero value otherwise. + +### GetArrayStringEnumDefaultOk + +`func (o *DefaultValue) GetArrayStringEnumDefaultOk() (*[]string, bool)` + +GetArrayStringEnumDefaultOk returns a tuple with the ArrayStringEnumDefault field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayStringEnumDefault + +`func (o *DefaultValue) SetArrayStringEnumDefault(v []string)` + +SetArrayStringEnumDefault sets ArrayStringEnumDefault field to given value. + +### HasArrayStringEnumDefault + +`func (o *DefaultValue) HasArrayStringEnumDefault() bool` + +HasArrayStringEnumDefault returns a boolean if a field has been set. + +### GetArrayStringDefault + +`func (o *DefaultValue) GetArrayStringDefault() []string` + +GetArrayStringDefault returns the ArrayStringDefault field if non-nil, zero value otherwise. + +### GetArrayStringDefaultOk + +`func (o *DefaultValue) GetArrayStringDefaultOk() (*[]string, bool)` + +GetArrayStringDefaultOk returns a tuple with the ArrayStringDefault field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayStringDefault + +`func (o *DefaultValue) SetArrayStringDefault(v []string)` + +SetArrayStringDefault sets ArrayStringDefault field to given value. + +### HasArrayStringDefault + +`func (o *DefaultValue) HasArrayStringDefault() bool` + +HasArrayStringDefault returns a boolean if a field has been set. + +### GetArrayIntegerDefault + +`func (o *DefaultValue) GetArrayIntegerDefault() []int32` + +GetArrayIntegerDefault returns the ArrayIntegerDefault field if non-nil, zero value otherwise. + +### GetArrayIntegerDefaultOk + +`func (o *DefaultValue) GetArrayIntegerDefaultOk() (*[]int32, bool)` + +GetArrayIntegerDefaultOk returns a tuple with the ArrayIntegerDefault field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayIntegerDefault + +`func (o *DefaultValue) SetArrayIntegerDefault(v []int32)` + +SetArrayIntegerDefault sets ArrayIntegerDefault field to given value. + +### HasArrayIntegerDefault + +`func (o *DefaultValue) HasArrayIntegerDefault() bool` + +HasArrayIntegerDefault returns a boolean if a field has been set. + +### GetArrayString + +`func (o *DefaultValue) GetArrayString() []string` + +GetArrayString returns the ArrayString field if non-nil, zero value otherwise. + +### GetArrayStringOk + +`func (o *DefaultValue) GetArrayStringOk() (*[]string, bool)` + +GetArrayStringOk returns a tuple with the ArrayString field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayString + +`func (o *DefaultValue) SetArrayString(v []string)` + +SetArrayString sets ArrayString field to given value. + +### HasArrayString + +`func (o *DefaultValue) HasArrayString() bool` + +HasArrayString returns a boolean if a field has been set. + +### GetArrayStringNullable + +`func (o *DefaultValue) GetArrayStringNullable() []string` + +GetArrayStringNullable returns the ArrayStringNullable field if non-nil, zero value otherwise. + +### GetArrayStringNullableOk + +`func (o *DefaultValue) GetArrayStringNullableOk() (*[]string, bool)` + +GetArrayStringNullableOk returns a tuple with the ArrayStringNullable field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayStringNullable + +`func (o *DefaultValue) SetArrayStringNullable(v []string)` + +SetArrayStringNullable sets ArrayStringNullable field to given value. + +### HasArrayStringNullable + +`func (o *DefaultValue) HasArrayStringNullable() bool` + +HasArrayStringNullable returns a boolean if a field has been set. + +### SetArrayStringNullableNil + +`func (o *DefaultValue) SetArrayStringNullableNil(b bool)` + + SetArrayStringNullableNil sets the value for ArrayStringNullable to be an explicit nil + +### UnsetArrayStringNullable +`func (o *DefaultValue) UnsetArrayStringNullable()` + +UnsetArrayStringNullable ensures that no value is present for ArrayStringNullable, not even an explicit nil +### GetArrayStringExtensionNullable + +`func (o *DefaultValue) GetArrayStringExtensionNullable() []string` + +GetArrayStringExtensionNullable returns the ArrayStringExtensionNullable field if non-nil, zero value otherwise. + +### GetArrayStringExtensionNullableOk + +`func (o *DefaultValue) GetArrayStringExtensionNullableOk() (*[]string, bool)` + +GetArrayStringExtensionNullableOk returns a tuple with the ArrayStringExtensionNullable field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArrayStringExtensionNullable + +`func (o *DefaultValue) SetArrayStringExtensionNullable(v []string)` + +SetArrayStringExtensionNullable sets ArrayStringExtensionNullable field to given value. + +### HasArrayStringExtensionNullable + +`func (o *DefaultValue) HasArrayStringExtensionNullable() bool` + +HasArrayStringExtensionNullable returns a boolean if a field has been set. + +### SetArrayStringExtensionNullableNil + +`func (o *DefaultValue) SetArrayStringExtensionNullableNil(b bool)` + + SetArrayStringExtensionNullableNil sets the value for ArrayStringExtensionNullable to be an explicit nil + +### UnsetArrayStringExtensionNullable +`func (o *DefaultValue) UnsetArrayStringExtensionNullable()` + +UnsetArrayStringExtensionNullable ensures that no value is present for ArrayStringExtensionNullable, not even an explicit nil +### GetStringNullable + +`func (o *DefaultValue) GetStringNullable() string` + +GetStringNullable returns the StringNullable field if non-nil, zero value otherwise. + +### GetStringNullableOk + +`func (o *DefaultValue) GetStringNullableOk() (*string, bool)` + +GetStringNullableOk returns a tuple with the StringNullable field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStringNullable + +`func (o *DefaultValue) SetStringNullable(v string)` + +SetStringNullable sets StringNullable field to given value. + +### HasStringNullable + +`func (o *DefaultValue) HasStringNullable() bool` + +HasStringNullable returns a boolean if a field has been set. + +### SetStringNullableNil + +`func (o *DefaultValue) SetStringNullableNil(b bool)` + + SetStringNullableNil sets the value for StringNullable to be an explicit nil + +### UnsetStringNullable +`func (o *DefaultValue) UnsetStringNullable()` + +UnsetStringNullable ensures that no value is present for StringNullable, not even an explicit nil + +[[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/echo_api/go-external-refs/docs/FormAPI.md b/samples/client/echo_api/go-external-refs/docs/FormAPI.md new file mode 100644 index 00000000000..56d7d9921db --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/FormAPI.md @@ -0,0 +1,156 @@ +# \FormAPI + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestFormIntegerBooleanString**](FormAPI.md#TestFormIntegerBooleanString) | **Post** /form/integer/boolean/string | Test form parameter(s) +[**TestFormOneof**](FormAPI.md#TestFormOneof) | **Post** /form/oneof | Test form parameter(s) for oneOf schema + + + +## TestFormIntegerBooleanString + +> string TestFormIntegerBooleanString(ctx).IntegerForm(integerForm).BooleanForm(booleanForm).StringForm(stringForm).Execute() + +Test form parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + integerForm := int32(56) // int32 | (optional) + booleanForm := true // bool | (optional) + stringForm := "stringForm_example" // string | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FormAPI.TestFormIntegerBooleanString(context.Background()).IntegerForm(integerForm).BooleanForm(booleanForm).StringForm(stringForm).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FormAPI.TestFormIntegerBooleanString``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestFormIntegerBooleanString`: string + fmt.Fprintf(os.Stdout, "Response from `FormAPI.TestFormIntegerBooleanString`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestFormIntegerBooleanStringRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerForm** | **int32** | | + **booleanForm** | **bool** | | + **stringForm** | **string** | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: text/plain + +[[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) + + +## TestFormOneof + +> string TestFormOneof(ctx).Form1(form1).Form2(form2).Form3(form3).Form4(form4).Id(id).Name(name).Execute() + +Test form parameter(s) for oneOf schema + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + form1 := "form1_example" // string | (optional) + form2 := int32(56) // int32 | (optional) + form3 := "form3_example" // string | (optional) + form4 := true // bool | (optional) + id := int64(789) // int64 | (optional) + name := "name_example" // string | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.FormAPI.TestFormOneof(context.Background()).Form1(form1).Form2(form2).Form3(form3).Form4(form4).Id(id).Name(name).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FormAPI.TestFormOneof``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestFormOneof`: string + fmt.Fprintf(os.Stdout, "Response from `FormAPI.TestFormOneof`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestFormOneofRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **form1** | **string** | | + **form2** | **int32** | | + **form3** | **string** | | + **form4** | **bool** | | + **id** | **int64** | | + **name** | **string** | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: text/plain + +[[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/echo_api/go-external-refs/docs/HeaderAPI.md b/samples/client/echo_api/go-external-refs/docs/HeaderAPI.md new file mode 100644 index 00000000000..859a1f9dd40 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/HeaderAPI.md @@ -0,0 +1,83 @@ +# \HeaderAPI + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestHeaderIntegerBooleanStringEnums**](HeaderAPI.md#TestHeaderIntegerBooleanStringEnums) | **Get** /header/integer/boolean/string/enums | Test header parameter(s) + + + +## TestHeaderIntegerBooleanStringEnums + +> string TestHeaderIntegerBooleanStringEnums(ctx).IntegerHeader(integerHeader).BooleanHeader(booleanHeader).StringHeader(stringHeader).EnumNonrefStringHeader(enumNonrefStringHeader).EnumRefStringHeader(enumRefStringHeader).Execute() + +Test header parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + integerHeader := int32(56) // int32 | (optional) + booleanHeader := true // bool | (optional) + stringHeader := "stringHeader_example" // string | (optional) + enumNonrefStringHeader := "enumNonrefStringHeader_example" // string | (optional) + enumRefStringHeader := openapiclient.StringEnumRef("success") // StringEnumRef | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.HeaderAPI.TestHeaderIntegerBooleanStringEnums(context.Background()).IntegerHeader(integerHeader).BooleanHeader(booleanHeader).StringHeader(stringHeader).EnumNonrefStringHeader(enumNonrefStringHeader).EnumRefStringHeader(enumRefStringHeader).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `HeaderAPI.TestHeaderIntegerBooleanStringEnums``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestHeaderIntegerBooleanStringEnums`: string + fmt.Fprintf(os.Stdout, "Response from `HeaderAPI.TestHeaderIntegerBooleanStringEnums`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestHeaderIntegerBooleanStringEnumsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerHeader** | **int32** | | + **booleanHeader** | **bool** | | + **stringHeader** | **string** | | + **enumNonrefStringHeader** | **string** | | + **enumRefStringHeader** | [**StringEnumRef**](StringEnumRef.md) | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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/echo_api/go-external-refs/docs/NumberPropertiesOnly.md b/samples/client/echo_api/go-external-refs/docs/NumberPropertiesOnly.md new file mode 100644 index 00000000000..0a37cc725c5 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/NumberPropertiesOnly.md @@ -0,0 +1,108 @@ +# NumberPropertiesOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Number** | Pointer to **float32** | | [optional] +**Float** | Pointer to **float32** | | [optional] +**Double** | Pointer to **float64** | | [optional] + +## Methods + +### NewNumberPropertiesOnly + +`func NewNumberPropertiesOnly() *NumberPropertiesOnly` + +NewNumberPropertiesOnly instantiates a new NumberPropertiesOnly object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewNumberPropertiesOnlyWithDefaults + +`func NewNumberPropertiesOnlyWithDefaults() *NumberPropertiesOnly` + +NewNumberPropertiesOnlyWithDefaults instantiates a new NumberPropertiesOnly object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetNumber + +`func (o *NumberPropertiesOnly) GetNumber() float32` + +GetNumber returns the Number field if non-nil, zero value otherwise. + +### GetNumberOk + +`func (o *NumberPropertiesOnly) GetNumberOk() (*float32, bool)` + +GetNumberOk returns a tuple with the Number field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNumber + +`func (o *NumberPropertiesOnly) SetNumber(v float32)` + +SetNumber sets Number field to given value. + +### HasNumber + +`func (o *NumberPropertiesOnly) HasNumber() bool` + +HasNumber returns a boolean if a field has been set. + +### GetFloat + +`func (o *NumberPropertiesOnly) GetFloat() float32` + +GetFloat returns the Float field if non-nil, zero value otherwise. + +### GetFloatOk + +`func (o *NumberPropertiesOnly) GetFloatOk() (*float32, bool)` + +GetFloatOk returns a tuple with the Float field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFloat + +`func (o *NumberPropertiesOnly) SetFloat(v float32)` + +SetFloat sets Float field to given value. + +### HasFloat + +`func (o *NumberPropertiesOnly) HasFloat() bool` + +HasFloat returns a boolean if a field has been set. + +### GetDouble + +`func (o *NumberPropertiesOnly) GetDouble() float64` + +GetDouble returns the Double field if non-nil, zero value otherwise. + +### GetDoubleOk + +`func (o *NumberPropertiesOnly) GetDoubleOk() (*float64, bool)` + +GetDoubleOk returns a tuple with the Double field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDouble + +`func (o *NumberPropertiesOnly) SetDouble(v float64)` + +SetDouble sets Double field to given value. + +### HasDouble + +`func (o *NumberPropertiesOnly) HasDouble() bool` + +HasDouble returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/go-external-refs/docs/PathAPI.md b/samples/client/echo_api/go-external-refs/docs/PathAPI.md new file mode 100644 index 00000000000..2ae33bb6e96 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/PathAPI.md @@ -0,0 +1,88 @@ +# \PathAPI + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](PathAPI.md#TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **Get** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) + + + +## TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath + +> string TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(ctx, pathString, pathInteger, enumNonrefStringPath, enumRefStringPath).Execute() + +Test path parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + pathString := "pathString_example" // string | + pathInteger := int32(56) // int32 | + enumNonrefStringPath := "enumNonrefStringPath_example" // string | + enumRefStringPath := openapiclient.StringEnumRef("success") // StringEnumRef | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PathAPI.TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(context.Background(), pathString, pathInteger, enumNonrefStringPath, enumRefStringPath).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PathAPI.TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath`: string + fmt.Fprintf(os.Stdout, "Response from `PathAPI.TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**pathString** | **string** | | +**pathInteger** | **int32** | | +**enumNonrefStringPath** | **string** | | +**enumRefStringPath** | [**StringEnumRef**](.md) | | + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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/echo_api/go-external-refs/docs/Pet.md b/samples/client/echo_api/go-external-refs/docs/Pet.md new file mode 100644 index 00000000000..4887d2c69dd --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/Pet.md @@ -0,0 +1,176 @@ +# Pet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | | [optional] +**Name** | **string** | | +**Category** | Pointer to [**Category**](Category.md) | | [optional] +**PhotoUrls** | **[]string** | | +**Tags** | Pointer to [**[]Tag**](Tag.md) | | [optional] +**Status** | Pointer to **string** | pet status in the store | [optional] + +## Methods + +### NewPet + +`func NewPet(name string, photoUrls []string, ) *Pet` + +NewPet instantiates a new Pet object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewPetWithDefaults + +`func NewPetWithDefaults() *Pet` + +NewPetWithDefaults instantiates a new Pet object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *Pet) GetId() int64` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Pet) GetIdOk() (*int64, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Pet) SetId(v int64)` + +SetId sets Id field to given value. + +### HasId + +`func (o *Pet) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetName + +`func (o *Pet) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Pet) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *Pet) SetName(v string)` + +SetName sets Name field to given value. + + +### GetCategory + +`func (o *Pet) GetCategory() Category` + +GetCategory returns the Category field if non-nil, zero value otherwise. + +### GetCategoryOk + +`func (o *Pet) GetCategoryOk() (*Category, bool)` + +GetCategoryOk returns a tuple with the Category field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCategory + +`func (o *Pet) SetCategory(v Category)` + +SetCategory sets Category field to given value. + +### HasCategory + +`func (o *Pet) HasCategory() bool` + +HasCategory returns a boolean if a field has been set. + +### GetPhotoUrls + +`func (o *Pet) GetPhotoUrls() []string` + +GetPhotoUrls returns the PhotoUrls field if non-nil, zero value otherwise. + +### GetPhotoUrlsOk + +`func (o *Pet) GetPhotoUrlsOk() (*[]string, bool)` + +GetPhotoUrlsOk returns a tuple with the PhotoUrls field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPhotoUrls + +`func (o *Pet) SetPhotoUrls(v []string)` + +SetPhotoUrls sets PhotoUrls field to given value. + + +### GetTags + +`func (o *Pet) GetTags() []Tag` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *Pet) GetTagsOk() (*[]Tag, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *Pet) SetTags(v []Tag)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *Pet) HasTags() bool` + +HasTags returns a boolean if a field has been set. + +### GetStatus + +`func (o *Pet) GetStatus() string` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *Pet) GetStatusOk() (*string, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *Pet) SetStatus(v string)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *Pet) HasStatus() bool` + +HasStatus returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/go-external-refs/docs/Query.md b/samples/client/echo_api/go-external-refs/docs/Query.md new file mode 100644 index 00000000000..2216bdeabda --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/Query.md @@ -0,0 +1,82 @@ +# Query + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | Query | [optional] +**Outcomes** | Pointer to **[]string** | | [optional] [default to ["SUCCESS","FAILURE"]] + +## Methods + +### NewQuery + +`func NewQuery() *Query` + +NewQuery instantiates a new Query object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewQueryWithDefaults + +`func NewQueryWithDefaults() *Query` + +NewQueryWithDefaults instantiates a new Query object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *Query) GetId() int64` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Query) GetIdOk() (*int64, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Query) SetId(v int64)` + +SetId sets Id field to given value. + +### HasId + +`func (o *Query) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetOutcomes + +`func (o *Query) GetOutcomes() []string` + +GetOutcomes returns the Outcomes field if non-nil, zero value otherwise. + +### GetOutcomesOk + +`func (o *Query) GetOutcomesOk() (*[]string, bool)` + +GetOutcomesOk returns a tuple with the Outcomes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutcomes + +`func (o *Query) SetOutcomes(v []string)` + +SetOutcomes sets Outcomes field to given value. + +### HasOutcomes + +`func (o *Query) HasOutcomes() bool` + +HasOutcomes returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/go-external-refs/docs/QueryAPI.md b/samples/client/echo_api/go-external-refs/docs/QueryAPI.md new file mode 100644 index 00000000000..a62e1eb6bbc --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/QueryAPI.md @@ -0,0 +1,689 @@ +# \QueryAPI + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestEnumRefString**](QueryAPI.md#TestEnumRefString) | **Get** /query/enum_ref_string | Test query parameter(s) +[**TestQueryDatetimeDateString**](QueryAPI.md#TestQueryDatetimeDateString) | **Get** /query/datetime/date/string | Test query parameter(s) +[**TestQueryIntegerBooleanString**](QueryAPI.md#TestQueryIntegerBooleanString) | **Get** /query/integer/boolean/string | Test query parameter(s) +[**TestQueryStyleDeepObjectExplodeTrueObject**](QueryAPI.md#TestQueryStyleDeepObjectExplodeTrueObject) | **Get** /query/style_deepObject/explode_true/object | Test query parameter(s) +[**TestQueryStyleDeepObjectExplodeTrueObjectAllOf**](QueryAPI.md#TestQueryStyleDeepObjectExplodeTrueObjectAllOf) | **Get** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) +[**TestQueryStyleFormExplodeFalseArrayInteger**](QueryAPI.md#TestQueryStyleFormExplodeFalseArrayInteger) | **Get** /query/style_form/explode_false/array_integer | Test query parameter(s) +[**TestQueryStyleFormExplodeFalseArrayString**](QueryAPI.md#TestQueryStyleFormExplodeFalseArrayString) | **Get** /query/style_form/explode_false/array_string | Test query parameter(s) +[**TestQueryStyleFormExplodeTrueArrayString**](QueryAPI.md#TestQueryStyleFormExplodeTrueArrayString) | **Get** /query/style_form/explode_true/array_string | Test query parameter(s) +[**TestQueryStyleFormExplodeTrueObject**](QueryAPI.md#TestQueryStyleFormExplodeTrueObject) | **Get** /query/style_form/explode_true/object | Test query parameter(s) +[**TestQueryStyleFormExplodeTrueObjectAllOf**](QueryAPI.md#TestQueryStyleFormExplodeTrueObjectAllOf) | **Get** /query/style_form/explode_true/object/allOf | Test query parameter(s) + + + +## TestEnumRefString + +> string TestEnumRefString(ctx).EnumNonrefStringQuery(enumNonrefStringQuery).EnumRefStringQuery(enumRefStringQuery).Execute() + +Test query parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + enumNonrefStringQuery := "enumNonrefStringQuery_example" // string | (optional) + enumRefStringQuery := openapiclient.StringEnumRef("success") // StringEnumRef | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QueryAPI.TestEnumRefString(context.Background()).EnumNonrefStringQuery(enumNonrefStringQuery).EnumRefStringQuery(enumRefStringQuery).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestEnumRefString``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestEnumRefString`: string + fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestEnumRefString`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestEnumRefStringRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumNonrefStringQuery** | **string** | | + **enumRefStringQuery** | [**StringEnumRef**](StringEnumRef.md) | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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) + + +## TestQueryDatetimeDateString + +> string TestQueryDatetimeDateString(ctx).DatetimeQuery(datetimeQuery).DateQuery(dateQuery).StringQuery(stringQuery).Execute() + +Test query parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + "time" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + datetimeQuery := time.Now() // time.Time | (optional) + dateQuery := time.Now() // string | (optional) + stringQuery := "stringQuery_example" // string | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QueryAPI.TestQueryDatetimeDateString(context.Background()).DatetimeQuery(datetimeQuery).DateQuery(dateQuery).StringQuery(stringQuery).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryDatetimeDateString``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestQueryDatetimeDateString`: string + fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryDatetimeDateString`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestQueryDatetimeDateStringRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **datetimeQuery** | **time.Time** | | + **dateQuery** | **string** | | + **stringQuery** | **string** | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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) + + +## TestQueryIntegerBooleanString + +> string TestQueryIntegerBooleanString(ctx).IntegerQuery(integerQuery).BooleanQuery(booleanQuery).StringQuery(stringQuery).Execute() + +Test query parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + integerQuery := int32(56) // int32 | (optional) + booleanQuery := true // bool | (optional) + stringQuery := "stringQuery_example" // string | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QueryAPI.TestQueryIntegerBooleanString(context.Background()).IntegerQuery(integerQuery).BooleanQuery(booleanQuery).StringQuery(stringQuery).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryIntegerBooleanString``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestQueryIntegerBooleanString`: string + fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryIntegerBooleanString`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestQueryIntegerBooleanStringRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerQuery** | **int32** | | + **booleanQuery** | **bool** | | + **stringQuery** | **string** | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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) + + +## TestQueryStyleDeepObjectExplodeTrueObject + +> string TestQueryStyleDeepObjectExplodeTrueObject(ctx).QueryObject(queryObject).Execute() + +Test query parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + queryObject := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QueryAPI.TestQueryStyleDeepObjectExplodeTrueObject(context.Background()).QueryObject(queryObject).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleDeepObjectExplodeTrueObject``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestQueryStyleDeepObjectExplodeTrueObject`: string + fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleDeepObjectExplodeTrueObject`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestQueryStyleDeepObjectExplodeTrueObjectRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**Pet**](Pet.md) | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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) + + +## TestQueryStyleDeepObjectExplodeTrueObjectAllOf + +> string TestQueryStyleDeepObjectExplodeTrueObjectAllOf(ctx).QueryObject(queryObject).Execute() + +Test query parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + queryObject := *openapiclient.NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() // TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QueryAPI.TestQueryStyleDeepObjectExplodeTrueObjectAllOf(context.Background()).QueryObject(queryObject).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleDeepObjectExplodeTrueObjectAllOf``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestQueryStyleDeepObjectExplodeTrueObjectAllOf`: string + fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleDeepObjectExplodeTrueObjectAllOf`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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) + + +## TestQueryStyleFormExplodeFalseArrayInteger + +> string TestQueryStyleFormExplodeFalseArrayInteger(ctx).QueryObject(queryObject).Execute() + +Test query parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + queryObject := []int32{int32(123)} // []int32 | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QueryAPI.TestQueryStyleFormExplodeFalseArrayInteger(context.Background()).QueryObject(queryObject).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleFormExplodeFalseArrayInteger``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestQueryStyleFormExplodeFalseArrayInteger`: string + fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleFormExplodeFalseArrayInteger`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestQueryStyleFormExplodeFalseArrayIntegerRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | **[]int32** | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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) + + +## TestQueryStyleFormExplodeFalseArrayString + +> string TestQueryStyleFormExplodeFalseArrayString(ctx).QueryObject(queryObject).Execute() + +Test query parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + queryObject := []string{"Inner_example"} // []string | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QueryAPI.TestQueryStyleFormExplodeFalseArrayString(context.Background()).QueryObject(queryObject).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleFormExplodeFalseArrayString``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestQueryStyleFormExplodeFalseArrayString`: string + fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleFormExplodeFalseArrayString`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestQueryStyleFormExplodeFalseArrayStringRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | **[]string** | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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) + + +## TestQueryStyleFormExplodeTrueArrayString + +> string TestQueryStyleFormExplodeTrueArrayString(ctx).QueryObject(queryObject).Execute() + +Test query parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + queryObject := *openapiclient.NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QueryAPI.TestQueryStyleFormExplodeTrueArrayString(context.Background()).QueryObject(queryObject).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleFormExplodeTrueArrayString``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestQueryStyleFormExplodeTrueArrayString`: string + fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleFormExplodeTrueArrayString`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestQueryStyleFormExplodeTrueArrayStringRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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) + + +## TestQueryStyleFormExplodeTrueObject + +> string TestQueryStyleFormExplodeTrueObject(ctx).QueryObject(queryObject).Execute() + +Test query parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + queryObject := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QueryAPI.TestQueryStyleFormExplodeTrueObject(context.Background()).QueryObject(queryObject).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleFormExplodeTrueObject``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestQueryStyleFormExplodeTrueObject`: string + fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleFormExplodeTrueObject`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestQueryStyleFormExplodeTrueObjectRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**Pet**](Pet.md) | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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) + + +## TestQueryStyleFormExplodeTrueObjectAllOf + +> string TestQueryStyleFormExplodeTrueObjectAllOf(ctx).QueryObject(queryObject).Execute() + +Test query parameter(s) + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func main() { + queryObject := *openapiclient.NewDataQuery() // DataQuery | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.QueryAPI.TestQueryStyleFormExplodeTrueObjectAllOf(context.Background()).QueryObject(queryObject).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleFormExplodeTrueObjectAllOf``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestQueryStyleFormExplodeTrueObjectAllOf`: string + fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleFormExplodeTrueObjectAllOf`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestQueryStyleFormExplodeTrueObjectAllOfRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**DataQuery**](DataQuery.md) | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + +[[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/echo_api/go-external-refs/docs/StringEnumRef.md b/samples/client/echo_api/go-external-refs/docs/StringEnumRef.md new file mode 100644 index 00000000000..e4636302a7f --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/StringEnumRef.md @@ -0,0 +1,15 @@ +# StringEnumRef + +## Enum + + +* `SUCCESS` (value: `"success"`) + +* `FAILURE` (value: `"failure"`) + +* `UNCLASSIFIED` (value: `"unclassified"`) + + +[[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/echo_api/go-external-refs/docs/Tag.md b/samples/client/echo_api/go-external-refs/docs/Tag.md new file mode 100644 index 00000000000..391be6b4900 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/Tag.md @@ -0,0 +1,82 @@ +# Tag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int64** | | [optional] +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewTag + +`func NewTag() *Tag` + +NewTag instantiates a new Tag object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTagWithDefaults + +`func NewTagWithDefaults() *Tag` + +NewTagWithDefaults instantiates a new Tag object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *Tag) GetId() int64` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Tag) GetIdOk() (*int64, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Tag) SetId(v int64)` + +SetId sets Id field to given value. + +### HasId + +`func (o *Tag) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetName + +`func (o *Tag) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Tag) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *Tag) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *Tag) HasName() bool` + +HasName returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/go-external-refs/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md b/samples/client/echo_api/go-external-refs/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md new file mode 100644 index 00000000000..8efa3db73b9 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md @@ -0,0 +1,134 @@ +# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | Pointer to **string** | | [optional] +**Color** | Pointer to **string** | | [optional] +**Id** | Pointer to **int64** | | [optional] +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + +`func NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` + +NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter instantiates a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterWithDefaults + +`func NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterWithDefaults() *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` + +NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterWithDefaults instantiates a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetSize + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetSize() string` + +GetSize returns the Size field if non-nil, zero value otherwise. + +### GetSizeOk + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetSizeOk() (*string, bool)` + +GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSize + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetSize(v string)` + +SetSize sets Size field to given value. + +### HasSize + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasSize() bool` + +HasSize returns a boolean if a field has been set. + +### GetColor + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetColor() string` + +GetColor returns the Color field if non-nil, zero value otherwise. + +### GetColorOk + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetColorOk() (*string, bool)` + +GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetColor + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetColor(v string)` + +SetColor sets Color field to given value. + +### HasColor + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasColor() bool` + +HasColor returns a boolean if a field has been set. + +### GetId + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetId() int64` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetIdOk() (*int64, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetId(v int64)` + +SetId sets Id field to given value. + +### HasId + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetName + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasName() bool` + +HasName returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/go-external-refs/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/go-external-refs/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md new file mode 100644 index 00000000000..8de9ec2b2e8 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md @@ -0,0 +1,56 @@ +# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Values** | Pointer to **[]string** | | [optional] + +## Methods + +### NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +`func NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` + +NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter instantiates a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterWithDefaults + +`func NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterWithDefaults() *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` + +NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterWithDefaults instantiates a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetValues + +`func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) GetValues() []string` + +GetValues returns the Values field if non-nil, zero value otherwise. + +### GetValuesOk + +`func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) GetValuesOk() (*[]string, bool)` + +GetValuesOk returns a tuple with the Values field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetValues + +`func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) SetValues(v []string)` + +SetValues sets Values field to given value. + +### HasValues + +`func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) HasValues() bool` + +HasValues returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/go-external-refs/git_push.sh b/samples/client/echo_api/go-external-refs/git_push.sh new file mode 100644 index 00000000000..f53a75d4fab --- /dev/null +++ b/samples/client/echo_api/go-external-refs/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/echo_api/go-external-refs/go.mod b/samples/client/echo_api/go-external-refs/go.mod new file mode 100644 index 00000000000..7fca7eee925 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/go.mod @@ -0,0 +1,6 @@ +module github.com/GIT_USER_ID/GIT_REPO_ID + +go 1.18 + +require ( +) diff --git a/samples/client/echo_api/go-external-refs/go.sum b/samples/client/echo_api/go-external-refs/go.sum new file mode 100644 index 00000000000..c966c8ddfd0 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/go.sum @@ -0,0 +1,11 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/samples/client/echo_api/go-external-refs/model_bird.go b/samples/client/echo_api/go-external-refs/model_bird.go new file mode 100644 index 00000000000..5b15b73862e --- /dev/null +++ b/samples/client/echo_api/go-external-refs/model_bird.go @@ -0,0 +1,163 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the Bird type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Bird{} + +// Bird struct for Bird +type Bird struct { + Size *string `json:"size,omitempty"` + Color *string `json:"color,omitempty"` +} + +// NewBird instantiates a new Bird object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBird() *Bird { + this := Bird{} + return &this +} + +// NewBirdWithDefaults instantiates a new Bird object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBirdWithDefaults() *Bird { + this := Bird{} + return &this +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Bird) GetSize() string { + if o == nil || IsNil(o.Size) { + var ret string + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Bird) GetSizeOk() (*string, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *Bird) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given string and assigns it to the Size field. +func (o *Bird) SetSize(v string) { + o.Size = &v +} + +// GetColor returns the Color field value if set, zero value otherwise. +func (o *Bird) GetColor() string { + if o == nil || IsNil(o.Color) { + var ret string + return ret + } + return *o.Color +} + +// GetColorOk returns a tuple with the Color field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Bird) GetColorOk() (*string, bool) { + if o == nil || IsNil(o.Color) { + return nil, false + } + return o.Color, true +} + +// HasColor returns a boolean if a field has been set. +func (o *Bird) HasColor() bool { + if o != nil && !IsNil(o.Color) { + return true + } + + return false +} + +// SetColor gets a reference to the given string and assigns it to the Color field. +func (o *Bird) SetColor(v string) { + o.Color = &v +} + +func (o Bird) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Bird) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.Color) { + toSerialize["color"] = o.Color + } + return toSerialize, nil +} + +type NullableBird struct { + value *Bird + isSet bool +} + +func (v NullableBird) Get() *Bird { + return v.value +} + +func (v *NullableBird) Set(val *Bird) { + v.value = val + v.isSet = true +} + +func (v NullableBird) IsSet() bool { + return v.isSet +} + +func (v *NullableBird) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBird(val *Bird) *NullableBird { + return &NullableBird{value: val, isSet: true} +} + +func (v NullableBird) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBird) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/echo_api/go-external-refs/model_category.go b/samples/client/echo_api/go-external-refs/model_category.go new file mode 100644 index 00000000000..20937702195 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/model_category.go @@ -0,0 +1,163 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the Category type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Category{} + +// Category struct for Category +type Category struct { + Id *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} + +// NewCategory instantiates a new Category object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCategory() *Category { + this := Category{} + return &this +} + +// NewCategoryWithDefaults instantiates a new Category object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCategoryWithDefaults() *Category { + this := Category{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Category) GetId() int64 { + if o == nil || IsNil(o.Id) { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Category) GetIdOk() (*int64, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Category) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Category) SetId(v int64) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Category) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Category) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Category) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Category) SetName(v string) { + o.Name = &v +} + +func (o Category) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Category) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableCategory struct { + value *Category + isSet bool +} + +func (v NullableCategory) Get() *Category { + return v.value +} + +func (v *NullableCategory) Set(val *Category) { + v.value = val + v.isSet = true +} + +func (v NullableCategory) IsSet() bool { + return v.isSet +} + +func (v *NullableCategory) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCategory(val *Category) *NullableCategory { + return &NullableCategory{value: val, isSet: true} +} + +func (v NullableCategory) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCategory) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/echo_api/go-external-refs/model_data_query.go b/samples/client/echo_api/go-external-refs/model_data_query.go new file mode 100644 index 00000000000..9a5fe8ce906 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/model_data_query.go @@ -0,0 +1,212 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "time" +) + +// checks if the DataQuery type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DataQuery{} + +// DataQuery struct for DataQuery +type DataQuery struct { + Query + // test suffix + Suffix *string `json:"suffix,omitempty"` + // Some text containing white spaces + Text *string `json:"text,omitempty"` + // A date + Date *time.Time `json:"date,omitempty"` +} + +// NewDataQuery instantiates a new DataQuery object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDataQuery() *DataQuery { + this := DataQuery{} + return &this +} + +// NewDataQueryWithDefaults instantiates a new DataQuery object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDataQueryWithDefaults() *DataQuery { + this := DataQuery{} + return &this +} + +// GetSuffix returns the Suffix field value if set, zero value otherwise. +func (o *DataQuery) GetSuffix() string { + if o == nil || IsNil(o.Suffix) { + var ret string + return ret + } + return *o.Suffix +} + +// GetSuffixOk returns a tuple with the Suffix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataQuery) GetSuffixOk() (*string, bool) { + if o == nil || IsNil(o.Suffix) { + return nil, false + } + return o.Suffix, true +} + +// HasSuffix returns a boolean if a field has been set. +func (o *DataQuery) HasSuffix() bool { + if o != nil && !IsNil(o.Suffix) { + return true + } + + return false +} + +// SetSuffix gets a reference to the given string and assigns it to the Suffix field. +func (o *DataQuery) SetSuffix(v string) { + o.Suffix = &v +} + +// GetText returns the Text field value if set, zero value otherwise. +func (o *DataQuery) GetText() string { + if o == nil || IsNil(o.Text) { + var ret string + return ret + } + return *o.Text +} + +// GetTextOk returns a tuple with the Text field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataQuery) GetTextOk() (*string, bool) { + if o == nil || IsNil(o.Text) { + return nil, false + } + return o.Text, true +} + +// HasText returns a boolean if a field has been set. +func (o *DataQuery) HasText() bool { + if o != nil && !IsNil(o.Text) { + return true + } + + return false +} + +// SetText gets a reference to the given string and assigns it to the Text field. +func (o *DataQuery) SetText(v string) { + o.Text = &v +} + +// GetDate returns the Date field value if set, zero value otherwise. +func (o *DataQuery) GetDate() time.Time { + if o == nil || IsNil(o.Date) { + var ret time.Time + return ret + } + return *o.Date +} + +// GetDateOk returns a tuple with the Date field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DataQuery) GetDateOk() (*time.Time, bool) { + if o == nil || IsNil(o.Date) { + return nil, false + } + return o.Date, true +} + +// HasDate returns a boolean if a field has been set. +func (o *DataQuery) HasDate() bool { + if o != nil && !IsNil(o.Date) { + return true + } + + return false +} + +// SetDate gets a reference to the given time.Time and assigns it to the Date field. +func (o *DataQuery) SetDate(v time.Time) { + o.Date = &v +} + +func (o DataQuery) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DataQuery) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + serializedQuery, errQuery := json.Marshal(o.Query) + if errQuery != nil { + return map[string]interface{}{}, errQuery + } + errQuery = json.Unmarshal([]byte(serializedQuery), &toSerialize) + if errQuery != nil { + return map[string]interface{}{}, errQuery + } + if !IsNil(o.Suffix) { + toSerialize["suffix"] = o.Suffix + } + if !IsNil(o.Text) { + toSerialize["text"] = o.Text + } + if !IsNil(o.Date) { + toSerialize["date"] = o.Date + } + return toSerialize, nil +} + +type NullableDataQuery struct { + value *DataQuery + isSet bool +} + +func (v NullableDataQuery) Get() *DataQuery { + return v.value +} + +func (v *NullableDataQuery) Set(val *DataQuery) { + v.value = val + v.isSet = true +} + +func (v NullableDataQuery) IsSet() bool { + return v.isSet +} + +func (v *NullableDataQuery) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDataQuery(val *DataQuery) *NullableDataQuery { + return &NullableDataQuery{value: val, isSet: true} +} + +func (v NullableDataQuery) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDataQuery) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/echo_api/go-external-refs/model_default_value.go b/samples/client/echo_api/go-external-refs/model_default_value.go new file mode 100644 index 00000000000..e40a4e5a142 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/model_default_value.go @@ -0,0 +1,391 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the DefaultValue type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DefaultValue{} + +// DefaultValue to test the default value of properties +type DefaultValue struct { + ArrayStringEnumRefDefault []StringEnumRef `json:"array_string_enum_ref_default,omitempty"` + ArrayStringEnumDefault []string `json:"array_string_enum_default,omitempty"` + ArrayStringDefault []string `json:"array_string_default,omitempty"` + ArrayIntegerDefault []int32 `json:"array_integer_default,omitempty"` + ArrayString []string `json:"array_string,omitempty"` + ArrayStringNullable []string `json:"array_string_nullable,omitempty"` + ArrayStringExtensionNullable []string `json:"array_string_extension_nullable,omitempty"` + StringNullable NullableString `json:"string_nullable,omitempty"` +} + +// NewDefaultValue instantiates a new DefaultValue object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDefaultValue() *DefaultValue { + this := DefaultValue{} + return &this +} + +// NewDefaultValueWithDefaults instantiates a new DefaultValue object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDefaultValueWithDefaults() *DefaultValue { + this := DefaultValue{} + return &this +} + +// GetArrayStringEnumRefDefault returns the ArrayStringEnumRefDefault field value if set, zero value otherwise. +func (o *DefaultValue) GetArrayStringEnumRefDefault() []StringEnumRef { + if o == nil || IsNil(o.ArrayStringEnumRefDefault) { + var ret []StringEnumRef + return ret + } + return o.ArrayStringEnumRefDefault +} + +// GetArrayStringEnumRefDefaultOk returns a tuple with the ArrayStringEnumRefDefault field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DefaultValue) GetArrayStringEnumRefDefaultOk() ([]StringEnumRef, bool) { + if o == nil || IsNil(o.ArrayStringEnumRefDefault) { + return nil, false + } + return o.ArrayStringEnumRefDefault, true +} + +// HasArrayStringEnumRefDefault returns a boolean if a field has been set. +func (o *DefaultValue) HasArrayStringEnumRefDefault() bool { + if o != nil && !IsNil(o.ArrayStringEnumRefDefault) { + return true + } + + return false +} + +// SetArrayStringEnumRefDefault gets a reference to the given []StringEnumRef and assigns it to the ArrayStringEnumRefDefault field. +func (o *DefaultValue) SetArrayStringEnumRefDefault(v []StringEnumRef) { + o.ArrayStringEnumRefDefault = v +} + +// GetArrayStringEnumDefault returns the ArrayStringEnumDefault field value if set, zero value otherwise. +func (o *DefaultValue) GetArrayStringEnumDefault() []string { + if o == nil || IsNil(o.ArrayStringEnumDefault) { + var ret []string + return ret + } + return o.ArrayStringEnumDefault +} + +// GetArrayStringEnumDefaultOk returns a tuple with the ArrayStringEnumDefault field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DefaultValue) GetArrayStringEnumDefaultOk() ([]string, bool) { + if o == nil || IsNil(o.ArrayStringEnumDefault) { + return nil, false + } + return o.ArrayStringEnumDefault, true +} + +// HasArrayStringEnumDefault returns a boolean if a field has been set. +func (o *DefaultValue) HasArrayStringEnumDefault() bool { + if o != nil && !IsNil(o.ArrayStringEnumDefault) { + return true + } + + return false +} + +// SetArrayStringEnumDefault gets a reference to the given []string and assigns it to the ArrayStringEnumDefault field. +func (o *DefaultValue) SetArrayStringEnumDefault(v []string) { + o.ArrayStringEnumDefault = v +} + +// GetArrayStringDefault returns the ArrayStringDefault field value if set, zero value otherwise. +func (o *DefaultValue) GetArrayStringDefault() []string { + if o == nil || IsNil(o.ArrayStringDefault) { + var ret []string + return ret + } + return o.ArrayStringDefault +} + +// GetArrayStringDefaultOk returns a tuple with the ArrayStringDefault field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DefaultValue) GetArrayStringDefaultOk() ([]string, bool) { + if o == nil || IsNil(o.ArrayStringDefault) { + return nil, false + } + return o.ArrayStringDefault, true +} + +// HasArrayStringDefault returns a boolean if a field has been set. +func (o *DefaultValue) HasArrayStringDefault() bool { + if o != nil && !IsNil(o.ArrayStringDefault) { + return true + } + + return false +} + +// SetArrayStringDefault gets a reference to the given []string and assigns it to the ArrayStringDefault field. +func (o *DefaultValue) SetArrayStringDefault(v []string) { + o.ArrayStringDefault = v +} + +// GetArrayIntegerDefault returns the ArrayIntegerDefault field value if set, zero value otherwise. +func (o *DefaultValue) GetArrayIntegerDefault() []int32 { + if o == nil || IsNil(o.ArrayIntegerDefault) { + var ret []int32 + return ret + } + return o.ArrayIntegerDefault +} + +// GetArrayIntegerDefaultOk returns a tuple with the ArrayIntegerDefault field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DefaultValue) GetArrayIntegerDefaultOk() ([]int32, bool) { + if o == nil || IsNil(o.ArrayIntegerDefault) { + return nil, false + } + return o.ArrayIntegerDefault, true +} + +// HasArrayIntegerDefault returns a boolean if a field has been set. +func (o *DefaultValue) HasArrayIntegerDefault() bool { + if o != nil && !IsNil(o.ArrayIntegerDefault) { + return true + } + + return false +} + +// SetArrayIntegerDefault gets a reference to the given []int32 and assigns it to the ArrayIntegerDefault field. +func (o *DefaultValue) SetArrayIntegerDefault(v []int32) { + o.ArrayIntegerDefault = v +} + +// GetArrayString returns the ArrayString field value if set, zero value otherwise. +func (o *DefaultValue) GetArrayString() []string { + if o == nil || IsNil(o.ArrayString) { + var ret []string + return ret + } + return o.ArrayString +} + +// GetArrayStringOk returns a tuple with the ArrayString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DefaultValue) GetArrayStringOk() ([]string, bool) { + if o == nil || IsNil(o.ArrayString) { + return nil, false + } + return o.ArrayString, true +} + +// HasArrayString returns a boolean if a field has been set. +func (o *DefaultValue) HasArrayString() bool { + if o != nil && !IsNil(o.ArrayString) { + return true + } + + return false +} + +// SetArrayString gets a reference to the given []string and assigns it to the ArrayString field. +func (o *DefaultValue) SetArrayString(v []string) { + o.ArrayString = v +} + +// GetArrayStringNullable returns the ArrayStringNullable field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DefaultValue) GetArrayStringNullable() []string { + if o == nil { + var ret []string + return ret + } + return o.ArrayStringNullable +} + +// GetArrayStringNullableOk returns a tuple with the ArrayStringNullable field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DefaultValue) GetArrayStringNullableOk() ([]string, bool) { + if o == nil || IsNil(o.ArrayStringNullable) { + return nil, false + } + return o.ArrayStringNullable, true +} + +// HasArrayStringNullable returns a boolean if a field has been set. +func (o *DefaultValue) HasArrayStringNullable() bool { + if o != nil && IsNil(o.ArrayStringNullable) { + return true + } + + return false +} + +// SetArrayStringNullable gets a reference to the given []string and assigns it to the ArrayStringNullable field. +func (o *DefaultValue) SetArrayStringNullable(v []string) { + o.ArrayStringNullable = v +} + +// GetArrayStringExtensionNullable returns the ArrayStringExtensionNullable field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DefaultValue) GetArrayStringExtensionNullable() []string { + if o == nil { + var ret []string + return ret + } + return o.ArrayStringExtensionNullable +} + +// GetArrayStringExtensionNullableOk returns a tuple with the ArrayStringExtensionNullable field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DefaultValue) GetArrayStringExtensionNullableOk() ([]string, bool) { + if o == nil || IsNil(o.ArrayStringExtensionNullable) { + return nil, false + } + return o.ArrayStringExtensionNullable, true +} + +// HasArrayStringExtensionNullable returns a boolean if a field has been set. +func (o *DefaultValue) HasArrayStringExtensionNullable() bool { + if o != nil && IsNil(o.ArrayStringExtensionNullable) { + return true + } + + return false +} + +// SetArrayStringExtensionNullable gets a reference to the given []string and assigns it to the ArrayStringExtensionNullable field. +func (o *DefaultValue) SetArrayStringExtensionNullable(v []string) { + o.ArrayStringExtensionNullable = v +} + +// GetStringNullable returns the StringNullable field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DefaultValue) GetStringNullable() string { + if o == nil || IsNil(o.StringNullable.Get()) { + var ret string + return ret + } + return *o.StringNullable.Get() +} + +// GetStringNullableOk returns a tuple with the StringNullable field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DefaultValue) GetStringNullableOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.StringNullable.Get(), o.StringNullable.IsSet() +} + +// HasStringNullable returns a boolean if a field has been set. +func (o *DefaultValue) HasStringNullable() bool { + if o != nil && o.StringNullable.IsSet() { + return true + } + + return false +} + +// SetStringNullable gets a reference to the given NullableString and assigns it to the StringNullable field. +func (o *DefaultValue) SetStringNullable(v string) { + o.StringNullable.Set(&v) +} +// SetStringNullableNil sets the value for StringNullable to be an explicit nil +func (o *DefaultValue) SetStringNullableNil() { + o.StringNullable.Set(nil) +} + +// UnsetStringNullable ensures that no value is present for StringNullable, not even an explicit nil +func (o *DefaultValue) UnsetStringNullable() { + o.StringNullable.Unset() +} + +func (o DefaultValue) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DefaultValue) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ArrayStringEnumRefDefault) { + toSerialize["array_string_enum_ref_default"] = o.ArrayStringEnumRefDefault + } + if !IsNil(o.ArrayStringEnumDefault) { + toSerialize["array_string_enum_default"] = o.ArrayStringEnumDefault + } + if !IsNil(o.ArrayStringDefault) { + toSerialize["array_string_default"] = o.ArrayStringDefault + } + if !IsNil(o.ArrayIntegerDefault) { + toSerialize["array_integer_default"] = o.ArrayIntegerDefault + } + if !IsNil(o.ArrayString) { + toSerialize["array_string"] = o.ArrayString + } + if o.ArrayStringNullable != nil { + toSerialize["array_string_nullable"] = o.ArrayStringNullable + } + if o.ArrayStringExtensionNullable != nil { + toSerialize["array_string_extension_nullable"] = o.ArrayStringExtensionNullable + } + if o.StringNullable.IsSet() { + toSerialize["string_nullable"] = o.StringNullable.Get() + } + return toSerialize, nil +} + +type NullableDefaultValue struct { + value *DefaultValue + isSet bool +} + +func (v NullableDefaultValue) Get() *DefaultValue { + return v.value +} + +func (v *NullableDefaultValue) Set(val *DefaultValue) { + v.value = val + v.isSet = true +} + +func (v NullableDefaultValue) IsSet() bool { + return v.isSet +} + +func (v *NullableDefaultValue) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDefaultValue(val *DefaultValue) *NullableDefaultValue { + return &NullableDefaultValue{value: val, isSet: true} +} + +func (v NullableDefaultValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDefaultValue) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/echo_api/go-external-refs/model_number_properties_only.go b/samples/client/echo_api/go-external-refs/model_number_properties_only.go new file mode 100644 index 00000000000..667c4aec6db --- /dev/null +++ b/samples/client/echo_api/go-external-refs/model_number_properties_only.go @@ -0,0 +1,199 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the NumberPropertiesOnly type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NumberPropertiesOnly{} + +// NumberPropertiesOnly struct for NumberPropertiesOnly +type NumberPropertiesOnly struct { + Number *float32 `json:"number,omitempty"` + Float *float32 `json:"float,omitempty"` + Double *float64 `json:"double,omitempty"` +} + +// NewNumberPropertiesOnly instantiates a new NumberPropertiesOnly object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNumberPropertiesOnly() *NumberPropertiesOnly { + this := NumberPropertiesOnly{} + return &this +} + +// NewNumberPropertiesOnlyWithDefaults instantiates a new NumberPropertiesOnly object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNumberPropertiesOnlyWithDefaults() *NumberPropertiesOnly { + this := NumberPropertiesOnly{} + return &this +} + +// GetNumber returns the Number field value if set, zero value otherwise. +func (o *NumberPropertiesOnly) GetNumber() float32 { + if o == nil || IsNil(o.Number) { + var ret float32 + return ret + } + return *o.Number +} + +// GetNumberOk returns a tuple with the Number field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NumberPropertiesOnly) GetNumberOk() (*float32, bool) { + if o == nil || IsNil(o.Number) { + return nil, false + } + return o.Number, true +} + +// HasNumber returns a boolean if a field has been set. +func (o *NumberPropertiesOnly) HasNumber() bool { + if o != nil && !IsNil(o.Number) { + return true + } + + return false +} + +// SetNumber gets a reference to the given float32 and assigns it to the Number field. +func (o *NumberPropertiesOnly) SetNumber(v float32) { + o.Number = &v +} + +// GetFloat returns the Float field value if set, zero value otherwise. +func (o *NumberPropertiesOnly) GetFloat() float32 { + if o == nil || IsNil(o.Float) { + var ret float32 + return ret + } + return *o.Float +} + +// GetFloatOk returns a tuple with the Float field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NumberPropertiesOnly) GetFloatOk() (*float32, bool) { + if o == nil || IsNil(o.Float) { + return nil, false + } + return o.Float, true +} + +// HasFloat returns a boolean if a field has been set. +func (o *NumberPropertiesOnly) HasFloat() bool { + if o != nil && !IsNil(o.Float) { + return true + } + + return false +} + +// SetFloat gets a reference to the given float32 and assigns it to the Float field. +func (o *NumberPropertiesOnly) SetFloat(v float32) { + o.Float = &v +} + +// GetDouble returns the Double field value if set, zero value otherwise. +func (o *NumberPropertiesOnly) GetDouble() float64 { + if o == nil || IsNil(o.Double) { + var ret float64 + return ret + } + return *o.Double +} + +// GetDoubleOk returns a tuple with the Double field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NumberPropertiesOnly) GetDoubleOk() (*float64, bool) { + if o == nil || IsNil(o.Double) { + return nil, false + } + return o.Double, true +} + +// HasDouble returns a boolean if a field has been set. +func (o *NumberPropertiesOnly) HasDouble() bool { + if o != nil && !IsNil(o.Double) { + return true + } + + return false +} + +// SetDouble gets a reference to the given float64 and assigns it to the Double field. +func (o *NumberPropertiesOnly) SetDouble(v float64) { + o.Double = &v +} + +func (o NumberPropertiesOnly) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NumberPropertiesOnly) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Number) { + toSerialize["number"] = o.Number + } + if !IsNil(o.Float) { + toSerialize["float"] = o.Float + } + if !IsNil(o.Double) { + toSerialize["double"] = o.Double + } + return toSerialize, nil +} + +type NullableNumberPropertiesOnly struct { + value *NumberPropertiesOnly + isSet bool +} + +func (v NullableNumberPropertiesOnly) Get() *NumberPropertiesOnly { + return v.value +} + +func (v *NullableNumberPropertiesOnly) Set(val *NumberPropertiesOnly) { + v.value = val + v.isSet = true +} + +func (v NullableNumberPropertiesOnly) IsSet() bool { + return v.isSet +} + +func (v *NullableNumberPropertiesOnly) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNumberPropertiesOnly(val *NumberPropertiesOnly) *NullableNumberPropertiesOnly { + return &NullableNumberPropertiesOnly{value: val, isSet: true} +} + +func (v NullableNumberPropertiesOnly) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNumberPropertiesOnly) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/echo_api/go-external-refs/model_pet.go b/samples/client/echo_api/go-external-refs/model_pet.go new file mode 100644 index 00000000000..13f24706dfd --- /dev/null +++ b/samples/client/echo_api/go-external-refs/model_pet.go @@ -0,0 +1,332 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the Pet type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Pet{} + +// Pet struct for Pet +type Pet struct { + Id *int64 `json:"id,omitempty"` + Name string `json:"name"` + Category *Category `json:"category,omitempty"` + PhotoUrls []string `json:"photoUrls"` + Tags []Tag `json:"tags,omitempty"` + // pet status in the store + Status *string `json:"status,omitempty"` +} + +type _Pet Pet + +// NewPet instantiates a new Pet object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPet(name string, photoUrls []string) *Pet { + this := Pet{} + this.Name = name + this.PhotoUrls = photoUrls + return &this +} + +// NewPetWithDefaults instantiates a new Pet object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPetWithDefaults() *Pet { + this := Pet{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Pet) GetId() int64 { + if o == nil || IsNil(o.Id) { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pet) GetIdOk() (*int64, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Pet) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Pet) SetId(v int64) { + o.Id = &v +} + +// GetName returns the Name field value +func (o *Pet) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Pet) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Pet) SetName(v string) { + o.Name = v +} + +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *Pet) GetCategory() Category { + if o == nil || IsNil(o.Category) { + var ret Category + return ret + } + return *o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pet) GetCategoryOk() (*Category, bool) { + if o == nil || IsNil(o.Category) { + return nil, false + } + return o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *Pet) HasCategory() bool { + if o != nil && !IsNil(o.Category) { + return true + } + + return false +} + +// SetCategory gets a reference to the given Category and assigns it to the Category field. +func (o *Pet) SetCategory(v Category) { + o.Category = &v +} + +// GetPhotoUrls returns the PhotoUrls field value +func (o *Pet) GetPhotoUrls() []string { + if o == nil { + var ret []string + return ret + } + + return o.PhotoUrls +} + +// GetPhotoUrlsOk returns a tuple with the PhotoUrls field value +// and a boolean to check if the value has been set. +func (o *Pet) GetPhotoUrlsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.PhotoUrls, true +} + +// SetPhotoUrls sets field value +func (o *Pet) SetPhotoUrls(v []string) { + o.PhotoUrls = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *Pet) GetTags() []Tag { + if o == nil || IsNil(o.Tags) { + var ret []Tag + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pet) GetTagsOk() ([]Tag, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *Pet) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []Tag and assigns it to the Tags field. +func (o *Pet) SetTags(v []Tag) { + o.Tags = v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Pet) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Pet) GetStatusOk() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Pet) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Pet) SetStatus(v string) { + o.Status = &v +} + +func (o Pet) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Pet) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + toSerialize["name"] = o.Name + if !IsNil(o.Category) { + toSerialize["category"] = o.Category + } + toSerialize["photoUrls"] = o.PhotoUrls + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + return toSerialize, nil +} + +func (o *Pet) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "photoUrls", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varPet := _Pet{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varPet) + + if err != nil { + return err + } + + *o = Pet(varPet) + + return err +} + +type NullablePet struct { + value *Pet + isSet bool +} + +func (v NullablePet) Get() *Pet { + return v.value +} + +func (v *NullablePet) Set(val *Pet) { + v.value = val + v.isSet = true +} + +func (v NullablePet) IsSet() bool { + return v.isSet +} + +func (v *NullablePet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePet(val *Pet) *NullablePet { + return &NullablePet{value: val, isSet: true} +} + +func (v NullablePet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/echo_api/go-external-refs/model_query.go b/samples/client/echo_api/go-external-refs/model_query.go new file mode 100644 index 00000000000..653e18c8300 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/model_query.go @@ -0,0 +1,164 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the Query type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Query{} + +// Query struct for Query +type Query struct { + // Query + Id *int64 `json:"id,omitempty"` + Outcomes []string `json:"outcomes,omitempty"` +} + +// NewQuery instantiates a new Query object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuery() *Query { + this := Query{} + return &this +} + +// NewQueryWithDefaults instantiates a new Query object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQueryWithDefaults() *Query { + this := Query{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Query) GetId() int64 { + if o == nil || IsNil(o.Id) { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Query) GetIdOk() (*int64, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Query) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Query) SetId(v int64) { + o.Id = &v +} + +// GetOutcomes returns the Outcomes field value if set, zero value otherwise. +func (o *Query) GetOutcomes() []string { + if o == nil || IsNil(o.Outcomes) { + var ret []string + return ret + } + return o.Outcomes +} + +// GetOutcomesOk returns a tuple with the Outcomes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Query) GetOutcomesOk() ([]string, bool) { + if o == nil || IsNil(o.Outcomes) { + return nil, false + } + return o.Outcomes, true +} + +// HasOutcomes returns a boolean if a field has been set. +func (o *Query) HasOutcomes() bool { + if o != nil && !IsNil(o.Outcomes) { + return true + } + + return false +} + +// SetOutcomes gets a reference to the given []string and assigns it to the Outcomes field. +func (o *Query) SetOutcomes(v []string) { + o.Outcomes = v +} + +func (o Query) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Query) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Outcomes) { + toSerialize["outcomes"] = o.Outcomes + } + return toSerialize, nil +} + +type NullableQuery struct { + value *Query + isSet bool +} + +func (v NullableQuery) Get() *Query { + return v.value +} + +func (v *NullableQuery) Set(val *Query) { + v.value = val + v.isSet = true +} + +func (v NullableQuery) IsSet() bool { + return v.isSet +} + +func (v *NullableQuery) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuery(val *Query) *NullableQuery { + return &NullableQuery{value: val, isSet: true} +} + +func (v NullableQuery) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuery) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/echo_api/go-external-refs/model_string_enum_ref.go b/samples/client/echo_api/go-external-refs/model_string_enum_ref.go new file mode 100644 index 00000000000..f1ae6625287 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/model_string_enum_ref.go @@ -0,0 +1,114 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// StringEnumRef the model 'StringEnumRef' +type StringEnumRef string + +// List of StringEnumRef +const ( + SUCCESS StringEnumRef = "success" + FAILURE StringEnumRef = "failure" + UNCLASSIFIED StringEnumRef = "unclassified" +) + +// All allowed values of StringEnumRef enum +var AllowedStringEnumRefEnumValues = []StringEnumRef{ + "success", + "failure", + "unclassified", +} + +func (v *StringEnumRef) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := StringEnumRef(value) + for _, existing := range AllowedStringEnumRefEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid StringEnumRef", value) +} + +// NewStringEnumRefFromValue returns a pointer to a valid StringEnumRef +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewStringEnumRefFromValue(v string) (*StringEnumRef, error) { + ev := StringEnumRef(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for StringEnumRef: valid values are %v", v, AllowedStringEnumRefEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v StringEnumRef) IsValid() bool { + for _, existing := range AllowedStringEnumRefEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StringEnumRef value +func (v StringEnumRef) Ptr() *StringEnumRef { + return &v +} + +type NullableStringEnumRef struct { + value *StringEnumRef + isSet bool +} + +func (v NullableStringEnumRef) Get() *StringEnumRef { + return v.value +} + +func (v *NullableStringEnumRef) Set(val *StringEnumRef) { + v.value = val + v.isSet = true +} + +func (v NullableStringEnumRef) IsSet() bool { + return v.isSet +} + +func (v *NullableStringEnumRef) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStringEnumRef(val *StringEnumRef) *NullableStringEnumRef { + return &NullableStringEnumRef{value: val, isSet: true} +} + +func (v NullableStringEnumRef) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStringEnumRef) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/samples/client/echo_api/go-external-refs/model_tag.go b/samples/client/echo_api/go-external-refs/model_tag.go new file mode 100644 index 00000000000..0b69e30a761 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/model_tag.go @@ -0,0 +1,163 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the Tag type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Tag{} + +// Tag struct for Tag +type Tag struct { + Id *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} + +// NewTag instantiates a new Tag object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTag() *Tag { + this := Tag{} + return &this +} + +// NewTagWithDefaults instantiates a new Tag object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTagWithDefaults() *Tag { + this := Tag{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Tag) GetId() int64 { + if o == nil || IsNil(o.Id) { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Tag) GetIdOk() (*int64, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Tag) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Tag) SetId(v int64) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Tag) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Tag) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Tag) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Tag) SetName(v string) { + o.Name = &v +} + +func (o Tag) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Tag) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableTag struct { + value *Tag + isSet bool +} + +func (v NullableTag) Get() *Tag { + return v.value +} + +func (v *NullableTag) Set(val *Tag) { + v.value = val + v.isSet = true +} + +func (v NullableTag) IsSet() bool { + return v.isSet +} + +func (v *NullableTag) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTag(val *Tag) *NullableTag { + return &NullableTag{value: val, isSet: true} +} + +func (v NullableTag) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTag) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/echo_api/go-external-refs/model_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.go b/samples/client/echo_api/go-external-refs/model_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.go new file mode 100644 index 00000000000..b270889eaec --- /dev/null +++ b/samples/client/echo_api/go-external-refs/model_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.go @@ -0,0 +1,235 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter{} + +// TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter struct for TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter +type TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter struct { + Size *string `json:"size,omitempty"` + Color *string `json:"color,omitempty"` + Id *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} + +// NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter instantiates a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { + this := TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter{} + return &this +} + +// NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterWithDefaults instantiates a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterWithDefaults() *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { + this := TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter{} + return &this +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetSize() string { + if o == nil || IsNil(o.Size) { + var ret string + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetSizeOk() (*string, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given string and assigns it to the Size field. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetSize(v string) { + o.Size = &v +} + +// GetColor returns the Color field value if set, zero value otherwise. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetColor() string { + if o == nil || IsNil(o.Color) { + var ret string + return ret + } + return *o.Color +} + +// GetColorOk returns a tuple with the Color field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetColorOk() (*string, bool) { + if o == nil || IsNil(o.Color) { + return nil, false + } + return o.Color, true +} + +// HasColor returns a boolean if a field has been set. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasColor() bool { + if o != nil && !IsNil(o.Color) { + return true + } + + return false +} + +// SetColor gets a reference to the given string and assigns it to the Color field. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetColor(v string) { + o.Color = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetId() int64 { + if o == nil || IsNil(o.Id) { + var ret int64 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetIdOk() (*int64, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetId(v int64) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetName(v string) { + o.Name = &v +} + +func (o TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.Color) { + toSerialize["color"] = o.Color + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter struct { + value *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + isSet bool +} + +func (v NullableTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) Get() *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { + return v.value +} + +func (v *NullableTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) Set(val *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) { + v.value = val + v.isSet = true +} + +func (v NullableTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(val *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) *NullableTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { + return &NullableTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter{value: val, isSet: true} +} + +func (v NullableTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/echo_api/go-external-refs/model_test_query_style_form_explode_true_array_string_query_object_parameter.go b/samples/client/echo_api/go-external-refs/model_test_query_style_form_explode_true_array_string_query_object_parameter.go new file mode 100644 index 00000000000..d2e8f877529 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/model_test_query_style_form_explode_true_array_string_query_object_parameter.go @@ -0,0 +1,127 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter{} + +// TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter struct for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +type TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter struct { + Values []string `json:"values,omitempty"` +} + +// NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter instantiates a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { + this := TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter{} + return &this +} + +// NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterWithDefaults instantiates a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterWithDefaults() *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { + this := TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter{} + return &this +} + +// GetValues returns the Values field value if set, zero value otherwise. +func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) GetValues() []string { + if o == nil || IsNil(o.Values) { + var ret []string + return ret + } + return o.Values +} + +// GetValuesOk returns a tuple with the Values field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) GetValuesOk() ([]string, bool) { + if o == nil || IsNil(o.Values) { + return nil, false + } + return o.Values, true +} + +// HasValues returns a boolean if a field has been set. +func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) HasValues() bool { + if o != nil && !IsNil(o.Values) { + return true + } + + return false +} + +// SetValues gets a reference to the given []string and assigns it to the Values field. +func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) SetValues(v []string) { + o.Values = v +} + +func (o TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Values) { + toSerialize["values"] = o.Values + } + return toSerialize, nil +} + +type NullableTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter struct { + value *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + isSet bool +} + +func (v NullableTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) Get() *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { + return v.value +} + +func (v *NullableTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) Set(val *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) { + v.value = val + v.isSet = true +} + +func (v NullableTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(val *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) *NullableTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { + return &NullableTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter{value: val, isSet: true} +} + +func (v NullableTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/samples/client/echo_api/go-external-refs/response.go b/samples/client/echo_api/go-external-refs/response.go new file mode 100644 index 00000000000..1d21f5323dd --- /dev/null +++ b/samples/client/echo_api/go-external-refs/response.go @@ -0,0 +1,48 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/samples/client/echo_api/go-external-refs/test/api_auth_test.go b/samples/client/echo_api/go-external-refs/test/api_auth_test.go new file mode 100644 index 00000000000..e8fb1b22c05 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/test/api_auth_test.go @@ -0,0 +1,49 @@ +/* +Echo Server API + +Testing AuthAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func Test_openapi_AuthAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test AuthAPIService TestAuthHttpBasic", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.AuthAPI.TestAuthHttpBasic(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test AuthAPIService TestAuthHttpBearer", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.AuthAPI.TestAuthHttpBearer(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/samples/client/echo_api/go-external-refs/test/api_body_test.go b/samples/client/echo_api/go-external-refs/test/api_body_test.go new file mode 100644 index 00000000000..948a244fe33 --- /dev/null +++ b/samples/client/echo_api/go-external-refs/test/api_body_test.go @@ -0,0 +1,133 @@ +/* +Echo Server API + +Testing BodyAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func Test_openapi_BodyAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test BodyAPIService TestBinaryGif", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.BodyAPI.TestBinaryGif(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BodyAPIService TestBodyApplicationOctetstreamBinary", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.BodyAPI.TestBodyApplicationOctetstreamBinary(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BodyAPIService TestBodyMultipartFormdataArrayOfBinary", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.BodyAPI.TestBodyMultipartFormdataArrayOfBinary(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BodyAPIService TestBodyMultipartFormdataSingleBinary", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.BodyAPI.TestBodyMultipartFormdataSingleBinary(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BodyAPIService TestEchoBodyAllOfPet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.BodyAPI.TestEchoBodyAllOfPet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BodyAPIService TestEchoBodyFreeFormObjectResponseString", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.BodyAPI.TestEchoBodyFreeFormObjectResponseString(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BodyAPIService TestEchoBodyPet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.BodyAPI.TestEchoBodyPet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BodyAPIService TestEchoBodyPetResponseString", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.BodyAPI.TestEchoBodyPetResponseString(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BodyAPIService TestEchoBodyTagResponseString", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.BodyAPI.TestEchoBodyTagResponseString(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/samples/client/echo_api/go-external-refs/test/api_form_test.go b/samples/client/echo_api/go-external-refs/test/api_form_test.go new file mode 100644 index 00000000000..fbb3916d44d --- /dev/null +++ b/samples/client/echo_api/go-external-refs/test/api_form_test.go @@ -0,0 +1,49 @@ +/* +Echo Server API + +Testing FormAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func Test_openapi_FormAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test FormAPIService TestFormIntegerBooleanString", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.FormAPI.TestFormIntegerBooleanString(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test FormAPIService TestFormOneof", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.FormAPI.TestFormOneof(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/samples/client/echo_api/go-external-refs/test/api_header_test.go b/samples/client/echo_api/go-external-refs/test/api_header_test.go new file mode 100644 index 00000000000..6013c51c8fb --- /dev/null +++ b/samples/client/echo_api/go-external-refs/test/api_header_test.go @@ -0,0 +1,37 @@ +/* +Echo Server API + +Testing HeaderAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func Test_openapi_HeaderAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test HeaderAPIService TestHeaderIntegerBooleanStringEnums", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.HeaderAPI.TestHeaderIntegerBooleanStringEnums(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/samples/client/echo_api/go-external-refs/test/api_path_test.go b/samples/client/echo_api/go-external-refs/test/api_path_test.go new file mode 100644 index 00000000000..2217059235b --- /dev/null +++ b/samples/client/echo_api/go-external-refs/test/api_path_test.go @@ -0,0 +1,42 @@ +/* +Echo Server API + +Testing PathAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func Test_openapi_PathAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test PathAPIService TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var pathString string + var pathInteger int32 + var enumNonrefStringPath string + var enumRefStringPath StringEnumRef + + resp, httpRes, err := apiClient.PathAPI.TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(context.Background(), pathString, pathInteger, enumNonrefStringPath, enumRefStringPath).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/samples/client/echo_api/go-external-refs/test/api_query_test.go b/samples/client/echo_api/go-external-refs/test/api_query_test.go new file mode 100644 index 00000000000..161ca1c791a --- /dev/null +++ b/samples/client/echo_api/go-external-refs/test/api_query_test.go @@ -0,0 +1,145 @@ +/* +Echo Server API + +Testing QueryAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func Test_openapi_QueryAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test QueryAPIService TestEnumRefString", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.QueryAPI.TestEnumRefString(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test QueryAPIService TestQueryDatetimeDateString", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.QueryAPI.TestQueryDatetimeDateString(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test QueryAPIService TestQueryIntegerBooleanString", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.QueryAPI.TestQueryIntegerBooleanString(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test QueryAPIService TestQueryStyleDeepObjectExplodeTrueObject", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.QueryAPI.TestQueryStyleDeepObjectExplodeTrueObject(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test QueryAPIService TestQueryStyleDeepObjectExplodeTrueObjectAllOf", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.QueryAPI.TestQueryStyleDeepObjectExplodeTrueObjectAllOf(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test QueryAPIService TestQueryStyleFormExplodeFalseArrayInteger", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.QueryAPI.TestQueryStyleFormExplodeFalseArrayInteger(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test QueryAPIService TestQueryStyleFormExplodeFalseArrayString", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.QueryAPI.TestQueryStyleFormExplodeFalseArrayString(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test QueryAPIService TestQueryStyleFormExplodeTrueArrayString", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.QueryAPI.TestQueryStyleFormExplodeTrueArrayString(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test QueryAPIService TestQueryStyleFormExplodeTrueObject", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.QueryAPI.TestQueryStyleFormExplodeTrueObject(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test QueryAPIService TestQueryStyleFormExplodeTrueObjectAllOf", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.QueryAPI.TestQueryStyleFormExplodeTrueObjectAllOf(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/samples/client/echo_api/go-external-refs/utils.go b/samples/client/echo_api/go-external-refs/utils.go new file mode 100644 index 00000000000..fc16b8e366c --- /dev/null +++ b/samples/client/echo_api/go-external-refs/utils.go @@ -0,0 +1,348 @@ +/* +Echo Server API + +Echo Server API + +API version: 0.1.0 +Contact: team@openapitools.org +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +}