Documentation ¶
Index ¶
- type Client
- func (client *Client) CheckToken(tkn string) *token.TokenData
- func (client *Client) Close()
- func (client *Client) DeleteUser(userID string, token string) error
- func (client *Client) GetUnverifiedUsers(token string) ([]schema.UserData, error)
- func (client *Client) GetUser(userID, token string) (*schema.UserData, error)
- func (client *Client) Login(username, password string) (*schema.UserData, string, error)
- func (client *Client) Signup(username, password, email string) (*schema.UserData, error)
- func (client *Client) Start() error
- func (client *Client) TokenProvide() string
- func (client *Client) UpdateUser(userID string, userUpdate schema.UserUpdate, token string) error
- type ClientBuilder
- func (b *ClientBuilder) Build() *Client
- func (b *ClientBuilder) WithConfig(val *ClientConfig) *ClientBuilder
- func (b *ClientBuilder) WithHTTPClient(httpClient *http.Client) *ClientBuilder
- func (b *ClientBuilder) WithHost(host string) *ClientBuilder
- func (b *ClientBuilder) WithName(val string) *ClientBuilder
- func (b *ClientBuilder) WithSecret(val string) *ClientBuilder
- func (b *ClientBuilder) WithTokenGetInterval(val time.Duration) *ClientBuilder
- func (b *ClientBuilder) WithTokenRefreshInterval(val time.Duration) *ClientBuilder
- type ClientConfig
- type ClientInterface
- type ShorelineMockClient
- func (client *ShorelineMockClient) CheckToken(tkn string) *token.TokenData
- func (client *ShorelineMockClient) Close()
- func (client *ShorelineMockClient) DeleteUser(userId string, token string) error
- func (client *ShorelineMockClient) GetUnverifiedUsers(token string) ([]schema.UserData, error)
- func (client *ShorelineMockClient) GetUser(userID, token string) (*schema.UserData, error)
- func (client *ShorelineMockClient) Login(username, password string) (*schema.UserData, string, error)
- func (client *ShorelineMockClient) Signup(username, password, email string) (*schema.UserData, error)
- func (client *ShorelineMockClient) Start() error
- func (client *ShorelineMockClient) TokenProvide() string
- func (client *ShorelineMockClient) UpdateUser(userID string, userUpdate schema.UserUpdate, token string) error
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
}
func NewShorelineClientFromEnv ¶
NewShorelineClientFromEnv read the config from the environment variables
func (*Client) CheckToken ¶
CheckToken tests a token with the user-api to make sure it's current; if so, it returns the data encoded in the token.
func (*Client) DeleteUser ¶ added in v1.8.5
Delete user
func (*Client) GetUnverifiedUsers ¶ added in v1.8.5
Get users with unverified email
func (*Client) GetUser ¶
Get user details for the given user In this case the userID could be the actual ID or an email address
func (*Client) Login ¶
Login logs in a user with a username and password. Returns a UserData object if successful and also stores the returned login token into ClientToken.
func (*Client) Start ¶
Start starts the client and makes it ready for us. This must be done before using any of the functionality that requires a server token
func (*Client) TokenProvide ¶
func (*Client) UpdateUser ¶
Get user details for the given user In this case the userID could be the actual ID or an email address
type ClientBuilder ¶
type ClientBuilder struct {
// contains filtered or unexported fields
}
func NewShorelineClientBuilder ¶
func NewShorelineClientBuilder() *ClientBuilder
func (*ClientBuilder) Build ¶
func (b *ClientBuilder) Build() *Client
Build return client from builder
func (*ClientBuilder) WithConfig ¶
func (b *ClientBuilder) WithConfig(val *ClientConfig) *ClientBuilder
WithConfig sets the whole config
func (*ClientBuilder) WithHTTPClient ¶
func (b *ClientBuilder) WithHTTPClient(httpClient *http.Client) *ClientBuilder
WithHTTPClient set the HTTP client
func (*ClientBuilder) WithHost ¶
func (b *ClientBuilder) WithHost(host string) *ClientBuilder
WithHost set the host
func (*ClientBuilder) WithName ¶
func (b *ClientBuilder) WithName(val string) *ClientBuilder
WithName sets the name of the server (config)
func (*ClientBuilder) WithSecret ¶
func (b *ClientBuilder) WithSecret(val string) *ClientBuilder
WithSecret sets the secret (config)
func (*ClientBuilder) WithTokenGetInterval ¶
func (b *ClientBuilder) WithTokenGetInterval(val time.Duration) *ClientBuilder
WithTokenGetInterval sets the duration interval for token initial ack (config)
func (*ClientBuilder) WithTokenRefreshInterval ¶
func (b *ClientBuilder) WithTokenRefreshInterval(val time.Duration) *ClientBuilder
WithTokenRefreshInterval sets the duration interval for token refresh (config)
type ClientConfig ¶
type ClientConfig struct { Name string `json:"name"` // The name of this server for use in obtaining a server token Secret string `json:"secret"` // The secret used along with the name to obtain a server token TokenRefreshInterval jepson.Duration `json:"tokenRefreshInterval"` // The amount of time between refreshes of the server token TokenGetInterval time.Duration `json:"tokenGetInterval"` // The amount of time between attempts to get the server token }
type ClientInterface ¶
type ClientInterface interface { Start() error Close() Login(username, password string) (*schema.UserData, string, error) Signup(username, password, email string) (*schema.UserData, error) CheckToken(token string) *token.TokenData TokenProvide() string GetUser(userID, token string) (*schema.UserData, error) UpdateUser(userID string, userUpdate schema.UserUpdate, token string) error GetUnverifiedUsers(token string) ([]schema.UserData, error) DeleteUser(userID string, token string) error }
type ShorelineMockClient ¶
func NewMock ¶
func NewMock(token string) *ShorelineMockClient
func (*ShorelineMockClient) CheckToken ¶
func (client *ShorelineMockClient) CheckToken(tkn string) *token.TokenData
func (*ShorelineMockClient) Close ¶
func (client *ShorelineMockClient) Close()
func (*ShorelineMockClient) DeleteUser ¶ added in v1.8.5
func (client *ShorelineMockClient) DeleteUser(userId string, token string) error
func (*ShorelineMockClient) GetUnverifiedUsers ¶ added in v1.8.5
func (client *ShorelineMockClient) GetUnverifiedUsers(token string) ([]schema.UserData, error)
func (*ShorelineMockClient) GetUser ¶
func (client *ShorelineMockClient) GetUser(userID, token string) (*schema.UserData, error)
func (*ShorelineMockClient) Signup ¶
func (client *ShorelineMockClient) Signup(username, password, email string) (*schema.UserData, error)
func (*ShorelineMockClient) Start ¶
func (client *ShorelineMockClient) Start() error
func (*ShorelineMockClient) TokenProvide ¶
func (client *ShorelineMockClient) TokenProvide() string
func (*ShorelineMockClient) UpdateUser ¶
func (client *ShorelineMockClient) UpdateUser(userID string, userUpdate schema.UserUpdate, token string) error