@atproto/api 0.1.1 → 0.1.2

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.
Files changed (34) hide show
  1. package/dist/client/index.d.ts +4 -0
  2. package/dist/client/lexicons.d.ts +158 -244
  3. package/dist/client/types/app/bsky/actor/getProfile.d.ts +2 -24
  4. package/dist/client/types/app/bsky/actor/getSuggestions.d.ts +2 -15
  5. package/dist/client/types/app/bsky/actor/profile.d.ts +24 -1
  6. package/dist/client/types/app/bsky/actor/ref.d.ts +2 -0
  7. package/dist/client/types/app/bsky/actor/search.d.ts +2 -15
  8. package/dist/client/types/app/bsky/actor/searchTypeahead.d.ts +2 -13
  9. package/dist/client/types/app/bsky/feed/getRepostedBy.d.ts +2 -15
  10. package/dist/client/types/app/bsky/graph/getFollowers.d.ts +1 -15
  11. package/dist/client/types/app/bsky/graph/getFollows.d.ts +1 -15
  12. package/dist/client/types/app/bsky/graph/getMutes.d.ts +2 -13
  13. package/dist/client/types/com/atproto/handle/update.d.ts +17 -0
  14. package/dist/client/types/com/atproto/report/reasonType.d.ts +1 -1
  15. package/dist/client/types/com/atproto/sync/subscribeAllRepos.d.ts +20 -0
  16. package/dist/index.js +471 -524
  17. package/dist/index.js.map +4 -4
  18. package/package.json +1 -1
  19. package/src/client/index.ts +15 -0
  20. package/src/client/lexicons.ts +177 -267
  21. package/src/client/types/app/bsky/actor/getProfile.ts +2 -35
  22. package/src/client/types/app/bsky/actor/getSuggestions.ts +2 -25
  23. package/src/client/types/app/bsky/actor/profile.ts +47 -1
  24. package/src/client/types/app/bsky/actor/ref.ts +2 -0
  25. package/src/client/types/app/bsky/actor/search.ts +2 -23
  26. package/src/client/types/app/bsky/actor/searchTypeahead.ts +2 -23
  27. package/src/client/types/app/bsky/feed/getRepostedBy.ts +2 -25
  28. package/src/client/types/app/bsky/graph/getFollowers.ts +1 -25
  29. package/src/client/types/app/bsky/graph/getFollows.ts +1 -25
  30. package/src/client/types/app/bsky/graph/getMutes.ts +2 -23
  31. package/src/client/types/com/atproto/handle/update.ts +31 -0
  32. package/src/client/types/com/atproto/report/reasonType.ts +2 -2
  33. package/src/client/types/com/atproto/sync/subscribeAllRepos.ts +48 -0
  34. package/tsconfig.build.tsbuildinfo +1 -1
@@ -5,29 +5,14 @@ import { Headers, XRPCError } from '@atproto/xrpc'
5
5
  import { ValidationResult } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as AppBskySystemDeclRef from '../system/declRef'
8
+ import * as AppBskyActorProfile from './profile'
9
9
 
10
10
  export interface QueryParams {
11
11
  actor: string
12
12
  }
13
13
 
14
14
  export type InputSchema = undefined
15
-
16
- export interface OutputSchema {
17
- did: string
18
- declaration: AppBskySystemDeclRef.Main
19
- handle: string
20
- creator: string
21
- displayName?: string
22
- description?: string
23
- avatar?: string
24
- banner?: string
25
- followersCount: number
26
- followsCount: number
27
- postsCount: number
28
- myState?: MyState
29
- [k: string]: unknown
30
- }
15
+ export type OutputSchema = AppBskyActorProfile.View
31
16
 
32
17
  export interface CallOptions {
33
18
  headers?: Headers
@@ -44,21 +29,3 @@ export function toKnownErr(e: any) {
44
29
  }
45
30
  return e
46
31
  }
