satori

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the HTTP Satori API client.

func NewClient

func NewClient(cfg Config) *Client

NewClient creates a Satori client from config.

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context, id string, defaultProperties, customProperties map[string]string, noSession bool, ipAddress ...string) (*Properties, error)

Authenticate creates or updates a Satori identity.

func (*Client) ConsoleDirectMessageSend

func (c *Client) ConsoleDirectMessageSend(ctx context.Context, templateId string, recipientIDs []string, integrations []MessageIntegration, persist bool, channels map[MessageIntegration]*MessageIntegrationChannels, templateOverride *MessageTemplateOverride) (*MessageSendResults, error)

ConsoleDirectMessageSend sends a console direct message (reference-shaped).

func (*Client) ConsoleDirectMessageSendSimple

func (c *Client) ConsoleDirectMessageSendSimple(ctx context.Context, identityID, title, body string) error

ConsoleDirectMessageSendSimple is a convenience wrapper used by console HTTP/gRPC.

func (*Client) ConsoleMessageTemplatesList

func (c *Client) ConsoleMessageTemplatesList(ctx context.Context, limit int, cursor string) ([]MessageTemplate, string, error)

ConsoleMessageTemplatesList lists message templates from Satori.

func (*Client) EventsPublish

func (c *Client) EventsPublish(ctx context.Context, id string, events []*Event, ipAddress ...string) error

EventsPublish publishes analytics events for an identity.

func (*Client) EventsPublishLegacy

func (c *Client) EventsPublishLegacy(ctx context.Context, events []map[string]any) error

EventsPublishLegacy supports the prior untyped events map shape.

func (*Client) ExperimentsList

func (c *Client) ExperimentsList(ctx context.Context, id string, names, labels []string) (*ExperimentList, error)

ExperimentsList lists experiments for an identity.

func (*Client) FlagsList

func (c *Client) FlagsList(ctx context.Context, id string, names, labels []string) (*FlagList, error)

FlagsList lists feature flags for an identity.

func (*Client) FlagsListLegacy

func (c *Client) FlagsListLegacy(ctx context.Context, identities []map[string]string) (map[string]interface{}, error)

FlagsListLegacy supports the prior multi-identity map shape used by early Lua bindings.

func (*Client) FlagsOverridesList

func (c *Client) FlagsOverridesList(ctx context.Context, id string, names, labels []string) (*FlagOverridesList, error)

FlagsOverridesList lists flag overrides for an identity.

func (*Client) IdentityDelete

func (c *Client) IdentityDelete(ctx context.Context, id string) error

IdentityDelete deletes an identity and associated data.

func (*Client) LiveEventJoin

func (c *Client) LiveEventJoin(ctx context.Context, id, liveEventId string) error

LiveEventJoin joins a live event.

func (*Client) LiveEventsList

func (c *Client) LiveEventsList(ctx context.Context, id string, names, labels []string, pastRunCount, futureRunCount int32, startTimeSec, endTimeSec int64) (*LiveEventList, error)

LiveEventsList lists live events for an identity.

func (*Client) MessageDelete

func (c *Client) MessageDelete(ctx context.Context, id, messageId string) error

MessageDelete deletes a message.

func (*Client) MessageUpdate

func (c *Client) MessageUpdate(ctx context.Context, id, messageId string, readTime, consumeTime int64) error

MessageUpdate updates read/consume times on a message.

func (*Client) MessagesList

func (c *Client) MessagesList(ctx context.Context, id string, limit int, forward bool, cursor string, messageIDs []string) (*MessageList, error)

MessagesList lists messages for an identity.

func (*Client) PropertiesGet

func (c *Client) PropertiesGet(ctx context.Context, id string) (*Properties, error)

PropertiesGet returns identity properties.

func (*Client) PropertiesUpdate

func (c *Client) PropertiesUpdate(ctx context.Context, id string, properties *PropertiesUpdate) error

PropertiesUpdate updates identity properties.

func (*Client) ServerEventsPublish

func (c *Client) ServerEventsPublish(ctx context.Context, events []*Event, ipAddress ...string) error

ServerEventsPublish publishes server-side events (no identity session).

type Config

type Config struct {
	URL        string
	APIKeyName string
	APIKey     string
	SigningKey string
	TimeoutMs  int64
}

Config holds Satori connection settings.

type Event

