Echo Server API
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 0.1.0
- Package version: 1.0.0
- Generator version: 7.20.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/contextPut the package under your project folder and add the following in import:
import openapi "github.com/GIT_USER_ID/GIT_REPO_ID"To use a proxy, set the environment variable HTTP_PROXY:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value openapi.ContextServerIndex of type int.
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)Templated server URL is formatted using default variables from configuration or from context value openapi.ContextServerVariables of type map[string]string.
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.
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.
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",
},
})All URIs are relative to http://localhost:3000
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AuthAPI | TestAuthHttpBasic | Post /auth/http/basic | To test HTTP basic authentication |
| AuthAPI | TestAuthHttpBearer | Post /auth/http/bearer | To test HTTP bearer authentication |
| BodyAPI | TestBinaryGif | Post /binary/gif | Test binary (gif) response body |
| BodyAPI | TestBodyApplicationOctetstreamBinary | Post /body/application/octetstream/binary | Test body parameter(s) |
| BodyAPI | TestBodyMultipartFormdataArrayOfBinary | Post /body/application/octetstream/array_of_binary | Test array of binary in multipart mime |
| BodyAPI | TestBodyMultipartFormdataSingleBinary | Post /body/application/octetstream/single_binary | Test single binary in multipart mime |
| BodyAPI | TestEchoBodyAllOfPet | Post /echo/body/allOf/Pet | Test body parameter(s) |
| BodyAPI | TestEchoBodyFreeFormObjectResponseString | Post /echo/body/FreeFormObject/response_string | Test free form object |
| BodyAPI | TestEchoBodyPet | Post /echo/body/Pet | Test body parameter(s) |
| BodyAPI | TestEchoBodyPetResponseString | Post /echo/body/Pet/response_string | Test empty response body |
| BodyAPI | TestEchoBodyStringEnum | Post /echo/body/string_enum | Test string enum response body |
| BodyAPI | TestEchoBodyTagResponseString | Post /echo/body/Tag/response_string | Test empty json (request body) |
| FormAPI | TestFormIntegerBooleanString | Post /form/integer/boolean/string | Test form parameter(s) |
| FormAPI | TestFormObjectMultipart | Post /form/object/multipart | Test form parameter(s) for multipart schema |
| FormAPI | TestFormOneof | Post /form/oneof | Test form parameter(s) for oneOf schema |
| HeaderAPI | TestHeaderIntegerBooleanStringEnums | Get /header/integer/boolean/string/enums | Test header parameter(s) |
| PathAPI | TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath | Get /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) |
| QueryAPI | TestEnumRefString | Get /query/enum_ref_string | Test query parameter(s) |
| QueryAPI | TestQueryDatetimeDateString | Get /query/datetime/date/string | Test query parameter(s) |
| QueryAPI | TestQueryIntegerBooleanString | Get /query/integer/boolean/string | Test query parameter(s) |
| QueryAPI | TestQueryStyleDeepObjectExplodeTrueObject | Get /query/style_deepObject/explode_true/object | Test query parameter(s) |
| QueryAPI | TestQueryStyleDeepObjectExplodeTrueObjectAllOf | Get /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) |
| QueryAPI | TestQueryStyleFormExplodeFalseArrayInteger | Get /query/style_form/explode_false/array_integer | Test query parameter(s) |
| QueryAPI | TestQueryStyleFormExplodeFalseArrayString | Get /query/style_form/explode_false/array_string | Test query parameter(s) |
| QueryAPI | TestQueryStyleFormExplodeTrueArrayString | Get /query/style_form/explode_true/array_string | Test query parameter(s) |
| QueryAPI | TestQueryStyleFormExplodeTrueObject | Get /query/style_form/explode_true/object | Test query parameter(s) |
| QueryAPI | TestQueryStyleFormExplodeTrueObjectAllOf | Get /query/style_form/explode_true/object/allOf | Test query parameter(s) |
| QueryAPI | TestQueryStyleJsonSerializationObject | Get /query/style_jsonSerialization/object | Test query parameter(s) |
- Bird
- Category
- DataQuery
- DefaultValue
- NumberPropertiesOnly
- Pet
- Query
- StringEnumRef
- Tag
- TestFormObjectMultipartRequestMarker
- TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
- TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
Authentication schemes defined for the API:
- Type: HTTP basic authentication
Example
auth := context.WithValue(context.Background(), openapi.ContextBasicAuth, openapi.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)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:
PtrBoolPtrIntPtrInt32PtrInt64PtrFloatPtrFloat32PtrFloat64PtrStringPtrTime