mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 20:50:55 +00:00
[Go] Use consistent indentation in readme (#7336)
* [Go] Use consistent indentation in readme * [Go] Regenerate petstore sample
This commit is contained in:
parent
72abb20f2e
commit
0f6696089f
@ -19,8 +19,8 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
|
||||
## Installation
|
||||
Put the package under your project folder and add the following in import:
|
||||
```
|
||||
"./{{packageName}}"
|
||||
```golang
|
||||
import "./{{packageName}}"
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
@ -45,7 +45,7 @@ Class | Method | HTTP request | Description
|
||||
{{#isApiKey}}- **Type**: API key
|
||||
|
||||
Example
|
||||
```
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
|
||||
Key: "APIKEY",
|
||||
Prefix: "Bearer", // Omit if not necessary.
|
||||
@ -56,7 +56,7 @@ Example
|
||||
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||
|
||||
Example
|
||||
```
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
|
||||
UserName: "username",
|
||||
Password: "password",
|
||||
@ -72,16 +72,16 @@ Example
|
||||
{{/scopes}}
|
||||
|
||||
Example
|
||||
```
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
|
||||
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
|
||||
```
|
||||
```golang
|
||||
import "golang.org/x/oauth2"
|
||||
|
||||
/ .. Perform OAuth2 round trip request and obtain a token .. //
|
||||
/* Perform OAuth2 round trip request and obtain a token */
|
||||
|
||||
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
|
||||
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
|
||||
|
@ -11,8 +11,8 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
|
||||
|
||||
## Installation
|
||||
Put the package under your project folder and add the following in import:
|
||||
```
|
||||
"./petstore"
|
||||
```golang
|
||||
import "./petstore"
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
@ -100,7 +100,7 @@ Class | Method | HTTP request | Description
|
||||
- **Type**: API key
|
||||
|
||||
Example
|
||||
```
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
|
||||
Key: "APIKEY",
|
||||
Prefix: "Bearer", // Omit if not necessary.
|
||||
@ -111,7 +111,7 @@ Example
|
||||
- **Type**: API key
|
||||
|
||||
Example
|
||||
```
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
|
||||
Key: "APIKEY",
|
||||
Prefix: "Bearer", // Omit if not necessary.
|
||||
@ -122,7 +122,7 @@ Example
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
Example
|
||||
```
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
|
||||
UserName: "username",
|
||||
Password: "password",
|
||||
@ -138,16 +138,16 @@ Example
|
||||
- **read:pets**: read your pets
|
||||
|
||||
Example
|
||||
```
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
|
||||
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
|
||||
```
|
||||
```golang
|
||||
import "golang.org/x/oauth2"
|
||||
|
||||
/ .. Perform OAuth2 round trip request and obtain a token .. //
|
||||
/* Perform OAuth2 round trip request and obtain a token */
|
||||
|
||||
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
|
||||
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
|
||||
|
Loading…
x
Reference in New Issue
Block a user