@atproto/api 0.2.10 → 0.2.11

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/dist/index.js CHANGED
@@ -101,7 +101,9 @@ __export(src_exports4, {
101
101
  AppBskyFeedLike: () => like_exports,
102
102
  AppBskyFeedPost: () => post_exports,
103
103
  AppBskyFeedRepost: () => repost_exports,
104
+ AppBskyGraphBlock: () => block_exports,
104
105
  AppBskyGraphFollow: () => follow_exports,
106
+ AppBskyGraphGetBlocks: () => getBlocks_exports2,
105
107
  AppBskyGraphGetFollowers: () => getFollowers_exports,
106
108
  AppBskyGraphGetFollows: () => getFollows_exports,
107
109
  AppBskyGraphGetMutes: () => getMutes_exports,
@@ -119,6 +121,7 @@ __export(src_exports4, {
119
121
  AtpServiceClient: () => AtpServiceClient,
120
122
  AtprotoNS: () => AtprotoNS,
121
123
  BlobRef: () => BlobRef,
124
+ BlockRecord: () => BlockRecord,
122
125
  BskyAgent: () => BskyAgent,
123
126
  BskyNS: () => BskyNS,
124
127
  COM_ATPROTO_ADMIN: () => COM_ATPROTO_ADMIN,
@@ -10488,6 +10491,13 @@ var schemaDict = {
10488
10491
  muted: {
10489
10492
  type: "boolean"
10490
10493
  },
10494
+ blockedBy: {
10495
+ type: "boolean"
10496
+ },
10497
+ blocking: {
10498
+ type: "string",
10499
+ format: "at-uri"
10500
+ },
10491
10501
  following: {
10492
10502
  type: "string",
10493
10503
  format: "at-uri"
@@ -10883,7 +10893,8 @@ var schemaDict = {
10883
10893
  type: "union",
10884
10894
  refs: [
10885
10895
  "lex:app.bsky.embed.record#viewRecord",
10886
- "lex:app.bsky.embed.record#viewNotFound"
10896
+ "lex:app.bsky.embed.record#viewNotFound",
10897
+ "lex:app.bsky.embed.record#viewBlocked"
10887
10898
  ]
10888
10899
  }
10889
10900
  }
@@ -10941,6 +10952,16 @@ var schemaDict = {
10941
10952
  format: "at-uri"
10942
10953
  }
10943
10954
  }
10955
+ },
10956
+ viewBlocked: {
10957
+ type: "object",
10958
+ required: ["uri"],
10959
+ properties: {
10960
+ uri: {
10961
+ type: "string",
10962
+ format: "at-uri"
10963
+ }
10964
+ }
10944
10965
  }
10945
10966
  }
10946
10967
  },
@@ -11111,7 +11132,8 @@ var schemaDict = {
11111
11132
  type: "union",
11112
11133
  refs: [
11113
11134
  "lex:app.bsky.feed.defs#threadViewPost",
11114
- "lex:app.bsky.feed.defs#notFoundPost"
11135
+ "lex:app.bsky.feed.defs#notFoundPost",
11136
+ "lex:app.bsky.feed.defs#blockedPost"
11115
11137
  ]
11116
11138
  },
11117
11139
  replies: {
@@ -11120,7 +11142,8 @@ var schemaDict = {
11120
11142
  type: "union",
11121
11143
  refs: [
11122
11144
  "lex:app.bsky.feed.defs#threadViewPost",
11123
- "lex:app.bsky.feed.defs#notFoundPost"
11145
+ "lex:app.bsky.feed.defs#notFoundPost",
11146
+ "lex:app.bsky.feed.defs#blockedPost"
11124
11147
  ]
11125
11148
  }
11126
11149
  }
@@ -11139,6 +11162,20 @@ var schemaDict = {
11139
11162
  const: true
11140
11163
  }
11141
11164
  }
11165
+ },
11166
+ blockedPost: {
11167
+ type: "object",
11168
+ required: ["uri", "blocked"],
11169
+ properties: {
11170
+ uri: {
11171
+ type: "string",
11172
+ format: "at-uri"
11173
+ },
11174
+ blocked: {
11175
+ type: "boolean",
11176
+ const: true
11177
+ }
11178
+ }
11142
11179
  }
