Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type Profile
- func (p *Profile) ResolveAvatar(ctx context.Context) error
- func (p *Profile) ResolveAvatarWithLimit(ctx context.Context, bytes uint64) error
- func (p *Profile) ResolveBanner(ctx context.Context) error
- func (p *Profile) ResolveBannerWithLimit(ctx context.Context, bytes uint64) error
- func (p *Profile) ResolveFollowees(ctx context.Context) error
- func (p *Profile) ResolveFollowers(ctx context.Context) error
- func (p *Profile) StreamFollowees(ctx context.Context) (<-chan *User, <-chan error)
- func (p *Profile) StreamFollowers(ctx context.Context) (<-chan *User, <-chan error)
- func (p *Profile) String() string
- type User
Constants ¶
const (
// ServerBskySocial is the original Bluesky server operated by the team.
ServerBskySocial = "https://bsky.social"
)
Variables ¶
var ( // are rejected by the server or the local client (master credentials). ErrLoginUnauthorized = errors.New("unauthorized") // ErrMasterCredentials is returned from a login attempt if the credentials // are valid on the Bluesky server, but they are the user's master password. // Since that is a security malpractice, this library forbids it. ErrMasterCredentials = errors.New("master credentials used") // ErrSessionExpired is returned from any API call if the underlying session // has expired and a new login from scratch is required. ErrSessionExpired = errors.New("session expired") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an API client attached to (and authenticated to) a Bluesky PDS instance.
func Dial ¶
Dial connects to a remote Bluesky server and exchanges some basic information to ensure the connectivity works.
func DialWithClient ¶
DialWithClient connects to a remote Bluesky server using a user supplied HTTP client and exchanges some basic information to ensure the connectivity works.
func (*Client) Close ¶
Close terminates the client, shutting down all pending tasks and background operations.
func (*Client) CustomCall ¶
CustomCall is a wildcard method for executing atproto API calls that are not (yet?) implemented by this library. The user needs to provide a callback that will receive an XRPC client to do direct atproto calls through.
Note, the caller should not hold onto the xrpc.Client. The client is a copy of the internal one and will not receive JWT token updates, so it *will* be a dud after the JWT expiration time passes.
func (*Client) FetchProfile ¶
FetchProfile retrieves all the metadata about a specific user.
Supported IDs are the Bluesky handles or atproto DIDs.
type Profile ¶
type Profile struct { Handle string // User-friendly - unstable - identifier for the user DID string // Machine friendly - stable - identifier for the user Name string // Display name to use in various apps Bio string // Profile description to use in various apps AvatarURL string // CDN URL to the user's profile picture, empty if unset Avatar image.Image // Profile picture, nil if unset or not yet resolved BannerURL string // CDN URL to the user's banner picture, empty if unset Banner image.Image // Banner picture, nil if unset ot not yet resolved FollowerCount uint // Number of people who follow this user Followers []*User // Actual list of followers, nil if not yet resolved FolloweeCount uint // Number of people who this user follows Followees []*User // Actual list of followees, nil if not yet resolved PostCount uint // Number of posts this user made // contains filtered or unexported fields }
Profile represents a user profile on a Bluesky server.
func (*Profile) ResolveAvatar ¶
ResolveAvatar resolves the profile avatar from the server URL and injects it into the profile itself. If the avatar (URL) is unset, the method will return success and leave the image in the profile nil.
Note, the method will place a sanity limit on the maximum size of the image in bytes to avoid malicious content. You may use the ResolveAvatarWithLimit to override and potentially disable this protection.
func (*Profile) ResolveAvatarWithLimit ¶
ResolveAvatarWithLimit resolves the profile avatar from the server URL using a custom data download limit (set to 0 to disable entirely) and injects it into the profile itself. If the avatar (URL) is unset, the method will return success and leave the image in the profile nil.
func (*Profile) ResolveBanner ¶
ResolveBanner resolves the profile banner from the server URL and injects it into the profile itself. If the banner (URL) is unset, the method will return success and leave the image in the profile nil.
Note, the method will place a sanity limit on the maximum size of the image in bytes to avoid malicious content. You may use the ResolveBannerWithLimit to override and potentially disable this protection.
func (*Profile) ResolveBannerWithLimit ¶
ResolveBannerWithLimit resolves the profile banner from the server URL using a custom data download limit (set to 0 to disable entirely) and injects it into the profile itself. If the banner (URL) is unset, the method will return success and leave the image in the profile nil.
func (*Profile) ResolveFollowees ¶
ResolveFollowees resolves the full list of followees of a profile and injects it into the profile itself.
Note, since there is a fairly low limit on retrievable followees per API call, this method might take a while to complete on larger accounts. You may use the StreamFollowees to have finer control over the rate of retrievals, interruptions and memory usage.
func (*Profile) ResolveFollowers ¶
ResolveFollowers resolves the full list of followers of a profile and injects it into the profile itself.
Note, since there is a fairly low limit on retrievable followers per API call, this method might take a while to complete on larger accounts. You may use the StreamFollowers to have finer control over the rate of retrievals, interruptions and memory usage.
func (*Profile) StreamFollowees ¶
StreamFollowees gradually resolves the full list of followees of a profile, feeding them async into a result channel, closing the channel when there are no more followees left. An error channel is also returned and will receive (optionally, only ever one) error in case of a failure.
Note, this method is meant to process the followeer list as a stream, and will thus not populate the profile's followees field.
func (*Profile) StreamFollowers ¶
StreamFollowers gradually resolves the full list of followers of a profile, feeding them async into a result channel, closing the channel when there are no more followers left. An error channel is also returned and will receive (optionally, only ever one) error in case of a failure.
Note, this method is meant to process the follower list as a stream, and will thus not populate the profile's followers field.
type User ¶
type User struct { Handle string // User-friendly - unstable - identifier for the follower DID string // Machine friendly - stable - identifier for the follower Name string // Display name to use in various apps Bio string // Profile description to use in various apps AvatarURL string // CDN URL to the user's profile picture, empty if unset Avatar image.Image // Profile picture, nil if unset or not yet fetched // contains filtered or unexported fields }
User tracks some metadata about a user on a Bluesky server.
func (*User) ResolveAvatar ¶
ResolveAvatar resolves the user avatar from the server URL and injects it into the user itself. If the avatar (URL) is unset, the method will return success and leave the image in the user nil.
Note, the method will place a sanity limit on the maximum size of the image in bytes to avoid malicious content. You may use the ResolveAvatarWithLimit to override and potentially disable this protection.
func (*User) ResolveAvatarWithLimit ¶
ResolveAvatarWithLimit resolves the user avatar from the server URL using a custom data download limit (set to 0 to disable entirely) and injects it into the user itself. If the avatar (URL) is unset, the method will return success and leave the image in the user nil.