Skip to content

Commit

Permalink
[Go] Use consistent indentation in readme (#7336)
Browse files Browse the repository at this point in the history
* [Go] Use consistent indentation in readme

* [Go] Regenerate petstore sample
  • Loading branch information
euank authored and wing328 committed Jan 14, 2018
1 parent 72abb20 commit 0f66960
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 52 deletions.
46 changes: 23 additions & 23 deletions modules/swagger-codegen/src/main/resources/go/README.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -45,23 +45,23 @@ Class | Method | HTTP request | Description
{{#isApiKey}}- **Type**: API key

Example
```
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
```golang
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
```
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication

Example
```
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
```golang
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
```
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
Expand All @@ -72,20 +72,20 @@ Example
{{/scopes}}

Example
```
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
```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.
```
import "golang.org/x/oauth2"
```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)
r, err := client.Service.Operation(auth, args)
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
```
{{/isOAuth}}
{{/authMethods}}
Expand Down
58 changes: 29 additions & 29 deletions samples/client/petstore/go/go-petstore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -100,34 +100,34 @@ Class | Method | HTTP request | Description
- **Type**: API key

Example
```
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
```golang
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
```
## api_key_query
- **Type**: API key

Example
```
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
```golang
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
```
## http_basic_test
- **Type**: HTTP basic authentication

Example
```
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
```golang
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
```
## petstore_auth
- **Type**: OAuth
Expand All @@ -138,20 +138,20 @@ Example
- **read:pets**: read your pets

Example
```
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
```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.
```
import "golang.org/x/oauth2"
```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)
r, err := client.Service.Operation(auth, args)
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
```

## Author
Expand Down

0 comments on commit 0f66960

Please sign in to comment.