47
-
48
- export interface MyState {
49
- follow?: string
50
- muted?: boolean
51
- [k: string]: unknown
52
- }
53
-
54
- export function isMyState(v: unknown): v is MyState {
55
- return (
56
- isObj(v) &&
57
- hasProp(v, '$type') &&
58
- v.$type === 'app.bsky.actor.getProfile#myState'
59
- )
60
- }
61
-
62
- export function validateMyState(v: unknown): ValidationResult {
63
- return lexicons.validate('app.bsky.actor.getProfile#myState', v)
64
- }
@@ -5,7 +5,7 @@ import { Headers, XRPCError } from '@atproto/xrpc'
5
5
  import { ValidationResult } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as AppBskySystemDeclRef from '../system/declRef'
8
+ import * as AppBskyActorProfile from './profile'
9
9
 
10
10
  export interface QueryParams {
11
11
  limit?: number
@@ -16,7 +16,7 @@ export type InputSchema = undefined
16
16
 
17
17
  export interface OutputSchema {
18
18
  cursor?: string
19
- actors: Actor[]
19
+ actors: AppBskyActorProfile.ViewBasic[]
20
20
  [k: string]: unknown
21
21
  }
22
22
 
@@ -35,26 +35,3 @@ export function toKnownErr(e: any) {
35
35
  }
36
36
  return e
37
37
  }
