ai/at
ai/at
1
0
5 curl
syui edited this page 2024-10-30 20:01:16 +00:00

version

$ curl -sL syu.is/xrpc/_health

did

$ curl -sL "syu.is/xrpc/com.atproto.repo.describeRepo?repo=ai.syu.is" |jq -r .did
$ curl -sL plc.syu.is/did:plc:6qyecktefllvenje24fcxnie

timeline

$ curl -sL "syu.is/xrpc/com.atproto.repo.listRecords?repo=ai.syu.is&collection=app.bsky.feed.post&reverse=true&limit=1" 

invite code

host=syu.is
admin_password=xxx
url=https://${host}/xrpc/com.atproto.server.createInviteCode
json="{\"useCount\":1}"
curl -X POST -u admin:${admin_password} -H "Content-Type: application/json" -d "$json" -sL $url

create account

host=syu.is
url=https://${host}/xrpc/com.atproto.server.createAccount
json="{\"email\": \"$email\", \"handle\": \"$handle\", \"password\": \"$password\"}"
curl -X POST -H "Content-Type: application/json" -d $json -sL $url 

login

# session
host=syu.is
handle=ai.syu.is
password=xxx
url=https://${host}/xrpc/com.atproto.server.createSession
curl -sL -X POST -H "Content-Type: application/json" -d "{\"identifier\":\"$handle\",\"password\":\"$password\"}" $url

# refresh
j=`!!`
token=`echo $j|jq -r .accessJwt`
refresh=`echo $j|jq -r .refreshJwt`
url=https://${host}/xrpc/com.atproto.server.refreshSession
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $refresh" $url

feed

at://did:plc:6qyecktefllvenje24fcxnie/app.bsky.feed.generator/cmd

# https://docs.bsky.app/docs/api/app-bsky-feed-get-feed
token=`cat ~/.config/ai/token.json|jq -r .accessJwt`
url=at://did:plc:6qyecktefllvenje24fcxnie/app.bsky.feed.generator/cmd
curl -sL "https://syu.is/xrpc/app.bsky.feed.getFeed?feed=$url" -H "Authorization: Bearer $token"