|
| 1 | +# Go API client for openapi |
| 2 | + |
| 3 | +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) |
| 4 | + |
| 5 | +## Overview |
| 6 | +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. |
| 7 | + |
| 8 | +- API version: 1.0.0 |
| 9 | +- Package version: 1.0.0 |
| 10 | +- Generator version: 7.11.0-SNAPSHOT |
| 11 | +- Build package: org.openapitools.codegen.languages.GoClientCodegen |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +Install the following dependencies: |
| 16 | + |
| 17 | +```sh |
| 18 | +go get github.com/stretchr/testify/assert |
| 19 | +go get golang.org/x/net/context |
| 20 | +``` |
| 21 | + |
| 22 | +Put the package under your project folder and add the following in import: |
| 23 | + |
| 24 | +```go |
| 25 | +import openapi "github.com/GIT_USER_ID/GIT_REPO_ID" |
| 26 | +``` |
| 27 | + |
| 28 | +To use a proxy, set the environment variable `HTTP_PROXY`: |
| 29 | + |
| 30 | +```go |
| 31 | +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") |
| 32 | +``` |
| 33 | + |
| 34 | +## Configuration of Server URL |
| 35 | + |
| 36 | +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. |
| 37 | + |
| 38 | +### Select Server Configuration |
| 39 | + |
| 40 | +For using other server than the one defined on index 0 set context value `openapi.ContextServerIndex` of type `int`. |
| 41 | + |
| 42 | +```go |
| 43 | +ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1) |
| 44 | +``` |
| 45 | + |
| 46 | +### Templated Server URL |
| 47 | + |
| 48 | +Templated server URL is formatted using default variables from configuration or from context value `openapi.ContextServerVariables` of type `map[string]string`. |
| 49 | + |
| 50 | +```go |
| 51 | +ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{ |
| 52 | + "basePath": "v2", |
| 53 | +}) |
| 54 | +``` |
| 55 | + |
| 56 | +Note, enum values are always validated and all unused variables are silently ignored. |
| 57 | + |
| 58 | +### URLs Configuration per Operation |
| 59 | + |
| 60 | +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. |
| 61 | +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. |
| 62 | +Similar rules for overriding default operation server index and variables applies by using `openapi.ContextOperationServerIndices` and `openapi.ContextOperationServerVariables` context maps. |
| 63 | + |
| 64 | +```go |
| 65 | +ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{ |
| 66 | + "{classname}Service.{nickname}": 2, |
| 67 | +}) |
| 68 | +ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{ |
| 69 | + "{classname}Service.{nickname}": { |
| 70 | + "port": "8443", |
| 71 | + }, |
| 72 | +}) |
| 73 | +``` |
| 74 | + |
| 75 | +## Documentation for API Endpoints |
| 76 | + |
| 77 | +All URIs are relative to *http://localhost* |
| 78 | + |
| 79 | +Class | Method | HTTP request | Description |
| 80 | +------------ | ------------- | ------------- | ------------- |
| 81 | + |
| 82 | + |
| 83 | +## Documentation For Models |
| 84 | + |
| 85 | + - [NestedObject1](docs/NestedObject1.md) |
| 86 | + - [NestedObject2](docs/NestedObject2.md) |
| 87 | + - [Object](docs/Object.md) |
| 88 | + |
| 89 | + |
| 90 | +## Documentation For Authorization |
| 91 | + |
| 92 | +Endpoints do not require authorization. |
| 93 | + |
| 94 | + |
| 95 | +## Documentation for Utility Methods |
| 96 | + |
| 97 | +Due to the fact that model structure members are all pointers, this package contains |
| 98 | +a number of utility functions to easily obtain pointers to values of basic types. |
| 99 | +Each of these functions takes a value of the given basic type and returns a pointer to it: |
| 100 | + |
| 101 | +* `PtrBool` |
| 102 | +* `PtrInt` |
| 103 | +* `PtrInt32` |
| 104 | +* `PtrInt64` |
| 105 | +* `PtrFloat` |
| 106 | +* `PtrFloat32` |
| 107 | +* `PtrFloat64` |
| 108 | +* `PtrString` |
| 109 | +* `PtrTime` |
| 110 | + |
| 111 | +## Author |
| 112 | + |
| 113 | + |
0 commit comments