Documentation
¶
Overview ¶
Package atproto is a pure-Go, dependency-free read client for Bluesky and the AT Protocol, talking to the XRPC HTTP API.
By default the client targets the public Bluesky AppView at https://public.api.bsky.app, which serves read methods without authentication. Optionally, Login exchanges credentials for an access token so that authenticated methods such as Timeline can be used.
Index ¶
- Constants
- type Actor
- type ActorPage
- type Author
- type Client
- func (c *Client) AuthorFeed(ctx context.Context, actor string, limit int, cursor string) (*Feed, error)
- func (c *Client) Login(ctx context.Context, identifier, password string) error
- func (c *Client) SearchActors(ctx context.Context, q string, limit int, cursor string) (*ActorPage, error)
- func (c *Client) SearchPosts(ctx context.Context, q string, limit int, cursor string) (*Feed, error)
- func (c *Client) Timeline(ctx context.Context, limit int, cursor string) (*Feed, error)
- type Feed
- type Image
- type Option
- type Post
Constants ¶
const DefaultService = "https://public.api.bsky.app"
DefaultService is the public Bluesky AppView, which serves read XRPC methods without authentication.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶ added in v0.2.0
type Actor struct {
DID string
Handle string // e.g. "alice.bsky.social" (follow as @<Handle>)
DisplayName string
Description string
Avatar string
}
Actor is a Bluesky account profile returned by an actor search.
type Client ¶
type Client struct {
// Service is the base URL of the XRPC service (default DefaultService).
Service string
// HTTPClient is the underlying HTTP client (default http.DefaultClient).
HTTPClient *http.Client
// UserAgent is sent as the User-Agent header on every request.
UserAgent string
// contains filtered or unexported fields
}
Client is an AT Protocol / Bluesky XRPC read client.
func (*Client) AuthorFeed ¶
func (c *Client) AuthorFeed(ctx context.Context, actor string, limit int, cursor string) (*Feed, error)
AuthorFeed returns the feed of posts authored by actor (a handle or DID) via app.bsky.feed.getAuthorFeed.
func (*Client) Login ¶
Login exchanges credentials for an access token via com.atproto.server.createSession and stores it for subsequent authenticated calls. Note that the default public AppView does not host createSession; set a PDS URL (e.g. https://bsky.social) with WithService to authenticate.
func (*Client) SearchActors ¶ added in v0.2.0
func (c *Client) SearchActors(ctx context.Context, q string, limit int, cursor string) (*ActorPage, error)
SearchActors returns the accounts matching q via app.bsky.actor.searchActors, a public (unauthenticated) read on the default AppView — used to discover accounts to follow. limit caps the page (0 = server default); cursor pages.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithHTTPClient ¶
WithHTTPClient sets the underlying HTTP client.
func WithService ¶
WithService sets the base URL of the XRPC service.
func WithUserAgent ¶
WithUserAgent sets the User-Agent header sent on every request.
