bsky.client
Bluesky
client
License:
BSL-1.0
- struct
FetchRange
(T); -
- const @safe bool
empty
(); - const @trusted T
front
(); - @safe void
popFront
(); - @safe void
setFetchLength
(size_t len);
- class
Bluesky
; Bluesky
client- alias
ReplyRef
= bsky.lexicons.app.bsky.feed.Post.ReplyRef
; - alias
PostRef
= bsky.lexicons.com.atproto.repo.StrongRef; - alias
Post
= bsky.post.Post
; - @trusted this(Client = CurlHttpClient!())(string endpoint, AtprotoAuth auth = null, Client client = new Client);
@trusted this(Client : HttpClientBase)(string endpoint, AtprotoAuth auth = null, Client client);
@safe this(Client = CurlHttpClient!())(string endpoint, shared AtprotoAuth auth = null, Client client = new Client);
@safe this(Client : HttpClientBase)(string endpoint, shared AtprotoAuth auth = null, Client client);
@trusted this(Client = CurlHttpClient!())(AtprotoAuth auth, Client client = new Client);
@trusted this(Client : HttpClientBase)(AtprotoAuth auth, Client client);
@safe this(Client = CurlHttpClient!())(shared AtprotoAuth auth, Client client = new Client);
@safe this(Client : HttpClientBase)(shared AtprotoAuth auth, Client client);
@safe this(Client = CurlHttpClient!())(Client client = new Client);
@safe this(Client : HttpClientBase)(Client client); - Constructor
- @trusted void
login
(AtprotoAuth auth);
@safe voidlogin
(shared AtprotoAuth auth);
@safe voidlogin
(Client = CurlHttpClient!())(string id, string password, Client client = null);
@safe voidlogin
(Client : HttpClientBase)(string id, string password, Client client); - Login
- @safe void
logout
(); - Logout
- const @safe bool
available
(); - Account availability
- enum
AutoUpdateStrategy
: int; - Auto update access token types
none
herf
before5min
expired
- @safe void
autoUpdateAccessTokens
(bool cond);
@safe voidautoUpdateAccessTokens
(AutoUpdateStrategy type);
const @safe AutoUpdateStrategyautoUpdateAccessTokens
(); - Auto update access tokens
- @safe JSONValue
getProfile
(string name = null);
@trusted Profileprofile
(string name = null);
@trusted JSONValuegetProfiles
(string[] actors);
@safe Profile[]fetchProfiles
(string[] names);
@safe FetchRange!Profileprofiles
(string[] names); - Profile
getProfile
: Raw API execution.profile
: Get targetprofile
.getProfiles
: Raw API execution.fetchProfiles
: Execute multiple APIs to get all data.profiles
: Range to perform API execution when needed.
Parameters:string name did or handle, default is user of current session. string[] names did or handle list string[] actors did or handle list, max length is 25 - @safe JSONValue
getFollowers
(string actor, string cursor = null, size_t limit = 100);
@safe User[]fetchFollowers
(string name, size_t len = 100);
@safe User[]fetchFollowers
();
@safe FetchRange!Userfollowers
(string name, size_t limit = 100);
@safe FetchRange!Userfollowers
(); - Followers
getFollowers
: Raw API execution.fetchFollowers
: Execute multiple APIs to get all data.followers
: Range to perform API execution when needed.
Parameters:string name did or handle, default is user of current session. string actor did or handle, default is user of current session. string cursor Cursor for sequential data retrieval. size_t len Number of data to be acquired at one time. size_t limit Number to retrieve in a single API run. - @safe JSONValue
getFollows
(string actor, string cursor = null, size_t limit = 50);
@safe User[]fetchFollows
(string name, size_t len = 100);
@safe User[]fetchFollows
();
@safe FetchRange!Userfollows
(string name, size_t limit = 100);
@safe FetchRange!Userfollows
(); - Follows
getFollows
: Raw API executionfetchFollows
: Execute multiple APIs to get all data.follows
: Range to perform API execution when needed.
Parameters:string name did or handle, default is user of current session. string actor did or handle, default is user of current session. string cursor Cursor for sequential data retrieval. size_t limit Number to retrieve in a single API run. - struct
TimelineResult
; - Result of get timeline
- Feed[]
feed
; - string
cursor
;
- @safe JSONValue
getTimeline
(string cursor, size_t limit);
@safe TimelineResultfetchTimeline
(string cursor, size_t len = 100);
@safe Feed[]fetchTimeline
(size_t len);
@safe FetchRange!Feedtimeline
(string cursor, size_t limit = 100);
@safe FetchRange!Feedtimeline
(size_t limit = 100); - Get
timeline
getTimeline
: Raw API execution.fetchTimeline
: Execute multiple APIs to get all data.timeline
: Range to perform API execution when needed.
- alias
AuthorFeedResult
= TimelineResult; - @safe JSONValue
getAuthorFeed
(string actor, string cursor, size_t limit = 50);
@safe AuthorFeedResultfetchAuthorFeed
(string name, string cursor, size_t len = 100);
@safe FetchRange!FeedauthorFeed
(string name, string cursor, size_t limit = 100);
@safe FetchRange!FeedauthorFeed
(string name, size_t limit = 100);
@safe FetchRange!FeedauthorFeed
(size_t limit = 100); - Posts and reposts by any user
getAuthorFeed
:fetchAuthorFeed
:authorFeed
:
Parameters:string name did or handle, default is user of current session. string actor did or handle, default is user of current session. - alias
FeedResult
= TimelineResult; - @safe JSONValue
getFeed
(string feedUri, string cursor, size_t limit = 50);
@safe FeedResultfetchFeed
(string feedUri, string cursor, size_t len = 100);
@safe FetchRange!Feedfeed
(string feedUri, string cursor, size_t limit = 100);
@safe FetchRange!Feedfeed
(string feedUri, size_t limit = 100); - Posts by any
feed
- alias
ListFeedResult
= TimelineResult; - @safe JSONValue
getListFeed
(string listUri, string cursor, size_t limit = 50);
@safe autofetchListFeed
(string listUri, string cursor, size_t len);
@safe FetchRange!FeedlistFeed
(string listUri, string cursor, size_t limit = 100);
@safe FetchRange!FeedlistFeed
(string listUri, size_t limit = 100); - Posts by any feed
- struct
SearchPostsResult
; - Result of search posts
- string
cursor
; - size_t
hitsTotal
; - Post[]
posts
;
- @safe JSONValue
searchPosts
(string query, string cursor, size_t limit = 50);
@safe SearchPostsResultfetchSearchPosts
(string query, string cursor, size_t len = 100);
@safe Post[]fetchSearchPosts
(string query, size_t len = 100);
@safe FetchRange!PostsearchPostItems
(string query, string cursor, size_t limit = 100);
@safe FetchRange!PostsearchPostItems
(string query, size_t limit = 100); - Search posts
- @safe JSONValue
getPosts
(string[] uris);
@safe Post[]fetchPosts
(string[] uris);
@safe autogetPostItems
(Range)(Range uris)
if(is(imported!"std.range".ElementType!Range : string)); - struct
GetRepostResult
; -
- User[]
repostedBy
; - string
cursor
;
- @safe JSONValue
getRepostedBy
(string uri, string cursor, size_t limit = 50);
@safe GetRepostResultfetchRepostedByUsers
(string uri, string cursor, size_t len = 100);
@safe User[]fetchRepostedByUsers
(string uri, size_t len = 100);
@safe FetchRange!UserrepostedByUsers
(string uri, string cursor, size_t limit = 100);
@safe FetchRange!UserrepostedByUsers
(string uri, size_t limit = 100); - Users who has reposted the post
- struct
Like
;
structGetLikeResult
; -
- SysTime
indexedAt
; - SysTime
createdAt
; - User
actor
;
- @safe JSONValue
getLikes
(string uri, string cursor, size_t limit = 50);
@safe GetLikeResultfetchLikeUsers
(string uri, string cursor, size_t len = 100);
@safe Like[]fetchLikeUsers
(string uri, size_t len = 100);
@safe FetchRange!LikelikeUsers
(string uri, string cursor, size_t limit = 100);
@safe FetchRange!LikelikeUsers
(string uri, size_t limit = 100); - Users who has liked the post
- @safe string
resolveHandle
(string handle); - Resolve handleParameters:
string handle handle of user Returns: did - @safe JSONValue
createRecord
(JSONValue record, string collection = "app.bsky.feed.post", string rkey = null, bool validate = true, string swapCommit = null); - Create repository recordParameters:
JSONValue record Record to create as string collection Collection of record bool validate Can be set to ' false
' to skip Lexicon schema validation of record data, 'true
' to require it, or leave unset to validate only for known Lexicons.string rkey The Record Key. string swapCommit Compare and swap with the previous commit by CID. Returns: JSON of upload result data - @safe void
deleteRecord
(string collection, string rkey, string swapRecord = null, string swapCommit = null); - Delete repository recordParameters:
string collection Collection of record string rkey refresh key of record string swapRecord Swap Record string swapCommit Swap Commit Returns: JSON of upload result data - @safe Blob
uploadBlob
(immutable(ubyte)[] data, string mimeType); - Upload blob dataParameters:
immutable(ubyte)[] data Upload data string mimeType Upload data type Returns: JSON of upload result data - @safe StrongRef
getRecordRef
(string uri);
aliasgetPostRef
= getRecordRef; - Reply data from URIParameters:
string uri URI of reply parent Returns:PostRef: bsky.lexcons.com.atproto.repo.StrongRef - struct
EmbedImage
;
@safe app.bsky.embed.Images.ImagegetEmbedImage
(EmbedImage image);
@safe app.bsky.embed.Images.ImagegetEmbedImage
(immutable(ubyte)[] imageData, string mimeType, string alt);
@safe app.bsky.embed.ImagesgetEmbedImages
(EmbedImage[] images); - Embed data of image
- immutable(ubyte)[]
image
; - Binary of
image
Limitation: < 1MB - string
mimeType
; - MimeType of image
- string
alt
; - Alt text
- struct
EmbedExternal
;
@safe app.bsky.embed.ExternalgetEmbedExternal
(EmbedExternal external);
@safe app.bsky.embed.ExternalgetEmbedExternal
(string uri, string title, string description, immutable(ubyte)[] thumb = null, string thumbMimeType = null); - Embed data of external link
- string
uri
; - URL of external link
- string
title
; - Title of external link
- string
description
; - Descriptions
- immutable(ubyte)[]
thumb
; - Thumbnail of external link
- string
thumbMimeType
; - Thumbnail of external link
- alias
EmbedRecord
= bsky.lexicons.com.atproto.repo.StrongRef; - Embed data of external link
- struct
EmbedRecordWithMedia
; - Embed data of external link
- PostRef
record
; - URI of
record
- alias
Media
= std.sumtype.SumType!(EmbedImage[], EmbedExternal).SumType;
Mediamedia
; - Image data
- alias
EmbedData
= std.sumtype.SumType!(EmbedImage[], EmbedExternal, StrongRef, EmbedRecordWithMedia).SumType; - @safe ReplyRef
getReplyRef
(string uri); - Reply data from URIParameters:
string uri URI of reply parent Returns:ReplyRef: bsky.lexcons.app.bsky.feed.ReplyRef - @safe PostRef
sendPost
(string message, Embed embed, ReplyRef replyRef = ReplyRef.init, string[] langs = null);
@safe PostRefsendPost
(string message, EmbedData embed, ReplyRef replyRef = ReplyRef.init, string[] langs = null);
@safe PostRefsendPost
(string message, string[] langs = null);
@safe PostRefsendPost
(string message, app.bsky.embed.Images.Image image, string[] langs = null);
@safe PostRefsendPost
(string message, app.bsky.embed.Images images, string[] langs = null);
@safe PostRefsendPost
(string message, EmbedImage image, string[] langs = null);
@safe PostRefsendPost
(string message, EmbedImage[] images, string[] langs = null);
@safe PostRefsendPost
(string message, app.bsky.embed.External external, string[] langs = null);
@safe PostRefsendPost
(string message, EmbedExternal external, string[] langs = null);
@safe PostRefsendPost
(string message, app.bsky.embed.Record record, string[] langs = null);
@safe PostRefsendPost
(string message, EmbedRecord record, string[] langs = null);
@safe PostRefsendPost
(string message, app.bsky.embed.RecordWithMedia rwm, string[] langs = null);
@safe PostRefsendPost
(string message, EmbedRecordWithMedia recordWithMedia, string[] langs = null);
@safe PostRefsendPost
(string message, EmbedRecord record, EmbedImage image, string[] langs = null);
@safe PostRefsendPost
(string message, EmbedRecord record, EmbedImage[] image, string[] langs = null);
@safe PostRefsendPost
(string message, EmbedRecord record, EmbedExternal external, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, Embed embed = Embed.init, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.Images images, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.Images.Image[] images, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.Images.Image image, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, EmbedImage image, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, EmbedImage[] images, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.External external, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, EmbedExternal external, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.Record record, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, EmbedRecord record, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.RecordWithMedia recordWithMedia, string[] langs = null);
@safe PostRefsendReplyPost
(string uri, string message, EmbedRecordWithMedia recordWithMedia, string[] langs = null);
@safe PostRefsendQuotePost
(string uri, string message, string[] langs = null);
@safe PostRefsendQuotePost
(string uri, string message, app.bsky.embed.Images images, string[] langs = null);
@safe PostRefsendQuotePost
(string uri, string message, app.bsky.embed.Images.Image[] images, string[] langs = null);
@safe PostRefsendQuotePost
(string uri, string message, app.bsky.embed.Images.Image image, string[] langs = null);
@safe PostRefsendQuotePost
(string uri, string message, EmbedImage image, string[] langs = null);
@safe PostRefsendQuotePost
(string uri, string message, EmbedImage[] images, string[] langs = null);
@safe PostRefsendQuotePost
(string uri, string message, app.bsky.embed.External external, string[] langs = null);
@safe PostRefsendQuotePost
(string uri, string message, EmbedExternal external, string[] langs = null); - Post messageParameters:
app.bsky.embed.Record record Record of post string message Main text of post string[] langs Array of language of post, default ( null
) is nothingapp.bsky.embed.Images images Embed images of post - @safe void
deletePost
(string uri); - Delete posts
- @trusted StrongRef
markLike
(string uri); - Mark like the post
- @safe void
deleteLike
(string uri); - Delete like mark
- @safe StrongRef
repost
(string uri); - Repost posts
- @safe void
deleteRepost
(string uri); - Delete the repost