client

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const Auth0UserSearchMaxResults = 1000

Auth0UserSearchMaxResults is the hard limit imposed by Auth0's User Search API. Paginating beyond this limit results in a 400 error. See https://auth0.com/docs/manage-users/user-search/view-search-results-by-page#limitation.

View Source
const PageSizeDefault = 100

Variables

This section is empty.

Functions

func GetNextToken

func GetNextToken(
	page int,
	limit int,
	total int,
) string

GetNextToken given a limit and page that were used to fetch _this_ page of data, and total number of resources, return the next pagination token as a string.

func GetNextUsersToken

func GetNextUsersToken(
	page int,
	limit int,
	total int,
	since string,
	newestCreatedAt *time.Time,
) (string, error)

func ParsePaginationToken

func ParsePaginationToken(pToken *pagination.Token) (
	int,
	int,
	string,
	error,
)

ParsePaginationToken - takes as pagination token and returns page, limit, and `pagingRequestId` in that order.

func ParsePaginationTokenString

func ParsePaginationTokenString(pToken string) (
	int,
	int,
	string,
	error,
)

func ParseUserPaginationToken

func ParseUserPaginationToken(pToken *pagination.Token) (
	int,
	int,
	string,
	string,
	*time.Time,
	error,
)

ParseUserPaginationToken - takes as pagination token and returns page, limit, also it includes since and until dates to search users, and the date the newest user was created.

func WithBearerToken

func WithBearerToken(token string) uhttp.RequestOption

WithBearerToken - TODO(marcos): move this function to `baton-sdk`.

Types

type AuthRequest

type AuthRequest struct {
	Audience     string `json:"audience"`
	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	GrantType    string `json:"grant_type"`
}

type AuthResponse

type AuthResponse struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	Scope       string `json:"scope,omitempty"`
	TokenType   string `json:"token_type"`
}

type Client

type Client struct {
	BearerToken string
	BaseUrl     *url.URL
	// contains filtered or unexported fields
}

func New

func New(
	ctx context.Context,
	baseUrl string,
	clientId string,
	clientSecret string,
) (*Client, error)

func (*Client) AddUserToOrganization

func (c *Client) AddUserToOrganization(
	ctx context.Context,
	organizationId string,
	userId string,
) (
	*v2.RateLimitDescription,
	error,
)

func (*Client) AddUserToRole

func (c *Client) AddUserToRole(
	ctx context.Context,
	roleId string,
	userId string,
) (
	*v2.RateLimitDescription,
	error,
)

func (*Client) Authorize

func (c *Client) Authorize(
	ctx context.Context,
	clientId string,
	clientSecret string,
) error

func (*Client) GetOrganizationMembers

func (c *Client) GetOrganizationMembers(
	ctx context.Context,
	organizationId string,
	limit int,
	page int,
) (
	[]User,
	int,
	*v2.RateLimitDescription,
	error,
)

func (*Client) GetOrganizations

func (c *Client) GetOrganizations(
	ctx context.Context,
	limit int,
	page int,
) (
	[]Organization,
	int,
	*v2.RateLimitDescription,
	error,
)

func (*Client) GetResourceServer

func (c *Client) GetResourceServer(
	ctx context.Context,
	id string,
) (
	*ResourceServer,
	*v2.RateLimitDescription,
	error,
)

func (*Client) GetResourceServers

func (c *Client) GetResourceServers(
	ctx context.Context,
	limit int,
	page int,
) (
	[]*ResourceServer,
	int,
	*v2.RateLimitDescription,
	error,
)

func (*Client) GetRolePermissions

func (c *Client) GetRolePermissions(
	ctx context.Context,
	id string,
) (
	[]*RolePermission,
	*v2.RateLimitDescription,
	error,
)

func (*Client) GetRoleUsers

func (c *Client) GetRoleUsers(
	ctx context.Context,
	roleId string,
	limit int,
	page int,
) (
	[]User,
	int,
	*v2.RateLimitDescription,
	error,
)

func (*Client) GetRoles

func (c *Client) GetRoles(
	ctx context.Context,
	limit int,
	page int,
) (
	[]Role,
	int,
	*v2.RateLimitDescription,
	error,
)

func (*Client) GetUsers

