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, Client client = new Client);
@safe this(Client : HttpClientBase)(string endpoint, shared AtprotoAuth auth, 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
GetPostThreadResult
; -
- app.bsky.feed.ThreadViewPost.Node
thread
; - app.bsky.feed.ThreadgateView
threadgate
;
- @safe JSONValue
getPostThread
(string uri, size_t depth = 6, size_t parentHeight = 80);
@trusted autofetchPostThread
(string uri, size_t depth = 6, size_t parentHeight = 80); - Get posts in a thread
- 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
- struct
GetQuotedByResult
; -
- Post[]
quotedBy
; - string
cursor
;
- @safe JSONValue
getQuotes
(string uri, string cursor, size_t limit = 50);
@safe GetQuotedByResultfetchQuotedByPosts
(string uri, string cursor, size_t len = 100);
@safe Post[]fetchQuotedByPosts
(string uri, size_t len = 100);
@safe FetchRange!PostquotedByPosts
(string uri, string cursor, size_t limit = 100);
@safe FetchRange!PostquotedByPosts
(string uri, size_t limit = 100); - Users who has reposted the post
- @safe string
resolveHandle
(string handle); - Resolve handleResolve handle to DID. Usually https://
/xrpc/com.atproto.identity. resolveHandle
is used for resolution, but if this cannot be obtained, fall back to app.bsky.actor.getProfile.Parameters:string handle handle of user Returns: did - @safe JSONValue
getDidDoc
(string actor); - Get DID documentParameters:
string actor did or handle of user Returns: did document - @safe Bluesky
createPDSClient
(string actor); - Create client of PDSParameters:
string actor did or handle of user Returns: did document - @safe JSONValue
createRecord
(JSONValue record, string collection, JSONValue opts);
@safe JSONValuecreateRecord
(JSONValue record, string collection, string rkey, bool validate, string swapCommit);
@safe JSONValuecreateRecord
(JSONValue record, string collection = "app.bsky.feed.post", string rkey = null, 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 result data - @safe JSONValue
getRecord
(string authority, string collection, string rkey);
@safe JSONValuegetRecord
(AtProtoURI uri);
@safe JSONValuegetRecord
(string uri); - Get repository recordParameters:
string authority Author of repository. string collection Collection of records. string rkey The Record Key. Returns: JSON of result data - @safe void
deleteRecord
(string collection, string rkey, string swapRecord = null, string swapCommit = null);
@safe voiddeleteRecord
(AtProtoURI uri);
@safe voiddeleteRecord
(string uri); - 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 result data - struct
ListRecordItem
; - Record item of com.atproto.repo.listRecords API
- string
uri
; - string
cid
; - JSONValue
value
;
- struct
ListRecords
; - Response of com.atproto.repo.listRecords API
- ListRecordItem[]
records
; - string
cursor
;
- @safe JSONValue
listRecords
(string authority, string collection, size_t limit = 50);
@safe ListRecordsfetchRecords
(string authority, string collection, string cursor, size_t len = 50);
@safe ListRecordItem[]fetchRecords
(string authority, string collection, size_t len = 50);
@safe ListRecordItem[]fetchRecords
(string collection, size_t len = 50);
@safe FetchRange!ListRecordItemlistRecordItems
(string authority, string collection, size_t limit = 100);
@safe FetchRange!ListRecordItemlistRecordItems
(string collection, size_t limit = 100); - List-up repository recordsParameters:
string authority Author of repository. string collection Collection of record Returns: JSON of 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, int width = 0, int height = 0);
@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
- int
width
; - Aspect ratio -
width
- int
height
; - Aspect ratio -
height
- 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
- struct
EmbedVideo
;
@safe app.bsky.embed.VideogetEmbedVideo
(EmbedVideo video);
@safe app.bsky.embed.VideogetEmbedVideo
(immutable(ubyte)[] videoData, string mimeType, string alt, int width = 0, int height = 0); - Embed data of image
- immutable(ubyte)[]
video
; - Binary of imageLimitation: < 1MB
- string
mimeType
; - MimeType of image
- string
alt
; - Alt text
- int
width
; - Aspect ratio -
width
- int
height
; - Aspect ratio -
height
- struct
Caption
;
Caption[]captions
; Caption
file- string
lang
; - immutable(ubyte)[]
data
;
- @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, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, app.bsky.embed.Images.Image image, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, app.bsky.embed.Images images, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, EmbedImage image, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, EmbedImage[] images, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, app.bsky.embed.External external, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, EmbedExternal external, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, app.bsky.embed.Record record, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, EmbedRecord record, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, app.bsky.embed.RecordWithMedia rwm, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, EmbedRecordWithMedia recordWithMedia, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, EmbedRecord record, EmbedImage image, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, EmbedRecord record, EmbedImage[] image, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, EmbedRecord record, EmbedExternal external, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, app.bsky.embed.Video video, JSONValue opts = JSONValue.init);
@safe PostRefsendPost
(string message, EmbedVideo image, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, Embed embed = Embed.init, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.Images images, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.Images.Image[] images, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.Images.Image image, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, EmbedImage image, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, EmbedImage[] images, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.External external, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, EmbedExternal external, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.Record record, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, EmbedRecord record, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.RecordWithMedia recordWithMedia, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, EmbedRecordWithMedia recordWithMedia, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, app.bsky.embed.Video video, JSONValue opts = JSONValue.init);
@safe PostRefsendReplyPost
(string uri, string message, EmbedVideo video, JSONValue opts = JSONValue.init);
@safe PostRefsendQuotePost
(string uri, string message, JSONValue opts = JSONValue.init);
@safe PostRefsendQuotePost
(string uri, string message, app.bsky.embed.Images images, JSONValue opts = JSONValue.init);
@safe PostRefsendQuotePost
(string uri, string message, app.bsky.embed.Images.Image[] images, JSONValue opts = JSONValue.init);
@safe PostRefsendQuotePost
(string uri, string message, app.bsky.embed.Images.Image image, JSONValue opts = JSONValue.init);
@safe PostRefsendQuotePost
(string uri, string message, EmbedImage image, JSONValue opts = JSONValue.init);
@safe PostRefsendQuotePost
(string uri, string message, EmbedImage[] images, JSONValue opts = JSONValue.init);
@safe PostRefsendQuotePost
(string uri, string message, app.bsky.embed.External external, JSONValue opts = JSONValue.init);
@safe PostRefsendQuotePost
(string uri, string message, EmbedExternal external, JSONValue opts = JSONValue.init);
@safe PostRefsendQuotePost
(string uri, string message, app.bsky.embed.Video video, JSONValue opts = JSONValue.init);
@safe PostRefsendQuotePost
(string uri, string message, EmbedVideo video, JSONValue opts = JSONValue.init); - Post messageParameters:
app.bsky.embed.Record record Record of post string message Main text of post app.bsky.embed.Images images Embed images of post JSONValue opts Optional parameter of com.atproto.repo.createRecord
(ex1) langs:JSONValue(["record": JSONValue(["langs": JSONValue(["th", "en-US"])])])
(ex2) validation:JSONValue(["validation": true])
(ex3) optional field:JSONValue(["validation": JSONValue(false), "record": JSONValue(["optionalField": "data"])])
- @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
- @safe StrongRef
follow
(string name); - FollowParameters:
string name Specify the handle or DID of the user you wish to follow
Returns: If successful, a reference to the record is returned - @safe void
unfollow
(string name); - UnfollowParameters:
string name Specify the handle or DID of the user you wish to unfollow