A convenience library to access Bluesky API.
Gauche 0.9.13 or later
You need to have Bluesky handle and its app password. The first thing
you do is to call make-bsky-session
with those parameters to obtain
a <bsky-session>
object, which can be used for subsequent API calls.
(make-bsky-session :optional handle app-password)
accesses bsky.app
to get a session token. Returns <bsky-session>
on success.
Throws <bsky-error>
condition if something goes wrong.
If handle and/or app-password is omitted, values of the environment
variable GAUCHE_BSKY_HANDLE
and GAUCHE_BSKY_APP_PASSWORD
are used, respectively.
You need to know the rkey to retrieve a post. Rkey is shown in the last part of the post’s URL.
(bsky-get-record session rkey)
returns <bsky-record>
of the post.
Currently, only a simple text posting is supported.
(bsky-post-text session text :key created-at langs quote-post reply)
posts text.
-
Created-at is the post’s timestamp, and the current time is used when omitted.
-
Langs must be a list of language tags (e.g.
"en_US"
or"ja"
). -
Quoted-post must be a
<bsky-record>
of the post to quote. -
Reply must be a two-element list of
<bsky-record>
, the first element is the root post of the thread, and the second element is the direct parent of the post.
The actor argument of the following procedures should be DID of a user.
-
(bsky-get-followers session actor)
-
(bsky-get-follows session actor)
-
(bsky-get-listss session actor)
Returns the given user’s list of followers, follows, and lists.
If Bluesky API call fails, a condition of type <bsky-error>
is thrown.
Along with the error message in the API response, the condition
has the following slots.
-
status-code
: String HTTP status code. -
http-headers
: List of http response headers, in the form ashttp-get
orhttp-post
returned. -
payload
: If the response is in JSON, a parsed JSON structure. Otherwise, a string of the response body.
You can throw <bsky-error>
with (bsky-error status-code http-headers body)
.