add go api key example in README.md (#15705)

This commit is contained in:
Chris McEvoy 2023-06-01 02:01:21 +01:00 committed by GitHub
parent 3ee2eeedba
commit 5fae4f5d93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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}}