accountslib

package module
v0.0.0-...-32695ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 15 Imported by: 0

README

accountslib

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID           uuid.UUID  `json:"id"`
	UserID       *uuid.UUID `json:"user_id"`
	AgencyID     *uuid.UUID `json:"agencyId,omitempty"`
	CelebrityID  *uuid.UUID `json:"celebrityId,omitempty"`
	BusinessID   *uuid.UUID `json:"businessId,omitempty"`
	EnterpriseID *uuid.UUID `json:"enterpriseId,omitempty"`
	GovernmentID *uuid.UUID `json:"governmentId,omitempty"`
}
type AccountLink struct {
	UserID      uuid.UUID `json:"user_id"`
	AccountType string    `json:"account_type"`
	AccountID   uuid.UUID `json:"account_id"`
	CreatedAt   time.Time `json:"created_at"`
}

AccountLink represents the structure of an account link.

type AccountLinkRequest

type AccountLinkRequest struct {
	UserID      uuid.UUID `json:"user_id"`
	AccountType string    `json:"account_type"`
	AccountID   uuid.UUID `json:"account_id"`
}

AccountLinkRequest represents the structure of an account link request.

type AccountList

type AccountList struct {
	Accounts []Account `json:"accounts"`
}

type AccountMembership

type AccountMembership struct {
	ID          uuid.UUID `json:"id"`
	AccountType string    `json:"account_type"`
	AccountID   uuid.UUID `json:"account_id"`
	UserID      uuid.UUID `json:"user_id"`
	Role        string    `json:"role"`
	JoinedAt    time.Time `json:"joined_at"`
}

AccountMembership represents the structure of an account membership.

type AccountMembershipsResponse

type AccountMembershipsResponse struct {
	AccountMemberships []AccountMembership `json:"account_memberships"`
}

AccountMembershipsResponse represents a list of account memberships returned from the server.

type AddMemberToAgencyAccountEvent

type AddMemberToAgencyAccountEvent struct {
	UserID      uuid.UUID `json:"user_id"`
	AccountType string    `json:"account_type"`
	AccountID   uuid.UUID `json:"account_id"`
	Role        string    `json:"role"`
}

type AddMemberToBusinessAccountInput

type AddMemberToBusinessAccountInput struct {
	UserID     uuid.UUID `json:"user_id"`
	BusinessID uuid.UUID `json:"business_id"`
	RoleID     uuid.UUID `json:"role_id"`
}

func (*AddMemberToBusinessAccountInput) Validate

func (input *AddMemberToBusinessAccountInput) Validate() error

Define the validation for AddMemberToBusinessAccountInput

type AddMemberToCelebrityAccountInput

type AddMemberToCelebrityAccountInput struct {
	UserID      uuid.UUID `json:"user_id"`
	RoleID      uuid.UUID `json:"role_id"`
	CelebrityID uuid.UUID `json:"celebrity_id"`
}

type AddMemberToEnterpriseAccountEvent

type AddMemberToEnterpriseAccountEvent struct {
	UserID       uuid.UUID `json:"user_id"`
	RoleID       uuid.UUID `json:"role_id"`
	EnterpriseID uuid.UUID `json:"enterprise_id"`
}

type AddMemberToEnterpriseAccountInput

type AddMemberToEnterpriseAccountInput struct {
	EnterpriseID uuid.UUID `json:"enterprise_id"`
	UserID       uuid.UUID `json:"user_id"`
	RoleID       uuid.UUID `json:"role_id"`
}

AddMemberToEnterpriseAccountInput is the data structure for the request to add a member to an enterprise account.

type AddMemberToGovernmentAccountInput

type AddMemberToGovernmentAccountInput struct {
	UserID       uuid.UUID `json:"userId"`
	RoleID       uuid.UUID `json:"roleId"`
	GovernmentID uuid.UUID `json:"governmentId"`
}

func (*AddMemberToGovernmentAccountInput) Validate

func (input *AddMemberToGovernmentAccountInput) Validate() error

Validate checks if the UpdateGovernmentAccountEvent is valid

type AddSanctionedCountryInput

type AddSanctionedCountryInput struct {
	CountryCode string
	CountryName string
}

type Agency

