Documentation
¶
Overview ¶
Package `events` provides a client wrapping the WorkOS Events API.
Index ¶
Constants ¶
View Source
const ( // Connection Events ConnectionActivated = "connection.activated" ConnectionDeactivated = "connection.deactivated" ConnectionDeleted = "connection.deleted" // Directory Events DirectoryActivated = "dsync.activated" DirectoryDeleted = "dsync.deleted" // Directory User Events DirectoryUserCreated = "dsync.user.created" DirectoryUserUpdated = "dsync.user.updated" DirectoryUserDeleted = "dsync.user.deleted" // Directory Group Events DirectoryGroupCreated = "dsync.group.created" DirectoryGroupUpdated = "dsync.group.updated" DirectoryGroupDeleted = "dsync.group.deleted" DirectoryGroupUserAdded = "dsync.group.user_added" DirectoryGroupUserRemoved = "dsync.group.user_removed" DirectroyGroupUserRemoved = "dsync.group.user_removed" // Deprecated: use DirectoryGroupUserRemoved instead // Organization Events OrganizationCreated = "organization.created" OrganizationUpdated = "organization.updated" OrganizationDeleted = "organization.deleted" // User Management Events AuthenticationEmailVerificationSucceeded = "authentication.email_verification_succeeded" AuthenticationMagicAuthFailed = "authentication.magic_auth_failed" AuthenticationMagicAuthSucceeded = "authentication.magic_auth_succeeded" AuthenticationMfaSucceeded = "authentication.mfa_succeeded" AuthenticationOauthFailed = "authentication.oauth_failed" AuthenticationOauthSucceeded = "authentication.oauth_succeeded" AuthenticationPasswordFailed = "authentication.password_failed" AuthenticationPasswordSucceeded = "authentication.password_succeeded" AuthenticationSsoFailed = "authentication.sso_failed" AuthenticationSsoSucceeded = "authentication.sso_succeeded" UserCreated = "user.created" UserUpdated = "user.updated" UserDeleted = "user.deleted" OrganizationMembershipAdded = "organization_membership.added" // Deprecated: use OrganizationMembershipCreated instead OrganizationMembershipCreated = "organization_membership.created" OrganizationMembershipDeleted = "organization_membership.deleted" OrganizationMembershipUpdated = "organization_membership.updated" OrganizationMembershipRemoved = "organization_membership.removed" // Deprecated: use OrganizationMembershipDeleted instead SessionCreated = "session.created" EmailVerificationCreated = "email_verification.created" InvitationCreated = "invitation.created" MagicAuthCreated = "magic_auth.created" PasswordResetCreated = "password_reset.created" PasswordResetSucceeded = "password_reset.succeeded" // Organization Domain Events OrganizationDomainCreated = "organization_domain.created" OrganizationDomainUpdated = "organization_domain.updated" OrganizationDomainDeleted = "organization_domain.deleted" OrganizationDomainVerified = "organization_domain.verified" OrganizationDomainVerificationFailed = "organization_domain.verification_failed" )
View Source
const ResponseLimit = 10
ResponseLimit is the default number of records to limit a response to.
Variables ¶
View Source
var (
DefaultClient = &Client{
Endpoint: "https://api.workos.com",
}
)
DefaultClient is the client used by SetAPIKey and Event functions.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// The WorkOS API Key. It can be found in https://dashboard.workos.com/api-keys.
APIKey string
// The http.Client that is used to get Event records from WorkOS.
// Defaults to http.Client.
HTTPClient *http.Client
// The endpoint to WorkOS API. Defaults to https://api.workos.com.
Endpoint string
// contains filtered or unexported fields
}
Client represents a client that performs Event requests to the WorkOS API.
func (*Client) ListEvents ¶
func (c *Client) ListEvents( ctx context.Context, opts ListEventsOpts, ) (ListEventsResponse, error)
ListEvents gets a list of Events.
type Event ¶
type Event struct {
// The Event's unique identifier.
ID string `json:"id"`
// The type of Event.
Event string `json:"event"`
// The Event's data in raw encoded JSON.
Data json.RawMessage `json:"data"`
// The Event's created at date.
CreatedAt time.Time `json:"created_at"`
}
Event contains data about a particular Event.
type ListEventsOpts ¶
type ListEventsOpts struct {
// Filter to only return Events of particular types.
Events []string `url:"events"`
// Maximum number of records to return.
Limit int `url:"limit"`
// Pagination cursor to receive records after a provided Event ID.
After string `url:"after,omitempty"`
// Date range start for stream of Events.
RangeStart string `url:"range_start,omitempty"`
// Date range end for stream of Events.
RangeEnd string `url:"range_end,omitempty"`
OrganizationId string `url:"organization_id,omitempty"`
}
ListEventsOpts contains the options to request provisioned Events.
type ListEventsResponse ¶
type ListEventsResponse struct {
// List of Events.
Data []Event `json:"data"`
// Cursor pagination options.
ListMetadata common.ListMetadata `json:"list_metadata"`
}
GetEventsResponse describes the response structure when requesting Events.
func ListEvents ¶
func ListEvents( ctx context.Context, opts ListEventsOpts, ) (ListEventsResponse, error)
ListEvents gets a list of Events for an environment.
Click to show internal directories.
Click to hide internal directories.