@atproto/api 0.0.4 → 0.0.6

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 (105) hide show
  1. package/dist/client/lexicons.d.ts +0 -3
  2. package/dist/client/types/app/bsky/actor/getProfile.d.ts +3 -0
  3. package/dist/client/types/app/bsky/actor/getSuggestions.d.ts +5 -0
  4. package/dist/client/types/app/bsky/actor/profile.d.ts +3 -0
  5. package/dist/client/types/app/bsky/actor/ref.d.ts +7 -0
  6. package/dist/client/types/app/bsky/actor/search.d.ts +3 -0
  7. package/dist/client/types/app/bsky/actor/searchTypeahead.d.ts +3 -0
  8. package/dist/client/types/app/bsky/embed/external.d.ts +9 -0
  9. package/dist/client/types/app/bsky/embed/images.d.ts +9 -0
  10. package/dist/client/types/app/bsky/feed/feedViewPost.d.ts +9 -0
  11. package/dist/client/types/app/bsky/feed/getPostThread.d.ts +5 -0
  12. package/dist/client/types/app/bsky/feed/getRepostedBy.d.ts +3 -0
  13. package/dist/client/types/app/bsky/feed/getVotes.d.ts +3 -0
  14. package/dist/client/types/app/bsky/feed/post.d.ts +13 -1
  15. package/dist/client/types/app/bsky/feed/repost.d.ts +3 -0
  16. package/dist/client/types/app/bsky/feed/trend.d.ts +3 -0
  17. package/dist/client/types/app/bsky/feed/vote.d.ts +3 -0
  18. package/dist/client/types/app/bsky/graph/assertion.d.ts +3 -0
  19. package/dist/client/types/app/bsky/graph/confirmation.d.ts +3 -0
  20. package/dist/client/types/app/bsky/graph/follow.d.ts +3 -0
  21. package/dist/client/types/app/bsky/graph/getAssertions.d.ts +5 -0
  22. package/dist/client/types/app/bsky/graph/getFollowers.d.ts +3 -0
  23. package/dist/client/types/app/bsky/graph/getFollows.d.ts +3 -0
  24. package/dist/client/types/app/bsky/graph/getMembers.d.ts +3 -0
  25. package/dist/client/types/app/bsky/graph/getMemberships.d.ts +3 -0
  26. package/dist/client/types/app/bsky/graph/getMutes.d.ts +3 -0
  27. package/dist/client/types/app/bsky/notification/list.d.ts +3 -0
  28. package/dist/client/types/app/bsky/system/declRef.d.ts +3 -0
  29. package/dist/client/types/app/bsky/system/declaration.d.ts +3 -0
  30. package/dist/client/types/com/atproto/repo/batchWrite.d.ts +7 -0
  31. package/dist/client/types/com/atproto/repo/listRecords.d.ts +3 -0
  32. package/dist/client/types/com/atproto/repo/strongRef.d.ts +3 -0
  33. package/dist/client/types/com/atproto/server/getAccountsConfig.d.ts +3 -0
  34. package/dist/client/util.d.ts +2 -0
  35. package/dist/index.js +571 -23
  36. package/dist/index.js.map +4 -4
  37. package/package.json +1 -1
  38. package/src/client/lexicons.ts +0 -3
  39. package/src/client/types/app/bsky/actor/createScene.ts +3 -0
  40. package/src/client/types/app/bsky/actor/getProfile.ts +15 -0
  41. package/src/client/types/app/bsky/actor/getSuggestions.ts +27 -0
  42. package/src/client/types/app/bsky/actor/profile.ts +17 -0
  43. package/src/client/types/app/bsky/actor/ref.ts +37 -0
  44. package/src/client/types/app/bsky/actor/search.ts +13 -0
  45. package/src/client/types/app/bsky/actor/searchTypeahead.ts +15 -0
  46. package/src/client/types/app/bsky/actor/updateProfile.ts +3 -0
  47. package/src/client/types/app/bsky/embed/external.ts +53 -0
  48. package/src/client/types/app/bsky/embed/images.ts +51 -0
  49. package/src/client/types/app/bsky/feed/feedViewPost.ts +52 -0
  50. package/src/client/types/app/bsky/feed/getAuthorFeed.ts +3 -0
  51. package/src/client/types/app/bsky/feed/getPostThread.ts +27 -0
  52. package/src/client/types/app/bsky/feed/getRepostedBy.ts +15 -0
  53. package/src/client/types/app/bsky/feed/getTimeline.ts +3 -0
  54. package/src/client/types/app/bsky/feed/getVotes.ts +13 -0
  55. package/src/client/types/app/bsky/feed/post.ts +69 -1
  56. package/src/client/types/app/bsky/feed/repost.ts +16 -0
  57. package/src/client/types/app/bsky/feed/setVote.ts +3 -0
  58. package/src/client/types/app/bsky/feed/trend.ts +16 -0
  59. package/src/client/types/app/bsky/feed/vote.ts +15 -0
  60. package/src/client/types/app/bsky/graph/assertCreator.ts +4 -0
  61. package/src/client/types/app/bsky/graph/assertMember.ts +4 -0
  62. package/src/client/types/app/bsky/graph/assertion.ts +16 -0
  63. package/src/client/types/app/bsky/graph/confirmation.ts +16 -0
  64. package/src/client/types/app/bsky/graph/follow.ts +16 -0
  65. package/src/client/types/app/bsky/graph/getAssertions.ts +27 -0
  66. package/src/client/types/app/bsky/graph/getFollowers.ts +15 -0
  67. package/src/client/types/app/bsky/graph/getFollows.ts +15 -0
  68. package/src/client/types/app/bsky/graph/getMembers.ts +15 -0
  69. package/src/client/types/app/bsky/graph/getMemberships.ts +15 -0
  70. package/src/client/types/app/bsky/graph/getMutes.ts +15 -0
  71. package/src/client/types/app/bsky/graph/mute.ts +3 -0
  72. package/src/client/types/app/bsky/graph/unmute.ts +3 -0
  73. package/src/client/types/app/bsky/notification/getCount.ts +3 -0
  74. package/src/client/types/app/bsky/notification/list.ts +15 -0
  75. package/src/client/types/app/bsky/notification/updateSeen.ts +3 -0
  76. package/src/client/types/app/bsky/system/actorScene.ts +4 -0
  77. package/src/client/types/app/bsky/system/actorUser.ts +4 -0
  78. package/src/client/types/app/bsky/system/declRef.ts +17 -0
  79. package/src/client/types/app/bsky/system/declaration.ts +17 -0
  80. package/src/client/types/com/atproto/account/create.ts +3 -0
  81. package/src/client/types/com/atproto/account/createInviteCode.ts +3 -0
  82. package/src/client/types/com/atproto/account/delete.ts +3 -0
  83. package/src/client/types/com/atproto/account/get.ts +3 -0
  84. package/src/client/types/com/atproto/account/requestPasswordReset.ts +3 -0
  85. package/src/client/types/com/atproto/account/resetPassword.ts +3 -0
  86. package/src/client/types/com/atproto/blob/upload.ts +3 -0
  87. package/src/client/types/com/atproto/handle/resolve.ts +3 -0
  88. package/src/client/types/com/atproto/repo/batchWrite.ts +39 -0
  89. package/src/client/types/com/atproto/repo/createRecord.ts +3 -0
  90. package/src/client/types/com/atproto/repo/deleteRecord.ts +3 -0
  91. package/src/client/types/com/atproto/repo/describe.ts +3 -0
  92. package/src/client/types/com/atproto/repo/getRecord.ts +3 -0
  93. package/src/client/types/com/atproto/repo/listRecords.ts +15 -0
  94. package/src/client/types/com/atproto/repo/putRecord.ts +3 -0
  95. package/src/client/types/com/atproto/repo/strongRef.ts +17 -0
  96. package/src/client/types/com/atproto/server/getAccountsConfig.ts +15 -0
  97. package/src/client/types/com/atproto/session/create.ts +3 -0
  98. package/src/client/types/com/atproto/session/delete.ts +3 -0
  99. package/src/client/types/com/atproto/session/get.ts +3 -0
  100. package/src/client/types/com/atproto/session/refresh.ts +3 -0
  101. package/src/client/types/com/atproto/sync/getRepo.ts +3 -0
  102. package/src/client/types/com/atproto/sync/getRoot.ts +3 -0
  103. package/src/client/types/com/atproto/sync/updateRepo.ts +3 -0
  104. package/src/client/util.ts +13 -0
  105. package/tsconfig.build.tsbuildinfo +1 -1
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {
7
10
  /** The handle to resolve. If not supplied, will resolve the host's own handle. */
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -39,6 +42,18 @@ export interface Create {
39
42
  [k: string]: unknown
40
43
  }
41
44
 
45
+ export function isCreate(v: unknown): v is Create {
46
+ return (
47
+ isObj(v) &&
48
+ hasProp(v, '$type') &&
49
+ v.$type === 'com.atproto.repo.batchWrite#create'
50
+ )
51
+ }
52
+
53
+ export function validateCreate(v: unknown): ValidationResult {
54
+ return lexicons.validate('com.atproto.repo.batchWrite#create', v)
55
+ }
56
+
42
57
  export interface Update {
43
58
  action: 'update'
44
59
  collection: string
@@ -47,9 +62,33 @@ export interface Update {
47
62
  [k: string]: unknown
48
63
  }
49
64
 
65
+ export function isUpdate(v: unknown): v is Update {
66
+ return (
67
+ isObj(v) &&
68
+ hasProp(v, '$type') &&
69
+ v.$type === 'com.atproto.repo.batchWrite#update'
70
+ )
71
+ }
72
+
73
+ export function validateUpdate(v: unknown): ValidationResult {
74
+ return lexicons.validate('com.atproto.repo.batchWrite#update', v)
75
+ }
76
+
50
77
  export interface Delete {
51
78
  action: 'delete'
52
79
  collection: string
53
80
  rkey: string
54
81
  [k: string]: unknown
55
82
  }
83
+
84
+ export function isDelete(v: unknown): v is Delete {
85
+ return (
86
+ isObj(v) &&
87
+ hasProp(v, '$type') &&
88
+ v.$type === 'com.atproto.repo.batchWrite#delete'
89
+ )
90
+ }
91
+
92
+ export function validateDelete(v: unknown): ValidationResult {
93
+ return lexicons.validate('com.atproto.repo.batchWrite#delete', v)
94
+ }
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {
7
10
  /** The handle or DID of the repo. */
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {
7
10
  /** The handle or DID of the repo. */
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {
7
10
  /** The handle or DID of the repo. */
@@ -48,3 +51,15 @@ export interface Record {
48
51
  value: {}
49
52
  [k: string]: unknown
50
53
  }
54
+
55
+ export function isRecord(v: unknown): v is Record {
56
+ return (
57
+ isObj(v) &&
58
+ hasProp(v, '$type') &&
59
+ v.$type === 'com.atproto.repo.listRecords#record'
60
+ )
61
+ }
62
+
63
+ export function validateRecord(v: unknown): ValidationResult {
64
+ return lexicons.validate('com.atproto.repo.listRecords#record', v)
65
+ }
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -1,8 +1,25 @@
1
1
  /**
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
+ import { ValidationResult } from '@atproto/lexicon'
5
+ import { isObj, hasProp } from '../../../../util'
6
+ import { lexicons } from '../../../../lexicons'
7
+
4
8
  export interface Main {
5
9
  uri: string
6
10
  cid: string
7
11
  [k: string]: unknown
8
12
  }
13
+
14
+ export function isMain(v: unknown): v is Main {
15
+ return (
16
+ isObj(v) &&
17
+ hasProp(v, '$type') &&
18
+ (v.$type === 'com.atproto.repo.strongRef#main' ||
19
+ v.$type === 'com.atproto.repo.strongRef')
20
+ )
21
+ }
22
+
23
+ export function validateMain(v: unknown): ValidationResult {
24
+ return lexicons.validate('com.atproto.repo.strongRef#main', v)
25
+ }
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -35,3 +38,15 @@ export interface Links {
35
38
  termsOfService?: string
36
39
  [k: string]: unknown
37
40
  }
41
+
42
+ export function isLinks(v: unknown): v is Links {
43
+ return (
44
+ isObj(v) &&
45
+ hasProp(v, '$type') &&
46
+ v.$type === 'com.atproto.server.getAccountsConfig#links'
47
+ )
48
+ }
49
+
50
+ export function validateLinks(v: unknown): ValidationResult {
51
+ return lexicons.validate('com.atproto.server.getAccountsConfig#links', v)
52
+ }
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {}
7
10
 
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {
7
10
  /** The DID of the repo. */
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {
7
10
  /** The DID of the repo. */
@@ -2,6 +2,9 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
5
8
 
6
9
  export interface QueryParams {
7
10
  /** The DID of the repo. */
@@ -0,0 +1,13 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ export function isObj(v: unknown): v is Record<string, unknown> {
5
+ return typeof v === 'object' && v !== null
6
+ }
7
+
8
+ export function hasProp<K extends PropertyKey>(
9
+ data: object,
10
+ prop: K,
11
+ ): data is Record<K, unknown> {
12
+ return prop in data
13
+ }