type Event struct {
	Name             string            `json:"name,omitempty"`
	Id               string            `json:"id,omitempty"`
	Metadata         map[string]string `json:"metadata,omitempty"`
	Value            string            `json:"value,omitempty"`
	IdentityId       string            `json:"identity_id,omitempty"`
	SessionId        string            `json:"session_id,omitempty"`
	SessionIssuedAt  int64             `json:"session_issued_at,omitempty"`
	SessionExpiresAt int64             `json:"session_expires_at,omitempty"`
	Timestamp        int64             `json:"-"`
}

Event is a Satori analytics event.

type Experiment

type Experiment struct {
	Name      string   `json:"name,omitempty"`
	Value     string   `json:"value,omitempty"`
	Labels    []string `json:"labels,omitempty"`
	FlagNames []string `json:"flag_names,omitempty"`
}

Experiment is a Satori experiment assignment.

type ExperimentList

type ExperimentList struct {
	Experiments []*Experiment `json:"experiments,omitempty"`
}

ExperimentList wraps experiment entries.

type Flag

type Flag struct {
	Name             string   `json:"name,omitempty"`
	Value            string   `json:"value,omitempty"`
	Labels           []string `json:"labels,omitempty"`
	ConditionChanged bool     `json:"condition_changed,omitempty"`
}

Flag is a feature flag value.

type FlagList

type FlagList struct {
	Flags []*Flag `json:"flags,omitempty"`
}

FlagList wraps feature flags.

type FlagOverride

type FlagOverride struct {
	Type          int    `json:"type,omitempty"`
	Name          string `json:"name,omitempty"`
	VariantName   string `json:"variant_name,omitempty"`
	Value         string `json:"value,omitempty"`
	CreateTimeSec int64  `json:"create_time_sec,string,omitempty"`
}

FlagOverride is a single override entry.

type FlagOverrides

type FlagOverrides struct {
	FlagName  string          `json:"flag_name,omitempty"`
	Labels    []string        `json:"labels,omitempty"`
	Overrides []*FlagOverride `json:"overrides,omitempty"`
}

FlagOverrides lists overrides for one flag.

type FlagOverridesList

type FlagOverridesList struct {
	Flags []*FlagOverrides `json:"flags,omitempty"`
}

FlagOverridesList wraps flag override groups.

type LiveEvent

type LiveEvent struct {
	Name               string   `json:"name,omitempty"`
	Description        string   `json:"description,omitempty"`
	Value              string   `json:"value,omitempty"`
	Labels             []string `json:"labels,omitempty"`
	ActiveStartTimeSec int64    `json:"active_start_time_sec,string,omitempty"`
	ActiveEndTimeSec   int64    `json:"active_end_time_sec,string,omitempty"`
	Id                 string   `json:"id,omitempty"`
	StartTimeSec       int64    `json:"start_time_sec,string,omitempty"`
	EndTimeSec         int64    `json:"end_time_sec,string,omitempty"`
	DurationSec        int64    `json:"duration_sec,string,omitempty"`
	ResetCronExpr      string   `json:"reset_cron,omitempty"`
	Status             int      `json:"status,omitempty"`
	FlagNames          []string `json:"flag_names,omitempty"`
}

LiveEvent is a scheduled LiveOps event.

type LiveEventList

type LiveEventList struct {
	LiveEvents []*LiveEvent `json:"live_events,omitempty"`
}

LiveEventList wraps live events.

type Message

type Message struct {
	ScheduleId  string         `json:"schedule_id,omitempty"`
	SendTime    int64          `json:"send_time,string,omitempty"`
	Metadata    map[string]any `json:"metadata,omitempty"`
	CreateTime  int64          `json:"create_time,string,omitempty"`
	UpdateTime  int64          `json:"update_time,string,omitempty"`
	ReadTime    int64          `json:"read_time,string,omitempty"`
	ConsumeTime int64          `json:"consume_time,string,omitempty"`
	Text        string         `json:"text,omitempty"`
	Id          string         `json:"id,omitempty"`
	Title       string         `json:"title,omitempty"`
	ImageUrl    string         `json:"image_url,omitempty"`
}

Message is an inbox message.

type MessageIntegration

type MessageIntegration int

MessageIntegration is a console messaging channel type.

const (
	MessageIntegrationUnknown MessageIntegration = 0
	MessageIntegrationFCM     MessageIntegration = 1
	MessageIntegrationAPNS    MessageIntegration = 2
)

type MessageIntegrationChannel

type MessageIntegrationChannel int

MessageIntegrationChannel is push vs email.

