@atproto/api 0.3.5 → 0.3.7

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.
@@ -107,6 +107,7 @@ export function validateViewerState(v: unknown): ValidationResult {
107
107
  export type Preferences = (
108
108
  | AdultContentPref
109
109
  | ContentLabelPref
110
+ | SavedFeedsPref
110
111
  | { $type: string; [k: string]: unknown }
111
112
  )[]
112
113
 
@@ -144,3 +145,21 @@ export function isContentLabelPref(v: unknown): v is ContentLabelPref {
144
145
  export function validateContentLabelPref(v: unknown): ValidationResult {
145
146
  return lexicons.validate('app.bsky.actor.defs#contentLabelPref', v)
146
147
  }
148
+
149
+ export interface SavedFeedsPref {
150
+ pinned: string[]
151
+ saved: string[]
152
+ [k: string]: unknown
153
+ }
154
+
155
+ export function isSavedFeedsPref(v: unknown): v is SavedFeedsPref {
156
+ return (
157
+ isObj(v) &&
158
+ hasProp(v, '$type') &&
159
+ v.$type === 'app.bsky.actor.defs#savedFeedsPref'
160
+ )
161
+ }
162
+
163
+ export function validateSavedFeedsPref(v: unknown): ValidationResult {
164
+ return lexicons.validate('app.bsky.actor.defs#savedFeedsPref', v)
165
+ }
@@ -6,6 +6,7 @@ import { isObj, hasProp } from '../../../../util'
6
6
  import { lexicons } from '../../../../lexicons'
7
7
  import { CID } from 'multiformats/cid'
8
8
  import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef'
9
+ import * as AppBskyFeedDefs from '../feed/defs'
9
10
  import * as AppBskyActorDefs from '../actor/defs'
10
11
  import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
11
12
  import * as AppBskyEmbedImages from './images'
@@ -35,6 +36,7 @@ export interface View {
35
36
  | ViewRecord
36
37
  | ViewNotFound
37
38
  | ViewBlocked
39
+ | AppBskyFeedDefs.GeneratorView
38
40
  | { $type: string; [k: string]: unknown }
39
41
  [k: string]: unknown
40
42
  }
@@ -11,6 +11,7 @@ import * as AppBskyEmbedExternal from '../embed/external'
11
11
  import * as AppBskyEmbedRecord from '../embed/record'
12
12
  import * as AppBskyEmbedRecordWithMedia from '../embed/recordWithMedia'
13
13
  import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
14
+ import * as AppBskyRichtextFacet from '../richtext/facet'
14
15
 
15
16
  export interface PostView {
16
17
  uri: string
@@ -80,8 +81,16 @@ export function validateFeedViewPost(v: unknown): ValidationResult {
80
81
  }
81
82
 
82
83
  export interface ReplyRef {
83
- root: PostView
84
- parent: PostView
84
+ root:
85
+ | PostView
86
+ | NotFoundPost
87
+ | BlockedPost
88
+ | { $type: string; [k: string]: unknown }
89
+ parent:
90
+ | PostView
91
+ | NotFoundPost
92
+ | BlockedPost
93
+ | { $type: string; [k: string]: unknown }
85
94
  [k: string]: unknown
86
95
  }
87
96
 
@@ -176,3 +185,82 @@ export function isBlockedPost(v: unknown): v is BlockedPost {
176
185
  export function validateBlockedPost(v: unknown): ValidationResult {
177
186
  return lexicons.validate('app.bsky.feed.defs#blockedPost', v)
178
187
  }
188
+
189
+ export interface GeneratorView {
190
+ uri: string
191
+ cid: string
192
+ did?: string
193
+ creator: AppBskyActorDefs.ProfileView
194
+ displayName: string
195
+ description?: string
196
+ descriptionFacets?: AppBskyRichtextFacet.Main[]
197
+ avatar?: string
198
+ likeCount?: number
199
+ viewer?: GeneratorViewerState
200
+ indexedAt: string
201
+ [k: string]: unknown
202
+ }
203
+
204
+ export function isGeneratorView(v: unknown): v is GeneratorView {
205
+ return (
206
+ isObj(v) &&
207
+ hasProp(v, '$type') &&
208
+ v.$type === 'app.bsky.feed.defs#generatorView'
209
+ )
210
+ }
211
+
212
+ export function validateGeneratorView(v: unknown): ValidationResult {
213
+ return lexicons.validate('app.bsky.feed.defs#generatorView', v)
214
+ }
215
+
216
+ export interface GeneratorViewerState {
217
+ like?: string
218
+ [k: string]: unknown
219
+ }
220
+
221
+ export function isGeneratorViewerState(v: unknown): v is GeneratorViewerState {
222
+ return (
223
+ isObj(v) &&
224
+ hasProp(v, '$type') &&
225
+ v.$type === 'app.bsky.feed.defs#generatorViewerState'
226
+ )
227
+ }
228
+
229
+ export function validateGeneratorViewerState(v: unknown): ValidationResult {
230
+ return lexicons.validate('app.bsky.feed.defs#generatorViewerState', v)
231
+ }
232
+
233
+ export interface SkeletonFeedPost {
234
+ post: string
235
+ reason?: SkeletonReasonRepost | { $type: string; [k: string]: unknown }
236
+ [k: string]: unknown
237
+ }
238
+
239
+ export function isSkeletonFeedPost(v: unknown): v is SkeletonFeedPost {
240
+ return (
241
+ isObj(v) &&
242
+ hasProp(v, '$type') &&
243
+ v.$type === 'app.bsky.feed.defs#skeletonFeedPost'
244
+ )
245
+ }
246
+
247
+ export function validateSkeletonFeedPost(v: unknown): ValidationResult {
248
+ return lexicons.validate('app.bsky.feed.defs#skeletonFeedPost', v)
249
+ }
250
+
251
+ export interface SkeletonReasonRepost {
252
+ repost: string
253
+ [k: string]: unknown
254
+ }
255
+
256
+ export function isSkeletonReasonRepost(v: unknown): v is SkeletonReasonRepost {
257
+ return (
258
+ isObj(v) &&
259
+ hasProp(v, '$type') &&
260
+ v.$type === 'app.bsky.feed.defs#skeletonReasonRepost'
261
+ )
262
+ }
263
+
264
+ export function validateSkeletonReasonRepost(v: unknown): ValidationResult {
265
+ return lexicons.validate('app.bsky.feed.defs#skeletonReasonRepost', v)
266
+ }
@@ -0,0 +1,70 @@
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
+ did: string
16
+ feeds: Feed[]
17
+ links?: Links
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
+ }
36
+
37
+ export interface Feed {
38
+ uri: string
39
+ [k: string]: unknown
40
+ }
41
+
42
+ export function isFeed(v: unknown): v is Feed {
43
+ return (
44
+ isObj(v) &&
45
+ hasProp(v, '$type') &&
46
+ v.$type === 'app.bsky.feed.describeFeedGenerator#feed'
47
+ )
48
+ }
49
+
50
+ export function validateFeed(v: unknown): ValidationResult {
51
+ return lexicons.validate('app.bsky.feed.describeFeedGenerator#feed', v)
52
+ }
53
+
54
+ export interface Links {
55
+ privacyPolicy?: string
56
+ termsOfService?: string
57
+ [k: string]: unknown
58
+ }
59
+
60
+ export function isLinks(v: unknown): v is Links {
61
+ return (
62
+ isObj(v) &&
63
+ hasProp(v, '$type') &&
64
+ v.$type === 'app.bsky.feed.describeFeedGenerator#links'
65
+ )
66
+ }
67
+
68
+ export function validateLinks(v: unknown): ValidationResult {
69
+ return lexicons.validate('app.bsky.feed.describeFeedGenerator#links', v)
70
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { isObj, hasProp } from '../../../../util'
6
+ import { lexicons } from '../../../../lexicons'
7
+ import { CID } from 'multiformats/cid'
8
+ import * as AppBskyRichtextFacet from '../richtext/facet'
9
+
10
+ export interface Record {
11
+ did: string
12
+ displayName: string
13
+ description?: string
14
+ descriptionFacets?: AppBskyRichtextFacet.Main[]
15
+ avatar?: BlobRef
16
+ createdAt: string
17
+ [k: string]: unknown
18
+ }
19
+
20
+ export function isRecord(v: unknown): v is Record {
21
+ return (
22
+ isObj(v) &&
23
+ hasProp(v, '$type') &&
24
+ (v.$type === 'app.bsky.feed.generator#main' ||
25
+ v.$type === 'app.bsky.feed.generator')
26
+ )
27
+ }
28
+
29
+ export function validateRecord(v: unknown): ValidationResult {
30
+ return lexicons.validate('app.bsky.feed.generator#main', v)
31
+ }
@@ -0,0 +1,39 @@
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 AppBskyFeedDefs from './defs'
10
+
11
+ export interface QueryParams {
12
+ actor: string
13
+ limit?: number
14
+ cursor?: string
15
+ }
16
+
17
+ export type InputSchema = undefined
18
+
19
+ export interface OutputSchema {
20
+ cursor?: string
21
+ feeds: AppBskyFeedDefs.GeneratorView[]
22
+ [k: string]: unknown
23
+ }
24
+
25
+ export interface CallOptions {
26
+ headers?: Headers
27
+ }
28
+
29
+ export interface Response {
30
+ success: boolean
31
+ headers: Headers
32
+ data: OutputSchema
33
+ }
34
+
35
+ export function toKnownErr(e: any) {
36
+ if (e instanceof XRPCError) {
37
+ }
38
+ return e
39
+ }
@@ -0,0 +1,46 @@
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 AppBskyFeedDefs from './defs'
10
+
11
+ export interface QueryParams {
12
+ feed: string
13
+ limit?: number
14
+ cursor?: string
15
+ }
16
+
17
+ export type InputSchema = undefined
18
+
19
+ export interface OutputSchema {
20
+ cursor?: string
21
+ feed: AppBskyFeedDefs.FeedViewPost[]
22
+ [k: string]: unknown
23
+ }
24
+
25
+ export interface CallOptions {
26
+ headers?: Headers
27
+ }
28
+
29
+ export interface Response {
30
+ success: boolean
31
+ headers: Headers
32
+ data: OutputSchema
33
+ }
34
+
35
+ export class UnknownFeedError extends XRPCError {
36
+ constructor(src: XRPCError) {
37
+ super(src.status, src.error, src.message)
38
+ }
39
+ }
40
+
41
+ export function toKnownErr(e: any) {
42
+ if (e instanceof XRPCError) {
43
+ if (e.error === 'UnknownFeed') return new UnknownFeedError(e)
44
+ }
45
+ return e
46
+ }
@@ -0,0 +1,38 @@
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 AppBskyFeedDefs from './defs'
10
+
11
+ export interface QueryParams {
12
+ feed: string
13
+ }
14
+
15
+ export type InputSchema = undefined
16
+
17
+ export interface OutputSchema {
18
+ view: AppBskyFeedDefs.GeneratorView
19
+ isOnline: boolean
20
+ isValid: boolean
21
+ [k: string]: unknown
22
+ }
23
+
24
+ export interface CallOptions {
25
+ headers?: Headers
26
+ }
27
+
28
+ export interface Response {
29
+ success: boolean
30
+ headers: Headers
31
+ data: OutputSchema
32
+ }
33
+
34
+ export function toKnownErr(e: any) {
35
+ if (e instanceof XRPCError) {
36
+ }
37
+ return e
38
+ }
@@ -0,0 +1,36 @@
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 AppBskyFeedDefs from './defs'
10
+
11
+ export interface QueryParams {
12
+ feeds: string[]
13
+ }
14
+
15
+ export type InputSchema = undefined
16
+
17
+ export interface OutputSchema {
18
+ feeds: AppBskyFeedDefs.GeneratorView[]
19
+ [k: string]: unknown
20
+ }
21
+
22
+ export interface CallOptions {
23
+ headers?: Headers
24
+ }
25
+
26
+ export interface Response {
27
+ success: boolean
28
+ headers: Headers
29
+ data: OutputSchema
30
+ }
31
+
32
+ export function toKnownErr(e: any) {
33
+ if (e instanceof XRPCError) {
34
+ }
35
+ return e
36
+ }
@@ -0,0 +1,46 @@
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 AppBskyFeedDefs from './defs'
10
+
11
+ export interface QueryParams {
12
+ feed: string
13
+ limit?: number
14
+ cursor?: string
15
+ }
16
+
17
+ export type InputSchema = undefined
18
+
19
+ export interface OutputSchema {
20
+ cursor?: string
21
+ feed: AppBskyFeedDefs.SkeletonFeedPost[]
22
+ [k: string]: unknown
23
+ }
24
+
25
+ export interface CallOptions {
26
+ headers?: Headers
27
+ }
28
+
29
+ export interface Response {
30
+ success: boolean
31
+ headers: Headers
32
+ data: OutputSchema
33
+ }
34
+
35
+ export class UnknownFeedError extends XRPCError {
36
+ constructor(src: XRPCError) {
37
+ super(src.status, src.error, src.message)
38
+ }
39
+ }
40
+
41
+ export function toKnownErr(e: any) {
42
+ if (e instanceof XRPCError) {
43
+ if (e.error === 'UnknownFeed') return new UnknownFeedError(e)
44
+ }
45
+ return e
46
+ }