sync

package
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 9 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 syncs local events to the SC Bridge API.

func NewClient

func NewClient(endpoint, sessionToken string, s *store.Store) *Client

NewClient creates a sync client using Bearer token auth.

func NewClientWithAPIKey

func NewClientWithAPIKey(endpoint, apiToken string, s *store.Store) *Client

NewClientWithAPIKey creates a sync client using legacy X-API-Key auth.

func (*Client) Heartbeat

func (c *Client) Heartbeat(ctx context.Context, state map[string]string) error

Heartbeat sends a status ping to SC Bridge with current state.

func (*Client) Run

func (c *Client) Run(ctx context.Context) error

Run starts the sync loop. Blocks until ctx is cancelled.

func (*Client) SetOnAuthExpired

func (c *Client) SetOnAuthExpired(fn func())

SetOnAuthExpired sets a callback for 401 responses.

func (*Client) SetSyncCheck

func (c *Client) SetSyncCheck(fn func(string) bool)

SetSyncCheck sets a filter function for event types.

type SyncEvent

type SyncEvent struct {
	Type      string            `json:"type"`
	Source    string            `json:"source"`
	Timestamp string            `json:"timestamp"`
	Data      map[string]string `json:"data"`
}

SyncEvent is a single event in the sync payload.

type SyncPayload

type SyncPayload struct {
	Events []SyncEvent `json:"events"`
}

SyncPayload is sent to the SC Bridge API.

Jump to

Keyboard shortcuts

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