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 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) 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 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.
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.