mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-08 08:30:56 +00:00
add go api key example in README.md (#15705)
This commit is contained in:
parent
3ee2eeedba
commit
5fae4f5d93
@ -110,6 +110,19 @@ Class | Method | HTTP request | Description
|
||||
|
||||
Note, each API key must be added to a map of `map[string]APIKey` where the key is: {{keyParamName}} and passed in as the auth context for each request.
|
||||
|
||||
Example
|
||||
|
||||
```golang
|
||||
auth := context.WithValue(
|
||||
context.Background(),
|
||||
sw.ContextAPIKeys,
|
||||
map[string]sw.APIKey{
|
||||
"{{keyParamName}}": {Key: "API_KEY_STRING"},
|
||||
},
|
||||
)
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}
|
||||
{{#isBasicBearer}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user