type Agency struct {
	ID            uuid.UUID `json:"id"`
	UserAccountID uuid.UUID `json:"user_account_id"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Agency represents the structure of an agency.

type AssignPermissionToRoleEvent

type AssignPermissionToRoleEvent struct {
	RoleID       uuid.UUID `json:"role_id"`
	PermissionID uuid.UUID `json:"permission_id"`
}

type AssignPermissionToRoleInput

type AssignPermissionToRoleInput struct {
	RoleID       uuid.UUID
	PermissionID uuid.UUID
}

func (*AssignPermissionToRoleInput) Validate

func (input *AssignPermissionToRoleInput) Validate() error

You would also need to define the Validate method for AssignPermissionToRoleEvent

type AssignRoleData

type AssignRoleData struct {
	UserID uuid.UUID `json:"user_id"`
	RoleID uuid.UUID `json:"role_id"`
}

AssignRoleData represents the input data to assign a role to a user.

func (*AssignRoleData) Validate

func (d *AssignRoleData) Validate() error

Validate checks if the AssignRoleData structure is valid.

type AssignRoleInput

type AssignRoleInput struct {
	ServiceAccountID uuid.UUID `json:"service_account_id"`
	RoleID           uuid.UUID `json:"role_id"`
}

AssignRoleInput represents the input data for assigning a role to a service account.

type Business

type Business struct {
	ID            uuid.UUID `json:"id"`
	UserAccountID uuid.UUID `json:"user_account_id"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Business represents the structure of a business.

type Celebrity

type Celebrity struct {
	ID            uuid.UUID `json:"id"`
	UserAccountID uuid.UUID `json:"user_account_id"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Celebrity represents the structure of an artist, band, sports personality, or other public figure.

type CheckPasswordHashData

type CheckPasswordHashData struct {
	UserID   uuid.UUID `json:"userId"`
	Password string    `json:"password"`
}

func (*CheckPasswordHashData) Validate

func (d *CheckPasswordHashData) Validate() error

type CheckUserAuthorizationError

type CheckUserAuthorizationError struct {
	BaseError  error
	StatusCode int
}

This is a custom error type

func (*CheckUserAuthorizationError) Error

type Client

type Client struct {
	BaseURL    string
	HttpClient *http.Client
	Token      string
	ApiKey     string
}

Client represents an HTTP client that can be used to send requests to the skills server.

func NewClient

func NewClient(baseURL string, token string, apiKey string, httpClient ...*http.Client) *Client

func (*Client) AddMemberToAgencyAccount

func (c *Client) AddMemberToAgencyAccount(e AddMemberToAgencyAccountEvent) error

func (*Client) AddMemberToBusinessAccount

func (c *Client) AddMemberToBusinessAccount(input AddMemberToBusinessAccountInput) error

Update the AddMemberToBusinessAccount function

func (*Client) AddMemberToCelebrityAccount

func (c *Client) AddMemberToCelebrityAccount(input AddMemberToCelebrityAccountInput) error

AddMemberToCelebrityAccount adds a new member to a celebrity account.

func (*Client) AddMemberToEnterpriseAccount

func (c *Client) AddMemberToEnterpriseAccount(input AddMemberToEnterpriseAccountInput) error

func (*Client) AddMemberToGovernmentAccount

func (c *Client) AddMemberToGovernmentAccount(input AddMemberToGovernmentAccountInput) error

func (*Client) AddRoleToUser

func (c *Client) AddRoleToUser(userID, roleID uuid.UUID) error

AddRoleToUser adds a role to a user.

func (*Client) AddSanctionedCountry

func (c *Client) AddSanctionedCountry(input AddSanctionedCountryInput) error

func (*Client) AssignPermissionToRole

func (c *Client) AssignPermissionToRole(input AssignPermissionToRoleInput) error

func (*Client) AssignRoleToServiceAccount

func (c *Client) AssignRoleToServiceAccount(input AssignRoleInput) error

func (*Client) AssignRoleToUser

func (c *Client) AssignRoleToUser(data *AssignRoleData) error

AssignRoleToUser assigns a role to a user

func (*Client) CheckPasswordHash

func (c *Client) CheckPasswordHash(data *CheckPasswordHashData) (bool, error)

func (*Client) CheckUserAuthorization

func (c *Client) CheckUserAuthorization(ctx context.Context, token, permission string) (bool, error)

CheckUserAuthorization verifies a user's authorization to perform a certain action.

func (*Client) CreateAccount

func (c *Client) CreateAccount(input CreateAccountInput) (*Account, error)

CreateAccount makes a POST request to create an account

func (c *Client) CreateAccountLink(alr AccountLinkRequest) (*AccountLink, error)

func (*Client) CreateAccountMembership

func (c *Client) CreateAccountMembership(accountMembership *AccountMembership) (*AccountMembership, error)

CreateAccountMembership sends a POST request to create a new account membership.

func (*Client) CreateAgencyAccount

func (c *Client) CreateAgencyAccount(input CreateAgencyAccountInput) (*Agency, error)

func (*Client) CreateBusinessAccount

func (c *Client) CreateBusinessAccount(input CreateBusinessAccountInput) (*Business, error)

CreateBusinessAccount creates a new business account for a given user.

func (*Client) CreateCelebrityAccount

func (c *Client) CreateCelebrityAccount(input CreateCelebrityAccountInput) (*Celebrity, error)

CreateCelebrityAccount creates a new celebrity account.

func (*Client) CreateEnterpriseAccount

func (c *Client) CreateEnterpriseAccount(input CreateEnterpriseAccountInput) (*Enterprise, error)

func (*Client) CreateGovernmentAccount

func (c *Client) CreateGovernmentAccount(input CreateGovernmentAccountInput) (*Government, error)

CreateGovernmentAccount makes a POST request to create a government account

func (*Client) CreateMetadataKey

func (c *Client) CreateMetadataKey(input CreateMetadataKeyInput) (*MetadataKey, error)

func (*Client) CreatePermission

func (c *Client) CreatePermission(input CreatePermissionInput) (*Permission, error)

func (*Client) CreateRole

func (c *Client) CreateRole(input *CreateRoleInput) (*Role, error)

func (*Client) CreateToken

func (c *Client) CreateToken(input CreateTokenInput) (*Token, error)

CreateToken creates a new token for a user and returns it.

func (*Client) CreateUser

func (c *Client) CreateUser(data *User) error

func (*Client) CreateUserMetadata

func (c *Client) CreateUserMetadata(metadata *UserMetadata) error

func (*Client) DeleteAccount

func (c *Client) DeleteAccount(accountID uuid.UUID) error

DeleteAccount makes a DELETE request to delete an account

func (c *Client) DeleteAccountLink(accountLinkRequest *AccountLinkRequest) error

func (*Client) DeleteAccountMembership

func (c *Client) DeleteAccountMembership(accountID uuid.UUID, userID uuid.UUID) error

func (*Client) DeleteAgencyAccount

func (c *Client) DeleteAgencyAccount(agencyID uuid.UUID) error

func (*Client) DeleteBusinessAccount

func (c *Client) DeleteBusinessAccount(businessID uuid.UUID) error

func (*Client) DeleteCelebrityAccount

func (c *Client) DeleteCelebrityAccount(userID uuid.UUID, celebrityID uuid.UUID) error

func (*Client) DeleteEnterpriseAccount

func (c *Client) DeleteEnterpriseAccount(enterpriseID uuid.UUID) error

func (*Client) DeleteExpiredTokens

func (c *Client) DeleteExpiredTokens() error

func (*Client) DeleteGovernmentAccount

func (c *Client) DeleteGovernmentAccount(accountID uuid.UUID) error

func (*Client) DeleteMetadataKey

func (c *Client) DeleteMetadataKey(input DeleteMetadataKeyInput) error

DeleteMetadataKey deletes a metadata key by its id.

func (*Client) DeletePermission

func (c *Client) DeletePermission(input DeletePermissionInput) error

func (*Client) DeleteRole

func (c *Client) DeleteRole(input *DeleteRoleInput) error

DeleteRole deletes a role using the API.

func (*Client) DeleteServiceAccount

func (c *Client) DeleteServiceAccount(serviceAccountID uuid.UUID) error

DeleteServiceAccount deletes a service account by its ID

func (*Client) DeleteToken

func (c *Client) DeleteToken(input DeleteTokenInput) error

DeleteToken deletes a token associated with a user.

func (*Client) DeleteTokensByUserID

func (c *Client) DeleteTokensByUserID(input DeleteTokensByUserIDInput) error

DeleteTokensByUserID sends a request to the server to delete all tokens for the given user ID.

func (*Client) DeleteUser

func (c *Client) DeleteUser(userID uuid.UUID) error

func (*Client) DeleteUserMetadataByID

func (c *Client) DeleteUserMetadataByID(id uuid.UUID) error

DeleteUserMetadataByID deletes user metadata by its ID.

func (*Client) DeleteUserMetadataByKey

func (c *Client) DeleteUserMetadataByKey(userID uuid.UUID, key string) error

func (*Client) DeleteUserMetadataByUserID

func (c *Client) DeleteUserMetadataByUserID(userID uuid.UUID) error

func (*Client) DisableTwoFactorAuthentication

func (c *Client) DisableTwoFactorAuthentication(data DisableTwoFactorAuthenticationInput) error

func (*Client) DoesPermissionExist

func (c *Client) DoesPermissionExist(input *DoesPermissionExistInput) (bool, error)

func (*Client) DoesRoleExist

func (c *Client) DoesRoleExist(input DoesRoleExistInput) (bool, error)

func (*Client) EnableTwoFactorAuthentication

func (c *Client) EnableTwoFactorAuthentication(data EnableTwoFactorAuthenticationInput) error

func (*Client) GetAccount

func (ac *Client) GetAccount()

GetAccount retrieves an existing account.

func (*Client) GetAccountByField

func (c *Client) GetAccountByField(fieldName string, fieldValue uuid.UUID) (*Account, error)

GetAccountByField retrieves an account based on a field.

func (c *Client) GetAccountLink(userID uuid.UUID, accountID uuid.UUID) (*AccountLink, error)

GetAccountLink retrieves an account link by user ID, account type, and account ID

func (*Client) GetAccountLinksByAccountID

func (c *Client) GetAccountLinksByAccountID(accountID uuid.UUID) ([]AccountLink, error)

GetAccountLinksByAccountID fetches account links by account ID from the remote server.

func (*Client) GetAccountLinksByAccountType

func (c *Client) GetAccountLinksByAccountType(accountType string) ([]AccountLink, error)

func (*Client) GetAccountLinksByUserID

func (c *Client) GetAccountLinksByUserID(userID uuid.UUID) ([]AccountLink, error)

func (*Client) GetAccountMembershipByID

func (c *Client) GetAccountMembershipByID(id uuid.UUID) (*AccountMembership, error)

GetAccountMembershipByID retrieves an AccountMembership by ID.

func (*Client) GetAccountMembershipsByAccountID

func (c *Client) GetAccountMembershipsByAccountID(accountID uuid.UUID) (*AccountMembershipsResponse, error)

GetAccountMembershipsByAccountID sends a request to the server to retrieve account memberships by account ID.

func (*Client) GetAccountMembershipsByAccountType

func (c *Client) GetAccountMembershipsByAccountType(accountType string) ([]AccountMembership, error)

func (*Client) GetAccountMembershipsByUserID

func (c *Client) GetAccountMembershipsByUserID(userID uuid.UUID) ([]AccountMembership, error)

func (*Client) GetAccountType

func (ac *Client) GetAccountType()

GetAccountType retrieves the type of an existing account.

func (*Client) GetAgencyAccountByID

func (c *Client) GetAgencyAccountByID(agencyID uuid.UUID) (*Agency, error)

func (*Client) GetAgencyAccountsByUserID

func (c *Client) GetAgencyAccountsByUserID(userID uuid.UUID) ([]Agency, error)

func (*Client) GetBusinessAccountByID

func (c *Client) GetBusinessAccountByID(businessID uuid.UUID) (*Business, error)

func (*Client) GetBusinessAccountsByUserID

func (c *Client) GetBusinessAccountsByUserID(userID uuid.UUID) ([]Business, error)

func (*Client) GetCelebrityAccountByID

func (c *Client) GetCelebrityAccountByID(celebrityID uuid.UUID) (*Celebrity, error)

GetCelebrityAccountByID fetches celebrity account data by ID from the API.

func (*Client) GetCelebrityAccountsByUserID

func (c *Client) GetCelebrityAccountsByUserID(userID uuid.UUID) ([]Celebrity, error)

GetCelebrityAccountsByUserID sends a GET request to the server to retrieve celebrity accounts by user ID.

func (*Client) GetEnterpriseAccountByID

func (c *Client) GetEnterpriseAccountByID(enterpriseID uuid.UUID) (*Enterprise, error)

func (*Client) GetEnterpriseAccountsByUserID

func (c *Client) GetEnterpriseAccountsByUserID(userID uuid.UUID) ([]Enterprise, error)

func (*Client) GetGovernmentAccountByID

func (c *Client) GetGovernmentAccountByID(governmentID uuid.UUID) (*Government, error)

GetGovernmentAccountByID fetches a government account by its ID.

func (*Client) GetGovernmentAccountsByUserID

func (c *Client) GetGovernmentAccountsByUserID(userID uuid.UUID) ([]Government, error)

func (*Client) GetLinkedAccountsForUser

func (c *Client) GetLinkedAccountsForUser(userID uuid.UUID) ([]AccountLink, error)

GetLinkedAccountsForUser fetches all the linked accounts for a specific user.

func (*Client) GetMembersOfAccount

func (c *Client) GetMembersOfAccount(accountID uuid.UUID) ([]uuid.UUID, error)

func (*Client) GetMembersOfAgencyAccount

func (c *Client) GetMembersOfAgencyAccount(agencyID uuid.UUID) ([]AccountMembership, error)

func (*Client) GetMembersOfBusinessAccount

func (c *Client) GetMembersOfBusinessAccount(businessId uuid.UUID) ([]AccountMembership, error)

func (*Client) GetMembersOfCelebrityAccount

func (c *Client) GetMembersOfCelebrityAccount(celebrityID uuid.UUID) ([]AccountMembership, error)

func (*Client) GetMembersOfEnterpriseAccount

func (c *Client) GetMembersOfEnterpriseAccount(enterpriseID uuid.UUID) (*EnterpriseMembers, error)

GetMembersOfEnterpriseAccount makes a request to the server to get the members of a given enterprise account.

func (*Client) GetMembersOfGovernmentAccount

func (c *Client) GetMembersOfGovernmentAccount(input GetMembersOfGovernmentAccountInput) ([]AccountMembership, error)

func (*Client) GetMetadataKeyByID

func (c *Client) GetMetadataKeyByID(input GetMetadataKeyByIDInput) (*UserMetadata, error)

func (*Client) GetMetadataKeyByKeyName

func (c *Client) GetMetadataKeyByKeyName(input GetMetadataKeyByKeyNameInput) (*MetadataKey, error)

GetMetadataKeyByKeyName sends a GET request to the /metadata-keys/{keyName} endpoint of the account service to retrieve the metadata key by its key name.

func (*Client) GetPermissionByID

func (c *Client) GetPermissionByID(input GetPermissionByIDInput) (*Permission, error)

func (*Client) GetPermissionByName

func (c *Client) GetPermissionByName(input GetPermissionByNameInput) (*Permission, error)

func (*Client) GetPermissionsByRoleID

func (c *Client) GetPermissionsByRoleID(input *GetPermissionsByRoleIDInput) ([]Permission, error)

GetPermissionsByRoleID fetches the permissions associated with the provided role ID.

func (*Client) GetPermissionsByUserID

func (c *Client) GetPermissionsByUserID(input *GetPermissionsByUserIDInput) ([]Permission, error)

func (*Client) GetRoleByID

func (c *Client) GetRoleByID(roleID uuid.UUID) (*Role, error)

func (*Client) GetRoleByName

func (c *Client) GetRoleByName(roleName string) (*Role, error)

func (*Client) GetRolesByPermissionID

func (c *Client) GetRolesByPermissionID(input GetRolesByPermissionIDInput) ([]Role, error)

GetRolesByPermissionID retrieves all roles associated with a permission identified by its ID.

func (*Client) GetRolesByServiceAccountID

func (c *Client) GetRolesByServiceAccountID(input GetRolesInput) ([]Role, error)

GetRolesByServiceAccountID retrieves roles associated with a specific service account ID

func (*Client) GetRolesByUserID

func (c *Client) GetRolesByUserID(input GetRolesByUserIDInput) ([]Role, error)

func (*Client) GetRolesForUser

func (c *Client) GetRolesForUser(userID uuid.UUID) ([]Role, error)

func (*Client) GetRolesForUserInAccount

func (c *Client) GetRolesForUserInAccount(userID uuid.UUID, accountID uuid.UUID) ([]Role, error)

GetRolesForUserInAccount retrieves roles for the given user in the provided account.

func (*Client) GetServiceAccountByID

func (c *Client) GetServiceAccountByID(id uuid.UUID) (*ServiceAccount, error)

GetServiceAccountByID sends a GET request to the server to retrieve a service account by its ID

func (*Client) GetServiceAccountByName

func (c *Client) GetServiceAccountByName(serviceName string) (*ServiceAccount, error)

func (*Client) GetServiceAccountsByRoleID

func (c *Client) GetServiceAccountsByRoleID(input GetServiceAccountsInput) ([]ServiceAccount, error)

func (*Client) GetTokenByPlaintext

func (c *Client) GetTokenByPlaintext(input GetTokenByPlaintextInput) (*Token, error)

func (*Client) GetTokensByScope

func (c *Client) GetTokensByScope(input GetTokensByScopeInput) ([]Token, error)

GetTokensByScope gets all tokens associated with a scope.

func (*Client) GetTokensByUserID

func (c *Client) GetTokensByUserID(input GetTokensByUserIDInput) ([]Token, error)

GetTokensByUserID gets all tokens associated with a user ID.

func (*Client) GetUserByEmail

func (c *Client) GetUserByEmail(email string) (*User, error)

func (*Client) GetUserByID

func (c *Client) GetUserByID(id uuid.UUID) (*User, error)

GetUserByID fetches a user using the user's ID

func (*Client) GetUserMetadataByID

func (c *Client) GetUserMetadataByID(metadataID uuid.UUID) (*UserMetadata, error)

GetUserMetadataByID retrieves user metadata by ID

func (*Client) GetUserMetadataByKey

func (c *Client) GetUserMetadataByKey(userID, key string) (*UserMetadata, error)

func (*Client) GetUserMetadataByUserID

func (c *Client) GetUserMetadataByUserID(userID uuid.UUID) (*[]UserMetadata, error)

GetUserMetadataByUserID fetches a user's metadata from the server.

func (*Client) IsCountrySanctioned

func (c *Client) IsCountrySanctioned(input IsCountrySanctionedInput) (bool, error)

func (*Client) IsPermissionAssignedToRole

func (c *Client) IsPermissionAssignedToRole(input IsPermissionAssignedToRoleInput) (bool, error)

IsPermissionAssignedToRole checks if a permission is assigned to a role.

func (*Client) IsRoleAssignedToServiceAccount

func (c *Client) IsRoleAssignedToServiceAccount(input RoleAssignmentInput) (bool, error)

func (*Client) IsUserAMemberOfAccount

func (c *Client) IsUserAMemberOfAccount(userID uuid.UUID, accountID uuid.UUID) (bool, error)

func (*Client) IsUserInRole

func (c *Client) IsUserInRole(data *UserInRoleCheckData) (bool, error)

func (*Client) IsUserLinkedToAccount

func (c *Client) IsUserLinkedToAccount(userID uuid.UUID, accountID uuid.UUID) (bool, error)
func (c *Client) ListAccountLinks(userID uuid.UUID) ([]AccountLink, error)

func (*Client) ListAccountMemberships

func (c *Client) ListAccountMemberships(userID uuid.UUID) ([]AccountMembership, error)

func (*Client) ListAccounts

func (c *Client) ListAccounts() ([]Account, error)

ListAccounts lists all accounts.

func (*Client) ListAgencyAccounts

func (c *Client) ListAgencyAccounts(userID uuid.UUID) ([]Agency, error)

func (*Client) ListAllMetadataKeys

func (c *Client) ListAllMetadataKeys() ([]MetadataKey, error)

ListAllMetadataKeys retrieves all metadata keys.

func (*Client) ListAllUsers

func (c *Client) ListAllUsers() ([]User, error)

ListAllUsers sends a GET request to the accounts server to get a list of all users.

func (*Client) ListBusinessAccounts

func (c *Client) ListBusinessAccounts() ([]Business, error)

func (*Client) ListCelebrityAccounts

func (c *Client) ListCelebrityAccounts() ([]Celebrity, error)

func (*Client) ListEnterpriseAccounts

func (c *Client) ListEnterpriseAccounts() ([]*Enterprise, error)

func (*Client) ListGovernmentAccounts

func (c *Client) ListGovernmentAccounts() ([]Government, error)

func (*Client) ListPermissions

func (c *Client) ListPermissions() (*ListPermissionsResponse, error)

func (*Client) ListRoles

func (c *Client) ListRoles() ([]Role, error)

func (*Client) ListServiceAccounts

func (c *Client) ListServiceAccounts() ([]ServiceAccount, error)

func (*Client) MetadataKeyExists

func (c *Client) MetadataKeyExists(keyName string) (bool, error)

MetadataKeyExists sends a GET request to the service to determine if a metadata key exists. It returns true if it exists, false if not, and any error that occurred.

func (*Client) RegisterServiceAccount

func (c *Client) RegisterServiceAccount(ctx context.Context, input RegisterServiceAccountInput) (*ServiceAccount, error)

RegisterServiceAccount registers a new service account with the provided name and roles.

func (*Client) RegisterUser

func (c *Client) RegisterUser(data *UserRegistrationData) error

func (*Client) RemoveMemberFromAgencyAccount

func (c *Client) RemoveMemberFromAgencyAccount(userID uuid.UUID, agencyID uuid.UUID) error

func (*Client) RemoveMemberFromBusinessAccount

func (c *Client) RemoveMemberFromBusinessAccount(businessID, memberID uuid.UUID) error

func (*Client) RemoveMemberFromCelebrityAccount

func (c *Client) RemoveMemberFromCelebrityAccount(celebrityID uuid.UUID, userID uuid.UUID) error

func (*Client) RemoveMemberFromEnterpriseAccount

func (c *Client) RemoveMemberFromEnterpriseAccount(enterpriseID, userID uuid.UUID) error

func (*Client) RemoveMemberFromGovernmentAccount

func (c *Client) RemoveMemberFromGovernmentAccount(input RemoveMemberFromGovernmentAccountInput) error

func (*Client) RemovePermissionFromRole

func (c *Client) RemovePermissionFromRole(input RemovePermissionFromRoleInput) error

func (*Client) RemoveRoleFromServiceAccount

func (c *Client) RemoveRoleFromServiceAccount(input RemoveRoleInput) error

RemoveRoleFromServiceAccount removes a role from a service account.

func (*Client) RemoveRoleFromUser

func (c *Client) RemoveRoleFromUser(userID uuid.UUID, roleID uuid.UUID) error

func (*Client) RemoveSanctionedCountry

func (c *Client) RemoveSanctionedCountry(input RemoveSanctionedCountryInput) error

func (*Client) SearchAccounts

func (c *Client) SearchAccounts(input SearchAccountInput) ([]*Account, error)

SearchAccounts makes a GET request to search for accounts based on a query.

func (*Client) SetUserActiveStatus

func (c *Client) SetUserActiveStatus(event *SetUserActiveStatusEvent) error

func (*Client) UnassignRoleFromUser

func (c *Client) UnassignRoleFromUser(input *UserUnassignRoleInput) error

UnassignRoleFromUser removes a role from a user.

func (*Client) UpdateAccount

func (c *Client) UpdateAccount(accountID uuid.UUID, input UpdateAccountInput) (*Account, error)

UpdateAccount makes a PUT request to update an account

func (c *Client) UpdateAccountLink(userID uuid.UUID, accountType string, accountID uuid.UUID) error

func (*Client) UpdateAccountMembership

func (c *Client) UpdateAccountMembership(accountMembershipID uuid.UUID, event UpdateAccountMembershipEvent) (AccountMembership, error)

func (*Client) UpdateAgencyAccount

func (c *Client) UpdateAgencyAccount(input UpdateAgencyAccountInput) error

func (*Client) UpdateBusinessAccount

func (c *Client) UpdateBusinessAccount(input UpdateBusinessAccountInput) error

func (*Client) UpdateCelebrityAccount

func (c *Client) UpdateCelebrityAccount(event *UpdateCelebrityAccountEvent) (*Celebrity, error)

func (*Client) UpdateEnterpriseAccount

func (c *Client) UpdateEnterpriseAccount(input UpdateEnterpriseAccountInput) error

func (*Client) UpdateGovernmentAccount

func (c *Client) UpdateGovernmentAccount(userID uuid.UUID, governmentID uuid.UUID, newName string) error

func (*Client) UpdateMemberRoleInAgencyAccount

func (c *Client) UpdateMemberRoleInAgencyAccount(input UpdateMemberRoleInAgencyAccountInput) error

func (*Client) UpdateMemberRoleInBusinessAccount

func (c *Client) UpdateMemberRoleInBusinessAccount(input UpdateMemberRoleInBusinessAccountInput) error

UpdateMemberRoleInBusinessAccount sends a request to the REST API endpoint to update a member's role in a business account.

func (*Client) UpdateMemberRoleInCelebrityAccount

func (c *Client) UpdateMemberRoleInCelebrityAccount(e *UpdateMemberRoleInCelebrityAccountEvent) error

func (*Client) UpdateMemberRoleInEnterpriseAccount

func (c *Client) UpdateMemberRoleInEnterpriseAccount(req UpdateMemberRoleInEnterpriseAccountRequest) error

func (*Client) UpdateMemberRoleInGovernmentAccount

func (c *Client) UpdateMemberRoleInGovernmentAccount(event UpdateMemberRoleInGovernmentAccountEvent) error

func (*Client) UpdateMetadataKey

func (c *Client) UpdateMetadataKey(input UpdateMetadataKeyInput) (*MetadataKey, error)

func (*Client) UpdatePermission

func (c *Client) UpdatePermission(input UpdatePermissionInput) error

func (*Client) UpdateRole

func (c *Client) UpdateRole(input *UpdateRoleInput) error

func (*Client) UpdateServiceAccount

func (c *Client) UpdateServiceAccount(input UpdateServiceAccountInput) error

UpdateServiceAccount sends a request to update a service account.

func (*Client) UpdateUser

func (c *Client) UpdateUser(userID uuid.UUID, payload *UpdateUserPayload) error

func (*Client) UpdateUserMetadata

func (c *Client) UpdateUserMetadata(userMetadata *UserMetadataUpdate) error

UpdateUserMetadata sends an HTTP request to update user metadata.

func (*Client) Validate

func (c *Client) Validate() error

Validate validates the Client fields.

func (*Client) VerifyAccount

func (c *Client) VerifyAccount(input VerifyAccountInput) (*Account, error)

VerifyAccount makes a GET request to verify an account

func (*Client) VerifyEmail

func (c *Client) VerifyEmail(event *VerifyEmailEvent) error

func (*Client) VerifyPhoneNumber

func (c *Client) VerifyPhoneNumber(user *User) error

func (*Client) VerifyToken

func (c *Client) VerifyToken(token string) (*Token, error)

type CreateAccountInput

type CreateAccountInput struct {
	UserID       *uuid.UUID `json:"user_id"`
	AgencyID     *uuid.UUID `json:"agencyId,omitempty"`
	CelebrityID  *uuid.UUID `json:"celebrityId,omitempty"`
	BusinessID   *uuid.UUID `json:"businessId,omitempty"`
	EnterpriseID *uuid.UUID `json:"enterpriseId,omitempty"`
	GovernmentID *uuid.UUID `json:"governmentId,omitempty"`
}

func (*CreateAccountInput) GetAccountType

func (input *CreateAccountInput) GetAccountType() string

Adding this method to CreateAccountInput struct

type CreateAgencyAccountInput

type CreateAgencyAccountInput struct {
	UserID     uuid.UUID `json:"user_id"`
	AgencyName string    `json:"agency_name"`
}

type CreateBusinessAccountInput

type CreateBusinessAccountInput struct {
	UserID       uuid.UUID `json:"user_id"`
	BusinessName string    `json:"business_name"`
}

type CreateCelebrityAccountInput

type CreateCelebrityAccountInput struct {
	UserID        uuid.UUID `json:"user_id"`
	CelebrityName string    `json:"celebrity_name"`
}

CreateCelebrityAccountInput represents the information needed to create a celebrity account.

type CreateCelebrityAccountResponse

type CreateCelebrityAccountResponse struct {
	CelebrityID uuid.UUID `json:"celebrity_id"`
	Status      string    `json:"status"`
	Message     string    `json:"message,omitempty"`
}

CreateCelebrityAccountResponse represents the response from creating a celebrity account.

type CreateEnterpriseAccountInput

type CreateEnterpriseAccountInput struct {
	UserID         uuid.UUID `json:"user_id"`
	EnterpriseName string    `json:"enterprise_name"`
}

type CreateGovernmentAccountInput

type CreateGovernmentAccountInput struct {
	UserID         uuid.UUID `json:"user_id"`
	GovernmentName string    `json:"government_name"`
	GovernmentID   uuid.UUID `json:"government_id"`
}

type CreateMetadataKeyInput

type CreateMetadataKeyInput struct {
	KeyName string `json:"key_name"`
}

type CreatePermissionInput

type CreatePermissionInput struct {
	Name        string
	Description string
}

type CreateRoleInput

type CreateRoleInput struct {
	Name              string
	Description       string
	CompanyDomainOnly bool
	IsInternal        bool
	UserID            uuid.UUID
}

func (*CreateRoleInput) Validate

func (input *CreateRoleInput) Validate() error

type CreateTokenInput

type CreateTokenInput struct {
	UserID uuid.UUID `json:"user_id"`
	Scope  string    `json:"scope"`
}

CreateTokenInput represents the input data for creating a new token.

type DeleteGovernmentAccountInput

type DeleteGovernmentAccountInput struct {
	AccountID uuid.UUID `json:"account_id"`
}

type DeleteMetadataKeyInput

type DeleteMetadataKeyInput struct {
	ID uuid.UUID `json:"id"`
}

type DeletePermissionInput

type DeletePermissionInput struct {
	ID uuid.UUID `json:"id"`
}

type DeleteRoleInput

type DeleteRoleInput struct {
	RoleID uuid.UUID
	UserID uuid.UUID
}

type DeleteTokenInput

type DeleteTokenInput struct {
	UserID  uuid.UUID `json:"userId"`
	TokenID uuid.UUID `json:"tokenId"`
}

DeleteTokenInput represents the input data for deleting a token.

type DeleteTokensByUserIDInput

type DeleteTokensByUserIDInput struct {
	UserID uuid.UUID `json:"userId"`
}

DeleteTokensByUserIDInput represents the input for deleting all tokens of a user.

type DisableTwoFactorAuthenticationInput

type DisableTwoFactorAuthenticationInput struct {
	UserID uuid.UUID `json:"user_id"`
}

type DoesPermissionExistInput

type DoesPermissionExistInput struct {
	PermissionID uuid.UUID
}

type DoesRoleExistInput

type DoesRoleExistInput struct {
	RoleID uuid.UUID
}

type EnableTwoFactorAuthenticationInput

type EnableTwoFactorAuthenticationInput struct {
	UserID           uuid.UUID `json:"user_id"`
	TwoFactorEnabled bool      `json:"two_factor_enabled"`
}

type Enterprise

type Enterprise struct {
	ID            uuid.UUID `json:"id"`
	UserAccountID uuid.UUID `json:"user_account_id"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Enterprise represents the structure of an enterprise.

type EnterpriseAccountsResponse

type EnterpriseAccountsResponse struct {
	EnterpriseAccounts []*Enterprise `json:"enterprise_accounts"`
}

EnterpriseAccountsResponse represents the structure of the response for the ListEnterpriseAccounts function.

type EnterpriseMembers

type EnterpriseMembers struct {
	Members []AccountMembership `json:"members"`
}

type GetGovernmentAccountByIDInput

type GetGovernmentAccountByIDInput struct {
	GovernmentID uuid.UUID `json:"government_id"`
}

type GetGovernmentAccountsByUserIDInput

type GetGovernmentAccountsByUserIDInput struct {
	UserID uuid.UUID `json:"user_id"`
}

type GetMembersOfGovernmentAccountInput

type GetMembersOfGovernmentAccountInput struct {
	GovernmentID uuid.UUID `json:"government_id"`
}

type GetMetadataKeyByIDInput

type GetMetadataKeyByIDInput struct {
	MetadataKeyID uuid.UUID `json:"metadata_key_id"`
	UserID        uuid.UUID `json:"user_id"`
}

type GetMetadataKeyByKeyNameInput

type GetMetadataKeyByKeyNameInput struct {
	KeyName string `json:"key_name"`
}

type GetPermissionByIDInput

type GetPermissionByIDInput struct {
	PermissionID uuid.UUID
}

type GetPermissionByNameInput

type GetPermissionByNameInput struct {
	PermissionName string
}

type GetPermissionsByRoleIDInput

type GetPermissionsByRoleIDInput struct {
	RoleID uuid.UUID
}

type GetPermissionsByUserIDInput

type GetPermissionsByUserIDInput struct {
	UserID uuid.UUID
}

type GetRolesByPermissionIDInput

type GetRolesByPermissionIDInput struct {
	PermissionID uuid.UUID
}

type GetRolesByUserIDInput

type GetRolesByUserIDInput struct {
	UserID uuid.UUID
}

type GetRolesInput

type GetRolesInput struct {
	ServiceAccountID uuid.UUID `json:"service_account_id"`
}

GetRolesInput represents the input data for retrieving roles of a service account.

type GetServiceAccountsInput

type GetServiceAccountsInput struct {
	RoleID uuid.UUID `json:"role_id"`
}

GetServiceAccountsInput represents the input data for retrieving service accounts by a role ID.

type GetTokenByPlaintextInput

type GetTokenByPlaintextInput struct {
	Plaintext string `json:"plaintext"`
}

GetTokenByPlaintextInput represents the input data for retrieving a token by plaintext.

type GetTokensByScopeInput

type GetTokensByScopeInput struct {
	Scope string `json:"scope"`
}

GetTokensByScopeInput represents the input data for retrieving a token by scope.

type GetTokensByUserIDInput

type GetTokensByUserIDInput struct {
	UserID uuid.UUID `json:"user_id"`
}

GetTokensByUserIDInput represents the input data for retrieving a token by user ID.

type Government

type Government struct {
	ID            uuid.UUID `json:"id"`
	UserAccountID uuid.UUID `json:"user_account_id"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Government represents the structure of a government agency.

type IsCountrySanctionedInput

type IsCountrySanctionedInput struct {
	CountryCode string
}

type IsPermissionAssignedToRoleInput

type IsPermissionAssignedToRoleInput struct {
	RoleID       uuid.UUID
	PermissionID uuid.UUID
}

type ListPermissionsResponse

type ListPermissionsResponse struct {
	Permissions []Permission `json:"permissions"`
}

type MetadataKey

type MetadataKey struct {
	ID      uuid.UUID `json:"id"`
	KeyName string    `json:"key_name"`
}

MetadataKey represents a metadata key record in the database

type MetadataKeyExistsInput

type MetadataKeyExistsInput struct {
	KeyName string
}

type Permission

type Permission struct {
	ID          uuid.UUID `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
}

Permission represents the structure of a permission.

type PermissionRequest

type PermissionRequest struct {
	Token       string `json:"token"`
	Permissions string `json:"permissions"`
}

PermissionRequest represents the JSON request body sent to the authentication server to check a service account's permissions.

type PermissionResponse

type PermissionResponse struct {
	HasPermission bool `json:"has_permission"`
}

PermissionResponse represents the JSON response returned from the authentication server when checking a service account's permissions.

type RegisterServiceAccountInput

type RegisterServiceAccountInput struct {
	ServiceName string `json:"name"`
	Role        string `json:"role"`
}

type RemoveMemberFromGovernmentAccountInput

type RemoveMemberFromGovernmentAccountInput struct {
	UserID       uuid.UUID `json:"userId"`
	GovernmentID uuid.UUID `json:"governmentId"`
}

type RemovePermissionFromRoleEvent

type RemovePermissionFromRoleEvent struct {
	RoleID       uuid.UUID `json:"role_id"`
	PermissionID uuid.UUID `json:"permission_id"`
}

type RemovePermissionFromRoleInput

type RemovePermissionFromRoleInput struct {
	RoleID       uuid.UUID
	PermissionID uuid.UUID
}

func (*RemovePermissionFromRoleInput) Validate

func (input *RemovePermissionFromRoleInput) Validate() error

type RemoveRoleInput

type RemoveRoleInput struct {
	ServiceAccountID uuid.UUID `json:"service_account_id"`
	RoleID           uuid.UUID `json:"role_id"`
}

RemoveRoleInput represents the input data for removing a role from a service account.

type RemoveSanctionedCountryInput

type RemoveSanctionedCountryInput struct {
	CountryCode string
}

type Role

type Role struct {
	ID                uuid.UUID `json:"id"`
	Name              string    `json:"name"`
	Description       string    `json:"description"`
	CompanyDomainOnly bool      `json:"company_domain_only"`
	IsInternal        bool      `json:"is_internal"`
}

Role represents the structure of a role.

type RoleAssignmentInput

type RoleAssignmentInput struct {
	ServiceAccountID uuid.UUID `json:"service_account_id"`
	RoleID           uuid.UUID `json:"role_id"`
}

RoleAssignmentInput represents the input data for checking a role assignment.

type RoleData

type RoleData struct {
	Name              string `json:"name"`
	Description       string `json:"description"`
	CompanyDomainOnly bool   `json:"company_domain_only"`
	IsInternal        bool   `json:"is_internal"`
}

RoleData represents the input data for a new role.

type RolesForUserResponse

type RolesForUserResponse struct {
	Roles []Role `json:"roles"`
}

type SanctionedCountry

type SanctionedCountry struct {
	ID          uuid.UUID `json:"id"`
	CountryCode string    `json:"country_code"`
	CountryName string    `json:"country_name"`
	AddedAt     time.Time `json:"added_at"`
}

SanctionedCountry represents the structure of a sanctioned country.

type SearchAccountInput

type SearchAccountInput struct {
	UserID       *uuid.UUID `json:"user_id"`
	AgencyID     *uuid.UUID `json:"agencyId,omitempty"`
	CelebrityID  *uuid.UUID `json:"celebrityId,omitempty"`
	BusinessID   *uuid.UUID `json:"businessId,omitempty"`
	EnterpriseID *uuid.UUID `json:"enterpriseId,omitempty"`
	GovernmentID *uuid.UUID `json:"governmentId,omitempty"`
}

func (*SearchAccountInput) GetAccountType

func (input *SearchAccountInput) GetAccountType() string

Add this method to your SearchAccountInput struct

type ServiceAccount

type ServiceAccount struct {
	ID          uuid.UUID  `db:"id" json:"id"`
	Secret      string     `db:"secret" json:"secret"`
	ServiceName string     `db:"service_name" json:"service_name"`
	Roles       []string   `json:"roles"`
	CreatedAt   time.Time  `db:"created_at" json:"created_at"`
	ExpiresAt   *time.Time `db:"expires_at" json:"expires_at,omitempty"`
}

ServiceAccount represents the structure of a service account.

type SetUserActiveStatusEvent

type SetUserActiveStatusEvent struct {
	UserID   string `json:"user_id"`
	IsActive bool   `json:"is_active"`
}

SetUserActiveStatusEvent represents the event of a user's active status change.

func (*SetUserActiveStatusEvent) Validate

func (e *SetUserActiveStatusEvent) Validate() error

Validate validates the SetUserActiveStatusEvent data.

type Token

type Token struct {
	Plaintext string
	Hash      []byte
	UserID    uuid.UUID
	Expiry    time.Time
	Scope     string
	Error     error
}

Token represents the structure of a token.

func (*Token) Validate

func (t *Token) Validate() error

type UpdateAccountInput

type UpdateAccountInput struct {
	UserID       *uuid.UUID `json:"user_id"`
	AgencyID     *uuid.UUID `json:"agencyId,omitempty"`
	CelebrityID  *uuid.UUID `json:"celebrityId,omitempty"`
	BusinessID   *uuid.UUID `json:"businessId,omitempty"`
	EnterpriseID *uuid.UUID `json:"enterpriseId,omitempty"`
	GovernmentID *uuid.UUID `json:"governmentId,omitempty"`
}

UpdateAccount updates an existing account.

func (*UpdateAccountInput) GetAccountType

func (input *UpdateAccountInput) GetAccountType() string

Adding this method to UpdateAccountInput struct

type UpdateAccountMembershipEvent

type UpdateAccountMembershipEvent struct {
	AccountType string    `json:"account_type,omitempty"`
	AccountID   uuid.UUID `json:"account_id,omitempty"`
	UserID      uuid.UUID `json:"user_id,omitempty"`
	Role        string    `json:"role,omitempty"`
}

UpdateAccountMembershipEvent represents the structure of an update account membership event.

type UpdateAgencyAccountInput

type UpdateAgencyAccountInput struct {
	AgencyID             uuid.UUID `json:"agency_id"`
	UpdatedUserAccountID uuid.UUID `json:"updated_user_account_id"`
}

type UpdateBusinessAccountInput

type UpdateBusinessAccountInput struct {
	UserID          uuid.UUID `json:"user_id"`
	BusinessName    string    `json:"business_name"`
	NewBusinessName string    `json:"new_business_name"`
	BusinessID      uuid.UUID `json:"business_id"`
}

func (*UpdateBusinessAccountInput) Validate

func (u *UpdateBusinessAccountInput) Validate() error

type UpdateCelebrityAccountEvent

type UpdateCelebrityAccountEvent struct {
	CelebrityID uuid.UUID `json:"celebrity_id"`
	UserID      uuid.UUID `json:"user_id,omitempty"`
	NewName     string    `json:"new_name,omitempty"`
}

func (*UpdateCelebrityAccountEvent) Validate

func (e *UpdateCelebrityAccountEvent) Validate() error

type UpdateEnterpriseAccountInput

type UpdateEnterpriseAccountInput struct {
	UserID               uuid.UUID `json:"user_id"`
	EnterpriseID         uuid.UUID `json:"enterprise_id"`
	UpdatedUserAccountID uuid.UUID `json:"updated_user_account_id"`
}

UpdateEnterpriseAccountInput is the data structure for the request to update an enterprise account.

type UpdateGovernmentAccountEvent

type UpdateGovernmentAccountEvent struct {
	UserID         uuid.UUID `json:"user_id"`
	GovernmentName string    `json:"government_name"`
	GovernmentID   uuid.UUID `json:"government_id"`
}

func (*UpdateGovernmentAccountEvent) Validate

func (e *UpdateGovernmentAccountEvent) Validate() error

Validate checks if the UpdateGovernmentAccountEvent is valid

type UpdateGovernmentAccountInput

type UpdateGovernmentAccountInput struct {
	UserID         uuid.UUID `json:"user_id"`
	GovernmentName string    `json:"government_name"`
	GovernmentID   uuid.UUID `json:"government_id"`
}

type UpdateMemberRoleInAgencyAccountInput

type UpdateMemberRoleInAgencyAccountInput struct {
	AgencyID  uuid.UUID `json:"agency_id"`
	MemberID  uuid.UUID `json:"member_id"`
	NewRoleID uuid.UUID `json:"new_role_id"`
}

type UpdateMemberRoleInBusinessAccountInput

type UpdateMemberRoleInBusinessAccountInput struct {
	BusinessID   uuid.UUID `json:"business_id"`
	MemberUserID uuid.UUID `json:"member_user_id"`
	NewRoleID    uuid.UUID `json:"new_role_id"`
}

func (*UpdateMemberRoleInBusinessAccountInput) Validate

Validate validates input data for UpdateMemberRoleInBusinessAccountInput

type UpdateMemberRoleInCelebrityAccountEvent

type UpdateMemberRoleInCelebrityAccountEvent struct {
	CelebrityID uuid.UUID `json:"celebrity_id,omitempty"`
	UserID      uuid.UUID `json:"user_id,omitempty"`
	NewRole     string    `json:"new_role,omitempty"`
}

UpdateMemberRoleInCelebrityAccountEvent represents the structure of an update member role in celebrity account event.

type UpdateMemberRoleInEnterpriseAccountRequest

type UpdateMemberRoleInEnterpriseAccountRequest struct {
	UserID       uuid.UUID `json:"user_id"`
	EnterpriseID uuid.UUID `json:"enterprise_id"`
	NewRoleID    uuid.UUID `json:"new_role_id"`
}

UpdateMemberRoleRequest represents the request payload to update the role of the member in an enterprise account.

type UpdateMemberRoleInGovernmentAccountEvent

type UpdateMemberRoleInGovernmentAccountEvent struct {
	UserID       uuid.UUID `json:"user_id"`
	GovernmentID uuid.UUID `json:"government_id"`
	NewRoleID    uuid.UUID `json:"new_role_id"`
}

func (*UpdateMemberRoleInGovernmentAccountEvent) Validate

type UpdateMetadataKeyInput

type UpdateMetadataKeyInput struct {
	ID      uuid.UUID `json:"id"`
	KeyName string    `json:"key_name"`
}

type UpdatePermissionInput

type UpdatePermissionInput struct {
	ID          uuid.UUID `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
}

func (*UpdatePermissionInput) Validate

func (input *UpdatePermissionInput) Validate() error

type UpdateRoleInput

type UpdateRoleInput struct {
	Role   *Role
	UserID uuid.UUID
}

type UpdateServiceAccountInput

type UpdateServiceAccountInput struct {
	ID          uuid.UUID  `json:"id"`
	ServiceName string     `json:"service_name"`
	Roles       []string   `json:"roles"`
	ExpiresAt   *time.Time `json:"expires_at,omitempty"`
}

UpdateServiceAccountInput represents the input data for updating a service account.

type UpdateUserPayload

type UpdateUserPayload struct {
	Email            *string `json:"email,omitempty"`
	Username         *string `json:"username,omitempty"`
	FirstName        *string `json:"first_name,omitempty"`
	LastName         *string `json:"last_name,omitempty"`
	DisplayName      *string `json:"display_name,omitempty"`
	IsActive         *bool   `json:"is_active,omitempty"`
	IsEmailVerified  *bool   `json:"is_email_verified,omitempty"`
	IsPhoneVerified  *bool   `json:"is_phone_verified,omitempty"`
	TwoFactorEnabled *bool   `json:"two_factor_enabled,omitempty"`
}

func (*UpdateUserPayload) Validate

func (u *UpdateUserPayload) Validate() error

type User

type User struct {
	ID               uuid.UUID `json:"id"`
	Email            string    `json:"email"`
	Username         string    `json:"username,omitempty"`
	PasswordHash     []byte    `json:"-"`
	FirstName        string    `json:"first_name,omitempty"`
	LastName         string    `json:"last_name,omitempty"`
	DisplayName      string    `json:"display_name,omitempty"`
	AvatarURL        string    `json:"avatar_url,omitempty"`
	PhoneNumber      string    `json:"phone_number,omitempty"`
	IsActive         bool      `json:"is_active"`
	IsEmailVerified  bool      `json:"is_email_verified"`
	IsPhoneVerified  bool      `json:"is_phone_verified"`
	TwoFactorEnabled bool      `json:"two_factor_enabled"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at,omitempty"`
}

User represents the structure of a user.

func (*User) Validate

func (u *User) Validate() error

Validate validates the User fields.

type UserInRoleCheckData

type UserInRoleCheckData struct {
	UserID uuid.UUID `json:"user_id"`
	RoleID uuid.UUID `json:"role_id"`
}

UserInRoleCheckData represents the input data for a user role check.

type UserMetadata

type UserMetadata struct {
	ID        uuid.UUID `json:"id"`
	UserID    uuid.UUID `json:"user_id"`
	KeyID     uuid.UUID `json:"key"`
	Value     string    `json:"value"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

UserMetadata represents the structure of a user metadata.

func (*UserMetadata) Validate

func (u *UserMetadata) Validate() error

type UserMetadataUpdate

type UserMetadataUpdate struct {
	ID     uuid.UUID `json:"id"`
	UserID uuid.UUID `json:"user_id"`
	Key    string    `json:"key"`
	Value  string    `json:"value"`
}

UserMetadataUpdate represents the input data for updating user metadata.

func (*UserMetadataUpdate) Validate

func (u *UserMetadataUpdate) Validate() error

Validate validates the UserMetadataUpdate fields.

type UserRegistrationData

type UserRegistrationData struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

UserRegistrationData represents the input data for a new user registration.

func (*UserRegistrationData) Validate

func (d *UserRegistrationData) Validate() error

Validate validates the UserRegistrationData fields.

type UserRemoveRoleEvent

type UserRemoveRoleEvent struct {
	UserID uuid.UUID `json:"user_id"`
	RoleID uuid.UUID `json:"role_id"`
}

UserRemoveRoleEvent represents the payload structure for the RemoveRoleFromUser event.

func (*UserRemoveRoleEvent) Validate

func (e *UserRemoveRoleEvent) Validate() error

Validate checks if the UserRemoveRoleEvent structure is valid.

type UserRoleData

type UserRoleData struct {
	UserID uuid.UUID `json:"user_id"`
	RoleID uuid.UUID `json:"role_id"`
}

type UserUnassignRoleInput

type UserUnassignRoleInput struct {
	UserID uuid.UUID `json:"user_id"`
	RoleID uuid.UUID `json:"role_id"`
}

type VerifyAccountInput

type VerifyAccountInput struct {
	AccountID   uuid.UUID `json:"account_id"`
	AccountType string    `json:"account_type"`
}

VerifyAccountInput contains input parameters for VerifyAccount

type VerifyEmailEvent

type VerifyEmailEvent struct {
	UserID uuid.UUID `json:"user_id"`
	Email  string    `json:"email"`
}

func (*VerifyEmailEvent) Validate

func (e *VerifyEmailEvent) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL