@atproto/api 0.9.2 → 0.9.4
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/bsky-agent.d.ts +2 -1
- package/dist/client/index.d.ts +6 -0
- package/dist/client/lexicons.d.ts +153 -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/app/bsky/unspecced/getTaggedSuggestions.d.ts +26 -0
- package/dist/index.js +288 -42
- package/dist/index.js.map +3 -3
- package/dist/types.d.ts +5 -0
- package/package.json +2 -2
- package/src/bsky-agent.ts +27 -0
- package/src/client/index.ts +26 -0
- package/src/client/lexicons.ts +167 -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/app/bsky/unspecced/getTaggedSuggestions.ts +55 -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.4",
|
|
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.27"
|
|
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/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
|
@@ -132,6 +132,7 @@ import * as AppBskyGraphGetListBlocks from './types/app/bsky/graph/getListBlocks
|
|
|
132
132
|
import * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes'
|
|
133
133
|
import * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists'
|
|
134
134
|
import * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes'
|
|
135
|
+
import * as AppBskyGraphGetRelationships from './types/app/bsky/graph/getRelationships'
|
|
135
136
|
import * as AppBskyGraphGetSuggestedFollowsByActor from './types/app/bsky/graph/getSuggestedFollowsByActor'
|
|
136
137
|
import * as AppBskyGraphList from './types/app/bsky/graph/list'
|
|
137
138
|
import * as AppBskyGraphListblock from './types/app/bsky/graph/listblock'
|
|
@@ -147,6 +148,7 @@ import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/up
|
|
|
147
148
|
import * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet'
|
|
148
149
|
import * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
|
|
149
150
|
import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
|
|
151
|
+
import * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
|
|
150
152
|
import * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton'
|
|
151
153
|
import * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
|
|
152
154
|
import * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
|
|
@@ -276,6 +278,7 @@ export * as AppBskyGraphGetListBlocks from './types/app/bsky/graph/getListBlocks
|
|
|
276
278
|
export * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes'
|
|
277
279
|
export * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists'
|
|
278
280
|
export * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes'
|
|
281
|
+
export * as AppBskyGraphGetRelationships from './types/app/bsky/graph/getRelationships'
|
|
279
282
|
export * as AppBskyGraphGetSuggestedFollowsByActor from './types/app/bsky/graph/getSuggestedFollowsByActor'
|
|
280
283
|
export * as AppBskyGraphList from './types/app/bsky/graph/list'
|
|
281
284
|
export * as AppBskyGraphListblock from './types/app/bsky/graph/listblock'
|
|
@@ -291,6 +294,7 @@ export * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/up
|
|
|
291
294
|
export * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet'
|
|
292
295
|
export * as AppBskyUnspeccedDefs from './types/app/bsky/unspecced/defs'
|
|
293
296
|
export * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
|
|
297
|
+
export * as AppBskyUnspeccedGetTaggedSuggestions from './types/app/bsky/unspecced/getTaggedSuggestions'
|
|
294
298
|
export * as AppBskyUnspeccedGetTimelineSkeleton from './types/app/bsky/unspecced/getTimelineSkeleton'
|
|
295
299
|
export * as AppBskyUnspeccedSearchActorsSkeleton from './types/app/bsky/unspecced/searchActorsSkeleton'
|
|
296
300
|
export * as AppBskyUnspeccedSearchPostsSkeleton from './types/app/bsky/unspecced/searchPostsSkeleton'
|
|
@@ -2055,6 +2059,17 @@ export class AppBskyGraphNS {
|
|
|
2055
2059
|
})
|
|
2056
2060
|
}
|
|
2057
2061
|
|
|
2062
|
+
getRelationships(
|
|
2063
|
+
params?: AppBskyGraphGetRelationships.QueryParams,
|
|
2064
|
+
opts?: AppBskyGraphGetRelationships.CallOptions,
|
|
2065
|
+
): Promise<AppBskyGraphGetRelationships.Response> {
|
|
2066
|
+
return this._service.xrpc
|
|
2067
|
+
.call('app.bsky.graph.getRelationships', params, undefined, opts)
|
|
2068
|
+
.catch((e) => {
|
|
2069
|
+
throw AppBskyGraphGetRelationships.toKnownErr(e)
|
|
2070
|
+
})
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2058
2073
|
getSuggestedFollowsByActor(
|
|
2059
2074
|
params?: AppBskyGraphGetSuggestedFollowsByActor.QueryParams,
|
|
2060
2075
|
opts?: AppBskyGraphGetSuggestedFollowsByActor.CallOptions,
|
|
@@ -2508,6 +2523,17 @@ export class AppBskyUnspeccedNS {
|
|
|
2508
2523
|
})
|
|
2509
2524
|
}
|
|
2510
2525
|
|
|
2526
|
+
getTaggedSuggestions(
|
|
2527
|
+
params?: AppBskyUnspeccedGetTaggedSuggestions.QueryParams,
|
|
2528
|
+
opts?: AppBskyUnspeccedGetTaggedSuggestions.CallOptions,
|
|
2529
|
+
): Promise<AppBskyUnspeccedGetTaggedSuggestions.Response> {
|
|
2530
|
+
return this._service.xrpc
|
|
2531
|
+
.call('app.bsky.unspecced.getTaggedSuggestions', params, undefined, opts)
|
|
2532
|
+
.catch((e) => {
|
|
2533
|
+
throw AppBskyUnspeccedGetTaggedSuggestions.toKnownErr(e)
|
|
2534
|
+
})
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2511
2537
|
getTimelineSkeleton(
|
|
2512
2538
|
params?: AppBskyUnspeccedGetTimelineSkeleton.QueryParams,
|
|
2513
2539
|
opts?: AppBskyUnspeccedGetTimelineSkeleton.CallOptions,
|
package/src/client/lexicons.ts
CHANGED
|
@@ -4615,6 +4615,7 @@ export const schemaDict = {
|
|
|
4615
4615
|
'lex:app.bsky.actor.defs#personalDetailsPref',
|
|
4616
4616
|
'lex:app.bsky.actor.defs#feedViewPref',
|
|
4617
4617
|
'lex:app.bsky.actor.defs#threadViewPref',
|
|
4618
|
+
'lex:app.bsky.actor.defs#interestsPref',
|
|
4618
4619
|
],
|
|
4619
4620
|
},
|
|
4620
4621
|
},
|
|
@@ -4718,6 +4719,23 @@ export const schemaDict = {
|
|
|
4718
4719
|
},
|
|
4719
4720
|
},
|
|
4720
4721
|
},
|
|
4722
|
+
interestsPref: {
|
|
4723
|
+
type: 'object',
|
|
4724
|
+
required: ['tags'],
|
|
4725
|
+
properties: {
|
|
4726
|
+
tags: {
|
|
4727
|
+
type: 'array',
|
|
4728
|
+
maxLength: 100,
|
|
4729
|
+
items: {
|
|
4730
|
+
type: 'string',
|
|
4731
|
+
maxLength: 640,
|
|
4732
|
+
maxGraphemes: 64,
|
|
4733
|
+
},
|
|
4734
|
+
description:
|
|
4735
|
+
"A list of tags which describe the account owner's interests gathered during onboarding.",
|
|
4736
|
+
},
|
|
4737
|
+
},
|
|
4738
|
+
},
|
|
4721
4739
|
},
|
|
4722
4740
|
},
|
|
4723
4741
|
AppBskyActorGetPreferences: {
|
|
@@ -6925,6 +6943,45 @@ export const schemaDict = {
|
|
|
6925
6943
|
},
|
|
6926
6944
|
},
|
|
6927
6945
|
},
|
|
6946
|
+
notFoundActor: {
|
|
6947
|
+
type: 'object',
|
|
6948
|
+
description: 'indicates that a handle or DID could not be resolved',
|
|
6949
|
+
required: ['actor', 'notFound'],
|
|
6950
|
+
properties: {
|
|
6951
|
+
actor: {
|
|
6952
|
+
type: 'string',
|
|
6953
|
+
format: 'at-identifier',
|
|
6954
|
+
},
|
|
6955
|
+
notFound: {
|
|
6956
|
+
type: 'boolean',
|
|
6957
|
+
const: true,
|
|
6958
|
+
},
|
|
6959
|
+
},
|
|
6960
|
+
},
|
|
6961
|
+
relationship: {
|
|
6962
|
+
type: 'object',
|
|
6963
|
+
description:
|
|
6964
|
+
'lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object)',
|
|
6965
|
+
required: ['did'],
|
|
6966
|
+
properties: {
|
|
6967
|
+
did: {
|
|
6968
|
+
type: 'string',
|
|
6969
|
+
format: 'did',
|
|
6970
|
+
},
|
|
6971
|
+
following: {
|
|
6972
|
+
type: 'string',
|
|
6973
|
+
format: 'at-uri',
|
|
6974
|
+
description:
|
|
6975
|
+
'if the actor follows this DID, this is the AT-URI of the follow record',
|
|
6976
|
+
},
|
|
6977
|
+
followedBy: {
|
|
6978
|
+
type: 'string',
|
|
6979
|
+
format: 'at-uri',
|
|
6980
|
+
description:
|
|
6981
|
+
'if the actor is followed by this DID, contains the AT-URI of the follow record',
|
|
6982
|
+
},
|
|
6983
|
+
},
|
|
6984
|
+
},
|
|
6928
6985
|
},
|
|
6929
6986
|
},
|
|
6930
6987
|
AppBskyGraphFollow: {
|
|
@@ -7328,6 +7385,65 @@ export const schemaDict = {
|
|
|
7328
7385
|
},
|
|
7329
7386
|
},
|
|
7330
7387
|
},
|
|
7388
|
+
AppBskyGraphGetRelationships: {
|
|
7389
|
+
lexicon: 1,
|
|
7390
|
+
id: 'app.bsky.graph.getRelationships',
|
|
7391
|
+
defs: {
|
|
7392
|
+
main: {
|
|
7393
|
+
type: 'query',
|
|
7394
|
+
description:
|
|
7395
|
+
'Enumerates public relationships between one account, and a list of other accounts',
|
|
7396
|
+
parameters: {
|
|
7397
|
+
type: 'params',
|
|
7398
|
+
required: ['actor'],
|
|
7399
|
+
properties: {
|
|
7400
|
+
actor: {
|
|
7401
|
+
type: 'string',
|
|
7402
|
+
format: 'at-identifier',
|
|
7403
|
+
},
|
|
7404
|
+
others: {
|
|
7405
|
+
type: 'array',
|
|
7406
|
+
maxLength: 30,
|
|
7407
|
+
items: {
|
|
7408
|
+
type: 'string',
|
|
7409
|
+
format: 'at-identifier',
|
|
7410
|
+
},
|
|
7411
|
+
},
|
|
7412
|
+
},
|
|
7413
|
+
},
|
|
7414
|
+
output: {
|
|
7415
|
+
encoding: 'application/json',
|
|
7416
|
+
schema: {
|
|
7417
|
+
type: 'object',
|
|
7418
|
+
required: ['relationships'],
|
|
7419
|
+
properties: {
|
|
7420
|
+
actor: {
|
|
7421
|
+
type: 'string',
|
|
7422
|
+
format: 'did',
|
|
7423
|
+
},
|
|
7424
|
+
relationships: {
|
|
7425
|
+
type: 'array',
|
|
7426
|
+
items: {
|
|
7427
|
+
type: 'union',
|
|
7428
|
+
refs: [
|
|
7429
|
+
'lex:app.bsky.graph.defs#relationship',
|
|
7430
|
+
'lex:app.bsky.graph.defs#notFoundActor',
|
|
7431
|
+
],
|
|
7432
|
+
},
|
|
7433
|
+
},
|
|
7434
|
+
},
|
|
7435
|
+
},
|
|
7436
|
+
},
|
|
7437
|
+
errors: [
|
|
7438
|
+
{
|
|
7439
|
+
name: 'ActorNotFound',
|
|
7440
|
+
description:
|
|
7441
|
+
'the primary actor at-identifier could not be resolved',
|
|
7442
|
+
},
|
|
7443
|
+
],
|
|
7444
|
+
},
|
|
7445
|
+
},
|
|
7446
|
+
},
|
|
7331
7447
|
AppBskyGraphGetSuggestedFollowsByActor: {
|
|
7332
7448
|
lexicon: 1,
|
|
7333
7449
|
id: 'app.bsky.graph.getSuggestedFollowsByActor',
|
|
@@ -7908,6 +8024,54 @@ export const schemaDict = {
|
|
|
7908
8024
|
},
|
|
7909
8025
|
},
|
|
7910
8026
|
},
|
|
8027
|
+
AppBskyUnspeccedGetTaggedSuggestions: {
|
|
8028
|
+
lexicon: 1,
|
|
8029
|
+
id: 'app.bsky.unspecced.getTaggedSuggestions',
|
|
8030
|
+
defs: {
|
|
8031
|
+
main: {
|
|
8032
|
+
type: 'query',
|
|
8033
|
+
description:
|
|
8034
|
+
'Get a list of suggestions (feeds and users) tagged with categories',
|
|
8035
|
+
parameters: {
|
|
8036
|
+
type: 'params',
|
|
8037
|
+
properties: {},
|
|
8038
|
+
},
|
|
8039
|
+
output: {
|
|
8040
|
+
encoding: 'application/json',
|
|
8041
|
+
schema: {
|
|
8042
|
+
type: 'object',
|
|
8043
|
+
required: ['suggestions'],
|
|
8044
|
+
properties: {
|
|
8045
|
+
suggestions: {
|
|
8046
|
+
type: 'array',
|
|
8047
|
+
items: {
|
|
8048
|
+
type: 'ref',
|
|
8049
|
+
ref: 'lex:app.bsky.unspecced.getTaggedSuggestions#suggestion',
|
|
8050
|
+
},
|
|
8051
|
+
},
|
|
8052
|
+
},
|
|
8053
|
+
},
|
|
8054
|
+
},
|
|
8055
|
+
},
|
|
8056
|
+
suggestion: {
|
|
8057
|
+
type: 'object',
|
|
8058
|
+
required: ['tag', 'subjectType', 'subject'],
|
|
8059
|
+
properties: {
|
|
8060
|
+
tag: {
|
|
8061
|
+
type: 'string',
|
|
8062
|
+
},
|
|
8063
|
+
subjectType: {
|
|
8064
|
+
type: 'string',
|
|
8065
|
+
knownValues: ['actor', 'feed'],
|
|
8066
|
+
},
|
|
8067
|
+
subject: {
|
|
8068
|
+
type: 'string',
|
|
8069
|
+
format: 'uri',
|
|
8070
|
+
},
|
|
8071
|
+
},
|
|
8072
|
+
},
|
|
8073
|
+
},
|
|
8074
|
+
},
|
|
7911
8075
|
AppBskyUnspeccedGetTimelineSkeleton: {
|
|
7912
8076
|
lexicon: 1,
|
|
7913
8077
|
id: 'app.bsky.unspecced.getTimelineSkeleton',
|
|
@@ -8224,6 +8388,7 @@ export const ids = {
|
|
|
8224
8388
|
AppBskyGraphGetListMutes: 'app.bsky.graph.getListMutes',
|
|
8225
8389
|
AppBskyGraphGetLists: 'app.bsky.graph.getLists',
|
|
8226
8390
|
AppBskyGraphGetMutes: 'app.bsky.graph.getMutes',
|
|
8391
|
+
AppBskyGraphGetRelationships: 'app.bsky.graph.getRelationships',
|
|
8227
8392
|
AppBskyGraphGetSuggestedFollowsByActor:
|
|
8228
8393
|
'app.bsky.graph.getSuggestedFollowsByActor',
|
|
8229
8394
|
AppBskyGraphList: 'app.bsky.graph.list',
|
|
@@ -8242,6 +8407,8 @@ export const ids = {
|
|
|
8242
8407
|
AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs',
|
|
8243
8408
|
AppBskyUnspeccedGetPopularFeedGenerators:
|
|
8244
8409
|
'app.bsky.unspecced.getPopularFeedGenerators',
|
|
8410
|
+
AppBskyUnspeccedGetTaggedSuggestions:
|
|
8411
|
+
'app.bsky.unspecced.getTaggedSuggestions',
|
|
8245
8412
|
AppBskyUnspeccedGetTimelineSkeleton: 'app.bsky.unspecced.getTimelineSkeleton',
|
|
8246
8413
|
AppBskyUnspeccedSearchActorsSkeleton:
|
|
8247
8414
|
'app.bsky.unspecced.searchActorsSkeleton',
|
|
@@ -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,55 @@
|
|
|
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
|
+
suggestions: Suggestion[]
|
|
16
|
+
[k: string]: unknown
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CallOptions {
|
|
20
|
+
headers?: Headers
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Response {
|
|
24
|
+
success: boolean
|
|
25
|
+
headers: Headers
|
|
26
|
+
data: OutputSchema
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function toKnownErr(e: any) {
|
|
30
|
+
if (e instanceof XRPCError) {
|
|
31
|
+
}
|
|
32
|
+
return e
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface Suggestion {
|
|
36
|
+
tag: string
|
|
37
|
+
subjectType: 'actor' | 'feed' | (string & {})
|
|
38
|
+
subject: string
|
|
39
|
+
[k: string]: unknown
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function isSuggestion(v: unknown): v is Suggestion {
|
|
43
|
+
return (
|
|
44
|
+
isObj(v) &&
|
|
45
|
+
hasProp(v, '$type') &&
|
|
46
|
+
v.$type === 'app.bsky.unspecced.getTaggedSuggestions#suggestion'
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function validateSuggestion(v: unknown): ValidationResult {
|
|
51
|
+
return lexicons.validate(
|
|
52
|
+
'app.bsky.unspecced.getTaggedSuggestions#suggestion',
|
|
53
|
+
v,
|
|
54
|
+
)
|
|
55
|
+
}
|
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
|
}
|