[Go] Use consistent indentation in readme (#7336)

* [Go] Use consistent indentation in readme

* [Go] Regenerate petstore sample
This commit is contained in:
Euan Kemp 2018-01-14 01:05:18 -08:00 committed by William Cheng
parent 72abb20f2e
commit 0f6696089f
2 changed files with 52 additions and 52 deletions

View File

@ -19,8 +19,8 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
## Installation ## Installation
Put the package under your project folder and add the following in import: Put the package under your project folder and add the following in import:
``` ```golang
"./{{packageName}}" import "./{{packageName}}"
``` ```
## Documentation for API Endpoints ## Documentation for API Endpoints
@ -45,23 +45,23 @@ Class | Method | HTTP request | Description
{{#isApiKey}}- **Type**: API key {{#isApiKey}}- **Type**: API key
Example Example
``` ```golang
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY", Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary. Prefix: "Bearer", // Omit if not necessary.
}) })
r, err := client.Service.Operation(auth, args) r, err := client.Service.Operation(auth, args)
``` ```
{{/isApiKey}} {{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication {{#isBasic}}- **Type**: HTTP basic authentication
Example Example
``` ```golang
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username", UserName: "username",
Password: "password", Password: "password",
}) })
r, err := client.Service.Operation(auth, args) r, err := client.Service.Operation(auth, args)
``` ```
{{/isBasic}} {{/isBasic}}
{{#isOAuth}}- **Type**: OAuth {{#isOAuth}}- **Type**: OAuth
@ -72,20 +72,20 @@ Example
{{/scopes}} {{/scopes}}
Example Example
``` ```golang
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args) r, err := client.Service.Operation(auth, args)
``` ```
Or via OAuth2 module to automatically refresh tokens and perform user authentication. Or via OAuth2 module to automatically refresh tokens and perform user authentication.
``` ```golang
import "golang.org/x/oauth2" 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) tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args) r, err := client.Service.Operation(auth, args)
``` ```
{{/isOAuth}} {{/isOAuth}}
{{/authMethods}} {{/authMethods}}

View File

@ -11,8 +11,8 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
## Installation ## Installation
Put the package under your project folder and add the following in import: Put the package under your project folder and add the following in import:
``` ```golang
"./petstore" import "./petstore"
``` ```
## Documentation for API Endpoints ## Documentation for API Endpoints
@ -100,34 +100,34 @@ Class | Method | HTTP request | Description
- **Type**: API key - **Type**: API key
Example Example
``` ```golang
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY", Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary. Prefix: "Bearer", // Omit if not necessary.
}) })
r, err := client.Service.Operation(auth, args) r, err := client.Service.Operation(auth, args)
``` ```
## api_key_query ## api_key_query
- **Type**: API key - **Type**: API key
Example Example
``` ```golang
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY", Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary. Prefix: "Bearer", // Omit if not necessary.
}) })
r, err := client.Service.Operation(auth, args) r, err := client.Service.Operation(auth, args)
``` ```
## http_basic_test ## http_basic_test
- **Type**: HTTP basic authentication - **Type**: HTTP basic authentication
Example Example
``` ```golang
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username", UserName: "username",
Password: "password", Password: "password",
}) })
r, err := client.Service.Operation(auth, args) r, err := client.Service.Operation(auth, args)
``` ```
## petstore_auth ## petstore_auth
- **Type**: OAuth - **Type**: OAuth
@ -138,20 +138,20 @@ Example
- **read:pets**: read your pets - **read:pets**: read your pets
Example Example
``` ```golang
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args) r, err := client.Service.Operation(auth, args)
``` ```
Or via OAuth2 module to automatically refresh tokens and perform user authentication. Or via OAuth2 module to automatically refresh tokens and perform user authentication.
``` ```golang
import "golang.org/x/oauth2" 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) tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args) r, err := client.Service.Operation(auth, args)
``` ```
## Author ## Author