@atproto/api 0.0.8 → 0.1.1
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 +63 -61
- package/dist/client/lexicons.d.ts +237 -23
- package/dist/client/types/app/bsky/actor/getProfiles.d.ts +19 -0
- package/dist/client/types/app/bsky/actor/getSuggestions.d.ts +0 -7
- package/dist/client/types/app/bsky/actor/profile.d.ts +25 -0
- 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/client/types/com/atproto/sync/getRepo.d.ts +2 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +623 -253
- 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 +75 -63
- package/src/client/lexicons.ts +281 -38
- package/src/client/types/app/bsky/actor/getProfiles.ts +35 -0
- package/src/client/types/app/bsky/actor/getSuggestions.ts +0 -18
- package/src/client/types/app/bsky/actor/profile.ts +45 -0
- 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/client/types/com/atproto/sync/getRepo.ts +4 -2
- 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'
|
|
@@ -53,6 +54,7 @@ import * as ComAtprotoSyncGetHead from './types/com/atproto/sync/getHead'
|
|
|
53
54
|
import * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord'
|
|
54
55
|
import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo'
|
|
55
56
|
import * as AppBskyActorGetProfile from './types/app/bsky/actor/getProfile'
|
|
57
|
+
import * as AppBskyActorGetProfiles from './types/app/bsky/actor/getProfiles'
|
|
56
58
|
import * as AppBskyActorGetSuggestions from './types/app/bsky/actor/getSuggestions'
|
|
57
59
|
import * as AppBskyActorProfile from './types/app/bsky/actor/profile'
|
|
58
60
|
import * as AppBskyActorRef from './types/app/bsky/actor/ref'
|
|
@@ -95,6 +97,7 @@ export * as ComAtprotoAccountGet from './types/com/atproto/account/get'
|
|
|
95
97
|
export * as ComAtprotoAccountRequestDelete from './types/com/atproto/account/requestDelete'
|
|
96
98
|
export * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset'
|
|
97
99
|
export * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword'
|
|
100
|
+
export * as ComAtprotoAdminBlob from './types/com/atproto/admin/blob'
|
|
98
101
|
export * as ComAtprotoAdminGetModerationAction from './types/com/atproto/admin/getModerationAction'
|
|
99
102
|
export * as ComAtprotoAdminGetModerationActions from './types/com/atproto/admin/getModerationActions'
|
|
100
103
|
export * as ComAtprotoAdminGetModerationReport from './types/com/atproto/admin/getModerationReport'
|
|
@@ -135,6 +138,7 @@ export * as ComAtprotoSyncGetHead from './types/com/atproto/sync/getHead'
|
|
|
135
138
|
export * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord'
|
|
136
139
|
export * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo'
|
|
137
140
|
export * as AppBskyActorGetProfile from './types/app/bsky/actor/getProfile'
|
|
141
|
+
export * as AppBskyActorGetProfiles from './types/app/bsky/actor/getProfiles'
|
|
138
142
|
export * as AppBskyActorGetSuggestions from './types/app/bsky/actor/getSuggestions'
|
|
139
143
|
export * as AppBskyActorProfile from './types/app/bsky/actor/profile'
|
|
140
144
|
export * as AppBskyActorRef from './types/app/bsky/actor/ref'
|
|
@@ -187,28 +191,25 @@ export const APP_BSKY_SYSTEM = {
|
|
|
187
191
|
ActorUser: 'app.bsky.system.actorUser',
|
|
188
192
|
}
|
|
189
193
|
|
|
190
|
-
export class
|
|
194
|
+
export class AtpBaseClient {
|
|
191
195
|
xrpc: XrpcClient = new XrpcClient()
|
|
192
196
|
|
|
193
197
|
constructor() {
|
|
194
198
|
this.xrpc.addLexicons(schemas)
|
|
195
199
|
}
|
|
196
200
|
|
|
197
|
-
service(serviceUri: string | URL):
|
|
198
|
-
return new
|
|
201
|
+
service(serviceUri: string | URL): AtpServiceClient {
|
|
202
|
+
return new AtpServiceClient(this, this.xrpc.service(serviceUri))
|
|
199
203
|
}
|
|
200
204
|
}
|
|
201
205
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
export class ServiceClient {
|
|
206
|
-
_baseClient: Client
|
|
206
|
+
export class AtpServiceClient {
|
|
207
|
+
_baseClient: AtpBaseClient
|
|
207
208
|
xrpc: XrpcServiceClient
|
|
208
209
|
com: ComNS
|
|
209
210
|
app: AppNS
|
|
210
211
|
|
|
211
|
-
constructor(baseClient:
|
|
212
|
+
constructor(baseClient: AtpBaseClient, xrpcService: XrpcServiceClient) {
|
|
212
213
|
this._baseClient = baseClient
|
|
213
214
|
this.xrpc = xrpcService
|
|
214
215
|
this.com = new ComNS(this)
|
|
@@ -221,17 +222,17 @@ export class ServiceClient {
|
|
|
221
222
|
}
|
|
222
223
|
|
|
223
224
|
export class ComNS {
|
|
224
|
-
_service:
|
|
225
|
+
_service: AtpServiceClient
|
|
225
226
|
atproto: AtprotoNS
|
|
226
227
|
|
|
227
|
-
constructor(service:
|
|
228
|
+
constructor(service: AtpServiceClient) {
|
|
228
229
|
this._service = service
|
|
229
230
|
this.atproto = new AtprotoNS(service)
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
233
|
|
|
233
234
|
export class AtprotoNS {
|
|
234
|
-
_service:
|
|
235
|
+
_service: AtpServiceClient
|
|
235
236
|
account: AccountNS
|
|
236
237
|
admin: AdminNS
|
|
237
238
|
blob: BlobNS
|
|
@@ -242,7 +243,7 @@ export class AtprotoNS {
|
|
|
242
243
|
session: SessionNS
|
|
243
244
|
sync: SyncNS
|
|
244
245
|
|
|
245
|
-
constructor(service:
|
|
246
|
+
constructor(service: AtpServiceClient) {
|
|
246
247
|
this._service = service
|
|
247
248
|
this.account = new AccountNS(service)
|
|
248
249
|
this.admin = new AdminNS(service)
|
|
@@ -257,9 +258,9 @@ export class AtprotoNS {
|
|
|
257
258
|
}
|
|
258
259
|
|
|
259
260
|
export class AccountNS {
|
|
260
|
-
_service:
|
|
261
|
+
_service: AtpServiceClient
|
|
261
262
|
|
|
262
|
-
constructor(service:
|
|
263
|
+
constructor(service: AtpServiceClient) {
|
|
263
264
|
this._service = service
|
|
264
265
|
}
|
|
265
266
|
|
|
@@ -342,9 +343,9 @@ export class AccountNS {
|
|
|
342
343
|
}
|
|
343
344
|
|
|
344
345
|
export class AdminNS {
|
|
345
|
-
_service:
|
|
346
|
+
_service: AtpServiceClient
|
|
346
347
|
|
|
347
|
-
constructor(service:
|
|
348
|
+
constructor(service: AtpServiceClient) {
|
|
348
349
|
this._service = service
|
|
349
350
|
}
|
|
350
351
|
|
|
@@ -460,9 +461,9 @@ export class AdminNS {
|
|
|
460
461
|
}
|
|
461
462
|
|
|
462
463
|
export class BlobNS {
|
|
463
|
-
_service:
|
|
464
|
+
_service: AtpServiceClient
|
|
464
465
|
|
|
465
|
-
constructor(service:
|
|
466
|
+
constructor(service: AtpServiceClient) {
|
|
466
467
|
this._service = service
|
|
467
468
|
}
|
|
468
469
|
|
|
@@ -479,9 +480,9 @@ export class BlobNS {
|
|
|
479
480
|
}
|
|
480
481
|
|
|
481
482
|
export class HandleNS {
|
|
482
|
-
_service:
|
|
483
|
+
_service: AtpServiceClient
|
|
483
484
|
|
|
484
|
-
constructor(service:
|
|
485
|
+
constructor(service: AtpServiceClient) {
|
|
485
486
|
this._service = service
|
|
486
487
|
}
|
|
487
488
|
|
|
@@ -498,9 +499,9 @@ export class HandleNS {
|
|
|
498
499
|
}
|
|
499
500
|
|
|
500
501
|
export class RepoNS {
|
|
501
|
-
_service:
|
|
502
|
+
_service: AtpServiceClient
|
|
502
503
|
|
|
503
|
-
constructor(service:
|
|
504
|
+
constructor(service: AtpServiceClient) {
|
|
504
505
|
this._service = service
|
|
505
506
|
}
|
|
506
507
|
|
|
@@ -583,9 +584,9 @@ export class RepoNS {
|
|
|
583
584
|
}
|
|
584
585
|
|
|
585
586
|
export class ReportNS {
|
|
586
|
-
_service:
|
|
587
|
+
_service: AtpServiceClient
|
|
587
588
|
|
|
588
|
-
constructor(service:
|
|
589
|
+
constructor(service: AtpServiceClient) {
|
|
589
590
|
this._service = service
|
|
590
591
|
}
|
|
591
592
|
|
|
@@ -602,9 +603,9 @@ export class ReportNS {
|
|
|
602
603
|
}
|
|
603
604
|
|
|
604
605
|
export class ServerNS {
|
|
605
|
-
_service:
|
|
606
|
+
_service: AtpServiceClient
|
|
606
607
|
|
|
607
|
-
constructor(service:
|
|
608
|
+
constructor(service: AtpServiceClient) {
|
|
608
609
|
this._service = service
|
|
609
610
|
}
|
|
610
611
|
|
|
@@ -621,9 +622,9 @@ export class ServerNS {
|
|
|
621
622
|
}
|
|
622
623
|
|
|
623
624
|
export class SessionNS {
|
|
624
|
-
_service:
|
|
625
|
+
_service: AtpServiceClient
|
|
625
626
|
|
|
626
|
-
constructor(service:
|
|
627
|
+
constructor(service: AtpServiceClient) {
|
|
627
628
|
this._service = service
|
|
628
629
|
}
|
|
629
630
|
|
|
@@ -673,9 +674,9 @@ export class SessionNS {
|
|
|
673
674
|
}
|
|
674
675
|
|
|
675
676
|
export class SyncNS {
|
|
676
|
-
_service:
|
|
677
|
+
_service: AtpServiceClient
|
|
677
678
|
|
|
678
|
-
constructor(service:
|
|
679
|
+
constructor(service: AtpServiceClient) {
|
|
679
680
|
this._service = service
|
|
680
681
|
}
|
|
681
682
|
|
|
@@ -736,17 +737,17 @@ export class SyncNS {
|
|
|
736
737
|
}
|
|
737
738
|
|
|
738
739
|
export class AppNS {
|
|
739
|
-
_service:
|
|
740
|
+
_service: AtpServiceClient
|
|
740
741
|
bsky: BskyNS
|
|
741
742
|
|
|
742
|
-
constructor(service:
|
|
743
|
+
constructor(service: AtpServiceClient) {
|
|
743
744
|
this._service = service
|
|
744
745
|
this.bsky = new BskyNS(service)
|
|
745
746
|
}
|
|
746
747
|
}
|
|
747
748
|
|
|
748
749
|
export class BskyNS {
|
|
749
|
-
_service:
|
|
750
|
+
_service: AtpServiceClient
|
|
750
751
|
actor: ActorNS
|
|
751
752
|
embed: EmbedNS
|
|
752
753
|
feed: FeedNS
|
|
@@ -754,7 +755,7 @@ export class BskyNS {
|
|
|
754
755
|
notification: NotificationNS
|
|
755
756
|
system: SystemNS
|
|
756
757
|
|
|
757
|
-
constructor(service:
|
|
758
|
+
constructor(service: AtpServiceClient) {
|
|
758
759
|
this._service = service
|
|
759
760
|
this.actor = new ActorNS(service)
|
|
760
761
|
this.embed = new EmbedNS(service)
|
|
@@ -766,10 +767,10 @@ export class BskyNS {
|
|
|
766
767
|
}
|
|
767
768
|
|
|
768
769
|
export class ActorNS {
|
|
769
|
-
_service:
|
|
770
|
+
_service: AtpServiceClient
|
|
770
771
|
profile: ProfileRecord
|
|
771
772
|
|
|
772
|
-
constructor(service:
|
|
773
|
+
constructor(service: AtpServiceClient) {
|
|
773
774
|
this._service = service
|
|
774
775
|
this.profile = new ProfileRecord(service)
|
|
775
776
|
}
|
|
@@ -785,6 +786,17 @@ export class ActorNS {
|
|
|
785
786
|
})
|
|
786
787
|
}
|
|
787
788
|
|
|
789
|
+
getProfiles(
|
|
790
|
+
params?: AppBskyActorGetProfiles.QueryParams,
|
|
791
|
+
opts?: AppBskyActorGetProfiles.CallOptions,
|
|
792
|
+
): Promise<AppBskyActorGetProfiles.Response> {
|
|
793
|
+
return this._service.xrpc
|
|
794
|
+
.call('app.bsky.actor.getProfiles', params, undefined, opts)
|
|
795
|
+
.catch((e) => {
|
|
796
|
+
throw AppBskyActorGetProfiles.toKnownErr(e)
|
|
797
|
+
})
|
|
798
|
+
}
|
|
799
|
+
|
|
788
800
|
getSuggestions(
|
|
789
801
|
params?: AppBskyActorGetSuggestions.QueryParams,
|
|
790
802
|
opts?: AppBskyActorGetSuggestions.CallOptions,
|
|
@@ -831,9 +843,9 @@ export class ActorNS {
|
|
|
831
843
|
}
|
|
832
844
|
|
|
833
845
|
export class ProfileRecord {
|
|
834
|
-
_service:
|
|
846
|
+
_service: AtpServiceClient
|
|
835
847
|
|
|
836
|
-
constructor(service:
|
|
848
|
+
constructor(service: AtpServiceClient) {
|
|
837
849
|
this._service = service
|
|
838
850
|
}
|
|
839
851
|
|
|
@@ -892,20 +904,20 @@ export class ProfileRecord {
|
|
|
892
904
|
}
|
|
893
905
|
|
|
894
906
|
export class EmbedNS {
|
|
895
|
-
_service:
|
|
907
|
+
_service: AtpServiceClient
|
|
896
908
|
|
|
897
|
-
constructor(service:
|
|
909
|
+
constructor(service: AtpServiceClient) {
|
|
898
910
|
this._service = service
|
|
899
911
|
}
|
|
900
912
|
}
|
|
901
913
|
|
|
902
914
|
export class FeedNS {
|
|
903
|
-
_service:
|
|
915
|
+
_service: AtpServiceClient
|
|
904
916
|
post: PostRecord
|
|
905
917
|
repost: RepostRecord
|
|
906
918
|
vote: VoteRecord
|
|
907
919
|
|
|
908
|
-
constructor(service:
|
|
920
|
+
constructor(service: AtpServiceClient) {
|
|
909
921
|
this._service = service
|
|
910
922
|
this.post = new PostRecord(service)
|
|
911
923
|
this.repost = new RepostRecord(service)
|
|
@@ -980,9 +992,9 @@ export class FeedNS {
|
|
|
980
992
|
}
|
|
981
993
|
|
|
982
994
|
export class PostRecord {
|
|
983
|
-
_service:
|
|
995
|
+
_service: AtpServiceClient
|
|
984
996
|
|
|
985
|
-
constructor(service:
|
|
997
|
+
constructor(service: AtpServiceClient) {
|
|
986
998
|
this._service = service
|
|
987
999
|
}
|
|
988
1000
|
|
|
@@ -1041,9 +1053,9 @@ export class PostRecord {
|
|
|
1041
1053
|
}
|
|
1042
1054
|
|
|
1043
1055
|
export class RepostRecord {
|
|
1044
|
-
_service:
|
|
1056
|
+
_service: AtpServiceClient
|
|
1045
1057
|
|
|
1046
|
-
constructor(service:
|
|
1058
|
+
constructor(service: AtpServiceClient) {
|
|
1047
1059
|
this._service = service
|
|
1048
1060
|
}
|
|
1049
1061
|
|
|
@@ -1102,9 +1114,9 @@ export class RepostRecord {
|
|
|
1102
1114
|
}
|
|
1103
1115
|
|
|
1104
1116
|
export class VoteRecord {
|
|
1105
|
-
_service:
|
|
1117
|
+
_service: AtpServiceClient
|
|
1106
1118
|
|
|
1107
|
-
constructor(service:
|
|
1119
|
+
constructor(service: AtpServiceClient) {
|
|
1108
1120
|
this._service = service
|
|
1109
1121
|
}
|
|
1110
1122
|
|
|
@@ -1163,12 +1175,12 @@ export class VoteRecord {
|
|
|
1163
1175
|
}
|
|
1164
1176
|
|
|
1165
1177
|
export class GraphNS {
|
|
1166
|
-
_service:
|
|
1178
|
+
_service: AtpServiceClient
|
|
1167
1179
|
assertion: AssertionRecord
|
|
1168
1180
|
confirmation: ConfirmationRecord
|
|
1169
1181
|
follow: FollowRecord
|
|
1170
1182
|
|
|
1171
|
-
constructor(service:
|
|
1183
|
+
constructor(service: AtpServiceClient) {
|
|
1172
1184
|
this._service = service
|
|
1173
1185
|
this.assertion = new AssertionRecord(service)
|
|
1174
1186
|
this.confirmation = new ConfirmationRecord(service)
|
|
@@ -1232,9 +1244,9 @@ export class GraphNS {
|
|
|
1232
1244
|
}
|
|
1233
1245
|
|
|
1234
1246
|
export class AssertionRecord {
|
|
1235
|
-
_service:
|
|
1247
|
+
_service: AtpServiceClient
|
|
1236
1248
|
|
|
1237
|
-
constructor(service:
|
|
1249
|
+
constructor(service: AtpServiceClient) {
|
|
1238
1250
|
this._service = service
|
|
1239
1251
|
}
|
|
1240
1252
|
|
|
@@ -1297,9 +1309,9 @@ export class AssertionRecord {
|
|
|
1297
1309
|
}
|
|
1298
1310
|
|
|
1299
1311
|
export class ConfirmationRecord {
|
|
1300
|
-
_service:
|
|
1312
|
+
_service: AtpServiceClient
|
|
1301
1313
|
|
|
1302
|
-
constructor(service:
|
|
1314
|
+
constructor(service: AtpServiceClient) {
|
|
1303
1315
|
this._service = service
|
|
1304
1316
|
}
|
|
1305
1317
|
|
|
@@ -1362,9 +1374,9 @@ export class ConfirmationRecord {
|
|
|
1362
1374
|
}
|
|
1363
1375
|
|
|
1364
1376
|
export class FollowRecord {
|
|
1365
|
-
_service:
|
|
1377
|
+
_service: AtpServiceClient
|
|
1366
1378
|
|
|
1367
|
-
constructor(service:
|
|
1379
|
+
constructor(service: AtpServiceClient) {
|
|
1368
1380
|
this._service = service
|
|
1369
1381
|
}
|
|
1370
1382
|
|
|
@@ -1423,9 +1435,9 @@ export class FollowRecord {
|
|
|
1423
1435
|
}
|
|
1424
1436
|
|
|
1425
1437
|
export class NotificationNS {
|
|
1426
|
-
_service:
|
|
1438
|
+
_service: AtpServiceClient
|
|
1427
1439
|
|
|
1428
|
-
constructor(service:
|
|
1440
|
+
constructor(service: AtpServiceClient) {
|
|
1429
1441
|
this._service = service
|
|
1430
1442
|
}
|
|
1431
1443
|
|
|
@@ -1464,19 +1476,19 @@ export class NotificationNS {
|
|
|
1464
1476
|
}
|
|
1465
1477
|
|
|
1466
1478
|
export class SystemNS {
|
|
1467
|
-
_service:
|
|
1479
|
+
_service: AtpServiceClient
|
|
1468
1480
|
declaration: DeclarationRecord
|
|
1469
1481
|
|
|
1470
|
-
constructor(service:
|
|
1482
|
+
constructor(service: AtpServiceClient) {
|
|
1471
1483
|
this._service = service
|
|
1472
1484
|
this.declaration = new DeclarationRecord(service)
|
|
1473
1485
|
}
|
|
1474
1486
|
}
|
|
1475
1487
|
|
|
1476
1488
|
export class DeclarationRecord {
|
|
1477
|
-
_service:
|
|
1489
|
+
_service: AtpServiceClient
|
|
1478
1490
|
|
|
1479
|
-
constructor(service:
|
|
1491
|
+
constructor(service: AtpServiceClient) {
|
|
1480
1492
|
this._service = service
|
|
1481
1493
|
}
|
|
1482
1494
|
|