Skip to content

Commit

Permalink
Fix bluesky-social#152 http reference introduction add BskyAgent basi…
Browse files Browse the repository at this point in the history
…c example
  • Loading branch information
boly38 committed May 31, 2024
1 parent 6319f3f commit e894dc4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion docs/api/at-protocol-xrpc-api.info.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,25 @@ import Export from "@theme/ApiExplorer/Export";



This section contains HTTP API reference docs for Bluesky and AT Protocol lexicons. Generate a bearer token to test API calls directly from the docs.
This section contains HTTP API reference docs for Bluesky and AT Protocol lexicons.

You could generate a bearer token to test API calls directly from the docs.

You could also use `BskyAgent` directly. In this is an example, `BskyAgent` instance will call actor `getPreferences` api :

```javascript
import process from "node:process";
import {BskyAgent} from '@atproto/api';
const {"BLUESKY_USERNAME": identifier, "BLUESKY_PASSWORD": password} = process.env;// creds from env
const agent = new BskyAgent({"service": "https://api.bsky.social"})
await agent.login({identifier, password});

// api call
const response = await agent.api.app.bsky.actor.getPreferences();

const {preferences} = response.data
console.log(`${identifier}'s preferences:\n` + JSON.stringify(preferences, null, 2));
```

<div
style={{"marginBottom":"2rem"}}
Expand Down

0 comments on commit e894dc4

Please sign in to comment.