func (c *Client) GetUsers(
	ctx context.Context,
	limit int,
	page int,
	since string,
	until string,
) (
	[]User,
	int,
	*v2.RateLimitDescription,
	error,
)

func (*Client) List

func (c *Client) List(
	ctx context.Context,
	path string,
	target interface{},
	opts ...ReqOpt,
) (
	*v2.RateLimitDescription,
	error,
)

func (*Client) RemoveUserFromOrganization

func (c *Client) RemoveUserFromOrganization(
	ctx context.Context,
	organizationId string,
	userId string,
) (
	*v2.RateLimitDescription,
	error,
)

func (*Client) RemoveUserFromRole

func (c *Client) RemoveUserFromRole(
	ctx context.Context,
	roleId string,
	userId string,
) (
	*v2.RateLimitDescription,
	error,
)

type Organization

type Organization struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
}

type OrganizationMembersResponse

type OrganizationMembersResponse struct {
	Members []User `json:"members"`
	PaginatedResponse
}

type OrganizationsResponse

type OrganizationsResponse struct {
	Organizations []Organization `json:"organizations"`
	PaginatedResponse
}

type PaginatedResponse

type PaginatedResponse struct {
	Start int `json:"start,omitempty"`
	Limit int `json:"limit,omitempty"`
	Total int `json:"total,omitempty"`
}

type Pagination

type Pagination struct {
	PagingRequestId string `json:"pagingRequestId"`
	Page            int    `json:"page"`
}

type ReqOpt

type ReqOpt func(reqURL *url.URL)

func WithQueryParam

func WithQueryParam(key string, value string) ReqOpt

type ResourceServer

type ResourceServer struct {
	Id                                        string                `json:"id"`
	Name                                      string                `json:"name"`
	IsSystem                                  bool                  `json:"is_system"`
	Identifier                                string                `json:"identifier"`
	Scopes                                    []ResourceServerScope `json:"scopes"`
	SigningAlg                                string                `json:"signing_alg"`
	AllowOfflineAccess                        bool                  `json:"allow_offline_access"`
	SkipConsentForVerifiableFirstPartyClients bool                  `json:"skip_consent_for_verifiable_first_party_clients"`
	TokenLifetime                             int                   `json:"token_lifetime"`
	TokenLifetimeForWeb                       int                   `json:"token_lifetime_for_web"`
	EnforcePolicies                           bool                  `json:"enforce_policies"`
	TokenDialect                              string                `json:"token_dialect"`
	ConsentPolicy                             string                `json:"consent_policy"`
}

type ResourceServerResponse

type ResourceServerResponse struct {
	PaginatedResponse
	ResourceServers []*ResourceServer `json:"resource_servers"`
}

type ResourceServerScope

type ResourceServerScope struct {
	Description string `json:"description"`
	Value       string `json:"value"`
}

type Role

type Role struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type RolePermission

type RolePermission struct {
	PermissionName           string `json:"permission_name"`
	Description              string `json:"description"`
	ResourceServerName       string `json:"resource_server_name"`
	ResourceServerIdentifier string `json:"resource_server_identifier"`
}

type RolesResponse

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

type RolesUsersResponse

type RolesUsersResponse struct {
	PaginatedResponse
	Users []User `json:"users"`
}

type User

type User struct {
	CreatedAt     time.Time        `json:"created_at"`
	Email         string           `json:"email"`
	EmailVerified bool             `json:"email_verified"`
	Identities    []UserIdentities `json:"identities"`
	Name          string           `json:"name"`
	Nickname      string           `json:"nickname"`
	Picture       string           `json:"picture"`
	UpdatedAt     time.Time        `json:"updated_at"`
	UserId        string           `json:"user_id"`
}

type UserIdentities

type UserIdentities struct {
	Connection string `json:"connection"`
	IsSocial   bool   `json:"isSocial"`
	Provider   string `json:"provider"`
	UserId     string `json:"user_id"`
}

type UserPagination

type UserPagination struct {
	Page                int        `json:"page"`
	Since               string     `json:"since,omitempty"`
	Until               string     `json:"until,omitempty"`
	NewestUserCreatedAt *time.Time `json:"newestUserCreatedAt,omitempty"`
}

type UsersResponse

type UsersResponse struct {
	PaginatedResponse
	Length int    `json:"length"`
	Users  []User `json:"users"`
}

Jump to

Keyboard shortcuts

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