Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #152 http reference introduction add BskyAgent basic example #153

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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