38
-
39
- export interface Actor {
40
- did: string
41
- declaration: AppBskySystemDeclRef.Main
42
- handle: string
43
- displayName?: string
44
- description?: string
45
- avatar?: string
46
- indexedAt?: string
47
- [k: string]: unknown
48
- }
49
-
50
- export function isActor(v: unknown): v is Actor {
51
- return (
52
- isObj(v) &&
53
- hasProp(v, '$type') &&
54
- v.$type === 'app.bsky.actor.getSuggestions#actor'
55
- )
56
- }
57
-
58
- export function validateActor(v: unknown): ValidationResult {
59
- return lexicons.validate('app.bsky.actor.getSuggestions#actor', v)
60
- }
@@ -31,7 +31,6 @@ export interface View {
31
31
  did: string
32
32
  declaration: AppBskySystemDeclRef.Main
33
33
  handle: string
34
- creator: string
35
34
  displayName?: string
36
35
  description?: string
37
36
  avatar?: string
@@ -39,6 +38,9 @@ export interface View {
39
38
  followersCount: number
40
39
  followsCount: number
41
40
  postsCount: number
41
+ creator: string
42
+ indexedAt?: string
43
+ viewer?: ViewerState
42
44
  myState?: MyState
43
45
  [k: string]: unknown
44
46
  }
@@ -53,6 +55,50 @@ export function validateView(v: unknown): ValidationResult {
53
55
  return lexicons.validate('app.bsky.actor.profile#view', v)
54
56
  }
55
57
 
58
+ export interface ViewBasic {
59
+ did: string
60
+ declaration: AppBskySystemDeclRef.Main
61
+ handle: string
62
+ displayName?: string
63
+ description?: string
64
+ avatar?: string
65
+ indexedAt?: string
66
+ viewer?: ViewerState
67
+ [k: string]: unknown
68
+ }
69
+
70
+ export function isViewBasic(v: unknown): v is ViewBasic {
71
+ return (
72
+ isObj(v) &&
73
+ hasProp(v, '$type') &&
74
+ v.$type === 'app.bsky.actor.profile#viewBasic'
75
+ )
76
+ }
77
+
78
+ export function validateViewBasic(v: unknown): ValidationResult {
79
+ return lexicons.validate('app.bsky.actor.profile#viewBasic', v)
80
+ }
81
+
82
+ export interface ViewerState {
83
+ muted?: boolean
84
+ following?: string
85
+ followedBy?: string
86
+ [k: string]: unknown
87
+ }
88
+
89
+ export function isViewerState(v: unknown): v is ViewerState {
90
+ return (
91
+ isObj(v) &&
92
+ hasProp(v, '$type') &&
93
+ v.$type === 'app.bsky.actor.profile#viewerState'
94
+ )
95
+ }
96
+
97
+ export function validateViewerState(v: unknown): ValidationResult {
98
+ return lexicons.validate('app.bsky.actor.profile#viewerState', v)
99
+ }
100
+
101
+ /** Deprecated in favor of #viewerState */
56
102
  export interface MyState {
57
103
  follow?: string
58
104
  muted?: boolean
@@ -46,6 +46,8 @@ export function validateWithInfo(v: unknown): ValidationResult {
46
46
 
47
47
  export interface ViewerState {
48
48
  muted?: boolean
49
+ following?: string
50
+ followedBy?: string
49
51
  [k: string]: unknown
50
52
  }
51
53
 
@@ -5,7 +5,7 @@ import { Headers, XRPCError } from '@atproto/xrpc'
5
5
  import { ValidationResult } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as AppBskySystemDeclRef from '../system/declRef'
8
+ import * as AppBskyActorProfile from './profile'
9
9
 
10
10
  export interface QueryParams {
11
11
  term?: string
@@ -17,7 +17,7 @@ export type InputSchema = undefined
17
17
 
18
18
  export interface OutputSchema {
19
19
  cursor?: string
20
- users: User[]
20
+ users: AppBskyActorProfile.ViewBasic[]
21
21
  [k: string]: unknown
22
22
  }
23
23
 
@@ -36,24 +36,3 @@ export function toKnownErr(e: any) {
36
36
  }
37
37
  return e
38
38
  }
39
-
40
- export interface User {
41
- did: string
42
- declaration: AppBskySystemDeclRef.Main
43
- handle: string
44
- displayName?: string
45
- avatar?: string
46
- description?: string
47
- indexedAt?: string
48
- [k: string]: unknown
49
- }
50
-
51
- export function isUser(v: unknown): v is User {
52
- return (
53
- isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.actor.search#user'
54
- )
55
- }
56
-
57
- export function validateUser(v: unknown): ValidationResult {
58
- return lexicons.validate('app.bsky.actor.search#user', v)
59
- }
@@ -5,7 +5,7 @@ import { Headers, XRPCError } from '@atproto/xrpc'
5
5
  import { ValidationResult } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as AppBskySystemDeclRef from '../system/declRef'
8
+ import * as AppBskyActorRef from './ref'
9
9
 
10
10
  export interface QueryParams {
11
11
  term?: string
@@ -15,7 +15,7 @@ export interface QueryParams {
15
15
  export type InputSchema = undefined
16
16
 
17
17
  export interface OutputSchema {
18
- users: User[]
18
+ users: AppBskyActorRef.WithInfo[]
19
19
  [k: string]: unknown
20
20
  }
21
21
 
@@ -34,24 +34,3 @@ export function toKnownErr(e: any) {
34
34
  }
35
35
  return e
36
36
  }
37
-
38
- export interface User {
39
- did: string
40
- declaration: AppBskySystemDeclRef.Main
41
- handle: string
42
- displayName?: string
43
- avatar?: string
44
- [k: string]: unknown
45
- }
46
-
47
- export function isUser(v: unknown): v is User {
48
- return (
49
- isObj(v) &&
50
- hasProp(v, '$type') &&
51
- v.$type === 'app.bsky.actor.searchTypeahead#user'
52
- )
53
- }
54
-
55
- export function validateUser(v: unknown): ValidationResult {
56
- return lexicons.validate('app.bsky.actor.searchTypeahead#user', v)
57
- }
@@ -5,7 +5,7 @@ import { Headers, XRPCError } from '@atproto/xrpc'
5
5
  import { ValidationResult } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as AppBskySystemDeclRef from '../system/declRef'
8
+ import * as AppBskyActorRef from '../actor/ref'
9
9
 
10
10
  export interface QueryParams {
11
11
  uri: string
@@ -20,7 +20,7 @@ export interface OutputSchema {
20
20
  uri: string
21
21
  cid?: string
22
22
  cursor?: string
23
- repostedBy: RepostedBy[]
23
+ repostedBy: AppBskyActorRef.WithInfo[]
24
24
  [k: string]: unknown
25
25
  }
26
26
 
@@ -39,26 +39,3 @@ export function toKnownErr(e: any) {
39
39
  }
40
40
  return e
41
41
  }
42
-
43
- export interface RepostedBy {
44
- did: string
45
- declaration: AppBskySystemDeclRef.Main
46
- handle: string
47
- displayName?: string
48
- avatar?: string
49
- createdAt?: string
50
- indexedAt: string
51
- [k: string]: unknown
52
- }
53
-
54
- export function isRepostedBy(v: unknown): v is RepostedBy {
55
- return (
56
- isObj(v) &&
57
- hasProp(v, '$type') &&
58
- v.$type === 'app.bsky.feed.getRepostedBy#repostedBy'
59
- )
60
- }
61
-
62
- export function validateRepostedBy(v: unknown): ValidationResult {
63
- return lexicons.validate('app.bsky.feed.getRepostedBy#repostedBy', v)
64
- }
@@ -6,7 +6,6 @@ import { ValidationResult } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
8
  import * as AppBskyActorRef from '../actor/ref'
9
- import * as AppBskySystemDeclRef from '../system/declRef'
10
9
 
11
10
  export interface QueryParams {
12
11
  user: string
@@ -19,7 +18,7 @@ export type InputSchema = undefined
19
18
  export interface OutputSchema {
20
19
  subject: AppBskyActorRef.WithInfo
21
20
  cursor?: string
22
- followers: Follower[]
21
+ followers: AppBskyActorRef.WithInfo[]
23
22
  [k: string]: unknown
24
23
  }
25
24
 
@@ -38,26 +37,3 @@ export function toKnownErr(e: any) {
38
37
  }
39
38
  return e
40
39
  }
41
-
42
- export interface Follower {
43
- did: string
44
- declaration: AppBskySystemDeclRef.Main
45
- handle: string
46
- displayName?: string
47
- avatar?: string
48
- createdAt?: string
49
- indexedAt: string
50
- [k: string]: unknown
51
- }
52
-
53
- export function isFollower(v: unknown): v is Follower {
54
- return (
55
- isObj(v) &&
56
- hasProp(v, '$type') &&
57
- v.$type === 'app.bsky.graph.getFollowers#follower'
58
- )
59
- }
60
-
61
- export function validateFollower(v: unknown): ValidationResult {
62
- return lexicons.validate('app.bsky.graph.getFollowers#follower', v)
63
- }
@@ -6,7 +6,6 @@ import { ValidationResult } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
8
  import * as AppBskyActorRef from '../actor/ref'
9
- import * as AppBskySystemDeclRef from '../system/declRef'
10
9
 
11
10
  export interface QueryParams {
12
11
  user: string
@@ -19,7 +18,7 @@ export type InputSchema = undefined
19
18
  export interface OutputSchema {
20
19
  subject: AppBskyActorRef.WithInfo
21
20
  cursor?: string
22
- follows: Follow[]
21
+ follows: AppBskyActorRef.WithInfo[]
23
22
  [k: string]: unknown
24
23
  }
25
24
 
@@ -38,26 +37,3 @@ export function toKnownErr(e: any) {
38
37
  }
39
38
  return e
40
39
  }
41
-
42
- export interface Follow {
43
- did: string
44
- declaration: AppBskySystemDeclRef.Main
45
- handle: string
46
- displayName?: string
47
- avatar?: string
48
- createdAt?: string
49
- indexedAt: string
50
- [k: string]: unknown
51
- }
52
-
53
- export function isFollow(v: unknown): v is Follow {
54
- return (
55
- isObj(v) &&
56
- hasProp(v, '$type') &&
57
- v.$type === 'app.bsky.graph.getFollows#follow'
58
- )
59
- }
60
-
61
- export function validateFollow(v: unknown): ValidationResult {
62
- return lexicons.validate('app.bsky.graph.getFollows#follow', v)
63
- }
@@ -5,7 +5,7 @@ import { Headers, XRPCError } from '@atproto/xrpc'
5
5
  import { ValidationResult } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as AppBskySystemDeclRef from '../system/declRef'
8
+ import * as AppBskyActorRef from '../actor/ref'
9
9
 
10
10
  export interface QueryParams {
11
11
  limit?: number
@@ -16,7 +16,7 @@ export type InputSchema = undefined
16
16
 
17
17
  export interface OutputSchema {
18
18
  cursor?: string
19
- mutes: Mute[]
19
+ mutes: AppBskyActorRef.WithInfo[]
20
20
  [k: string]: unknown
21
21
  }
22
22
 
@@ -35,24 +35,3 @@ export function toKnownErr(e: any) {
35
35
  }
36
36
  return e
37
37
  }
38
-
39
- export interface Mute {
40
- did: string
41
- declaration: AppBskySystemDeclRef.Main
42
- handle: string
43
- displayName?: string
44
- createdAt: string
45
- [k: string]: unknown
46
- }
47
-
48
- export function isMute(v: unknown): v is Mute {
49
- return (
50
- isObj(v) &&
51
- hasProp(v, '$type') &&
52
- v.$type === 'app.bsky.graph.getMutes#mute'
53
- )
54
- }
55
-
56
- export function validateMute(v: unknown): ValidationResult {
57
- return lexicons.validate('app.bsky.graph.getMutes#mute', v)
58
- }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
8
+
9
+ export interface QueryParams {}
10
+
11
+ export interface InputSchema {
12
+ handle: string
13
+ [k: string]: unknown
14
+ }
15
+
16
+ export interface CallOptions {
17
+ headers?: Headers
18
+ qp?: QueryParams
19
+ encoding: 'application/json'
20
+ }
21
+
22
+ export interface Response {
23
+ success: boolean
24
+ headers: Headers
25
+ }
26
+
27
+ export function toKnownErr(e: any) {
28
+ if (e instanceof XRPCError) {
29
+ }
30
+ return e
31
+ }
@@ -6,8 +6,8 @@ import { isObj, hasProp } from '../../../../util'
6
6
  import { lexicons } from '../../../../lexicons'
7
7
 
8
8
  export type Main =
9
- | 'com.atproto.report.reason#spam'
10
- | 'com.atproto.report.reason#other'
9
+ | 'com.atproto.report.reasonType#spam'
10
+ | 'com.atproto.report.reasonType#other'
11
11
  | (string & {})
12
12
 
13
13
  /** Moderation report reason: Spam. */
@@ -0,0 +1,48 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
8
+
9
+ export interface RepoAppend {
10
+ time: string
11
+ repo: string
12
+ commit: string
13
+ prev?: string
14
+ blocks: {}
15
+ blobs: string[]
16
+ [k: string]: unknown
17
+ }
18
+
19
+ export function isRepoAppend(v: unknown): v is RepoAppend {
20
+ return (
21
+ isObj(v) &&
22
+ hasProp(v, '$type') &&
23
+ v.$type === 'com.atproto.sync.subscribeAllRepos#repoAppend'
24
+ )
25
+ }
26
+
27
+ export function validateRepoAppend(v: unknown): ValidationResult {
28
+ return lexicons.validate('com.atproto.sync.subscribeAllRepos#repoAppend', v)
29
+ }
30
+
31
+ export interface RepoRebase {
32
+ time: string
33
+ repo: string
34
+ commit: string
35
+ [k: string]: unknown
36
+ }
37
+
38
+ export function isRepoRebase(v: unknown): v is RepoRebase {
39
+ return (
40
+ isObj(v) &&
41
+ hasProp(v, '$type') &&
42
+ v.$type === 'com.atproto.sync.subscribeAllRepos#repoRebase'
43
+ )
44
+ }
45
+
46
+ export function validateRepoRebase(v: unknown): ValidationResult {
47
+ return lexicons.validate('com.atproto.sync.subscribeAllRepos#repoRebase', v)
48
+ }