Documentation
¶
Index ¶
- type ActiveSession
- type AdminCreateSessionRequest
- type AdminCreateSessionResponse
- type AdminCreateUserRequest
- type AdminCreateUserResponse
- type AdminListKeyPairsResponse
- type AdminListSessionsResponse
- type AdminSetPreferredEmailRequest
- type AdminUserDetailResponse
- type AdminVerificationResponse
- type AssignRoleRequest
- type AssignRoleResponse
- type CheckKeyPairResponse
- type Client
- func (c *Client) AdminAssignRole(ctx context.Context, userID string, req AssignRoleRequest) (*AssignRoleResponse, error)
- func (c *Client) AdminCreateEmail(ctx context.Context, userID string) error
- func (c *Client) AdminCreateKeyPair(ctx context.Context, userID string) error
- func (c *Client) AdminCreateSession(ctx context.Context, userID string, req AdminCreateSessionRequest) (*AdminCreateSessionResponse, error)
- func (c *Client) AdminDeleteEmail(ctx context.Context, emailID string) error
- func (c *Client) AdminDeleteKeyPair(ctx context.Context, keyID string) error
- func (c *Client) AdminDeleteSession(ctx context.Context, sessionID string) error
- func (c *Client) AdminDeleteUser(ctx context.Context, userID string) error
- func (c *Client) AdminDisableUser(ctx context.Context, userID string) error
- func (c *Client) AdminEnableUser(ctx context.Context, userID string) error
- func (c *Client) AdminGetUser(ctx context.Context, userID string) (*AdminUserDetailResponse, error)
- func (c *Client) AdminGetVerification(ctx context.Context, userID string) (*AdminVerificationResponse, error)
- func (c *Client) AdminListKeyPairs(ctx context.Context, opts *ListOpts) (*AdminListKeyPairsResponse, error)
- func (c *Client) AdminListRoles(ctx context.Context, userID string) (*ListRolesResponse, error)
- func (c *Client) AdminListSessions(ctx context.Context, opts *ListOpts) (*AdminListSessionsResponse, error)
- func (c *Client) AdminListUsers(ctx context.Context, opts *ListUsersOptions) (*ListUsersResponse, error)
- func (c *Client) AdminRemoveRole(ctx context.Context, userID, roleName string) error
- func (c *Client) AdminResetVerification(ctx context.Context, userID string) (*Verification, error)
- func (c *Client) AdminRevokeVerification(ctx context.Context, userID string) (*Verification, error)
- func (c *Client) AdminSetPreferredEmail(ctx context.Context, req AdminSetPreferredEmailRequest) error
- func (c *Client) AdminUnverifyUser(ctx context.Context, userID string) error
- func (c *Client) AdminVerifyEmail(ctx context.Context, emailID string) error
- func (c *Client) AdminVerifyKeyPair(ctx context.Context, keyID string) error
- func (c *Client) AdminVerifySession(ctx context.Context, sessionID string) error
- func (c *Client) AdminVerifyUser(ctx context.Context, userID string) error
- func (c *Client) CheckKeyPair(ctx context.Context) (*CheckKeyPairResponse, error)
- func (c *Client) CreateEmail(ctx context.Context, req CreateEmailRequest) (*CreateEmailResponse, error)
- func (c *Client) CreateKeyPair(ctx context.Context, req CreateKeyPairRequest) (*CreateKeyPairResponse, error)
- func (c *Client) CreateSession(ctx context.Context, req CreateSessionRequest) (*CreateSessionResponse, error)
- func (c *Client) CreateUser(ctx context.Context, req CreateUserRequest) (*CreateSessionResponse, error)
- func (c *Client) CreateVerification(ctx context.Context) (*CreateVerificationResponse, error)
- func (c *Client) DeleteEmail(ctx context.Context, emailID string) error
- func (c *Client) DeleteKeyPair(ctx context.Context, keyID string) error
- func (c *Client) DeleteSession(ctx context.Context, sessionID string) error
- func (c *Client) DeleteUser(ctx context.Context) error
- func (c *Client) ExtendSession(ctx context.Context) error
- func (c *Client) GetSession(ctx context.Context) (*GetSessionResponse, error)
- func (c *Client) GetUserByEmail(ctx context.Context, email string) (*GetUserByEmailResponse, error)
- func (c *Client) GetUserByID(ctx context.Context, userID string) (*GetUserResponse, error)
- func (c *Client) GetVerificationStatus(ctx context.Context) (*VerificationStatusResponse, error)
- func (c *Client) ListEmails(ctx context.Context) ([]Email, error)
- func (c *Client) ListKeyPairs(ctx context.Context) ([]KeyPair, error)
- func (c *Client) ListSessions(ctx context.Context) ([]ActiveSession, error)
- func (c *Client) PartnerCreateUser(ctx context.Context, req AdminCreateUserRequest) (*AdminCreateUserResponse, error)
- func (c *Client) SetPreferredEmail(ctx context.Context, req SetPreferredEmailRequest) error
- func (c *Client) VerifyEmail(ctx context.Context, req VerifyEmailRequest) error
- func (c *Client) VerifyKeyPair(ctx context.Context, req VerifyKeyPairRequest) error
- func (c *Client) VerifySession(ctx context.Context, req VerifySessionRequest) error
- type CreateEmailRequest
- type CreateEmailResponse
- type CreateKeyPairRequest
- type CreateKeyPairResponse
- type CreateSessionRequest
- type CreateSessionResponse
- type CreateUserRequest
- type CreateVerificationResponse
- type Email
- type GetSessionResponse
- type GetUserByEmailResponse
- type GetUserResponse
- type KeyPair
- type ListOpts
- type ListRolesResponse
- type ListUsersOptions
- type ListUsersResponse
- type SetPreferredEmailRequest
- type UserResponse
- type Verification
- type VerificationStatusResponse
- type VerifyEmailRequest
- type VerifyKeyPairRequest
- type VerifySessionRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveSession ¶
type ActiveSession struct {
SessionID string `json:"sessionID"`
UserID string `json:"userID"`
Roles []string `json:"roles"`
Verified bool `json:"verified"`
ExpireAt string `json:"expireAt"`
}
ActiveSession represents a session in a list.
type AdminCreateSessionRequest ¶
type AdminCreateSessionRequest struct {
Kind string `json:"kind"`
}
AdminCreateSessionRequest is the body for admin session creation.
type AdminCreateSessionResponse ¶
type AdminCreateSessionResponse struct {
Bearer string `json:"bearer"`
SessionID string `json:"sessionID"`
}
AdminCreateSessionResponse is returned when an admin creates a session.
type AdminCreateUserRequest ¶
type AdminCreateUserRequest struct {
Email string `json:"email"`
FullName string `json:"fullName"`
Alias string `json:"alias"`
Roles []string `json:"roles"`
PortalURL string `json:"portalURL"`
Notify bool `json:"notify"`
}
AdminCreateUserRequest is the body for partner user creation.
type AdminCreateUserResponse ¶
type AdminCreateUserResponse struct {
UserID string `json:"userID"`
}
AdminCreateUserResponse is returned when a partner creates a user.
type AdminListKeyPairsResponse ¶
type AdminListKeyPairsResponse struct {
Pages int `json:"pages"`
Items int `json:"items"`
KeyPairs []KeyPair `json:"keyPairs"`
}
AdminListKeyPairsResponse is the paginated response for admin key pair listing.
type AdminListSessionsResponse ¶
type AdminListSessionsResponse struct {
Pages int `json:"pages"`
Items int `json:"items"`
Sessions []ActiveSession `json:"sessions"`
}
AdminListSessionsResponse is the paginated response for admin session listing.
type AdminSetPreferredEmailRequest ¶
type AdminSetPreferredEmailRequest struct {
EmailID string `json:"emailID"`
}
AdminSetPreferredEmailRequest is the body for admin setting preferred email.
type AdminUserDetailResponse ¶
type AdminUserDetailResponse struct {
ID string `json:"id"`
Emails []Email `json:"emails"`
Roles []string `json:"roles"`
Verified bool `json:"verified"`
}
AdminUserDetailResponse is returned when fetching a user detail as admin.
type AdminVerificationResponse ¶
type AdminVerificationResponse struct {
Status string `json:"status"`
ExpiresAt string `json:"expiresAt"`
}
AdminVerificationResponse is returned when fetching admin verification status.
type AssignRoleRequest ¶
AssignRoleRequest is the body for assigning a role to a user.
type AssignRoleResponse ¶
AssignRoleResponse is returned when a role is assigned.
type CheckKeyPairResponse ¶
type CheckKeyPairResponse struct {
APIKey string `json:"apiKey"`
KeyID string `json:"keyID"`
Roles []string `json:"roles"`
Groups []string `json:"groups"`
Verified bool `json:"verified"`
ExpireAt string `json:"expireAt"`
}
CheckKeyPairResponse is returned when checking the current key pair.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides access to the Auth API endpoints.
func NewClient ¶
func NewClient(d doFunc) *Client
NewClient creates a new Auth client backed by the root SDK client's do function.
func (*Client) AdminAssignRole ¶
func (c *Client) AdminAssignRole(ctx context.Context, userID string, req AssignRoleRequest) (*AssignRoleResponse, error)
AdminAssignRole assigns a role to a user.
func (*Client) AdminCreateEmail ¶
AdminCreateEmail creates an email for a user as admin.
func (*Client) AdminCreateKeyPair ¶
AdminCreateKeyPair creates a key pair for a user as admin.
func (*Client) AdminCreateSession ¶
func (c *Client) AdminCreateSession(ctx context.Context, userID string, req AdminCreateSessionRequest) (*AdminCreateSessionResponse, error)
AdminCreateSession creates a session for a user as admin.
func (*Client) AdminDeleteEmail ¶
AdminDeleteEmail deletes an email as admin.
func (*Client) AdminDeleteKeyPair ¶
AdminDeleteKeyPair deletes a key pair as admin.
func (*Client) AdminDeleteSession ¶
AdminDeleteSession deletes a session as admin.
func (*Client) AdminDeleteUser ¶
AdminDeleteUser deletes a user by ID.
func (*Client) AdminDisableUser ¶
AdminDisableUser disables a user.
func (*Client) AdminEnableUser ¶
AdminEnableUser enables a user.
func (*Client) AdminGetUser ¶
AdminGetUser fetches a user by ID as admin.
func (*Client) AdminGetVerification ¶
func (c *Client) AdminGetVerification(ctx context.Context, userID string) (*AdminVerificationResponse, error)
AdminGetVerification gets verification status for a user as admin.
func (*Client) AdminListKeyPairs ¶
func (c *Client) AdminListKeyPairs(ctx context.Context, opts *ListOpts) (*AdminListKeyPairsResponse, error)
AdminListKeyPairs lists all key pairs as admin.
func (*Client) AdminListRoles ¶
AdminListRoles lists roles for a user.
func (*Client) AdminListSessions ¶
func (c *Client) AdminListSessions(ctx context.Context, opts *ListOpts) (*AdminListSessionsResponse, error)
AdminListSessions lists all sessions as admin.
func (*Client) AdminListUsers ¶
func (c *Client) AdminListUsers(ctx context.Context, opts *ListUsersOptions) (*ListUsersResponse, error)
AdminListUsers lists users with optional filtering.
func (*Client) AdminRemoveRole ¶
AdminRemoveRole removes a role from a user.
func (*Client) AdminResetVerification ¶
AdminResetVerification resets verification for a user as admin.
func (*Client) AdminRevokeVerification ¶
AdminRevokeVerification revokes verification for a user as admin.
func (*Client) AdminSetPreferredEmail ¶
func (c *Client) AdminSetPreferredEmail(ctx context.Context, req AdminSetPreferredEmailRequest) error
AdminSetPreferredEmail sets the preferred email as admin.
func (*Client) AdminUnverifyUser ¶
AdminUnverifyUser un-verifies a user.
func (*Client) AdminVerifyEmail ¶
AdminVerifyEmail verifies an email as admin.
func (*Client) AdminVerifyKeyPair ¶
AdminVerifyKeyPair verifies a key pair as admin.
func (*Client) AdminVerifySession ¶
AdminVerifySession verifies a session as admin.
func (*Client) AdminVerifyUser ¶
AdminVerifyUser verifies a user.
func (*Client) CheckKeyPair ¶
func (c *Client) CheckKeyPair(ctx context.Context) (*CheckKeyPairResponse, error)
CheckKeyPair returns the current key pair details.
func (*Client) CreateEmail ¶
func (c *Client) CreateEmail(ctx context.Context, req CreateEmailRequest) (*CreateEmailResponse, error)
CreateEmail creates a new email address for the user.
func (*Client) CreateKeyPair ¶
func (c *Client) CreateKeyPair(ctx context.Context, req CreateKeyPairRequest) (*CreateKeyPairResponse, error)
CreateKeyPair creates a new API key pair.
func (*Client) CreateSession ¶
func (c *Client) CreateSession(ctx context.Context, req CreateSessionRequest) (*CreateSessionResponse, error)
CreateSession creates a new session.
func (*Client) CreateUser ¶
func (c *Client) CreateUser(ctx context.Context, req CreateUserRequest) (*CreateSessionResponse, error)
CreateUser creates a new user account.
func (*Client) CreateVerification ¶
func (c *Client) CreateVerification(ctx context.Context) (*CreateVerificationResponse, error)
CreateVerification creates a new identity verification.
func (*Client) DeleteEmail ¶
DeleteEmail deletes an email address by ID.
func (*Client) DeleteKeyPair ¶
DeleteKeyPair deletes a key pair by ID.
func (*Client) DeleteSession ¶
DeleteSession deletes a session by ID.
func (*Client) DeleteUser ¶
DeleteUser deletes the current user account.
func (*Client) ExtendSession ¶
ExtendSession extends the current session TTL.
func (*Client) GetSession ¶
func (c *Client) GetSession(ctx context.Context) (*GetSessionResponse, error)
GetSession returns the current session.
func (*Client) GetUserByEmail ¶
GetUserByEmail fetches a user by their email address.
func (*Client) GetUserByID ¶
GetUserByID fetches a user by their ID.
func (*Client) GetVerificationStatus ¶
func (c *Client) GetVerificationStatus(ctx context.Context) (*VerificationStatusResponse, error)
GetVerificationStatus returns the current identity verification status.
func (*Client) ListEmails ¶
ListEmails lists all email addresses for the user.
func (*Client) ListKeyPairs ¶
ListKeyPairs lists all key pairs for the user.
func (*Client) ListSessions ¶
func (c *Client) ListSessions(ctx context.Context) ([]ActiveSession, error)
ListSessions lists all active sessions for the current user.
func (*Client) PartnerCreateUser ¶
func (c *Client) PartnerCreateUser(ctx context.Context, req AdminCreateUserRequest) (*AdminCreateUserResponse, error)
PartnerCreateUser creates a new user on behalf of a partner.
func (*Client) SetPreferredEmail ¶
func (c *Client) SetPreferredEmail(ctx context.Context, req SetPreferredEmailRequest) error
SetPreferredEmail sets the preferred email address.
func (*Client) VerifyEmail ¶
func (c *Client) VerifyEmail(ctx context.Context, req VerifyEmailRequest) error
VerifyEmail verifies an email address with the provided code.
func (*Client) VerifyKeyPair ¶
func (c *Client) VerifyKeyPair(ctx context.Context, req VerifyKeyPairRequest) error
VerifyKeyPair verifies a key pair with the provided code.
func (*Client) VerifySession ¶
func (c *Client) VerifySession(ctx context.Context, req VerifySessionRequest) error
VerifySession verifies a session with the provided code.
type CreateEmailRequest ¶
type CreateEmailRequest struct {
Address string `json:"address"`
}
CreateEmailRequest is the body for creating a new email address.
type CreateEmailResponse ¶
type CreateEmailResponse struct {
VerificationCodeID string `json:"verificationCodeID"`
}
CreateEmailResponse is returned when an email is created.
type CreateKeyPairRequest ¶
CreateKeyPairRequest is the body for creating a new API key pair.
type CreateKeyPairResponse ¶
type CreateKeyPairResponse struct {
APIKey string `json:"apiKey"`
APISecret string `json:"apiSecret"`
KeyID string `json:"keyID"`
ExpireAt string `json:"expireAt"`
Verified bool `json:"verified"`
VerificationCodeID string `json:"verificationCodeID"`
}
CreateKeyPairResponse is returned when a key pair is created.
type CreateSessionRequest ¶
CreateSessionRequest is the body for creating a new session.
type CreateSessionResponse ¶
type CreateSessionResponse struct {
Bearer string `json:"bearer"`
SessionID string `json:"sessionID"`
ExpireAt string `json:"expireAt"`
VerificationCodeID string `json:"verificationCodeID"`
}
CreateSessionResponse is returned when a session is created.
type CreateUserRequest ¶
type CreateUserRequest struct {
Email string `json:"email"`
FullName string `json:"fullName"`
Alias string `json:"alias"`
}
CreateUserRequest is the body for creating a new user.
type CreateVerificationResponse ¶
type CreateVerificationResponse struct {
URL string `json:"url"`
SessionID string `json:"sessionId"`
ClientSecret string `json:"clientSecret"`
Status string `json:"status"`
}
CreateVerificationResponse is returned when creating an identity verification.
type Email ¶
type Email struct {
ID string `json:"id"`
Address string `json:"address"`
Verified bool `json:"verified"`
Preferred bool `json:"preferred"`
}
Email represents a user's email address.
type GetSessionResponse ¶
type GetSessionResponse struct {
SessionID string `json:"sessionID"`
UserID string `json:"userID"`
Roles []string `json:"roles"`
Groups []string `json:"groups"`
Verified bool `json:"verified"`
ExpireAt string `json:"expireAt"`
}
GetSessionResponse is returned when fetching the current session.
type GetUserByEmailResponse ¶
type GetUserByEmailResponse struct {
UserID string `json:"userID"`
}
GetUserByEmailResponse is returned when fetching a user by email.
type GetUserResponse ¶
type GetUserResponse struct {
Alias string `json:"alias"`
}
GetUserResponse is returned when fetching a user by ID.
type KeyPair ¶
type KeyPair struct {
ID string `json:"id"`
Name string `json:"name"`
Verified bool `json:"verified"`
ExpireAt string `json:"expireAt"`
}
KeyPair represents a user's API key pair.
type ListRolesResponse ¶
ListRolesResponse is returned when listing roles for a user.
type ListUsersOptions ¶
type ListUsersOptions struct {
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
Enabled *bool `url:"enabled,omitempty"`
Role string `url:"role,omitempty"`
}
ListUsersOptions provides filtering for the admin user list endpoint.
type ListUsersResponse ¶
type ListUsersResponse struct {
Pages int `json:"pages"`
Items int `json:"items"`
Users []UserResponse `json:"users"`
}
ListUsersResponse is the paginated response for listing users.
type SetPreferredEmailRequest ¶
type SetPreferredEmailRequest struct {
EmailID string `json:"emailID"`
}
SetPreferredEmailRequest is the body for setting a preferred email.
type UserResponse ¶
type UserResponse struct {
ID string `json:"id"`
Emails []Email `json:"emails"`
Roles []string `json:"roles"`
Verified bool `json:"verified"`
Enabled bool `json:"enabled"`
}
UserResponse is a user in a paginated list.
type Verification ¶
Verification represents a verification record.
type VerificationStatusResponse ¶
type VerificationStatusResponse struct {
Status string `json:"status"`
ExpiresAt string `json:"expiresAt"`
Attempts int `json:"attempts"`
MaxAttempts int `json:"maxAttempts"`
}
VerificationStatusResponse is returned when checking verification status.
type VerifyEmailRequest ¶
type VerifyEmailRequest struct {
Code string `json:"code"`
VerificationCodeID string `json:"verificationCodeID"`
}
VerifyEmailRequest is the body for verifying an email address.
type VerifyKeyPairRequest ¶
type VerifyKeyPairRequest struct {
Code string `json:"code"`
VerificationCodeID string `json:"verificationCodeID"`
}
VerifyKeyPairRequest is the body for verifying a key pair.
type VerifySessionRequest ¶
type VerifySessionRequest struct {
Code string `json:"code"`
VerificationCodeID string `json:"verificationCodeID"`
}
VerifySessionRequest is the body for verifying a session.