mirror of
https://github.com/hanzoai/go-fulfillment.git
synced 2026-10-30 18:36:06 +00:00
61 lines
1.8 KiB
Go
61 lines
1.8 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package auth
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"github.com/go-openapi/runtime"
|
|
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
)
|
|
|
|
// New creates a new auth API client.
|
|
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
|
|
return &Client{transport: transport, formats: formats}
|
|
}
|
|
|
|
/*
|
|
Client for auth API
|
|
*/
|
|
type Client struct {
|
|
transport runtime.ClientTransport
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
/*
|
|
GenerateToken generates an access token
|
|
|
|
By default tokens are valid for 7 days while refresh tokens are valid for 30 days. If your `grant_type` is "password" include the `username` and `password`, if however your `grant_type` is "refresh_token" the username/password are not required, instead set the `refresh_token`
|
|
*/
|
|
func (a *Client) GenerateToken(params *GenerateTokenParams) (*GenerateTokenOK, error) {
|
|
// TODO: Validate the params before sending
|
|
if params == nil {
|
|
params = NewGenerateTokenParams()
|
|
}
|
|
|
|
result, err := a.transport.Submit(&runtime.ClientOperation{
|
|
ID: "generateToken",
|
|
Method: "POST",
|
|
PathPattern: "/oauth/access_token",
|
|
ProducesMediaTypes: []string{""},
|
|
ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"},
|
|
Schemes: []string{"http"},
|
|
Params: params,
|
|
Reader: &GenerateTokenReader{formats: a.formats},
|
|
Context: params.Context,
|
|
Client: params.HTTPClient,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return result.(*GenerateTokenOK), nil
|
|
|
|
}
|
|
|
|
// SetTransport changes the transport on the client
|
|
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
|
a.transport = transport
|
|
}
|