Documentation ¶
Overview ¶
This package provides functionality to interact with the Nhost API.
Index ¶
- Constants
- func MakeJSONRequest(ctx context.Context, client *http.Client, url string, method string, ...) error
- type BasicRetryer
- type Client
- func (n *Client) CreatePAT(ctx context.Context, accessToken string) (credentials.Credentials, error)
- func (n *Client) Login(ctx context.Context, email, password string) (credentials.Session, error)
- func (n *Client) LoginPAT(ctx context.Context, pat string) (credentials.Session, error)
- func (n *Client) Logout(ctx context.Context, refreshTokenID string, accessToken string) error
- func (n *Client) RefreshToken(ctx context.Context, refreshToken string) (RefreshTokenResponse, error)
- func (n *Client) VerifyEmail(ctx context.Context, email string) error
- type CreatePATRequest
- type Func
- type LoginPATRequest
- type LoginRequest
- type RefreshTokenRequest
- type RefreshTokenResponse
- type RequestError
- type ResponseValidator
- type VerifyEmailRequest
Constants ¶
View Source
const (
PATDuration = 90 * 24 * time.Hour
)
Variables ¶
This section is empty.
Functions ¶
func MakeJSONRequest ¶
Types ¶
type BasicRetryer ¶
type BasicRetryer struct {
// contains filtered or unexported fields
}
func NewBasicRetryer ¶
func NewBasicRetryer(maxAttempts int, multiplier int) BasicRetryer
func (BasicRetryer) Retry ¶
func (s BasicRetryer) Retry(f Func) error
type Client ¶
func New ¶
func New(authURL, graphqlURL string, interceptors ...clientv2.RequestInterceptor) *Client
func (*Client) CreatePAT ¶
func (n *Client) CreatePAT( ctx context.Context, accessToken string, ) (credentials.Credentials, error)
func (*Client) RefreshToken ¶ added in v1.12.0
type CreatePATRequest ¶
type LoginPATRequest ¶
type LoginPATRequest struct {
PersonalAccessToken string `json:"personalAccessToken"`
}
type LoginRequest ¶
type RefreshTokenRequest ¶ added in v1.12.0
type RefreshTokenRequest struct {
RefreshToken string `json:"refreshToken"`
}
type RefreshTokenResponse ¶ added in v1.12.0
type RefreshTokenResponse struct {
AccessToken string `json:"accessToken"`
}
type RequestError ¶ added in v1.15.4
type RequestError struct { Status int `json:"status"` ErrorCode string `json:"error"` Message string `json:"message"` }
func (*RequestError) Error ¶ added in v1.15.4
func (e *RequestError) Error() string
type ResponseValidator ¶
type VerifyEmailRequest ¶ added in v1.15.4
type VerifyEmailRequest struct {
Email string `json:"email"`
}
Click to show internal directories.
Click to hide internal directories.