|
| 1 | +# Go API client for x_auth_id_alias |
| 2 | + |
| 3 | +This specification shows how to use x-auth-id-alias extension for API keys. |
| 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 | +- Build package: org.openapitools.codegen.languages.GoClientExperimentalCodegen |
| 11 | + |
| 12 | +## Installation |
| 13 | + |
| 14 | +Install the following dependencies: |
| 15 | + |
| 16 | +```shell |
| 17 | +go get github.com/stretchr/testify/assert |
| 18 | +go get golang.org/x/oauth2 |
| 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 | +```golang |
| 25 | +import sw "./x_auth_id_alias" |
| 26 | +``` |
| 27 | + |
| 28 | +## Configuration of Server URL |
| 29 | + |
| 30 | +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. |
| 31 | + |
| 32 | +### Select Server Configuration |
| 33 | + |
| 34 | +For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. |
| 35 | + |
| 36 | +```golang |
| 37 | +ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1) |
| 38 | +``` |
| 39 | + |
| 40 | +### Templated Server URL |
| 41 | + |
| 42 | +Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. |
| 43 | + |
| 44 | +```golang |
| 45 | +ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{ |
| 46 | + "basePath": "v2", |
| 47 | +}) |
| 48 | +``` |
| 49 | + |
| 50 | +Note, enum values are always validated and all unused variables are silently ignored. |
| 51 | + |
| 52 | +### URLs Configuration per Operation |
| 53 | + |
| 54 | +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. |
| 55 | +An operation is uniquely identifield by `"{classname}Service.{nickname}"` string. |
| 56 | +Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. |
| 57 | + |
| 58 | +``` |
| 59 | +ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{ |
| 60 | + "{classname}Service.{nickname}": 2, |
| 61 | +}) |
| 62 | +ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{ |
| 63 | + "{classname}Service.{nickname}": { |
| 64 | + "port": "8443", |
| 65 | + }, |
| 66 | +}) |
| 67 | +``` |
| 68 | + |
| 69 | +## Documentation for API Endpoints |
| 70 | + |
| 71 | +All URIs are relative to *http://petstore.swagger.io:80/v2* |
| 72 | + |
| 73 | +Class | Method | HTTP request | Description |
| 74 | +------------ | ------------- | ------------- | ------------- |
| 75 | +*UsageApi* | [**AnyKey**](docs/UsageApi.md#anykey) | **Get** /any | Use any API key |
| 76 | +*UsageApi* | [**BothKeys**](docs/UsageApi.md#bothkeys) | **Get** /both | Use both API keys |
| 77 | +*UsageApi* | [**KeyInHeader**](docs/UsageApi.md#keyinheader) | **Get** /header | Use API key in header |
| 78 | +*UsageApi* | [**KeyInQuery**](docs/UsageApi.md#keyinquery) | **Get** /query | Use API key in query |
| 79 | + |
| 80 | + |
| 81 | +## Documentation For Models |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +## Documentation For Authorization |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | +### api_key |
| 90 | + |
| 91 | +- **Type**: API key |
| 92 | +- **API key parameter name**: X-Api-Key |
| 93 | +- **Location**: HTTP header |
| 94 | + |
| 95 | +Note, each API key must be added to a map of `map[string]APIKey` where the key is: X-Api-Key and passed in as the auth context for each request. |
| 96 | + |
| 97 | + |
| 98 | +### api_key_query |
| 99 | + |
| 100 | +- **Type**: API key |
| 101 | +- **API key parameter name**: api_key |
| 102 | +- **Location**: URL query string |
| 103 | + |
| 104 | +Note, each API key must be added to a map of `map[string]APIKey` where the key is: api_key and passed in as the auth context for each request. |
| 105 | + |
| 106 | + |
| 107 | +## Documentation for Utility Methods |
| 108 | + |
| 109 | +Due to the fact that model structure members are all pointers, this package contains |
| 110 | +a number of utility functions to easily obtain pointers to values of basic types. |
| 111 | +Each of these functions takes a value of the given basic type and returns a pointer to it: |
| 112 | + |
| 113 | +* `PtrBool` |
| 114 | +* `PtrInt` |
| 115 | +* `PtrInt32` |
| 116 | +* `PtrInt64` |
| 117 | +* `PtrFloat` |
| 118 | +* `PtrFloat32` |
| 119 | +* `PtrFloat64` |
| 120 | +* `PtrString` |
| 121 | +* `PtrTime` |
| 122 | + |
| 123 | +## Author |
| 124 | + |
| 125 | + |
| 126 | + |
0 commit comments