@atproto/api 0.9.3 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/agent.d.ts +1 -1
- package/dist/bsky-agent.d.ts +2 -1
- package/dist/client/index.d.ts +6 -0
- package/dist/client/lexicons.d.ts +134 -0
- package/dist/client/types/app/bsky/actor/defs.d.ts +7 -1
- package/dist/client/types/app/bsky/graph/defs.d.ts +15 -0
- package/dist/client/types/app/bsky/graph/getRelationships.d.ts +27 -0
- package/dist/client/types/com/atproto/temp/checkSignupQueue.d.ts +19 -0
- package/dist/index.js +374 -155
- package/dist/index.js.map +3 -3
- package/dist/types.d.ts +5 -0
- package/package.json +2 -2
- package/src/agent.ts +2 -2
- package/src/bsky-agent.ts +27 -0
- package/src/client/index.ts +26 -0
- package/src/client/lexicons.ts +146 -0
- package/src/client/types/app/bsky/actor/defs.ts +19 -0
- package/src/client/types/app/bsky/graph/defs.ts +41 -0
- package/src/client/types/app/bsky/graph/getRelationships.ts +49 -0
- package/src/client/types/com/atproto/temp/checkSignupQueue.ts +35 -0
- package/src/types.ts +9 -0
- package/tests/bsky-agent.test.ts +109 -0
package/dist/types.d.ts
CHANGED
|
@@ -41,6 +41,10 @@ export interface BskyThreadViewPreference {
|
|
|
41
41
|
prioritizeFollowedUsers: boolean;
|
|
42
42
|
[key: string]: any;
|
|
43
43
|
}
|
|
44
|
+
export interface BskyInterestsPreference {
|
|
45
|
+
tags: string[];
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}
|
|
44
48
|
export interface BskyPreferences {
|
|
45
49
|
feeds: {
|
|
46
50
|
saved?: string[];
|
|
@@ -51,5 +55,6 @@ export interface BskyPreferences {
|
|
|
51
55
|
adultContentEnabled: boolean;
|
|
52
56
|
contentLabels: Record<string, BskyLabelPreference>;
|
|
53
57
|
birthDate: Date | undefined;
|
|
58
|
+
interests: BskyInterestsPreference;
|
|
54
59
|
}
|
|
55
60
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/api",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Client library for atproto and Bluesky",
|
|
6
6
|
"keywords": [
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"common-tags": "^1.8.2",
|
|
30
30
|
"@atproto/lex-cli": "^0.3.0",
|
|
31
|
-
"@atproto/dev-env": "^0.2.
|
|
31
|
+
"@atproto/dev-env": "^0.2.28"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"codegen": "pnpm docgen && node ./scripts/generate-code.mjs && lex gen-api ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*",
|
package/src/agent.ts
CHANGED
|
@@ -231,7 +231,7 @@ export class AtpAgent {
|
|
|
231
231
|
// handle session-refreshes as needed
|
|
232
232
|
if (isErrorResponse(res, ['ExpiredToken']) && this.session?.refreshJwt) {
|
|
233
233
|
// attempt refresh
|
|
234
|
-
await this.
|
|
234
|
+
await this.refreshSession()
|
|
235
235
|
|
|
236
236
|
// resend the request with the new access token
|
|
237
237
|
res = await AtpAgent.fetch(
|
|
@@ -250,7 +250,7 @@ export class AtpAgent {
|
|
|
250
250
|
* - Wraps the actual implementation in a promise-guard to ensure only
|
|
251
251
|
* one refresh is attempted at a time.
|
|
252
252
|
*/
|
|
253
|
-
|
|
253
|
+
async refreshSession() {
|
|
254
254
|
if (this._refreshSessionPromise) {
|
|
255
255
|
return this._refreshSessionPromise
|
|
256
256
|
}
|
package/src/bsky-agent.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
BskyLabelPreference,
|
|
12
12
|
BskyFeedViewPreference,
|
|
13
13
|
BskyThreadViewPreference,
|
|
14
|
+
BskyInterestsPreference,
|
|
14
15
|
} from './types'
|
|
15
16
|
|
|
16
17
|
const FEED_VIEW_PREF_DEFAULTS = {
|
|
@@ -323,6 +324,9 @@ export class BskyAgent extends AtpAgent {
|
|
|
323
324
|
adultContentEnabled: false,
|
|
324
325
|
contentLabels: {},
|
|
325
326
|
birthDate: undefined,
|
|
327
|
+
interests: {
|
|
328
|
+
tags: [],
|
|
329
|
+
},
|
|
326
330
|
}
|
|
327
331
|
const res = await this.app.bsky.actor.getPreferences({})
|
|
328
332
|
for (const pref of res.data.preferences) {
|
|
@@ -369,6 +373,13 @@ export class BskyAgent extends AtpAgent {
|
|
|
369
373
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
370
374
|
const { $type, ...v } = pref
|
|
371
375
|
prefs.threadViewPrefs = { ...prefs.threadViewPrefs, ...v }
|
|
376
|
+
} else if (
|
|
377
|
+
AppBskyActorDefs.isInterestsPref(pref) &&
|
|
378
|
+
AppBskyActorDefs.validateInterestsPref(pref).success
|
|
379
|
+
) {
|
|
380
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
381
|
+
const { $type, ...v } = pref
|
|
382
|
+
prefs.interests = { ...prefs.interests, ...v }
|
|
372
383
|
}
|
|
373
384
|
}
|
|
374
385
|
return prefs
|
|
@@ -521,6 +532,22 @@ export class BskyAgent extends AtpAgent {
|
|
|
521
532
|
.concat([{ ...pref, $type: 'app.bsky.actor.defs#threadViewPref' }])
|
|
522
533
|
})
|
|
523
534
|
}
|
|
535
|
+
|
|
536
|
+
async setInterestsPref(pref: Partial<BskyInterestsPreference>) {
|
|
537
|
+
await updatePreferences(this, (prefs: AppBskyActorDefs.Preferences) => {
|
|
538
|
+
const existing = prefs.findLast(
|
|
539
|
+
(pref) =>
|
|
540
|
+
AppBskyActorDefs.isInterestsPref(pref) &&
|
|
541
|
+
AppBskyActorDefs.validateInterestsPref(pref).success,
|
|
542
|
+
)
|
|
543
|
+
if (existing) {
|
|
544
|
+
pref = { ...existing, ...pref }
|
|
545
|
+
}
|
|
546
|
+
return prefs
|
|
547
|
+
.filter((p) => !AppBskyActorDefs.isInterestsPref(p))
|
|
548
|
+
.concat([{ ...pref, $type: 'app.bsky.actor.defs#interestsPref' }])
|
|
549
|
+
})
|
|
550
|
+
}
|
|
524
551
|
}
|
|
525
552
|
|
|
526
553
|
/**
|
package/src/client/index.ts
CHANGED
|
@@ -81,6 +81,7 @@ import * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos'
|
|
|
81
81
|
import * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate'
|
|
82
82
|
import * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl'
|
|
83
83
|
import * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos'
|
|
84
|
+
import * as ComAtprotoTempCheckSignupQueue from './types/com/atproto/temp/checkSignupQueue'
|
|
84
85
|
import * as ComAtprotoTempFetchLabels from './types/com/atproto/temp/fetchLabels'
|
|
85
86
|
import * as ComAtprotoTempImportRepo from './types/com/atproto/temp/importRepo'
|
|
86
87
|
import * as ComAtprotoTempPushBlob from './types/com/atproto/temp/pushBlob'
|
|
@@ -132,6 +133,7 @@ import * as AppBskyGraphGetListBlocks from './types/app/bsky/graph/getListBlocks
|
|
|
132
133
|
import * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes'
|
|
133
134
|
import * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists'
|
|
134
135
|
import * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes'
|
|
136
|
+
import * as AppBskyGraphGetRelationships from './types/app/bsky/graph/getRelationships'
|
|
135
137
|
import * as AppBskyGraphGetSuggestedFollowsByActor from './types/app/bsky/graph/getSuggestedFollowsByActor'
|
|
136
138
|
import * as AppBskyGraphList from './types/app/bsky/graph/list'
|
|
137
139
|
import * as AppBskyGraphListblock from './types/app/bsky/graph/listblock'
|
|
@@ -226,6 +228,7 @@ export * as ComAtprotoSyncListRepos from './types/com/atproto/sync/listRepos'
|
|
|
226
228
|
export * as ComAtprotoSyncNotifyOfUpdate from './types/com/atproto/sync/notifyOfUpdate'
|
|
227
229
|
export * as ComAtprotoSyncRequestCrawl from './types/com/atproto/sync/requestCrawl'
|
|
228
230
|
export * as ComAtprotoSyncSubscribeRepos from './types/com/atproto/sync/subscribeRepos'
|
|
231
|
+
export * as ComAtprotoTempCheckSignupQueue from './types/com/atproto/temp/checkSignupQueue'
|
|
229
232
|
export * as ComAtprotoTempFetchLabels from './types/com/atproto/temp/fetchLabels'
|
|
230
233
|
export * as ComAtprotoTempImportRepo from './types/com/atproto/temp/importRepo'
|
|
231
234
|
export * as ComAtprotoTempPushBlob from './types/com/atproto/temp/pushBlob'
|
|
@@ -277,6 +280,7 @@ export * as AppBskyGraphGetListBlocks from './types/app/bsky/graph/getListBlocks
|
|
|
277
280
|
export * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes'
|
|
278
281
|
export * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists'
|
|
279
282
|
export * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes'
|
|
283
|
+
export * as AppBskyGraphGetRelationships from './types/app/bsky/graph/getRelationships'
|
|
280
284
|
export * as AppBskyGraphGetSuggestedFollowsByActor from './types/app/bsky/graph/getSuggestedFollowsByActor'
|
|
281
285
|
export * as AppBskyGraphList from './types/app/bsky/graph/list'
|
|
282
286
|
export * as AppBskyGraphListblock from './types/app/bsky/graph/listblock'
|
|
@@ -1205,6 +1209,17 @@ export class ComAtprotoTempNS {
|
|
|
1205
1209
|
this._service = service
|
|
1206
1210
|
}
|
|
1207
1211
|
|
|
1212
|
+
checkSignupQueue(
|
|
1213
|
+
params?: ComAtprotoTempCheckSignupQueue.QueryParams,
|
|
1214
|
+
opts?: ComAtprotoTempCheckSignupQueue.CallOptions,
|
|
1215
|
+
): Promise<ComAtprotoTempCheckSignupQueue.Response> {
|
|
1216
|
+
return this._service.xrpc
|
|
1217
|
+
.call('com.atproto.temp.checkSignupQueue', params, undefined, opts)
|
|
1218
|
+
.catch((e) => {
|
|
1219
|
+
throw ComAtprotoTempCheckSignupQueue.toKnownErr(e)
|
|
1220
|
+
})
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1208
1223
|
fetchLabels(
|
|
1209
1224
|
params?: ComAtprotoTempFetchLabels.QueryParams,
|
|
1210
1225
|
opts?: ComAtprotoTempFetchLabels.CallOptions,
|
|
@@ -2057,6 +2072,17 @@ export class AppBskyGraphNS {
|
|
|
2057
2072
|
})
|
|
2058
2073
|
}
|
|
2059
2074
|
|
|
2075
|
+
getRelationships(
|
|
2076
|
+
params?: AppBskyGraphGetRelationships.QueryParams,
|
|
2077
|
+
opts?: AppBskyGraphGetRelationships.CallOptions,
|
|
2078
|
+
): Promise<AppBskyGraphGetRelationships.Response> {
|
|
2079
|
+
return this._service.xrpc
|
|
2080
|
+
.call('app.bsky.graph.getRelationships', params, undefined, opts)
|
|
2081
|
+
.catch((e) => {
|
|
2082
|
+
throw AppBskyGraphGetRelationships.toKnownErr(e)
|
|
2083
|
+
})
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2060
2086
|
getSuggestedFollowsByActor(
|
|
2061
2087
|
params?: AppBskyGraphGetSuggestedFollowsByActor.QueryParams,
|
|
2062
2088
|
opts?: AppBskyGraphGetSuggestedFollowsByActor.CallOptions,
|
package/src/client/lexicons.ts
CHANGED
|
@@ -4246,6 +4246,34 @@ export const schemaDict = {
|
|
|
4246
4246
|
},
|
|
4247
4247
|
},
|
|
4248
4248
|
},
|
|
4249
|
+
ComAtprotoTempCheckSignupQueue: {
|
|
4250
|
+
lexicon: 1,
|
|
4251
|
+
id: 'com.atproto.temp.checkSignupQueue',
|
|
4252
|
+
defs: {
|
|
4253
|
+
main: {
|
|
4254
|
+
type: 'query',
|
|
4255
|
+
description: 'Check accounts location in signup queue.',
|
|
4256
|
+
output: {
|
|
4257
|
+
encoding: 'application/json',
|
|
4258
|
+
schema: {
|
|
4259
|
+
type: 'object',
|
|
4260
|
+
required: ['activated'],
|
|
4261
|
+
properties: {
|
|
4262
|
+
activated: {
|
|
4263
|
+
type: 'boolean',
|
|
4264
|
+
},
|
|
4265
|
+
placeInQueue: {
|
|
4266
|
+
type: 'integer',
|
|
4267
|
+
},
|
|
4268
|
+
estimatedTimeMs: {
|
|
4269
|
+
type: 'integer',
|
|
4270
|
+
},
|
|
4271
|
+
},
|
|
4272
|
+
},
|
|
4273
|
+
},
|
|
4274
|
+
},
|
|
4275
|
+
},
|
|
4276
|
+
},
|
|
4249
4277
|
ComAtprotoTempFetchLabels: {
|
|
4250
4278
|
lexicon: 1,
|
|
4251
4279
|
id: 'com.atproto.temp.fetchLabels',
|
|
@@ -4615,6 +4643,7 @@ export const schemaDict = {
|
|
|
4615
4643
|
'lex:app.bsky.actor.defs#personalDetailsPref',
|
|
4616
4644
|
'lex:app.bsky.actor.defs#feedViewPref',
|
|
4617
4645
|
'lex:app.bsky.actor.defs#threadViewPref',
|
|
4646
|
+
'lex:app.bsky.actor.defs#interestsPref',
|
|
4618
4647
|
],
|
|
4619
4648
|
},
|
|
4620
4649
|
},
|
|
@@ -4718,6 +4747,23 @@ export const schemaDict = {
|
|
|
4718
4747
|
},
|
|
4719
4748
|
},
|
|
4720
4749
|
},
|
|
4750
|
+
interestsPref: {
|
|
4751
|
+
type: 'object',
|
|
4752
|
+
required: ['tags'],
|
|
4753
|
+
properties: {
|
|
4754
|
+
tags: {
|
|
4755
|
+
type: 'array',
|
|
4756
|
+
maxLength: 100,
|
|
4757
|
+
items: {
|
|
4758
|
+
type: 'string',
|
|
4759
|
+
maxLength: 640,
|
|
4760
|
+
maxGraphemes: 64,
|
|
4761
|
+
},
|
|
4762
|
+
description:
|
|
4763
|
+
"A list of tags which describe the account owner's interests gathered during onboarding.",
|
|
4764
|
+
},
|
|
4765
|
+
},
|
|
4766
|
+
},
|
|
4721
4767
|
},
|
|
4722
4768
|
},
|
|
4723
4769
|
AppBskyActorGetPreferences: {
|
|
@@ -6925,6 +6971,45 @@ export const schemaDict = {
|
|
|
6925
6971
|
},
|
|
6926
6972
|
},
|
|
6927
6973
|
},
|
|
6974
|
+
notFoundActor: {
|
|
6975
|
+
type: 'object',
|
|
6976
|
+
description: 'indicates that a handle or DID could not be resolved',
|
|
6977
|
+
required: ['actor', 'notFound'],
|
|
6978
|
+
properties: {
|
|
6979
|
+
actor: {
|
|
6980
|
+
type: 'string',
|
|
6981
|
+
format: 'at-identifier',
|
|
6982
|
+
},
|
|
6983
|
+
notFound: {
|
|
6984
|
+
type: 'boolean',
|
|
6985
|
+
const: true,
|
|
6986
|
+
},
|
|
6987
|
+
},
|
|
6988
|
+
},
|
|
6989
|
+
relationship: {
|
|
6990
|
+
type: 'object',
|
|
6991
|
+
description:
|
|
6992
|
+
'lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object)',
|
|
6993
|
+
required: ['did'],
|
|
6994
|
+
properties: {
|
|
6995
|
+
did: {
|
|
6996
|
+
type: 'string',
|
|
6997
|
+
format: 'did',
|
|
6998
|
+
},
|
|
6999
|
+
following: {
|
|
7000
|
+
type: 'string',
|
|
7001
|
+
format: 'at-uri',
|
|
7002
|
+
description:
|
|
7003
|
+
'if the actor follows this DID, this is the AT-URI of the follow record',
|
|
7004
|
+
},
|
|
7005
|
+
followedBy: {
|
|
7006
|
+
type: 'string',
|
|
7007
|
+
format: 'at-uri',
|
|
7008
|
+
description:
|
|
7009
|
+
'if the actor is followed by this DID, contains the AT-URI of the follow record',
|
|
7010
|
+
},
|
|
7011
|
+
},
|
|
7012
|
+
},
|
|
6928
7013
|
},
|
|
6929
7014
|
},
|
|
6930
7015
|
AppBskyGraphFollow: {
|
|
@@ -7328,6 +7413,65 @@ export const schemaDict = {
|
|
|
7328
7413
|
},
|
|
7329
7414
|
},
|
|
7330
7415
|
},
|
|
7416
|
+
AppBskyGraphGetRelationships: {
|
|
7417
|
+
lexicon: 1,
|
|
7418
|
+
id: 'app.bsky.graph.getRelationships',
|
|
7419
|
+
defs: {
|
|
7420
|
+
main: {
|
|
7421
|
+
type: 'query',
|
|
7422
|
+
description:
|
|
7423
|
+
'Enumerates public relationships between one account, and a list of other accounts',
|
|
7424
|
+
parameters: {
|
|
7425
|
+
type: 'params',
|
|
7426
|
+
required: ['actor'],
|
|
7427
|
+
properties: {
|
|
7428
|
+
actor: {
|
|
7429
|
+
type: 'string',
|
|
7430
|
+
format: 'at-identifier',
|
|
7431
|
+
},
|
|
7432
|
+
others: {
|
|
7433
|
+
type: 'array',
|
|
7434
|
+
maxLength: 30,
|
|
7435
|
+
items: {
|
|
7436
|
+
type: 'string',
|
|
7437
|
+
format: 'at-identifier',
|
|
7438
|
+
},
|
|
7439
|
+
},
|
|
7440
|
+
},
|
|
7441
|
+
},
|
|
7442
|
+
output: {
|
|
7443
|
+
encoding: 'application/json',
|
|
7444
|
+
schema: {
|
|
7445
|
+
type: 'object',
|
|
7446
|
+
required: ['relationships'],
|
|
7447
|
+
properties: {
|
|
7448
|
+
actor: {
|
|
7449
|
+
type: 'string',
|
|
7450
|
+
format: 'did',
|
|
7451
|
+
},
|
|
7452
|
+
relationships: {
|
|
7453
|
+
type: 'array',
|
|
7454
|
+
items: {
|
|
7455
|
+
type: 'union',
|
|
7456
|
+
refs: [
|
|
7457
|
+
'lex:app.bsky.graph.defs#relationship',
|
|
7458
|
+
'lex:app.bsky.graph.defs#notFoundActor',
|
|
7459
|
+
],
|
|
7460
|
+
},
|
|
7461
|
+
},
|
|
7462
|
+
},
|
|
7463
|
+
},
|
|
7464
|
+
},
|
|
7465
|
+
errors: [
|
|
7466
|
+
{
|
|
7467
|
+
name: 'ActorNotFound',
|
|
7468
|
+
description:
|
|
7469
|
+
'the primary actor at-identifier could not be resolved',
|
|
7470
|
+
},
|
|
7471
|
+
],
|
|
7472
|
+
},
|
|
7473
|
+
},
|
|
7474
|
+
},
|
|
7331
7475
|
AppBskyGraphGetSuggestedFollowsByActor: {
|
|
7332
7476
|
lexicon: 1,
|
|
7333
7477
|
id: 'app.bsky.graph.getSuggestedFollowsByActor',
|
|
@@ -8220,6 +8364,7 @@ export const ids = {
|
|
|
8220
8364
|
ComAtprotoSyncNotifyOfUpdate: 'com.atproto.sync.notifyOfUpdate',
|
|
8221
8365
|
ComAtprotoSyncRequestCrawl: 'com.atproto.sync.requestCrawl',
|
|
8222
8366
|
ComAtprotoSyncSubscribeRepos: 'com.atproto.sync.subscribeRepos',
|
|
8367
|
+
ComAtprotoTempCheckSignupQueue: 'com.atproto.temp.checkSignupQueue',
|
|
8223
8368
|
ComAtprotoTempFetchLabels: 'com.atproto.temp.fetchLabels',
|
|
8224
8369
|
ComAtprotoTempImportRepo: 'com.atproto.temp.importRepo',
|
|
8225
8370
|
ComAtprotoTempPushBlob: 'com.atproto.temp.pushBlob',
|
|
@@ -8272,6 +8417,7 @@ export const ids = {
|
|
|
8272
8417
|
AppBskyGraphGetListMutes: 'app.bsky.graph.getListMutes',
|
|
8273
8418
|
AppBskyGraphGetLists: 'app.bsky.graph.getLists',
|
|
8274
8419
|
AppBskyGraphGetMutes: 'app.bsky.graph.getMutes',
|
|
8420
|
+
AppBskyGraphGetRelationships: 'app.bsky.graph.getRelationships',
|
|
8275
8421
|
AppBskyGraphGetSuggestedFollowsByActor:
|
|
8276
8422
|
'app.bsky.graph.getSuggestedFollowsByActor',
|
|
8277
8423
|
AppBskyGraphList: 'app.bsky.graph.list',
|
|
@@ -112,6 +112,7 @@ export type Preferences = (
|
|
|
112
112
|
| PersonalDetailsPref
|
|
113
113
|
| FeedViewPref
|
|
114
114
|
| ThreadViewPref
|
|
115
|
+
| InterestsPref
|
|
115
116
|
| { $type: string; [k: string]: unknown }
|
|
116
117
|
)[]
|
|
117
118
|
|
|
@@ -233,3 +234,21 @@ export function isThreadViewPref(v: unknown): v is ThreadViewPref {
|
|
|
233
234
|
export function validateThreadViewPref(v: unknown): ValidationResult {
|
|
234
235
|
return lexicons.validate('app.bsky.actor.defs#threadViewPref', v)
|
|
235
236
|
}
|
|
237
|
+
|
|
238
|
+
export interface InterestsPref {
|
|
239
|
+
/** A list of tags which describe the account owner's interests gathered during onboarding. */
|
|
240
|
+
tags: string[]
|
|
241
|
+
[k: string]: unknown
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function isInterestsPref(v: unknown): v is InterestsPref {
|
|
245
|
+
return (
|
|
246
|
+
isObj(v) &&
|
|
247
|
+
hasProp(v, '$type') &&
|
|
248
|
+
v.$type === 'app.bsky.actor.defs#interestsPref'
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function validateInterestsPref(v: unknown): ValidationResult {
|
|
253
|
+
return lexicons.validate('app.bsky.actor.defs#interestsPref', v)
|
|
254
|
+
}
|
|
@@ -102,3 +102,44 @@ export function isListViewerState(v: unknown): v is ListViewerState {
|
|
|
102
102
|
export function validateListViewerState(v: unknown): ValidationResult {
|
|
103
103
|
return lexicons.validate('app.bsky.graph.defs#listViewerState', v)
|
|
104
104
|
}
|
|
105
|
+
|
|
106
|
+
/** indicates that a handle or DID could not be resolved */
|
|
107
|
+
export interface NotFoundActor {
|
|
108
|
+
actor: string
|
|
109
|
+
notFound: true
|
|
110
|
+
[k: string]: unknown
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function isNotFoundActor(v: unknown): v is NotFoundActor {
|
|
114
|
+
return (
|
|
115
|
+
isObj(v) &&
|
|
116
|
+
hasProp(v, '$type') &&
|
|
117
|
+
v.$type === 'app.bsky.graph.defs#notFoundActor'
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function validateNotFoundActor(v: unknown): ValidationResult {
|
|
122
|
+
return lexicons.validate('app.bsky.graph.defs#notFoundActor', v)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */
|
|
126
|
+
export interface Relationship {
|
|
127
|
+
did: string
|
|
128
|
+
/** if the actor follows this DID, this is the AT-URI of the follow record */
|
|
129
|
+
following?: string
|
|
130
|
+
/** if the actor is followed by this DID, contains the AT-URI of the follow record */
|
|
131
|
+
followedBy?: string
|
|
132
|
+
[k: string]: unknown
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function isRelationship(v: unknown): v is Relationship {
|
|
136
|
+
return (
|
|
137
|
+
isObj(v) &&
|
|
138
|
+
hasProp(v, '$type') &&
|
|
139
|
+
v.$type === 'app.bsky.graph.defs#relationship'
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function validateRelationship(v: unknown): ValidationResult {
|
|
144
|
+
return lexicons.validate('app.bsky.graph.defs#relationship', v)
|
|
145
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { isObj, hasProp } from '../../../../util'
|
|
7
|
+
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import * as AppBskyGraphDefs from './defs'
|
|
10
|
+
|
|
11
|
+
export interface QueryParams {
|
|
12
|
+
actor: string
|
|
13
|
+
others?: string[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type InputSchema = undefined
|
|
17
|
+
|
|
18
|
+
export interface OutputSchema {
|
|
19
|
+
actor?: string
|
|
20
|
+
relationships: (
|
|
21
|
+
| AppBskyGraphDefs.Relationship
|
|
22
|
+
| AppBskyGraphDefs.NotFoundActor
|
|
23
|
+
| { $type: string; [k: string]: unknown }
|
|
24
|
+
)[]
|
|
25
|
+
[k: string]: unknown
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface CallOptions {
|
|
29
|
+
headers?: Headers
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Response {
|
|
33
|
+
success: boolean
|
|
34
|
+
headers: Headers
|
|
35
|
+
data: OutputSchema
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class ActorNotFoundError extends XRPCError {
|
|
39
|
+
constructor(src: XRPCError) {
|
|
40
|
+
super(src.status, src.error, src.message, src.headers)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function toKnownErr(e: any) {
|
|
45
|
+
if (e instanceof XRPCError) {
|
|
46
|
+
if (e.error === 'ActorNotFound') return new ActorNotFoundError(e)
|
|
47
|
+
}
|
|
48
|
+
return e
|
|
49
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { Headers, XRPCError } from '@atproto/xrpc'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { isObj, hasProp } from '../../../../util'
|
|
7
|
+
import { lexicons } from '../../../../lexicons'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
|
|
10
|
+
export interface QueryParams {}
|
|
11
|
+
|
|
12
|
+
export type InputSchema = undefined
|
|
13
|
+
|
|
14
|
+
export interface OutputSchema {
|
|
15
|
+
activated: boolean
|
|
16
|
+
placeInQueue?: number
|
|
17
|
+
estimatedTimeMs?: number
|
|
18
|
+
[k: string]: unknown
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CallOptions {
|
|
22
|
+
headers?: Headers
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface Response {
|
|
26
|
+
success: boolean
|
|
27
|
+
headers: Headers
|
|
28
|
+
data: OutputSchema
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function toKnownErr(e: any) {
|
|
32
|
+
if (e instanceof XRPCError) {
|
|
33
|
+
}
|
|
34
|
+
return e
|
|
35
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -97,6 +97,14 @@ export interface BskyThreadViewPreference {
|
|
|
97
97
|
[key: string]: any
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Bluesky interests preferences
|
|
102
|
+
*/
|
|
103
|
+
export interface BskyInterestsPreference {
|
|
104
|
+
tags: string[]
|
|
105
|
+
[key: string]: any
|
|
106
|
+
}
|
|
107
|
+
|
|
100
108
|
/**
|
|
101
109
|
* Bluesky preferences
|
|
102
110
|
*/
|
|
@@ -110,4 +118,5 @@ export interface BskyPreferences {
|
|
|
110
118
|
adultContentEnabled: boolean
|
|
111
119
|
contentLabels: Record<string, BskyLabelPreference>
|
|
112
120
|
birthDate: Date | undefined
|
|
121
|
+
interests: BskyInterestsPreference
|
|
113
122
|
}
|