11143
11180
  }
11144
11181
  },
@@ -11186,7 +11223,15 @@ var schemaDict = {
11186
11223
  }
11187
11224
  }
11188
11225
  }
11189
- }
11226
+ },
11227
+ errors: [
11228
+ {
11229
+ name: "BlockedActor"
11230
+ },
11231
+ {
11232
+ name: "BlockedByActor"
11233
+ }
11234
+ ]
11190
11235
  }
11191
11236
  }
11192
11237
  },
@@ -11296,7 +11341,8 @@ var schemaDict = {
11296
11341
  type: "union",
11297
11342
  refs: [
11298
11343
  "lex:app.bsky.feed.defs#threadViewPost",
11299
- "lex:app.bsky.feed.defs#notFoundPost"
11344
+ "lex:app.bsky.feed.defs#notFoundPost",
11345
+ "lex:app.bsky.feed.defs#blockedPost"
11300
11346
  ]
11301
11347
  }
11302
11348
  }
@@ -11603,6 +11649,31 @@ var schemaDict = {
11603
11649
  }
11604
11650
  }
11605
11651
  },
11652
+ AppBskyGraphBlock: {
11653
+ lexicon: 1,
11654
+ id: "app.bsky.graph.block",
11655
+ defs: {
11656
+ main: {
11657
+ type: "record",
11658
+ description: "A block.",
11659
+ key: "tid",
11660
+ record: {
11661
+ type: "object",
11662
+ required: ["subject", "createdAt"],
11663
+ properties: {
11664
+ subject: {
11665
+ type: "string",
11666
+ format: "did"
11667
+ },
11668
+ createdAt: {
11669
+ type: "string",
11670
+ format: "datetime"
11671
+ }
11672
+ }
11673
+ }
11674
+ }
11675
+ }
11676
+ },
11606
11677
  AppBskyGraphFollow: {
11607
11678
  lexicon: 1,
11608
11679
  id: "app.bsky.graph.follow",
@@ -11628,6 +11699,49 @@ var schemaDict = {
11628
11699
  }
11629
11700
  }
11630
11701
  },
