@atproto/oauth-client-node 0.0.1 → 0.0.2-rc.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +63 -0
- package/package.json +3 -3
package/README.md
CHANGED
@@ -280,6 +280,69 @@ const requestLock: RuntimeLock = async (key, fn) => {
|
|
280
280
|
}
|
281
281
|
```
|
282
282
|
|
283
|
+
## Usage with `@atproto/api`
|
284
|
+
|
285
|
+
`@atproto/oauth-client-*` packages all return an `ApiClient` instance upon
|
286
|
+
successful authentication. This instance can be used to make authenticated
|
287
|
+
requests using all the `ApiClient` methods defined in [[API]] (non exhaustive
|
288
|
+
list of examples below). Any refresh of the credentials will happen under the
|
289
|
+
hood, and the new tokens will be saved in the session store.
|
290
|
+
|
291
|
+
```ts
|
292
|
+
const agent = await client.restore('did:plc:123')
|
293
|
+
|
294
|
+
// Feeds and content
|
295
|
+
await agent.getTimeline(params, opts)
|
296
|
+
await agent.getAuthorFeed(params, opts)
|
297
|
+
await agent.getPostThread(params, opts)
|
298
|
+
await agent.getPost(params)
|
299
|
+
await agent.getPosts(params, opts)
|
300
|
+
await agent.getLikes(params, opts)
|
301
|
+
await agent.getRepostedBy(params, opts)
|
302
|
+
await agent.post(record)
|
303
|
+
await agent.deletePost(postUri)
|
304
|
+
await agent.like(uri, cid)
|
305
|
+
await agent.deleteLike(likeUri)
|
306
|
+
await agent.repost(uri, cid)
|
307
|
+
await agent.deleteRepost(repostUri)
|
308
|
+
await agent.uploadBlob(data, opts)
|
309
|
+
|
310
|
+
// Social graph
|
311
|
+
await agent.getFollows(params, opts)
|
312
|
+
await agent.getFollowers(params, opts)
|
313
|
+
await agent.follow(did)
|
314
|
+
await agent.deleteFollow(followUri)
|
315
|
+
|
316
|
+
// Actors
|
317
|
+
await agent.getProfile(params, opts)
|
318
|
+
await agent.upsertProfile(updateFn)
|
319
|
+
await agent.getProfiles(params, opts)
|
320
|
+
await agent.getSuggestions(params, opts)
|
321
|
+
await agent.searchActors(params, opts)
|
322
|
+
await agent.searchActorsTypeahead(params, opts)
|
323
|
+
await agent.mute(did)
|
324
|
+
await agent.unmute(did)
|
325
|
+
await agent.muteModList(listUri)
|
326
|
+
await agent.unmuteModList(listUri)
|
327
|
+
await agent.blockModList(listUri)
|
328
|
+
await agent.unblockModList(listUri)
|
329
|
+
|
330
|
+
// Notifications
|
331
|
+
await agent.listNotifications(params, opts)
|
332
|
+
await agent.countUnreadNotifications(params, opts)
|
333
|
+
await agent.updateSeenNotifications()
|
334
|
+
|
335
|
+
// Identity
|
336
|
+
await agent.resolveHandle(params, opts)
|
337
|
+
await agent.updateHandle(params, opts)
|
338
|
+
|
339
|
+
// etc.
|
340
|
+
|
341
|
+
if (agent instanceof OAuthAtpAgent) {
|
342
|
+
agent.signOut()
|
343
|
+
}
|
344
|
+
```
|
345
|
+
|
283
346
|
## Advances use-cases
|
284
347
|
|
285
348
|
### Listening for session updates and deletion
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atproto/oauth-client-node",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.2-rc.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ATPROTO OAuth client for the NodeJS",
|
6
6
|
"keywords": [
|
@@ -35,12 +35,12 @@
|
|
35
35
|
"@atproto/jwk": "0.1.1",
|
36
36
|
"@atproto/jwk-jose": "0.1.1",
|
37
37
|
"@atproto/jwk-webcrypto": "0.1.1",
|
38
|
-
"@atproto/oauth-client": "0.1.
|
38
|
+
"@atproto/oauth-client": "0.1.2-rc.0",
|
39
39
|
"@atproto/oauth-types": "0.1.1"
|
40
40
|
},
|
41
41
|
"devDependencies": {
|
42
42
|
"typescript": "^5.3.3",
|
43
|
-
"@atproto/api": "0.
|
43
|
+
"@atproto/api": "0.13.0-rc.0"
|
44
44
|
},
|
45
45
|
"scripts": {
|
46
46
|
"build": "tsc --build tsconfig.build.json"
|