Documentation ¶
Index ¶
- type Client
- func (a *Client) ObtainToken(params *ObtainTokenParams, opts ...ClientOption) (*ObtainTokenOK, error)
- func (a *Client) RenewToken(params *RenewTokenParams, authInfo runtime.ClientAuthInfoWriter, ...) (*RenewTokenOK, error)
- func (a *Client) RevokeToken(params *RevokeTokenParams, authInfo runtime.ClientAuthInfoWriter, ...) (*RevokeTokenOK, error)
- func (a *Client) SetTransport(transport runtime.ClientTransport)
- type ClientOption
- type ClientService
- type ObtainTokenOK
- type ObtainTokenParams
- func (o *ObtainTokenParams) SetBody(body *models.ObtainTokenRequest)
- func (o *ObtainTokenParams) SetContext(ctx context.Context)
- func (o *ObtainTokenParams) SetDefaults()
- func (o *ObtainTokenParams) SetHTTPClient(client *http.Client)
- func (o *ObtainTokenParams) SetTimeout(timeout time.Duration)
- func (o *ObtainTokenParams) WithBody(body *models.ObtainTokenRequest) *ObtainTokenParams
- func (o *ObtainTokenParams) WithContext(ctx context.Context) *ObtainTokenParams
- func (o *ObtainTokenParams) WithDefaults() *ObtainTokenParams
- func (o *ObtainTokenParams) WithHTTPClient(client *http.Client) *ObtainTokenParams
- func (o *ObtainTokenParams) WithTimeout(timeout time.Duration) *ObtainTokenParams
- func (o *ObtainTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error
- type ObtainTokenReader
- type RenewTokenOK
- type RenewTokenParams
- func (o *RenewTokenParams) SetBody(body *models.RenewTokenRequest)
- func (o *RenewTokenParams) SetClientID(clientID string)
- func (o *RenewTokenParams) SetContext(ctx context.Context)
- func (o *RenewTokenParams) SetDefaults()
- func (o *RenewTokenParams) SetHTTPClient(client *http.Client)
- func (o *RenewTokenParams) SetTimeout(timeout time.Duration)
- func (o *RenewTokenParams) WithBody(body *models.RenewTokenRequest) *RenewTokenParams
- func (o *RenewTokenParams) WithClientID(clientID string) *RenewTokenParams
- func (o *RenewTokenParams) WithContext(ctx context.Context) *RenewTokenParams
- func (o *RenewTokenParams) WithDefaults() *RenewTokenParams
- func (o *RenewTokenParams) WithHTTPClient(client *http.Client) *RenewTokenParams
- func (o *RenewTokenParams) WithTimeout(timeout time.Duration) *RenewTokenParams
- func (o *RenewTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error
- type RenewTokenReader
- type RevokeTokenOK
- type RevokeTokenParams
- func (o *RevokeTokenParams) SetBody(body *models.RevokeTokenRequest)
- func (o *RevokeTokenParams) SetContext(ctx context.Context)
- func (o *RevokeTokenParams) SetDefaults()
- func (o *RevokeTokenParams) SetHTTPClient(client *http.Client)
- func (o *RevokeTokenParams) SetTimeout(timeout time.Duration)
- func (o *RevokeTokenParams) WithBody(body *models.RevokeTokenRequest) *RevokeTokenParams
- func (o *RevokeTokenParams) WithContext(ctx context.Context) *RevokeTokenParams
- func (o *RevokeTokenParams) WithDefaults() *RevokeTokenParams
- func (o *RevokeTokenParams) WithHTTPClient(client *http.Client) *RevokeTokenParams
- func (o *RevokeTokenParams) WithTimeout(timeout time.Duration) *RevokeTokenParams
- func (o *RevokeTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error
- type RevokeTokenReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for o auth API
func (*Client) ObtainToken ¶
func (a *Client) ObtainToken(params *ObtainTokenParams, opts ...ClientOption) (*ObtainTokenOK, error)
ObtainToken obtains token Returns an OAuth access token.
The endpoint supports distinct methods of obtaining OAuth access tokens. Applications specify a method by adding the `grant_type` parameter in the request and also provide relevant information.
__Note:__ Regardless of the method application specified, the endpoint always returns two items; an OAuth access token and a refresh token in the response.
__OAuth tokens should only live on secure servers. Application clients should never interact directly with OAuth tokens__.
func (*Client) RenewToken ¶
func (a *Client) RenewToken(params *RenewTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RenewTokenOK, error)
RenewToken renews token `RenewToken` is deprecated. For information about refreshing OAuth access tokens, see
[Renew OAuth Token](https://developer.squareup.com/docs/oauth-api/cookbook/renew-oauth-tokens).
Renews an OAuth access token before it expires.
OAuth access tokens besides your application's personal access token expire after __30 days__. You can also renew expired tokens within __15 days__ of their expiration. You cannot renew an access token that has been expired for more than 15 days. Instead, the associated user must re-complete the OAuth flow from the beginning.
__Important:__ The `Authorization` header for this endpoint must have the following format:
``` Authorization: Client APPLICATION_SECRET ```
Replace `APPLICATION_SECRET` with the application secret on the Credentials page in the [application dashboard](https://connect.squareup.com/apps).
func (*Client) RevokeToken ¶
func (a *Client) RevokeToken(params *RevokeTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RevokeTokenOK, error)
RevokeToken revokes token Revokes an access token generated with the OAuth flow.
If an account has more than one OAuth access token for your application, this endpoint revokes all of them, regardless of which token you specify. When an OAuth access token is revoked, all of the active subscriptions associated with that OAuth token are canceled immediately.
__Important:__ The `Authorization` header for this endpoint must have the following format:
``` Authorization: Client APPLICATION_SECRET ```
Replace `APPLICATION_SECRET` with the application secret on the Credentials page in the [Developer Dashboard](https://developer.squareup.com/apps).
func (*Client) SetTransport ¶
func (a *Client) SetTransport(transport runtime.ClientTransport)
SetTransport changes the transport on the client
type ClientOption ¶
type ClientOption func(*runtime.ClientOperation)
ClientOption is the option for Client methods
type ClientService ¶
type ClientService interface { ObtainToken(params *ObtainTokenParams, opts ...ClientOption) (*ObtainTokenOK, error) RenewToken(params *RenewTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RenewTokenOK, error) RevokeToken(params *RevokeTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RevokeTokenOK, error) SetTransport(transport runtime.ClientTransport) }
ClientService is the interface for Client methods
func New ¶
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService
New creates a new o auth API client.
type ObtainTokenOK ¶
type ObtainTokenOK struct {
Payload *models.ObtainTokenResponse
}
ObtainTokenOK describes a response with status code 200, with default header values.
Success
func NewObtainTokenOK ¶
func NewObtainTokenOK() *ObtainTokenOK
NewObtainTokenOK creates a ObtainTokenOK with default headers values
func (*ObtainTokenOK) Error ¶
func (o *ObtainTokenOK) Error() string
func (*ObtainTokenOK) GetPayload ¶
func (o *ObtainTokenOK) GetPayload() *models.ObtainTokenResponse
type ObtainTokenParams ¶
type ObtainTokenParams struct { /* Body. An object containing the fields to POST for the request. See the corresponding object definition for field details. */ Body *models.ObtainTokenRequest Context context.Context HTTPClient *http.Client // contains filtered or unexported fields }
ObtainTokenParams contains all the parameters to send to the API endpoint
for the obtain token operation. Typically these are written to a http.Request.
func NewObtainTokenParams ¶
func NewObtainTokenParams() *ObtainTokenParams
NewObtainTokenParams creates a new ObtainTokenParams object, with the default timeout for this client.
Default values are not hydrated, since defaults are normally applied by the API server side.
To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewObtainTokenParamsWithContext ¶
func NewObtainTokenParamsWithContext(ctx context.Context) *ObtainTokenParams
NewObtainTokenParamsWithContext creates a new ObtainTokenParams object with the ability to set a context for a request.
func NewObtainTokenParamsWithHTTPClient ¶
func NewObtainTokenParamsWithHTTPClient(client *http.Client) *ObtainTokenParams
NewObtainTokenParamsWithHTTPClient creates a new ObtainTokenParams object with the ability to set a custom HTTPClient for a request.
func NewObtainTokenParamsWithTimeout ¶
func NewObtainTokenParamsWithTimeout(timeout time.Duration) *ObtainTokenParams
NewObtainTokenParamsWithTimeout creates a new ObtainTokenParams object with the ability to set a timeout on a request.
func (*ObtainTokenParams) SetBody ¶
func (o *ObtainTokenParams) SetBody(body *models.ObtainTokenRequest)
SetBody adds the body to the obtain token params
func (*ObtainTokenParams) SetContext ¶
func (o *ObtainTokenParams) SetContext(ctx context.Context)
SetContext adds the context to the obtain token params
func (*ObtainTokenParams) SetDefaults ¶
func (o *ObtainTokenParams) SetDefaults()
SetDefaults hydrates default values in the obtain token params (not the query body).
All values with no default are reset to their zero value.
func (*ObtainTokenParams) SetHTTPClient ¶
func (o *ObtainTokenParams) SetHTTPClient(client *http.Client)
SetHTTPClient adds the HTTPClient to the obtain token params
func (*ObtainTokenParams) SetTimeout ¶
func (o *ObtainTokenParams) SetTimeout(timeout time.Duration)
SetTimeout adds the timeout to the obtain token params
func (*ObtainTokenParams) WithBody ¶
func (o *ObtainTokenParams) WithBody(body *models.ObtainTokenRequest) *ObtainTokenParams
WithBody adds the body to the obtain token params
func (*ObtainTokenParams) WithContext ¶
func (o *ObtainTokenParams) WithContext(ctx context.Context) *ObtainTokenParams
WithContext adds the context to the obtain token params
func (*ObtainTokenParams) WithDefaults ¶
func (o *ObtainTokenParams) WithDefaults() *ObtainTokenParams
WithDefaults hydrates default values in the obtain token params (not the query body).
All values with no default are reset to their zero value.
func (*ObtainTokenParams) WithHTTPClient ¶
func (o *ObtainTokenParams) WithHTTPClient(client *http.Client) *ObtainTokenParams
WithHTTPClient adds the HTTPClient to the obtain token params
func (*ObtainTokenParams) WithTimeout ¶
func (o *ObtainTokenParams) WithTimeout(timeout time.Duration) *ObtainTokenParams
WithTimeout adds the timeout to the obtain token params
func (*ObtainTokenParams) WriteToRequest ¶
func (o *ObtainTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error
WriteToRequest writes these params to a swagger request
type ObtainTokenReader ¶
type ObtainTokenReader struct {
// contains filtered or unexported fields
}
ObtainTokenReader is a Reader for the ObtainToken structure.
func (*ObtainTokenReader) ReadResponse ¶
func (o *ObtainTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)
ReadResponse reads a server response into the received o.
type RenewTokenOK ¶
type RenewTokenOK struct {
Payload *models.RenewTokenResponse
}
RenewTokenOK describes a response with status code 200, with default header values.
Success
func NewRenewTokenOK ¶
func NewRenewTokenOK() *RenewTokenOK
NewRenewTokenOK creates a RenewTokenOK with default headers values
func (*RenewTokenOK) Error ¶
func (o *RenewTokenOK) Error() string
func (*RenewTokenOK) GetPayload ¶
func (o *RenewTokenOK) GetPayload() *models.RenewTokenResponse
type RenewTokenParams ¶
type RenewTokenParams struct { /* Body. An object containing the fields to POST for the request. See the corresponding object definition for field details. */ Body *models.RenewTokenRequest /* ClientID. Your application ID, available from the [application dashboard](https://connect.squareup.com/apps). */ ClientID string Context context.Context HTTPClient *http.Client // contains filtered or unexported fields }
RenewTokenParams contains all the parameters to send to the API endpoint
for the renew token operation. Typically these are written to a http.Request.
func NewRenewTokenParams ¶
func NewRenewTokenParams() *RenewTokenParams
NewRenewTokenParams creates a new RenewTokenParams object, with the default timeout for this client.
Default values are not hydrated, since defaults are normally applied by the API server side.
To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewRenewTokenParamsWithContext ¶
func NewRenewTokenParamsWithContext(ctx context.Context) *RenewTokenParams
NewRenewTokenParamsWithContext creates a new RenewTokenParams object with the ability to set a context for a request.
func NewRenewTokenParamsWithHTTPClient ¶
func NewRenewTokenParamsWithHTTPClient(client *http.Client) *RenewTokenParams
NewRenewTokenParamsWithHTTPClient creates a new RenewTokenParams object with the ability to set a custom HTTPClient for a request.
func NewRenewTokenParamsWithTimeout ¶
func NewRenewTokenParamsWithTimeout(timeout time.Duration) *RenewTokenParams
NewRenewTokenParamsWithTimeout creates a new RenewTokenParams object with the ability to set a timeout on a request.
func (*RenewTokenParams) SetBody ¶
func (o *RenewTokenParams) SetBody(body *models.RenewTokenRequest)
SetBody adds the body to the renew token params
func (*RenewTokenParams) SetClientID ¶
func (o *RenewTokenParams) SetClientID(clientID string)
SetClientID adds the clientId to the renew token params
func (*RenewTokenParams) SetContext ¶
func (o *RenewTokenParams) SetContext(ctx context.Context)
SetContext adds the context to the renew token params
func (*RenewTokenParams) SetDefaults ¶
func (o *RenewTokenParams) SetDefaults()
SetDefaults hydrates default values in the renew token params (not the query body).
All values with no default are reset to their zero value.
func (*RenewTokenParams) SetHTTPClient ¶
func (o *RenewTokenParams) SetHTTPClient(client *http.Client)
SetHTTPClient adds the HTTPClient to the renew token params
func (*RenewTokenParams) SetTimeout ¶
func (o *RenewTokenParams) SetTimeout(timeout time.Duration)
SetTimeout adds the timeout to the renew token params
func (*RenewTokenParams) WithBody ¶
func (o *RenewTokenParams) WithBody(body *models.RenewTokenRequest) *RenewTokenParams
WithBody adds the body to the renew token params
func (*RenewTokenParams) WithClientID ¶
func (o *RenewTokenParams) WithClientID(clientID string) *RenewTokenParams
WithClientID adds the clientID to the renew token params
func (*RenewTokenParams) WithContext ¶
func (o *RenewTokenParams) WithContext(ctx context.Context) *RenewTokenParams
WithContext adds the context to the renew token params
func (*RenewTokenParams) WithDefaults ¶
func (o *RenewTokenParams) WithDefaults() *RenewTokenParams
WithDefaults hydrates default values in the renew token params (not the query body).
All values with no default are reset to their zero value.
func (*RenewTokenParams) WithHTTPClient ¶
func (o *RenewTokenParams) WithHTTPClient(client *http.Client) *RenewTokenParams
WithHTTPClient adds the HTTPClient to the renew token params
func (*RenewTokenParams) WithTimeout ¶
func (o *RenewTokenParams) WithTimeout(timeout time.Duration) *RenewTokenParams
WithTimeout adds the timeout to the renew token params
func (*RenewTokenParams) WriteToRequest ¶
func (o *RenewTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error
WriteToRequest writes these params to a swagger request
type RenewTokenReader ¶
type RenewTokenReader struct {
// contains filtered or unexported fields
}
RenewTokenReader is a Reader for the RenewToken structure.
func (*RenewTokenReader) ReadResponse ¶
func (o *RenewTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)
ReadResponse reads a server response into the received o.
type RevokeTokenOK ¶
type RevokeTokenOK struct {
Payload *models.RevokeTokenResponse
}
RevokeTokenOK describes a response with status code 200, with default header values.
Success
func NewRevokeTokenOK ¶
func NewRevokeTokenOK() *RevokeTokenOK
NewRevokeTokenOK creates a RevokeTokenOK with default headers values
func (*RevokeTokenOK) Error ¶
func (o *RevokeTokenOK) Error() string
func (*RevokeTokenOK) GetPayload ¶
func (o *RevokeTokenOK) GetPayload() *models.RevokeTokenResponse
type RevokeTokenParams ¶
type RevokeTokenParams struct { /* Body. An object containing the fields to POST for the request. See the corresponding object definition for field details. */ Body *models.RevokeTokenRequest Context context.Context HTTPClient *http.Client // contains filtered or unexported fields }
RevokeTokenParams contains all the parameters to send to the API endpoint
for the revoke token operation. Typically these are written to a http.Request.
func NewRevokeTokenParams ¶
func NewRevokeTokenParams() *RevokeTokenParams
NewRevokeTokenParams creates a new RevokeTokenParams object, with the default timeout for this client.
Default values are not hydrated, since defaults are normally applied by the API server side.
To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewRevokeTokenParamsWithContext ¶
func NewRevokeTokenParamsWithContext(ctx context.Context) *RevokeTokenParams
NewRevokeTokenParamsWithContext creates a new RevokeTokenParams object with the ability to set a context for a request.
func NewRevokeTokenParamsWithHTTPClient ¶
func NewRevokeTokenParamsWithHTTPClient(client *http.Client) *RevokeTokenParams
NewRevokeTokenParamsWithHTTPClient creates a new RevokeTokenParams object with the ability to set a custom HTTPClient for a request.
func NewRevokeTokenParamsWithTimeout ¶
func NewRevokeTokenParamsWithTimeout(timeout time.Duration) *RevokeTokenParams
NewRevokeTokenParamsWithTimeout creates a new RevokeTokenParams object with the ability to set a timeout on a request.
func (*RevokeTokenParams) SetBody ¶
func (o *RevokeTokenParams) SetBody(body *models.RevokeTokenRequest)
SetBody adds the body to the revoke token params
func (*RevokeTokenParams) SetContext ¶
func (o *RevokeTokenParams) SetContext(ctx context.Context)
SetContext adds the context to the revoke token params
func (*RevokeTokenParams) SetDefaults ¶
func (o *RevokeTokenParams) SetDefaults()
SetDefaults hydrates default values in the revoke token params (not the query body).
All values with no default are reset to their zero value.
func (*RevokeTokenParams) SetHTTPClient ¶
func (o *RevokeTokenParams) SetHTTPClient(client *http.Client)
SetHTTPClient adds the HTTPClient to the revoke token params
func (*RevokeTokenParams) SetTimeout ¶
func (o *RevokeTokenParams) SetTimeout(timeout time.Duration)
SetTimeout adds the timeout to the revoke token params
func (*RevokeTokenParams) WithBody ¶
func (o *RevokeTokenParams) WithBody(body *models.RevokeTokenRequest) *RevokeTokenParams
WithBody adds the body to the revoke token params
func (*RevokeTokenParams) WithContext ¶
func (o *RevokeTokenParams) WithContext(ctx context.Context) *RevokeTokenParams
WithContext adds the context to the revoke token params
func (*RevokeTokenParams) WithDefaults ¶
func (o *RevokeTokenParams) WithDefaults() *RevokeTokenParams
WithDefaults hydrates default values in the revoke token params (not the query body).
All values with no default are reset to their zero value.
func (*RevokeTokenParams) WithHTTPClient ¶
func (o *RevokeTokenParams) WithHTTPClient(client *http.Client) *RevokeTokenParams
WithHTTPClient adds the HTTPClient to the revoke token params
func (*RevokeTokenParams) WithTimeout ¶
func (o *RevokeTokenParams) WithTimeout(timeout time.Duration) *RevokeTokenParams
WithTimeout adds the timeout to the revoke token params
func (*RevokeTokenParams) WriteToRequest ¶
func (o *RevokeTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error
WriteToRequest writes these params to a swagger request
type RevokeTokenReader ¶
type RevokeTokenReader struct {
// contains filtered or unexported fields
}
RevokeTokenReader is a Reader for the RevokeToken structure.
func (*RevokeTokenReader) ReadResponse ¶
func (o *RevokeTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)
ReadResponse reads a server response into the received o.