const (
	MessageIntegrationChannelDefault MessageIntegrationChannel = 0
	MessageIntegrationChannelPush    MessageIntegrationChannel = 1
	MessageIntegrationChannelEmail   MessageIntegrationChannel = 2
)

type MessageIntegrationChannels

type MessageIntegrationChannels struct {
	Channels []MessageIntegrationChannel `json:"channels,omitempty"`
}

MessageIntegrationChannels lists channels for an integration.

type MessageList

type MessageList struct {
	Messages        []*Message `json:"messages,omitempty"`
	NextCursor      string     `json:"next_cursor,omitempty"`
	PrevCursor      string     `json:"prev_cursor,omitempty"`
	CacheableCursor string     `json:"cacheable_cursor,omitempty"`
}

MessageList wraps inbox messages.

type MessageSendIntegrationResult

type MessageSendIntegrationResult struct {
	IntegrationType MessageIntegration        `json:"integration_type,omitempty"`
	Success         bool                      `json:"success,omitempty"`
	ErrorMessage    string                    `json:"error_message,omitempty"`
	ChannelType     MessageIntegrationChannel `json:"channel_type,omitempty"`
}

MessageSendIntegrationResult is per-integration delivery status.

type MessageSendResult

type MessageSendResult struct {
	RecipientID        string                          `json:"recipient_id,omitempty"`
	IntegrationResults []*MessageSendIntegrationResult `json:"integration_results,omitempty"`
}

MessageSendResult is per-recipient delivery status.

type MessageSendResults

type MessageSendResults struct {
	DeliveryResults []*MessageSendResult `json:"delivery_results,omitempty"`
}

MessageSendResults wraps delivery results.

type MessageTemplate

type MessageTemplate struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Title string `json:"title"`
	Value string `json:"value"`
}

MessageTemplate is a Satori console message template.

type MessageTemplateOverride

type MessageTemplateOverride struct {
	Title        string                              `json:"title,omitempty"`
	Value        string                              `json:"value,omitempty"`
	ImageURL     string                              `json:"image_url,omitempty"`
	JsonMetadata string                              `json:"json_metadata,omitempty"`
	Variants     map[string]*MessageTemplateOverride `json:"variants,omitempty"`
}

MessageTemplateOverride overrides template content for a send.

type Properties

type Properties struct {
	Default  map[string]string `json:"default,omitempty"`
	Custom   map[string]string `json:"custom,omitempty"`
	Computed map[string]string `json:"computed,omitempty"`
}

Properties holds default/custom/computed identity properties.

type PropertiesUpdate

type PropertiesUpdate struct {
	Default   map[string]string `json:"default,omitempty"`
	Custom    map[string]string `json:"custom,omitempty"`
	Recompute *bool             `json:"recompute,omitempty"`
}

PropertiesUpdate updates identity properties.

type Satori

type Satori interface {
	Authenticate(ctx context.Context, id string, defaultProperties, customProperties map[string]string, noSession bool, ipAddress ...string) (*Properties, error)
	IdentityDelete(ctx context.Context, id string) error
	PropertiesGet(ctx context.Context, id string) (*Properties, error)
	PropertiesUpdate(ctx context.Context, id string, properties *PropertiesUpdate) error
	EventsPublish(ctx context.Context, id string, events []*Event, ipAddress ...string) error
	ServerEventsPublish(ctx context.Context, events []*Event, ipAddress ...string) error
	ExperimentsList(ctx context.Context, id string, names, labels []string) (*ExperimentList, error)
	FlagsList(ctx context.Context, id string, names, labels []string) (*FlagList, error)
	FlagsOverridesList(ctx context.Context, id string, names, labels []string) (*FlagOverridesList, error)
	LiveEventsList(ctx context.Context, id string, names, labels []string, pastRunCount, futureRunCount int32, startTimeSec, endTimeSec int64) (*LiveEventList, error)
	LiveEventJoin(ctx context.Context, id, liveEventId string) error
	MessagesList(ctx context.Context, id string, limit int, forward bool, cursor string, messageIDs []string) (*MessageList, error)
	MessageUpdate(ctx context.Context, id, messageId string, readTime, consumeTime int64) error
	MessageDelete(ctx context.Context, id, messageId string) error
	ConsoleDirectMessageSend(ctx context.Context, templateId string, recipientIDs []string, integrations []MessageIntegration, persist bool, channels map[MessageIntegration]*MessageIntegrationChannels, templateOverride *MessageTemplateOverride) (*MessageSendResults, error)
}

Satori is the reference-shaped LiveOps client surface.

Jump to

Keyboard shortcuts

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