Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) BuildURI(did syntax.DID, collection string, rkey string) string
- func (c *Client) GetHandle(ctx context.Context, client *XrpcClient, did syntax.DID) (string, error)
- func (c *Client) GetRecord(ctx context.Context, repo string, path string) (*at.Message, cbg.CBORMarshaler, error)
- func (c *Client) GetRepoRecord(ctx context.Context, repo string, path string) (*at.Message, error)
- func (c *Client) GetXrpcClient(ctx context.Context, endpoint string) (*XrpcClient, error)
- func (c *Client) LookupDIDEndpoint(ctx context.Context, did syntax.DID) string
- func (c *Client) ParseCARList(ctx context.Context, did syntax.DID, handle string, repoBytes []byte) ([]*at.Message, error)
- func (c *Client) ParseCreatedAt(_ context.Context, createdAt string) (time.Time, bool)
- func (c *Client) ParsePath(path string) (string, string)
- func (c *Client) ParseRecord(ctx context.Context, rec cbg.CBORMarshaler, message *at.Message) (bool, error)
- func (c *Client) ParseRepoStrongRef(ctx context.Context, ref *atproto.RepoStrongRef) (*at.Message, error)
- func (c *Client) ParseURI(uri string) (string, string)
- func (c *Client) SyncGetRepo(ctx context.Context, repoData *atproto.SyncListRepos_Repo) ([]*at.Message, error)
- func (c *Client) SyncListRepos(ctx context.Context, cursor string, limit int64) ([]*at.Message, *string, error)
- type Option
- type XrpcClient
Constants ¶
const ( BskyEndpoint = "https://bsky.social" BskySubscribeURI = "wss://bsky.network/xrpc/com.atproto.sync.subscribeRepos" SyncListReposLimit = 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) BuildURI ¶
BuildURI constructs an AT Protocol URI from its components. Parameters: - did: Repository owner's DID - collection: Record collection identifier - rkey: Record key Returns complete URI in format "at://did/collection/rkey".
func (*Client) GetHandle ¶
GetHandle retrieves the handle (username) for a given DID. Parameters: - did: User's decentralized identifier Returns the user's handle or an error.
func (*Client) GetRepoRecord ¶
GetRepoRecord retrieves a specific record from a repository. Parameters: - repo: The DID of the repository - path: The path in format "collection/rkey" Returns the message containing the record data or an error.
func (*Client) GetXrpcClient ¶
GetXrpcClient returns a cached or new authenticated XRPC client. Parameters: - endpoint: API endpoint URL to connect to Returns authenticated client or error if authentication fails.
func (*Client) LookupDIDEndpoint ¶
func (*Client) ParseCARList ¶
func (c *Client) ParseCARList(ctx context.Context, did syntax.DID, handle string, repoBytes []byte) ([]*at.Message, error)
ParseCARList processes repository data in CAR format and extracts messages. Parameters: - did: Repository owner's DID - handle: User's handle - repoBytes: Raw CAR format repository data Returns list of processed messages from the repository.
func (*Client) ParseCreatedAt ¶
func (*Client) ParsePath ¶
ParsePath splits a path string into collection and rkey components. Parameters: - path: String in format "collection/rkey" Returns collection and rkey as separate strings.
func (*Client) ParseRecord ¶
func (c *Client) ParseRecord(ctx context.Context, rec cbg.CBORMarshaler, message *at.Message) (bool, error)
ParseRecord processes different types of records and updates the message. Parameters: - rec: CBOR marshaled record to parse - message: Message struct to be updated with record data Returns error if record parsing fails.
func (*Client) ParseRepoStrongRef ¶
func (*Client) ParseURI ¶
ParseURI splits an AT Protocol URI into components. Parameters: - uri: Complete AT Protocol URI (format: at://did/collection/rkey) Returns the repository DID and the path.
func (*Client) SyncGetRepo ¶
func (c *Client) SyncGetRepo(ctx context.Context, repoData *atproto.SyncListRepos_Repo) ([]*at.Message, error)
SyncGetRepo retrieves all records from a repository snapshot. Parameters: - repoData: Repository metadata including DID and status Returns list of messages containing the repository records.
func (*Client) SyncListRepos ¶
func (c *Client) SyncListRepos(ctx context.Context, cursor string, limit int64) ([]*at.Message, *string, error)
SyncListRepos fetches a paginated list of repository updates. Parameters: - cursor: Pagination token, empty for first page - limit: Maximum number of repos to fetch Returns list of messages and the next cursor for pagination.