Documentation
¶
Index ¶
- Constants
- Variables
- type CreateTokenReply
- type CreateTokenRequest
- type DeleteTokenReply
- type DeleteTokenRequest
- type InfoTokenReply
- type InfoTokenRequest
- type ListAvailablePermissionsReply
- type ListAvailablePermissionsRequest
- type ListTokensReply
- type ListTokensRequest
- type Options
- type Permission
- type SubscriptionInfo
- type TokenClient
- func (pc *TokenClient) CreateToken(tokenID string, tokenSetting *TokenSetting) (string, *TokenSetting, error)
- func (pc *TokenClient) DeleteToken(tokenID string) error
- func (pc *TokenClient) GetToken(tokenID string) (string, *TokenSetting, error)
- func (pc *TokenClient) ListAvailablePermissions() (map[string]string, error)
- func (pc *TokenClient) ListTokens() ([]*TokenSetting, error)
- func (pc *TokenClient) UpdateToken(tokenID string, productSetting *TokenSetting) (*TokenSetting, error)
- type TokenSetting
- type UpdateTokenReply
- type UpdateTokenRequest
Constants ¶
View Source
const (
TokenAPI = "$GVT.%s.API.TOKEN"
)
Variables ¶
View Source
var ( ErrTokenNotFound = errors.New("product not found") ErrTokenExistsAlready = errors.New("product exists already") ErrInvalidTokenToken = errors.New("invalid product token") )
View Source
var (
ErrSubscriptionNotFound = errors.New("subscription not found")
)
Functions ¶
This section is empty.
Types ¶
type CreateTokenReply ¶
type CreateTokenReply struct {
core.ErrorReply
Token string `json:"token"`
Setting *TokenSetting `json:"setting"`
}
type CreateTokenRequest ¶
type CreateTokenRequest struct {
TokenID string `json:"tokenID"`
Setting *TokenSetting `json:"setting"`
}
type DeleteTokenReply ¶
type DeleteTokenReply struct {
core.ErrorReply
}
type DeleteTokenRequest ¶
type DeleteTokenRequest struct {
TokenID string `json:"tokenID"`
}
type InfoTokenReply ¶
type InfoTokenReply struct {
core.ErrorReply
Token string `json:"token"`
Setting *TokenSetting `json:"setting"`
}
type InfoTokenRequest ¶
type InfoTokenRequest struct {
TokenID string `json:"token"`
}
type ListAvailablePermissionsReply ¶
type ListAvailablePermissionsReply struct {
core.ErrorReply
Permissions map[string]string `json:"permissions"`
}
type ListAvailablePermissionsRequest ¶
type ListAvailablePermissionsRequest struct {
}
type ListTokensReply ¶
type ListTokensReply struct {
core.ErrorReply
Tokens []*TokenSetting `json:"products"`
}
type ListTokensRequest ¶
type ListTokensRequest struct {
}
type Options ¶
func NewOptions ¶
func NewOptions() *Options
type Permission ¶
type Permission map[string]interface{}
type SubscriptionInfo ¶
type TokenClient ¶
type TokenClient struct {
// contains filtered or unexported fields
}
func NewTokenClient ¶
func NewTokenClient(client *core.Client, options *Options) *TokenClient
func (*TokenClient) CreateToken ¶
func (pc *TokenClient) CreateToken(tokenID string, tokenSetting *TokenSetting) (string, *TokenSetting, error)
func (*TokenClient) DeleteToken ¶
func (pc *TokenClient) DeleteToken(tokenID string) error
func (*TokenClient) GetToken ¶
func (pc *TokenClient) GetToken(tokenID string) (string, *TokenSetting, error)
func (*TokenClient) ListAvailablePermissions ¶
func (pc *TokenClient) ListAvailablePermissions() (map[string]string, error)
func (*TokenClient) ListTokens ¶
func (pc *TokenClient) ListTokens() ([]*TokenSetting, error)
func (*TokenClient) UpdateToken ¶
func (pc *TokenClient) UpdateToken(tokenID string, productSetting *TokenSetting) (*TokenSetting, error)
type TokenSetting ¶
type TokenSetting struct {
ID string `json:"id"`
Description string `json:"desc"`
Enabled bool `json:"enabled"`
Permissions map[string]*Permission `json:"permissions"`
Subscription *SubscriptionInfo `json:"subscription"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
func (*TokenSetting) CheckPermission ¶
func (ts *TokenSetting) CheckPermission(perm string) bool
func (*TokenSetting) CheckSubscription ¶
func (ts *TokenSetting) CheckSubscription(subscriptionID string) bool
func (*TokenSetting) GetSubscriptionByProduct ¶
func (ts *TokenSetting) GetSubscriptionByProduct(product string) (string, error)
type UpdateTokenReply ¶
type UpdateTokenReply struct {
core.ErrorReply
Setting *TokenSetting `json:"setting"`
}
type UpdateTokenRequest ¶
type UpdateTokenRequest struct {
TokenID string `json:"token"`
Setting *TokenSetting `json:"setting"`
}
Click to show internal directories.
Click to hide internal directories.