forked from loafle/openapi-generator-original
[BUG][GO] Replace references to sw package with {{packageName}} in README template (#16812)
* Replace references to sw package with {{packageName}} * Update samples
This commit is contained in:
parent
8db9af9873
commit
c5d6884c63
@ -47,7 +47,7 @@ Default configuration comes with `Servers` field that contains server objects as
|
|||||||
|
|
||||||
### Select Server Configuration
|
### Select Server Configuration
|
||||||
|
|
||||||
For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
|
For using other server than the one defined on index 0 set context value `{{packageName}}.ContextServerIndex` of type `int`.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), {{packageName}}.ContextServerIndex, 1)
|
ctx := context.WithValue(context.Background(), {{packageName}}.ContextServerIndex, 1)
|
||||||
@ -55,7 +55,7 @@ ctx := context.WithValue(context.Background(), {{packageName}}.ContextServerInde
|
|||||||
|
|
||||||
### Templated Server URL
|
### Templated Server URL
|
||||||
|
|
||||||
Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
|
Templated server URL is formatted using default variables from configuration or from context value `{{packageName}}.ContextServerVariables` of type `map[string]string`.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), {{packageName}}.ContextServerVariables, map[string]string{
|
ctx := context.WithValue(context.Background(), {{packageName}}.ContextServerVariables, map[string]string{
|
||||||
@ -69,7 +69,7 @@ Note, enum values are always validated and all unused variables are silently ign
|
|||||||
|
|
||||||
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
||||||
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
||||||
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
|
Similar rules for overriding default operation server index and variables applies by using `{{packageName}}.ContextOperationServerIndices` and `{{packageName}}.ContextOperationServerVariables` context maps.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), {{packageName}}.ContextOperationServerIndices, map[string]int{
|
ctx := context.WithValue(context.Background(), {{packageName}}.ContextOperationServerIndices, map[string]int{
|
||||||
@ -115,8 +115,8 @@ Example
|
|||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(
|
auth := context.WithValue(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
sw.ContextAPIKeys,
|
{{packageName}}.ContextAPIKeys,
|
||||||
map[string]sw.APIKey{
|
map[string]{{packageName}}.APIKey{
|
||||||
"{{keyParamName}}": {Key: "API_KEY_STRING"},
|
"{{keyParamName}}": {Key: "API_KEY_STRING"},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -131,7 +131,7 @@ r, err := client.Service.Operation(auth, args)
|
|||||||
Example
|
Example
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING")
|
auth := context.WithValue(context.Background(), {{packageName}}.ContextAccessToken, "BEARER_TOKEN_STRING")
|
||||||
r, err := client.Service.Operation(auth, args)
|
r, err := client.Service.Operation(auth, args)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ r, err := client.Service.Operation(auth, args)
|
|||||||
Example
|
Example
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
|
auth := context.WithValue(context.Background(), {{packageName}}.ContextBasicAuth, {{packageName}}.BasicAuth{
|
||||||
UserName: "username",
|
UserName: "username",
|
||||||
Password: "password",
|
Password: "password",
|
||||||
})
|
})
|
||||||
@ -156,20 +156,20 @@ r, err := client.Service.Operation(auth, args)
|
|||||||
Example
|
Example
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
authConfig := client.HttpSignatureAuth{
|
authConfig := {{packageName}}.HttpSignatureAuth{
|
||||||
KeyId: "my-key-id",
|
KeyId: "my-key-id",
|
||||||
PrivateKeyPath: "rsa.pem",
|
PrivateKeyPath: "rsa.pem",
|
||||||
Passphrase: "my-passphrase",
|
Passphrase: "my-passphrase",
|
||||||
SigningScheme: sw.HttpSigningSchemeHs2019,
|
SigningScheme: {{packageName}}.HttpSigningSchemeHs2019,
|
||||||
SignedHeaders: []string{
|
SignedHeaders: []string{
|
||||||
sw.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target.
|
{{packageName}}.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target.
|
||||||
sw.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value.
|
{{packageName}}.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value.
|
||||||
"Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number.
|
"Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number.
|
||||||
"Date", // The date and time at which the message was originated.
|
"Date", // The date and time at which the message was originated.
|
||||||
"Content-Type", // The Media type of the body of the request.
|
"Content-Type", // The Media type of the body of the request.
|
||||||
"Digest", // A cryptographic digest of the request body.
|
"Digest", // A cryptographic digest of the request body.
|
||||||
},
|
},
|
||||||
SigningAlgorithm: sw.HttpSigningAlgorithmRsaPSS,
|
SigningAlgorithm: {{packageName}}.HttpSigningAlgorithmRsaPSS,
|
||||||
SignatureMaxValidity: 5 * time.Minute,
|
SignatureMaxValidity: 5 * time.Minute,
|
||||||
}
|
}
|
||||||
var authCtx context.Context
|
var authCtx context.Context
|
||||||
@ -194,7 +194,7 @@ Example
|
|||||||
Example
|
Example
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
|
auth := context.WithValue(context.Background(), {{packageName}}.ContextAccessToken, "ACCESSTOKENSTRING")
|
||||||
r, err := client.Service.Operation(auth, args)
|
r, err := client.Service.Operation(auth, args)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ 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, {{packageName}}.ContextOAuth2, tokenSource)
|
||||||
r, err := client.Service.Operation(auth, args)
|
r, err := client.Service.Operation(auth, args)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ Default configuration comes with `Servers` field that contains server objects as
|
|||||||
|
|
||||||
### Select Server Configuration
|
### Select Server Configuration
|
||||||
|
|
||||||
For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
|
For using other server than the one defined on index 0 set context value `openapi.ContextServerIndex` of type `int`.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
|
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
|
||||||
@ -44,7 +44,7 @@ ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
|
|||||||
|
|
||||||
### Templated Server URL
|
### Templated Server URL
|
||||||
|
|
||||||
Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
|
Templated server URL is formatted using default variables from configuration or from context value `openapi.ContextServerVariables` of type `map[string]string`.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
|
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
|
||||||
@ -58,7 +58,7 @@ Note, enum values are always validated and all unused variables are silently ign
|
|||||||
|
|
||||||
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
||||||
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
||||||
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
|
Similar rules for overriding default operation server index and variables applies by using `openapi.ContextOperationServerIndices` and `openapi.ContextOperationServerVariables` context maps.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
|
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
|
||||||
@ -125,7 +125,7 @@ Authentication schemes defined for the API:
|
|||||||
Example
|
Example
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
|
auth := context.WithValue(context.Background(), openapi.ContextBasicAuth, openapi.BasicAuth{
|
||||||
UserName: "username",
|
UserName: "username",
|
||||||
Password: "password",
|
Password: "password",
|
||||||
})
|
})
|
||||||
|
@ -37,7 +37,7 @@ Default configuration comes with `Servers` field that contains server objects as
|
|||||||
|
|
||||||
### Select Server Configuration
|
### Select Server Configuration
|
||||||
|
|
||||||
For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
|
For using other server than the one defined on index 0 set context value `petstore.ContextServerIndex` of type `int`.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), petstore.ContextServerIndex, 1)
|
ctx := context.WithValue(context.Background(), petstore.ContextServerIndex, 1)
|
||||||
@ -45,7 +45,7 @@ ctx := context.WithValue(context.Background(), petstore.ContextServerIndex, 1)
|
|||||||
|
|
||||||
### Templated Server URL
|
### Templated Server URL
|
||||||
|
|
||||||
Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
|
Templated server URL is formatted using default variables from configuration or from context value `petstore.ContextServerVariables` of type `map[string]string`.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), petstore.ContextServerVariables, map[string]string{
|
ctx := context.WithValue(context.Background(), petstore.ContextServerVariables, map[string]string{
|
||||||
@ -59,7 +59,7 @@ Note, enum values are always validated and all unused variables are silently ign
|
|||||||
|
|
||||||
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
||||||
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
||||||
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
|
Similar rules for overriding default operation server index and variables applies by using `petstore.ContextOperationServerIndices` and `petstore.ContextOperationServerVariables` context maps.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), petstore.ContextOperationServerIndices, map[string]int{
|
ctx := context.WithValue(context.Background(), petstore.ContextOperationServerIndices, map[string]int{
|
||||||
@ -183,7 +183,7 @@ Authentication schemes defined for the API:
|
|||||||
Example
|
Example
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
|
auth := context.WithValue(context.Background(), petstore.ContextAccessToken, "ACCESSTOKENSTRING")
|
||||||
r, err := client.Service.Operation(auth, args)
|
r, err := client.Service.Operation(auth, args)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ 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, petstore.ContextOAuth2, tokenSource)
|
||||||
r, err := client.Service.Operation(auth, args)
|
r, err := client.Service.Operation(auth, args)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -212,8 +212,8 @@ Example
|
|||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(
|
auth := context.WithValue(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
sw.ContextAPIKeys,
|
petstore.ContextAPIKeys,
|
||||||
map[string]sw.APIKey{
|
map[string]petstore.APIKey{
|
||||||
"api_key": {Key: "API_KEY_STRING"},
|
"api_key": {Key: "API_KEY_STRING"},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -233,8 +233,8 @@ Example
|
|||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(
|
auth := context.WithValue(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
sw.ContextAPIKeys,
|
petstore.ContextAPIKeys,
|
||||||
map[string]sw.APIKey{
|
map[string]petstore.APIKey{
|
||||||
"api_key_query": {Key: "API_KEY_STRING"},
|
"api_key_query": {Key: "API_KEY_STRING"},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -248,7 +248,7 @@ r, err := client.Service.Operation(auth, args)
|
|||||||
Example
|
Example
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
|
auth := context.WithValue(context.Background(), petstore.ContextBasicAuth, petstore.BasicAuth{
|
||||||
UserName: "username",
|
UserName: "username",
|
||||||
Password: "password",
|
Password: "password",
|
||||||
})
|
})
|
||||||
|
@ -36,7 +36,7 @@ Default configuration comes with `Servers` field that contains server objects as
|
|||||||
|
|
||||||
### Select Server Configuration
|
### Select Server Configuration
|
||||||
|
|
||||||
For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
|
For using other server than the one defined on index 0 set context value `x_auth_id_alias.ContextServerIndex` of type `int`.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), x_auth_id_alias.ContextServerIndex, 1)
|
ctx := context.WithValue(context.Background(), x_auth_id_alias.ContextServerIndex, 1)
|
||||||
@ -44,7 +44,7 @@ ctx := context.WithValue(context.Background(), x_auth_id_alias.ContextServerInde
|
|||||||
|
|
||||||
### Templated Server URL
|
### Templated Server URL
|
||||||
|
|
||||||
Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
|
Templated server URL is formatted using default variables from configuration or from context value `x_auth_id_alias.ContextServerVariables` of type `map[string]string`.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), x_auth_id_alias.ContextServerVariables, map[string]string{
|
ctx := context.WithValue(context.Background(), x_auth_id_alias.ContextServerVariables, map[string]string{
|
||||||
@ -58,7 +58,7 @@ Note, enum values are always validated and all unused variables are silently ign
|
|||||||
|
|
||||||
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
||||||
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
||||||
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
|
Similar rules for overriding default operation server index and variables applies by using `x_auth_id_alias.ContextOperationServerIndices` and `x_auth_id_alias.ContextOperationServerVariables` context maps.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), x_auth_id_alias.ContextOperationServerIndices, map[string]int{
|
ctx := context.WithValue(context.Background(), x_auth_id_alias.ContextOperationServerIndices, map[string]int{
|
||||||
@ -104,8 +104,8 @@ Example
|
|||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(
|
auth := context.WithValue(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
sw.ContextAPIKeys,
|
x_auth_id_alias.ContextAPIKeys,
|
||||||
map[string]sw.APIKey{
|
map[string]x_auth_id_alias.APIKey{
|
||||||
"X-Api-Key": {Key: "API_KEY_STRING"},
|
"X-Api-Key": {Key: "API_KEY_STRING"},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -125,8 +125,8 @@ Example
|
|||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(
|
auth := context.WithValue(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
sw.ContextAPIKeys,
|
x_auth_id_alias.ContextAPIKeys,
|
||||||
map[string]sw.APIKey{
|
map[string]x_auth_id_alias.APIKey{
|
||||||
"api_key": {Key: "API_KEY_STRING"},
|
"api_key": {Key: "API_KEY_STRING"},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -37,7 +37,7 @@ Default configuration comes with `Servers` field that contains server objects as
|
|||||||
|
|
||||||
### Select Server Configuration
|
### Select Server Configuration
|
||||||
|
|
||||||
For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
|
For using other server than the one defined on index 0 set context value `petstore.ContextServerIndex` of type `int`.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), petstore.ContextServerIndex, 1)
|
ctx := context.WithValue(context.Background(), petstore.ContextServerIndex, 1)
|
||||||
@ -45,7 +45,7 @@ ctx := context.WithValue(context.Background(), petstore.ContextServerIndex, 1)
|
|||||||
|
|
||||||
### Templated Server URL
|
### Templated Server URL
|
||||||
|
|
||||||
Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
|
Templated server URL is formatted using default variables from configuration or from context value `petstore.ContextServerVariables` of type `map[string]string`.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), petstore.ContextServerVariables, map[string]string{
|
ctx := context.WithValue(context.Background(), petstore.ContextServerVariables, map[string]string{
|
||||||
@ -59,7 +59,7 @@ Note, enum values are always validated and all unused variables are silently ign
|
|||||||
|
|
||||||
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
||||||
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
||||||
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
|
Similar rules for overriding default operation server index and variables applies by using `petstore.ContextOperationServerIndices` and `petstore.ContextOperationServerVariables` context maps.
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
ctx := context.WithValue(context.Background(), petstore.ContextOperationServerIndices, map[string]int{
|
ctx := context.WithValue(context.Background(), petstore.ContextOperationServerIndices, map[string]int{
|
||||||
@ -206,7 +206,7 @@ Authentication schemes defined for the API:
|
|||||||
Example
|
Example
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
|
auth := context.WithValue(context.Background(), petstore.ContextAccessToken, "ACCESSTOKENSTRING")
|
||||||
r, err := client.Service.Operation(auth, args)
|
r, err := client.Service.Operation(auth, args)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ 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, petstore.ContextOAuth2, tokenSource)
|
||||||
r, err := client.Service.Operation(auth, args)
|
r, err := client.Service.Operation(auth, args)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -235,8 +235,8 @@ Example
|
|||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(
|
auth := context.WithValue(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
sw.ContextAPIKeys,
|
petstore.ContextAPIKeys,
|
||||||
map[string]sw.APIKey{
|
map[string]petstore.APIKey{
|
||||||
"api_key": {Key: "API_KEY_STRING"},
|
"api_key": {Key: "API_KEY_STRING"},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -256,8 +256,8 @@ Example
|
|||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(
|
auth := context.WithValue(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
sw.ContextAPIKeys,
|
petstore.ContextAPIKeys,
|
||||||
map[string]sw.APIKey{
|
map[string]petstore.APIKey{
|
||||||
"api_key_query": {Key: "API_KEY_STRING"},
|
"api_key_query": {Key: "API_KEY_STRING"},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -271,7 +271,7 @@ r, err := client.Service.Operation(auth, args)
|
|||||||
Example
|
Example
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
|
auth := context.WithValue(context.Background(), petstore.ContextBasicAuth, petstore.BasicAuth{
|
||||||
UserName: "username",
|
UserName: "username",
|
||||||
Password: "password",
|
Password: "password",
|
||||||
})
|
})
|
||||||
@ -285,7 +285,7 @@ r, err := client.Service.Operation(auth, args)
|
|||||||
Example
|
Example
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING")
|
auth := context.WithValue(context.Background(), petstore.ContextAccessToken, "BEARER_TOKEN_STRING")
|
||||||
r, err := client.Service.Operation(auth, args)
|
r, err := client.Service.Operation(auth, args)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -296,20 +296,20 @@ r, err := client.Service.Operation(auth, args)
|
|||||||
Example
|
Example
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
authConfig := client.HttpSignatureAuth{
|
authConfig := petstore.HttpSignatureAuth{
|
||||||
KeyId: "my-key-id",
|
KeyId: "my-key-id",
|
||||||
PrivateKeyPath: "rsa.pem",
|
PrivateKeyPath: "rsa.pem",
|
||||||
Passphrase: "my-passphrase",
|
Passphrase: "my-passphrase",
|
||||||
SigningScheme: sw.HttpSigningSchemeHs2019,
|
SigningScheme: petstore.HttpSigningSchemeHs2019,
|
||||||
SignedHeaders: []string{
|
SignedHeaders: []string{
|
||||||
sw.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target.
|
petstore.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target.
|
||||||
sw.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value.
|
petstore.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value.
|
||||||
"Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number.
|
"Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number.
|
||||||
"Date", // The date and time at which the message was originated.
|
"Date", // The date and time at which the message was originated.
|
||||||
"Content-Type", // The Media type of the body of the request.
|
"Content-Type", // The Media type of the body of the request.
|
||||||
"Digest", // A cryptographic digest of the request body.
|
"Digest", // A cryptographic digest of the request body.
|
||||||
},
|
},
|
||||||
SigningAlgorithm: sw.HttpSigningAlgorithmRsaPSS,
|
SigningAlgorithm: petstore.HttpSigningAlgorithmRsaPSS,
|
||||||
SignatureMaxValidity: 5 * time.Minute,
|
SignatureMaxValidity: 5 * time.Minute,
|
||||||
}
|
}
|
||||||
var authCtx context.Context
|
var authCtx context.Context
|
||||||
|
Loading…
x
Reference in New Issue
Block a user