11702
+ AppBskyGraphGetBlocks: {
11703
+ lexicon: 1,
11704
+ id: "app.bsky.graph.getBlocks",
11705
+ defs: {
11706
+ main: {
11707
+ type: "query",
11708
+ description: "Who is the requester's account blocking?",
11709
+ parameters: {
11710
+ type: "params",
11711
+ properties: {
11712
+ limit: {
11713
+ type: "integer",
11714
+ minimum: 1,
11715
+ maximum: 100,
11716
+ default: 50
11717
+ },
11718
+ cursor: {
11719
+ type: "string"
11720
+ }
11721
+ }
11722
+ },
11723
+ output: {
11724
+ encoding: "application/json",
11725
+ schema: {
11726
+ type: "object",
11727
+ required: ["blocks"],
11728
+ properties: {
11729
+ cursor: {
11730
+ type: "string"
11731
+ },
11732
+ blocks: {
11733
+ type: "array",
11734
+ items: {
11735
+ type: "ref",
11736
+ ref: "lex:app.bsky.actor.defs#profileView"
11737
+ }
11738
+ }
11739
+ }
11740
+ }
11741
+ }
11742
+ }
11743
+ }
11744
+ },
11631
11745
  AppBskyGraphGetFollowers: {
11632
11746
  lexicon: 1,
11633
11747
  id: "app.bsky.graph.getFollowers",
@@ -12970,10 +13084,26 @@ function toKnownErr58(e) {
12970
13084
  // src/client/types/app/bsky/feed/getAuthorFeed.ts
12971
13085
  var getAuthorFeed_exports = {};
12972
13086
  __export(getAuthorFeed_exports, {
13087
+ BlockedActorError: () => BlockedActorError,
13088
+ BlockedByActorError: () => BlockedByActorError,
12973
13089
  toKnownErr: () => toKnownErr59
12974
13090
  });
13091
+ var BlockedActorError = class extends XRPCError {
13092
+ constructor(src2) {
13093
+ super(src2.status, src2.error, src2.message);
13094
+ }
13095
+ };
13096
+ var BlockedByActorError = class extends XRPCError {
13097
+ constructor(src2) {
13098
+ super(src2.status, src2.error, src2.message);
13099
+ }
13100
+ };
12975
13101
  function toKnownErr59(e) {
12976
13102
  if (e instanceof XRPCError) {
13103
+ if (e.error === "BlockedActor")
13104
+ return new BlockedActorError(e);
13105
+ if (e.error === "BlockedByActor")
13106
+ return new BlockedByActorError(e);
12977
13107
  }
12978
13108
  return e;
12979
13109
  }
@@ -13049,12 +13179,23 @@ function toKnownErr64(e) {
13049
13179
  return e;
13050
13180
  }
13051
13181
 
13182
+ // src/client/types/app/bsky/graph/getBlocks.ts
13183
+ var getBlocks_exports2 = {};
13184
+ __export(getBlocks_exports2, {
13185
+ toKnownErr: () => toKnownErr65
13186
+ });
13187
+ function toKnownErr65(e) {
13188
+ if (e instanceof XRPCError) {
13189
+ }
13190
+ return e;
13191
+ }
13192
+
13052
13193
  // src/client/types/app/bsky/graph/getFollowers.ts
13053
13194
  var getFollowers_exports = {};
13054
13195
  __export(getFollowers_exports, {
13055
- toKnownErr: () => toKnownErr65
13196
+ toKnownErr: () => toKnownErr66
13056
13197
  });
13057
- function toKnownErr65(e) {
13198
+ function toKnownErr66(e) {
13058
13199
  if (e instanceof XRPCError) {
13059
13200
  }
13060
13201
  return e;
@@ -13063,9 +13204,9 @@ function toKnownErr65(e) {
13063
13204
  // src/client/types/app/bsky/graph/getFollows.ts
13064
13205
  var getFollows_exports = {};
13065
13206
  __export(getFollows_exports, {
13066
- toKnownErr: () => toKnownErr66
13207
+ toKnownErr: () => toKnownErr67
13067
13208
  });
13068
- function toKnownErr66(e) {
13209
+ function toKnownErr67(e) {
13069
13210
  if (e instanceof XRPCError) {
13070
13211
  }
13071
13212
  return e;
@@ -13074,9 +13215,9 @@ function toKnownErr66(e) {
13074
13215
  // src/client/types/app/bsky/graph/getMutes.ts
13075
13216
  var getMutes_exports = {};
13076
13217
  __export(getMutes_exports, {
13077
- toKnownErr: () => toKnownErr67
13218
+ toKnownErr: () => toKnownErr68
13078
13219
  });
13079
- function toKnownErr67(e) {
13220
+ function toKnownErr68(e) {
13080
13221
  if (e instanceof XRPCError) {
13081
13222
  }
13082
13223
  return e;
@@ -13085,9 +13226,9 @@ function toKnownErr67(e) {
13085
13226
  // src/client/types/app/bsky/graph/muteActor.ts
13086
13227
  var muteActor_exports = {};
13087
13228
  __export(muteActor_exports, {
13088
- toKnownErr: () => toKnownErr68
13229
+ toKnownErr: () => toKnownErr69
13089
13230
  });
13090
- function toKnownErr68(e) {
13231
+ function toKnownErr69(e) {
13091
13232
  if (e instanceof XRPCError) {
13092
13233
  }
13093
13234
  return e;
@@ -13096,9 +13237,9 @@ function toKnownErr68(e) {
13096
13237
  // src/client/types/app/bsky/graph/unmuteActor.ts
13097
13238
  var unmuteActor_exports = {};
13098
13239
  __export(unmuteActor_exports, {
13099
- toKnownErr: () => toKnownErr69
13240
+ toKnownErr: () => toKnownErr70
13100
13241
  });
13101
- function toKnownErr69(e) {
13242
+ function toKnownErr70(e) {
13102
13243
  if (e instanceof XRPCError) {
13103
13244
  }
13104
13245
  return e;
@@ -13107,9 +13248,9 @@ function toKnownErr69(e) {
13107
13248
  // src/client/types/app/bsky/notification/getUnreadCount.ts
13108
13249
  var getUnreadCount_exports = {};
13109
13250
  __export(getUnreadCount_exports, {
13110
- toKnownErr: () => toKnownErr70
13251
+ toKnownErr: () => toKnownErr71
13111
13252
  });
13112
- function toKnownErr70(e) {
13253
+ function toKnownErr71(e) {
13113
13254
  if (e instanceof XRPCError) {
13114
13255
  }
13115
13256
  return e;
@@ -13119,10 +13260,10 @@ function toKnownErr70(e) {
13119
13260
  var listNotifications_exports = {};
13120
13261
  __export(listNotifications_exports, {
13121
13262
  isNotification: () => isNotification,
13122
- toKnownErr: () => toKnownErr71,
13263
+ toKnownErr: () => toKnownErr72,
13123
13264
  validateNotification: () => validateNotification
13124
13265
  });
13125
- function toKnownErr71(e) {
13266
+ function toKnownErr72(e) {
13126
13267
  if (e instanceof XRPCError) {
13127
13268
  }
13128
13269
  return e;
@@ -13140,9 +13281,9 @@ function validateNotification(v) {
13140
13281
  // src/client/types/app/bsky/notification/updateSeen.ts
13141
13282
  var updateSeen_exports = {};
13142
13283
  __export(updateSeen_exports, {
13143
- toKnownErr: () => toKnownErr72
13284
+ toKnownErr: () => toKnownErr73
13144
13285
  });
13145
- function toKnownErr72(e) {
13286
+ function toKnownErr73(e) {
13146
13287
  if (e instanceof XRPCError) {
13147
13288
  }
13148
13289
  return e;
@@ -13151,9 +13292,9 @@ function toKnownErr72(e) {
13151
13292
  // src/client/types/app/bsky/unspecced/getPopular.ts
13152
13293
  var getPopular_exports = {};
13153
13294
  __export(getPopular_exports, {
13154
- toKnownErr: () => toKnownErr73
13295
+ toKnownErr: () => toKnownErr74
13155
13296
  });
13156
- function toKnownErr73(e) {
13297
+ function toKnownErr74(e) {
13157
13298
  if (e instanceof XRPCError) {
13158
13299
  }
13159
13300
  return e;
@@ -13565,10 +13706,12 @@ var record_exports = {};
13565
13706
  __export(record_exports, {
13566
13707
  isMain: () => isMain4,
13567
13708
  isView: () => isView3,
13709
+ isViewBlocked: () => isViewBlocked,
13568
13710
  isViewNotFound: () => isViewNotFound,
13569
13711
  isViewRecord: () => isViewRecord,
13570
13712
  validateMain: () => validateMain4,
13571
13713
  validateView: () => validateView3,
13714
+ validateViewBlocked: () => validateViewBlocked,
13572
13715
  validateViewNotFound: () => validateViewNotFound,
13573
13716
  validateViewRecord: () => validateViewRecord
13574
13717
  });
@@ -13596,6 +13739,12 @@ function isViewNotFound(v) {
13596
13739
  function validateViewNotFound(v) {
13597
13740
  return lexicons.validate("app.bsky.embed.record#viewNotFound", v);
13598
13741
  }
13742
+ function isViewBlocked(v) {
13743
+ return isObj2(v) && hasProp2(v, "$type") && v.$type === "app.bsky.embed.record#viewBlocked";
13744
+ }
13745
+ function validateViewBlocked(v) {
13746
+ return lexicons.validate("app.bsky.embed.record#viewBlocked", v);
13747
+ }
13599
13748
 
13600
13749
  // src/client/types/app/bsky/embed/recordWithMedia.ts
13601
13750
  var recordWithMedia_exports = {};
@@ -13621,6 +13770,7 @@ function validateView4(v) {
13621
13770
  // src/client/types/app/bsky/feed/defs.ts
13622
13771
  var defs_exports6 = {};
13623
13772
  __export(defs_exports6, {
13773
+ isBlockedPost: () => isBlockedPost,
13624
13774
  isFeedViewPost: () => isFeedViewPost,
13625
13775
  isNotFoundPost: () => isNotFoundPost,
13626
13776
  isPostView: () => isPostView,
@@ -13628,6 +13778,7 @@ __export(defs_exports6, {
13628
13778
  isReplyRef: () => isReplyRef,
13629
13779
  isThreadViewPost: () => isThreadViewPost,
13630
13780
  isViewerState: () => isViewerState2,
13781
+ validateBlockedPost: () => validateBlockedPost,
13631
13782
  validateFeedViewPost: () => validateFeedViewPost,
13632
13783
  validateNotFoundPost: () => validateNotFoundPost,
13633
13784
  validatePostView: () => validatePostView,
@@ -13678,6 +13829,12 @@ function isNotFoundPost(v) {
13678
13829
  function validateNotFoundPost(v) {
13679
13830
  return lexicons.validate("app.bsky.feed.defs#notFoundPost", v);
13680
13831
  }
13832
+ function isBlockedPost(v) {
13833
+ return isObj2(v) && hasProp2(v, "$type") && v.$type === "app.bsky.feed.defs#blockedPost";
13834
+ }
13835
+ function validateBlockedPost(v) {
13836
+ return lexicons.validate("app.bsky.feed.defs#blockedPost", v);
13837
+ }
13681
13838
 
13682
13839
  // src/client/types/app/bsky/feed/like.ts
13683
13840
  var like_exports = {};
@@ -13742,16 +13899,29 @@ function validateRecord5(v) {
13742
13899
  return lexicons.validate("app.bsky.feed.repost#main", v);
13743
13900
  }
13744
13901
 
13745
- // src/client/types/app/bsky/graph/follow.ts
13746
- var follow_exports = {};
13747
- __export(follow_exports, {
13902
+ // src/client/types/app/bsky/graph/block.ts
13903
+ var block_exports = {};
13904
+ __export(block_exports, {
13748
13905
  isRecord: () => isRecord6,
13749
13906
  validateRecord: () => validateRecord6
13750
13907
  });
13751
13908
  function isRecord6(v) {
13752
- return isObj2(v) && hasProp2(v, "$type") && (v.$type === "app.bsky.graph.follow#main" || v.$type === "app.bsky.graph.follow");
13909
+ return isObj2(v) && hasProp2(v, "$type") && (v.$type === "app.bsky.graph.block#main" || v.$type === "app.bsky.graph.block");
13753
13910
  }
13754
13911
  function validateRecord6(v) {
13912
+ return lexicons.validate("app.bsky.graph.block#main", v);
13913
+ }
13914
+
13915
+ // src/client/types/app/bsky/graph/follow.ts
13916
+ var follow_exports = {};
13917
+ __export(follow_exports, {
13918
+ isRecord: () => isRecord7,
13919
+ validateRecord: () => validateRecord7
13920
+ });
13921
+ function isRecord7(v) {
13922
+ return isObj2(v) && hasProp2(v, "$type") && (v.$type === "app.bsky.graph.follow#main" || v.$type === "app.bsky.graph.follow");
13923
+ }
13924
+ function validateRecord7(v) {
13755
13925
  return lexicons.validate("app.bsky.graph.follow#main", v);
13756
13926
  }
13757
13927
 
@@ -14387,34 +14557,77 @@ var RepostRecord = class {
14387
14557
  var GraphNS = class {
14388
14558
  constructor(service) {
14389
14559
  this._service = service;
14560
+ this.block = new BlockRecord(service);
14390
14561
  this.follow = new FollowRecord(service);
14391
14562
  }
14563
+ getBlocks(params2, opts) {
14564
+ return this._service.xrpc.call("app.bsky.graph.getBlocks", params2, void 0, opts).catch((e) => {
14565
+ throw toKnownErr65(e);
14566
+ });
14567
+ }
14392
14568
  getFollowers(params2, opts) {
14393
14569
  return this._service.xrpc.call("app.bsky.graph.getFollowers", params2, void 0, opts).catch((e) => {
14394
- throw toKnownErr65(e);
14570
+ throw toKnownErr66(e);
14395
14571
  });
14396
14572
  }
14397
14573
  getFollows(params2, opts) {
14398
14574
  return this._service.xrpc.call("app.bsky.graph.getFollows", params2, void 0, opts).catch((e) => {
14399
- throw toKnownErr66(e);
14575
+ throw toKnownErr67(e);
14400
14576
  });
14401
14577
  }
14402
14578
  getMutes(params2, opts) {
14403
14579
  return this._service.xrpc.call("app.bsky.graph.getMutes", params2, void 0, opts).catch((e) => {
14404
- throw toKnownErr67(e);
14580
+ throw toKnownErr68(e);
14405
14581
  });
14406
14582
  }
14407
14583
  muteActor(data, opts) {
14408
14584
  return this._service.xrpc.call("app.bsky.graph.muteActor", opts?.qp, data, opts).catch((e) => {
14409
- throw toKnownErr68(e);
14585
+ throw toKnownErr69(e);
14410
14586
  });
14411
14587
  }
14412
14588
  unmuteActor(data, opts) {
14413
14589
  return this._service.xrpc.call("app.bsky.graph.unmuteActor", opts?.qp, data, opts).catch((e) => {
14414
- throw toKnownErr69(e);
14590
+ throw toKnownErr70(e);
14415
14591
  });
14416
14592
  }
14417
14593
  };
14594
+ var BlockRecord = class {
14595
+ constructor(service) {
14596
+ this._service = service;
14597
+ }
14598
+ async list(params2) {
14599
+ const res = await this._service.xrpc.call("com.atproto.repo.listRecords", {
14600
+ collection: "app.bsky.graph.block",
14601
+ ...params2
14602
+ });
14603
+ return res.data;
14604
+ }
14605
+ async get(params2) {
14606
+ const res = await this._service.xrpc.call("com.atproto.repo.getRecord", {
14607
+ collection: "app.bsky.graph.block",
14608
+ ...params2
14609
+ });
14610
+ return res.data;
14611
+ }
14612
+ async create(params2, record, headers) {
14613
+ record.$type = "app.bsky.graph.block";
14614
+ const res = await this._service.xrpc.call(
14615
+ "com.atproto.repo.createRecord",
14616
+ void 0,
14617
+ { collection: "app.bsky.graph.block", ...params2, record },
14618
+ { encoding: "application/json", headers }
14619
+ );
14620
+ return res.data;
14621
+ }
14622
+ async delete(params2, headers) {
14623
+ await this._service.xrpc.call(
14624
+ "com.atproto.repo.deleteRecord",
14625
+ void 0,
14626
+ { collection: "app.bsky.graph.block", ...params2 },
14627
+ { headers }
14628
+ );
14629
+ }
14630
+ };
14418
14631
  var FollowRecord = class {
14419
14632
  constructor(service) {
14420
14633
  this._service = service;
@@ -14458,17 +14671,17 @@ var NotificationNS = class {
14458
14671
  }
14459
14672
  getUnreadCount(params2, opts) {
14460
14673
  return this._service.xrpc.call("app.bsky.notification.getUnreadCount", params2, void 0, opts).catch((e) => {
14461
- throw toKnownErr70(e);
14674
+ throw toKnownErr71(e);
14462
14675
  });
14463
14676
  }
14464
14677
  listNotifications(params2, opts) {
14465
14678
  return this._service.xrpc.call("app.bsky.notification.listNotifications", params2, void 0, opts).catch((e) => {
14466
- throw toKnownErr71(e);
14679
+ throw toKnownErr72(e);
14467
14680
  });
14468
14681
  }
14469
14682
  updateSeen(data, opts) {
14470
14683
  return this._service.xrpc.call("app.bsky.notification.updateSeen", opts?.qp, data, opts).catch((e) => {
14471
- throw toKnownErr72(e);
14684
+ throw toKnownErr73(e);
14472
14685
  });
14473
14686
  }
14474
14687
  };
@@ -14483,7 +14696,7 @@ var UnspeccedNS = class {
14483
14696
  }
14484
14697
  getPopular(params2, opts) {
14485
14698
  return this._service.xrpc.call("app.bsky.unspecced.getPopular", params2, void 0, opts).catch((e) => {
14486
- throw toKnownErr73(e);
14699
+ throw toKnownErr74(e);
14487
14700
  });
14488
14701
  }
14489
14702
  };