@atproto/api 0.0.8 → 0.1.0
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/README.md +44 -6
- package/dist/agent.d.ts +22 -0
- package/dist/client/index.d.ts +60 -61
- package/dist/client/lexicons.d.ts +136 -22
- package/dist/client/types/app/bsky/actor/getSuggestions.d.ts +0 -7
- package/dist/client/types/com/atproto/admin/blob.d.ts +37 -0
- package/dist/client/types/com/atproto/admin/moderationAction.d.ts +13 -2
- package/dist/client/types/com/atproto/admin/record.d.ts +5 -2
- package/dist/client/types/com/atproto/admin/repo.d.ts +2 -2
- package/dist/client/types/com/atproto/admin/takeModerationAction.d.ts +5 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +425 -196
- package/dist/index.js.map +4 -4
- package/dist/types.d.ts +33 -0
- package/package.json +1 -1
- package/src/agent.ts +305 -0
- package/src/client/index.ts +62 -63
- package/src/client/lexicons.ts +169 -36
- package/src/client/types/app/bsky/actor/getSuggestions.ts +0 -18
- package/src/client/types/com/atproto/admin/blob.ts +84 -0
- package/src/client/types/com/atproto/admin/moderationAction.ts +29 -10
- package/src/client/types/com/atproto/admin/record.ts +5 -2
- package/src/client/types/com/atproto/admin/repo.ts +2 -2
- package/src/client/types/com/atproto/admin/takeModerationAction.ts +8 -0
- package/src/index.ts +3 -3
- package/src/types.ts +71 -0
- package/tests/_util.ts +26 -0
- package/tests/agent.test.ts +391 -0
- package/tests/errors.test.ts +4 -8
- package/tsconfig.build.tsbuildinfo +1 -1
- package/src/session.ts +0 -194
- package/tests/session.test.ts +0 -239
package/src/client/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import * as ComAtprotoAccountGet from './types/com/atproto/account/get'
|
|
|
13
13
|
import * as ComAtprotoAccountRequestDelete from './types/com/atproto/account/requestDelete'
|
|
14
14
|
import * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset'
|
|
15
15
|
import * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword'
|
|
16
|
+
import * as ComAtprotoAdminBlob from './types/com/atproto/admin/blob'
|
|
16
17
|
import * as ComAtprotoAdminGetModerationAction from './types/com/atproto/admin/getModerationAction'
|
|
17
18
|
import * as ComAtprotoAdminGetModerationActions from './types/com/atproto/admin/getModerationActions'
|
|
18
19
|
import * as ComAtprotoAdminGetModerationReport from './types/com/atproto/admin/getModerationReport'
|
|
@@ -95,6 +96,7 @@ export * as ComAtprotoAccountGet from './types/com/atproto/account/get'
|
|
|
95
96
|
export * as ComAtprotoAccountRequestDelete from './types/com/atproto/account/requestDelete'
|
|
96
97
|
export * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset'
|
|
97
98
|
export * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword'
|
|
99
|
+
export * as ComAtprotoAdminBlob from './types/com/atproto/admin/blob'
|
|
98
100
|
export * as ComAtprotoAdminGetModerationAction from './types/com/atproto/admin/getModerationAction'
|
|
99
101
|
export * as ComAtprotoAdminGetModerationActions from './types/com/atproto/admin/getModerationActions'
|
|
100
102
|
export * as ComAtprotoAdminGetModerationReport from './types/com/atproto/admin/getModerationReport'
|
|
@@ -187,28 +189,25 @@ export const APP_BSKY_SYSTEM = {
|
|
|
187
189
|
ActorUser: 'app.bsky.system.actorUser',
|
|
188
190
|
}
|
|
189
191
|
|
|
190
|
-
export class
|
|
192
|
+
export class AtpBaseClient {
|
|
191
193
|
xrpc: XrpcClient = new XrpcClient()
|
|
192
194
|
|
|
193
195
|
constructor() {
|
|
194
196
|
this.xrpc.addLexicons(schemas)
|
|
195
197
|
}
|
|
196
198
|
|
|
197
|
-
service(serviceUri: string | URL):
|
|
198
|
-
return new
|
|
199
|
+
service(serviceUri: string | URL): AtpServiceClient {
|
|
200
|
+
return new AtpServiceClient(this, this.xrpc.service(serviceUri))
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
203
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
export class ServiceClient {
|
|
206
|
-
_baseClient: Client
|
|
204
|
+
export class AtpServiceClient {
|
|
205
|
+
_baseClient: AtpBaseClient
|
|
207
206
|
xrpc: XrpcServiceClient
|
|
208
207
|
com: ComNS
|
|
209
208
|
app: AppNS
|
|
210
209
|
|
|
211
|
-
constructor(baseClient:
|
|
210
|
+
constructor(baseClient: AtpBaseClient, xrpcService: XrpcServiceClient) {
|
|
212
211
|
this._baseClient = baseClient
|
|
213
212
|
this.xrpc = xrpcService
|
|
214
213
|
this.com = new ComNS(this)
|
|
@@ -221,17 +220,17 @@ export class ServiceClient {
|
|
|
221
220
|
}
|
|
222
221
|
|
|
223
222
|
export class ComNS {
|
|
224
|
-
_service:
|
|
223
|
+
_service: AtpServiceClient
|
|
225
224
|
atproto: AtprotoNS
|
|
226
225
|
|
|
227
|
-
constructor(service:
|
|
226
|
+
constructor(service: AtpServiceClient) {
|
|
228
227
|
this._service = service
|
|
229
228
|
this.atproto = new AtprotoNS(service)
|
|
230
229
|
}
|
|
231
230
|
}
|
|
232
231
|
|
|
233
232
|
export class AtprotoNS {
|
|
234
|
-
_service:
|
|
233
|
+
_service: AtpServiceClient
|
|
235
234
|
account: AccountNS
|
|
236
235
|
admin: AdminNS
|
|
237
236
|
blob: BlobNS
|
|
@@ -242,7 +241,7 @@ export class AtprotoNS {
|
|
|
242
241
|
session: SessionNS
|
|
243
242
|
sync: SyncNS
|
|
244
243
|
|
|
245
|
-
constructor(service:
|
|
244
|
+
constructor(service: AtpServiceClient) {
|
|
246
245
|
this._service = service
|
|
247
246
|
this.account = new AccountNS(service)
|
|
248
247
|
this.admin = new AdminNS(service)
|
|
@@ -257,9 +256,9 @@ export class AtprotoNS {
|
|
|
257
256
|
}
|
|
258
257
|
|
|
259
258
|
export class AccountNS {
|
|
260
|
-
_service:
|
|
259
|
+
_service: AtpServiceClient
|
|
261
260
|
|
|
262
|
-
constructor(service:
|
|
261
|
+
constructor(service: AtpServiceClient) {
|
|
263
262
|
this._service = service
|
|
264
263
|
}
|
|
265
264
|
|
|
@@ -342,9 +341,9 @@ export class AccountNS {
|
|
|
342
341
|
}
|
|
343
342
|
|
|
344
343
|
export class AdminNS {
|
|
345
|
-
_service:
|
|
344
|
+
_service: AtpServiceClient
|
|
346
345
|
|
|
347
|
-
constructor(service:
|
|
346
|
+
constructor(service: AtpServiceClient) {
|
|
348
347
|
this._service = service
|
|
349
348
|
}
|
|
350
349
|
|
|
@@ -460,9 +459,9 @@ export class AdminNS {
|
|
|
460
459
|
}
|
|
461
460
|
|
|
462
461
|
export class BlobNS {
|
|
463
|
-
_service:
|
|
462
|
+
_service: AtpServiceClient
|
|
464
463
|
|
|
465
|
-
constructor(service:
|
|
464
|
+
constructor(service: AtpServiceClient) {
|
|
466
465
|
this._service = service
|
|
467
466
|
}
|
|
468
467
|
|
|
@@ -479,9 +478,9 @@ export class BlobNS {
|
|
|
479
478
|
}
|
|
480
479
|
|
|
481
480
|
export class HandleNS {
|
|
482
|
-
_service:
|
|
481
|
+
_service: AtpServiceClient
|
|
483
482
|
|
|
484
|
-
constructor(service:
|
|
483
|
+
constructor(service: AtpServiceClient) {
|
|
485
484
|
this._service = service
|
|
486
485
|
}
|
|
487
486
|
|
|
@@ -498,9 +497,9 @@ export class HandleNS {
|
|
|
498
497
|
}
|
|
499
498
|
|
|
500
499
|
export class RepoNS {
|
|
501
|
-
_service:
|
|
500
|
+
_service: AtpServiceClient
|
|
502
501
|
|
|
503
|
-
constructor(service:
|
|
502
|
+
constructor(service: AtpServiceClient) {
|
|
504
503
|
this._service = service
|
|
505
504
|
}
|
|
506
505
|
|
|
@@ -583,9 +582,9 @@ export class RepoNS {
|
|
|
583
582
|
}
|
|
584
583
|
|
|
585
584
|
export class ReportNS {
|
|
586
|
-
_service:
|
|
585
|
+
_service: AtpServiceClient
|
|
587
586
|
|
|
588
|
-
constructor(service:
|
|
587
|
+
constructor(service: AtpServiceClient) {
|
|
589
588
|
this._service = service
|
|
590
589
|
}
|
|
591
590
|
|
|
@@ -602,9 +601,9 @@ export class ReportNS {
|
|
|
602
601
|
}
|
|
603
602
|
|
|
604
603
|
export class ServerNS {
|
|
605
|
-
_service:
|
|
604
|
+
_service: AtpServiceClient
|
|
606
605
|
|
|
607
|
-
constructor(service:
|
|
606
|
+
constructor(service: AtpServiceClient) {
|
|
608
607
|
this._service = service
|
|
609
608
|
}
|
|
610
609
|
|
|
@@ -621,9 +620,9 @@ export class ServerNS {
|
|
|
621
620
|
}
|
|
622
621
|
|
|
623
622
|
export class SessionNS {
|
|
624
|
-
_service:
|
|
623
|
+
_service: AtpServiceClient
|
|
625
624
|
|
|
626
|
-
constructor(service:
|
|
625
|
+
constructor(service: AtpServiceClient) {
|
|
627
626
|
this._service = service
|
|
628
627
|
}
|
|
629
628
|
|
|
@@ -673,9 +672,9 @@ export class SessionNS {
|
|
|
673
672
|
}
|
|
674
673
|
|
|
675
674
|
export class SyncNS {
|
|
676
|
-
_service:
|
|
675
|
+
_service: AtpServiceClient
|
|
677
676
|
|
|
678
|
-
constructor(service:
|
|
677
|
+
constructor(service: AtpServiceClient) {
|
|
679
678
|
this._service = service
|
|
680
679
|
}
|
|
681
680
|
|
|
@@ -736,17 +735,17 @@ export class SyncNS {
|
|
|
736
735
|
}
|
|
737
736
|
|
|
738
737
|
export class AppNS {
|
|
739
|
-
_service:
|
|
738
|
+
_service: AtpServiceClient
|
|
740
739
|
bsky: BskyNS
|
|
741
740
|
|
|
742
|
-
constructor(service:
|
|
741
|
+
constructor(service: AtpServiceClient) {
|
|
743
742
|
this._service = service
|
|
744
743
|
this.bsky = new BskyNS(service)
|
|
745
744
|
}
|
|
746
745
|
}
|
|
747
746
|
|
|
748
747
|
export class BskyNS {
|
|
749
|
-
_service:
|
|
748
|
+
_service: AtpServiceClient
|
|
750
749
|
actor: ActorNS
|
|
751
750
|
embed: EmbedNS
|
|
752
751
|
feed: FeedNS
|
|
@@ -754,7 +753,7 @@ export class BskyNS {
|
|
|
754
753
|
notification: NotificationNS
|
|
755
754
|
system: SystemNS
|
|
756
755
|
|
|
757
|
-
constructor(service:
|
|
756
|
+
constructor(service: AtpServiceClient) {
|
|
758
757
|
this._service = service
|
|
759
758
|
this.actor = new ActorNS(service)
|
|
760
759
|
this.embed = new EmbedNS(service)
|
|
@@ -766,10 +765,10 @@ export class BskyNS {
|
|
|
766
765
|
}
|
|
767
766
|
|
|
768
767
|
export class ActorNS {
|
|
769
|
-
_service:
|
|
768
|
+
_service: AtpServiceClient
|
|
770
769
|
profile: ProfileRecord
|
|
771
770
|
|
|
772
|
-
constructor(service:
|
|
771
|
+
constructor(service: AtpServiceClient) {
|
|
773
772
|
this._service = service
|
|
774
773
|
this.profile = new ProfileRecord(service)
|
|
775
774
|
}
|
|
@@ -831,9 +830,9 @@ export class ActorNS {
|
|
|
831
830
|
}
|
|
832
831
|
|
|
833
832
|
export class ProfileRecord {
|
|
834
|
-
_service:
|
|
833
|
+
_service: AtpServiceClient
|
|
835
834
|
|
|
836
|
-
constructor(service:
|
|
835
|
+
constructor(service: AtpServiceClient) {
|
|
837
836
|
this._service = service
|
|
838
837
|
}
|
|
839
838
|
|
|
@@ -892,20 +891,20 @@ export class ProfileRecord {
|
|
|
892
891
|
}
|
|
893
892
|
|
|
894
893
|
export class EmbedNS {
|
|
895
|
-
_service:
|
|
894
|
+
_service: AtpServiceClient
|
|
896
895
|
|
|
897
|
-
constructor(service:
|
|
896
|
+
constructor(service: AtpServiceClient) {
|
|
898
897
|
this._service = service
|
|
899
898
|
}
|
|
900
899
|
}
|
|
901
900
|
|
|
902
901
|
export class FeedNS {
|
|
903
|
-
_service:
|
|
902
|
+
_service: AtpServiceClient
|
|
904
903
|
post: PostRecord
|
|
905
904
|
repost: RepostRecord
|
|
906
905
|
vote: VoteRecord
|
|
907
906
|
|
|
908
|
-
constructor(service:
|
|
907
|
+
constructor(service: AtpServiceClient) {
|
|
909
908
|
this._service = service
|
|
910
909
|
this.post = new PostRecord(service)
|
|
911
910
|
this.repost = new RepostRecord(service)
|
|
@@ -980,9 +979,9 @@ export class FeedNS {
|
|
|
980
979
|
}
|
|
981
980
|
|
|
982
981
|
export class PostRecord {
|
|
983
|
-
_service:
|
|
982
|
+
_service: AtpServiceClient
|
|
984
983
|
|
|
985
|
-
constructor(service:
|
|
984
|
+
constructor(service: AtpServiceClient) {
|
|
986
985
|
this._service = service
|
|
987
986
|
}
|
|
988
987
|
|
|
@@ -1041,9 +1040,9 @@ export class PostRecord {
|
|
|
1041
1040
|
}
|
|
1042
1041
|
|
|
1043
1042
|
export class RepostRecord {
|
|
1044
|
-
_service:
|
|
1043
|
+
_service: AtpServiceClient
|
|
1045
1044
|
|
|
1046
|
-
constructor(service:
|
|
1045
|
+
constructor(service: AtpServiceClient) {
|
|
1047
1046
|
this._service = service
|
|
1048
1047
|
}
|
|
1049
1048
|
|
|
@@ -1102,9 +1101,9 @@ export class RepostRecord {
|
|
|
1102
1101
|
}
|
|
1103
1102
|
|
|
1104
1103
|
export class VoteRecord {
|
|
1105
|
-
_service:
|
|
1104
|
+
_service: AtpServiceClient
|
|
1106
1105
|
|
|
1107
|
-
constructor(service:
|
|
1106
|
+
constructor(service: AtpServiceClient) {
|
|
1108
1107
|
this._service = service
|
|
1109
1108
|
}
|
|
1110
1109
|
|
|
@@ -1163,12 +1162,12 @@ export class VoteRecord {
|
|
|
1163
1162
|
}
|
|
1164
1163
|
|
|
1165
1164
|
export class GraphNS {
|
|
1166
|
-
_service:
|
|
1165
|
+
_service: AtpServiceClient
|
|
1167
1166
|
assertion: AssertionRecord
|
|
1168
1167
|
confirmation: ConfirmationRecord
|
|
1169
1168
|
follow: FollowRecord
|
|
1170
1169
|
|
|
1171
|
-
constructor(service:
|
|
1170
|
+
constructor(service: AtpServiceClient) {
|
|
1172
1171
|
this._service = service
|
|
1173
1172
|
this.assertion = new AssertionRecord(service)
|
|
1174
1173
|
this.confirmation = new ConfirmationRecord(service)
|
|
@@ -1232,9 +1231,9 @@ export class GraphNS {
|
|
|
1232
1231
|
}
|
|
1233
1232
|
|
|
1234
1233
|
export class AssertionRecord {
|
|
1235
|
-
_service:
|
|
1234
|
+
_service: AtpServiceClient
|
|
1236
1235
|
|
|
1237
|
-
constructor(service:
|
|
1236
|
+
constructor(service: AtpServiceClient) {
|
|
1238
1237
|
this._service = service
|
|
1239
1238
|
}
|
|
1240
1239
|
|
|
@@ -1297,9 +1296,9 @@ export class AssertionRecord {
|
|
|
1297
1296
|
}
|
|
1298
1297
|
|
|
1299
1298
|
export class ConfirmationRecord {
|
|
1300
|
-
_service:
|
|
1299
|
+
_service: AtpServiceClient
|
|
1301
1300
|
|
|
1302
|
-
constructor(service:
|
|
1301
|
+
constructor(service: AtpServiceClient) {
|
|
1303
1302
|
this._service = service
|
|
1304
1303
|
}
|
|
1305
1304
|
|
|
@@ -1362,9 +1361,9 @@ export class ConfirmationRecord {
|
|
|
1362
1361
|
}
|
|
1363
1362
|
|
|
1364
1363
|
export class FollowRecord {
|
|
1365
|
-
_service:
|
|
1364
|
+
_service: AtpServiceClient
|
|
1366
1365
|
|
|
1367
|
-
constructor(service:
|
|
1366
|
+
constructor(service: AtpServiceClient) {
|
|
1368
1367
|
this._service = service
|
|
1369
1368
|
}
|
|
1370
1369
|
|
|
@@ -1423,9 +1422,9 @@ export class FollowRecord {
|
|
|
1423
1422
|
}
|
|
1424
1423
|
|
|
1425
1424
|
export class NotificationNS {
|
|
1426
|
-
_service:
|
|
1425
|
+
_service: AtpServiceClient
|
|
1427
1426
|
|
|
1428
|
-
constructor(service:
|
|
1427
|
+
constructor(service: AtpServiceClient) {
|
|
1429
1428
|
this._service = service
|
|
1430
1429
|
}
|
|
1431
1430
|
|
|
@@ -1464,19 +1463,19 @@ export class NotificationNS {
|
|
|
1464
1463
|
}
|
|
1465
1464
|
|
|
1466
1465
|
export class SystemNS {
|
|
1467
|
-
_service:
|
|
1466
|
+
_service: AtpServiceClient
|
|
1468
1467
|
declaration: DeclarationRecord
|
|
1469
1468
|
|
|
1470
|
-
constructor(service:
|
|
1469
|
+
constructor(service: AtpServiceClient) {
|
|
1471
1470
|
this._service = service
|
|
1472
1471
|
this.declaration = new DeclarationRecord(service)
|
|
1473
1472
|
}
|
|
1474
1473
|
}
|
|
1475
1474
|
|
|
1476
1475
|
export class DeclarationRecord {
|
|
1477
|
-
_service:
|
|
1476
|
+
_service: AtpServiceClient
|
|
1478
1477
|
|
|
1479
|
-
constructor(service:
|
|
1478
|
+
constructor(service: AtpServiceClient) {
|
|
1480
1479
|
this._service = service
|
|
1481
1480
|
}
|
|
1482
1481
|
|