Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) AddGroupMember(ctx context.Context, groupID, userID int64, isAdmin bool) error
- func (c *Client) CreateGroup(ctx context.Context, organizationID *int64, name string) error
- func (c *Client) CreateUser(ctx context.Context, params CreateUserParams) (*RESTUser, annotations.Annotations, error)
- func (c *Client) DeleteGroupPage(ctx context.Context, id int64) error
- func (c *Client) GetGroup(ctx context.Context, groupID int64) (*GroupModel, error)
- func (c *Client) GetGroupByName(ctx context.Context, organizationID *int64, name string) (*GroupModel, error)
- func (c *Client) GetGroupFolderDefault(ctx context.Context, groupID int64, folderID int64) (*GroupFolderDefault, error)
- func (c *Client) GetGroupMember(ctx context.Context, groupID, userID int64) (*GroupMember, error)
- func (c *Client) GetGroupPage(ctx context.Context, groupID int64, pageID int64) (*GroupPage, error)
- func (c *Client) GetGroupResource(ctx context.Context, groupID int64, resourceID int64) (*GroupResource, error)
- func (c *Client) GetGroupResourceFolderDefault(ctx context.Context, groupID int64, folderID int64) (*GroupResourceFolderDefault, error)
- func (c *Client) GetPage(ctx context.Context, id int64) (*PageModel, error)
- func (c *Client) GetResource(ctx context.Context, id int64) (*ResourceModel, error)
- func (c *Client) GetUserByEmail(ctx context.Context, email string) (*RESTUser, annotations.Annotations, error)
- func (c *Client) GetUserSID(ctx context.Context, legacyID int64) (string, error)
- func (c *Client) InsertGroupPage(ctx context.Context, groupID int64, pageID int64, accessLevel string) error
- func (c *Client) ListGroupMembers(ctx context.Context, groupID int64, pager *Pager, skipDisabledUsers bool) ([]*GroupMember, string, error)
- func (c *Client) ListGroupsForOrg(ctx context.Context, orgID int64, pager *Pager) ([]*GroupModel, string, error)
- func (c *Client) ListOrganizations(ctx context.Context, pager *Pager) ([]*OrgModel, string, error)
- func (c *Client) ListPagesForOrg(ctx context.Context, orgID int64, pager *Pager) ([]*PageModel, string, error)
- func (c *Client) ListResourcesForOrg(ctx context.Context, orgID int64, pager *Pager) ([]*ResourceModel, string, error)
- func (c *Client) ListUsersForOrg(ctx context.Context, orgID int64, pager *Pager, skipDisabledUsers bool) ([]*UserModel, string, error)
- func (c *Client) RESTEnabled() bool
- func (c *Client) RemoveGroupMember(ctx context.Context, groupID, userID int64) error
- func (c *Client) SetUserActive(ctx context.Context, sid string, active bool) (annotations.Annotations, error)
- func (c *Client) UpdateGroupMember(ctx context.Context, groupID, userID int64, isAdmin bool) (*GroupMember, error)
- func (c *Client) UpdateGroupPage(ctx context.Context, id int64, accessLevel string) error
- func (c *Client) ValidateConnection(ctx context.Context) error
- func (c *Client) ValidateREST(ctx context.Context) (annotations.Annotations, error)
- type CreateUserParams
- type GroupFolderDefault
- type GroupMember
- type GroupModel
- type GroupPage
- type GroupResource
- type GroupResourceFolderDefault
- type Logger
- type OrgModel
- type PageModel
- type Pager
- type RESTUser
- type ResourceModel
- type RetoolErrorResponse
- type UserModel
Constants ¶
const ( MaxPageSize = 250 MinPageSize = 10 )
Variables ¶
var ErrUserAlreadyExists = errors.New("user already exists")
ErrUserAlreadyExists is the idempotent-create sentinel the lifecycle handlers tolerate.
var ErrUserNotFound = errors.New("user not found")
ErrUserNotFound is returned by GetUserSID when no user row matches the legacy id.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddGroupMember ¶ added in v0.0.8
func (*Client) CreateGroup ¶ added in v0.0.11
func (*Client) CreateUser ¶ added in v0.0.16
func (c *Client) CreateUser(ctx context.Context, params CreateUserParams) (*RESTUser, annotations.Annotations, error)
CreateUser provisions a new Retool user. Returns ErrUserAlreadyExists on a duplicate email (HTTP 409) so the caller can resolve and return the existing account.
func (*Client) DeleteGroupPage ¶ added in v0.0.11
func (*Client) GetGroupByName ¶ added in v0.0.11
func (*Client) GetGroupFolderDefault ¶
func (*Client) GetGroupMember ¶ added in v0.0.8
func (*Client) GetGroupPage ¶
func (*Client) GetGroupResource ¶
func (*Client) GetGroupResourceFolderDefault ¶
func (*Client) GetResource ¶
func (*Client) GetUserByEmail ¶ added in v0.0.16
func (c *Client) GetUserByEmail(ctx context.Context, email string) (*RESTUser, annotations.Annotations, error)
GetUserByEmail resolves a user by email via the server-side filter. Returns ErrUserNotFound when no user matches and an error if the match is ambiguous.
func (*Client) GetUserSID ¶ added in v0.0.16
GetUserSID resolves a Postgres user id (the int64 that baton keys `user:<int64>` on, surfaced as `legacy_id` over REST) to its stable `sid` (`user_<uuid>`), which is the id every REST user endpoint addresses users by. Because the connector always holds the Postgres pool, this is the robust int64->UUID join — no mutable-email lookup required.
func (*Client) InsertGroupPage ¶ added in v0.0.11
func (*Client) ListGroupMembers ¶
func (*Client) ListGroupsForOrg ¶
func (*Client) ListOrganizations ¶
select id, domain, name, hostname, subdomain from organizations;.
func (*Client) ListPagesForOrg ¶
func (*Client) ListResourcesForOrg ¶
func (*Client) ListUsersForOrg ¶
func (*Client) RESTEnabled ¶ added in v0.0.16
RESTEnabled reports whether the REST surface (account lifecycle) is configured.
func (*Client) RemoveGroupMember ¶ added in v0.0.8
func (*Client) SetUserActive ¶ added in v0.0.16
func (c *Client) SetUserActive(ctx context.Context, sid string, active bool) (annotations.Annotations, error)
SetUserActive enables (active=true) or disables (active=false) a user by sid. Idempotent: patching to the current state succeeds. Retool has no hard delete — this deactivation/reactivation pair is the whole account lifecycle after create.
func (*Client) UpdateGroupMember ¶ added in v0.0.8
func (*Client) UpdateGroupPage ¶ added in v0.0.11
func (*Client) ValidateREST ¶ added in v0.0.16
func (c *Client) ValidateREST(ctx context.Context) (annotations.Annotations, error)
ValidateREST cheaply confirms the REST token + base URL work (used by Validate()).
type CreateUserParams ¶ added in v0.0.16
CreateUserParams are the fields required to provision a new Retool user.
type GroupFolderDefault ¶
type GroupMember ¶
type GroupMember struct {
Id int64 `db:"id"`
UserID *int64 `db:"userId"`
GroupID *int64 `db:"groupId"`
IsAdmin bool `db:"isAdmin"`
Enabled bool `db:"enabled"`
}
func (*GroupMember) GetGroupID ¶
func (g *GroupMember) GetGroupID() int64
func (*GroupMember) GetUserID ¶
func (g *GroupMember) GetUserID() int64
type GroupModel ¶
type GroupModel struct {
ID int64 `db:"id"`
Name *string `db:"name"`
OrganizationID *int64 `db:"organizationId"`
UniversalAccess string `db:"universalAccess"`
UniversalResourceAccess string `db:"universalResourceAccess"`
UniversalQueryLibraryAccess string `db:"universalQueryLibraryAccess"`
UserListAccess bool `db:"userListAccess"`
AuditLogAccess bool `db:"auditLogAccess"`
UnpublishedReleaseAccess bool `db:"unpublishedReleaseAccess"`
}
func (*GroupModel) GetName ¶
func (g *GroupModel) GetName() string
func (*GroupModel) GetOrgID ¶
func (g *GroupModel) GetOrgID() int64
type GroupResource ¶
type Logger ¶ added in v0.0.6
type Logger struct{}
func (*Logger) Pgx2ZapLogLevel ¶ added in v0.0.6
type PageModel ¶
type PageModel struct {
ID int64 `db:"id"`
Name string `db:"name"`
OrganizationID *int64 `db:"organizationId"`
FolderID int64 `db:"folderId"`
PhotoUrl *string `db:"photoUrl"`
Description *string `db:"description"`
}
func (*PageModel) GetDescription ¶
func (*PageModel) GetPhotoUrl ¶
type RESTUser ¶ added in v0.0.16
type RESTUser struct {
ID string `json:"id"`
LegacyID int64 `json:"legacy_id"`
Email string `json:"email"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Active bool `json:"active"`
UserType string `json:"user_type"`
}
RESTUser is the Retool REST representation of a user. `ID` is the stable `sid` (user_<uuid>); `LegacyID` is the Postgres `users.id` that baton keys `user:<int64>` on.
type ResourceModel ¶
type ResourceModel struct {
ID int64 `db:"id"`
OrganizationID int64 `db:"organizationId"`
Name string `db:"name"`
Type string `db:"type"`
DisplayName *string `db:"displayName"`
EnvironmentID *string `db:"environmentId"`
ResourceFolderID *int64 `db:"resourceFolderId"`
}
func (*ResourceModel) GetDisplayName ¶
func (u *ResourceModel) GetDisplayName() string
func (*ResourceModel) GetEnvironmentID ¶
func (u *ResourceModel) GetEnvironmentID() string
func (*ResourceModel) GetResourceFolderID ¶
func (g *ResourceModel) GetResourceFolderID() int64
type RetoolErrorResponse ¶ added in v0.0.16
RetoolErrorResponse satisfies uhttp.ErrorResponse so error bodies surface their message.
func (*RetoolErrorResponse) Message ¶ added in v0.0.16
func (e *RetoolErrorResponse) Message() string
type UserModel ¶
type UserModel struct {
ID int64 `db:"id"`
Email string `db:"email"`
FirstName *string `db:"firstName"`
LastName *string `db:"lastName"`
ProfilePhotoURL *string `db:"profilePhotoUrl"`
UserName *string `db:"userName"`
Enabled bool `db:"enabled"`
LastLoggedIn *time.Time `db:"lastLoggedIn"`
OrganizationID int64 `db:"organizationId"`
}