tapc

package
v1.14.1-alpha Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 11 Imported by: 0

README

basic tap client package

Replace this to official indigo package when https://github.com/bluesky-social/indigo/pull/1241 gets merged.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Url           string
	AdminPassword string
	HTTPClient    *http.Client
}

func NewClient

func NewClient(url, adminPassword string) Client

func (*Client) AddRepos

func (c *Client) AddRepos(ctx context.Context, dids []syntax.DID) error

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, handler Handler) error

func (*Client) RemoveRepos

func (c *Client) RemoveRepos(ctx context.Context, dids []syntax.DID) error

type ConnectHandler

type ConnectHandler interface {
	OnConnect(ctx context.Context)
}

type Event

type Event struct {
	ID       int64              `json:"id"`
	Type     EventType          `json:"type"`
	Record   *RecordEventData   `json:"record,omitempty"`
	Identity *IdentityEventData `json:"identity,omitempty"`
}

type EventType

type EventType string
const (
	EvtRecord   EventType = "record"
	EvtIdentity EventType = "identity"
)

type Handler

type Handler interface {
	OnEvent(ctx context.Context, evt Event) error
	OnError(ctx context.Context, err error)
}

type IdentityEventData

type IdentityEventData struct {
	DID      syntax.DID `json:"did"`
	Handle   string     `json:"handle"`
	IsActive bool       `json:"is_active"`
	Status   RepoStatus `json:"status"`
}

type RecordAction

type RecordAction string
const (
	RecordCreateAction RecordAction = "create"
	RecordUpdateAction RecordAction = "update"
	RecordDeleteAction RecordAction = "delete"
)

type RecordEventData

type RecordEventData struct {
	Live       bool             `json:"live"`
	Did        syntax.DID       `json:"did"`
	Rev        string           `json:"rev"`
	Collection syntax.NSID      `json:"collection"`
	Rkey       syntax.RecordKey `json:"rkey"`
	Action     RecordAction     `json:"action"`
	Record     json.RawMessage  `json:"record,omitempty"`
	CID        *syntax.CID      `json:"cid,omitempty"`
}

func (*RecordEventData) AtUri

func (r *RecordEventData) AtUri() syntax.ATURI

type RepoStatus

type RepoStatus string
const (
	RepoStatusActive      RepoStatus = "active"
	RepoStatusTakendown   RepoStatus = "takendown"
	RepoStatusSuspended   RepoStatus = "suspended"
	RepoStatusDeactivated RepoStatus = "deactivated"
	RepoStatusDeleted     RepoStatus = "deleted"
)

type SimpleIndexer

type SimpleIndexer struct {
	EventHandler   func(ctx context.Context, evt Event) error
	ErrorHandler   func(ctx context.Context, err error)
	ConnectHandler func(ctx context.Context)
}

func (*SimpleIndexer) OnConnect

func (i *SimpleIndexer) OnConnect(ctx context.Context)

func (*SimpleIndexer) OnError

func (i *SimpleIndexer) OnError(ctx context.Context, err error)

func (*SimpleIndexer) OnEvent

func (i *SimpleIndexer) OnEvent(ctx context.Context, evt Event) error

Source Files

  • simple_indexer.go
  • tap.go
  • types.go

Jump to

Keyboard shortcuts

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