@atproto/api 0.6.4 → 0.6.5

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 (79) hide show
  1. package/dist/bsky-agent.d.ts +1 -0
  2. package/dist/client/index.d.ts +3 -0
  3. package/dist/client/lexicons.d.ts +52 -0
  4. package/dist/client/types/app/bsky/actor/createScene.d.ts +32 -0
  5. package/dist/client/types/app/bsky/actor/ref.d.ts +28 -0
  6. package/dist/client/types/app/bsky/actor/search.d.ts +22 -0
  7. package/dist/client/types/app/bsky/actor/searchTypeahead.d.ts +20 -0
  8. package/dist/client/types/app/bsky/actor/updateProfile.d.ts +40 -0
  9. package/dist/client/types/app/bsky/feed/feedViewPost.d.ts +28 -0
  10. package/dist/client/types/app/bsky/feed/getActorLikes.d.ts +28 -0
  11. package/dist/client/types/app/bsky/feed/getSavedFeeds.d.ts +21 -0
  12. package/dist/client/types/app/bsky/feed/getVotes.d.ts +36 -0
  13. package/dist/client/types/app/bsky/feed/saveFeed.d.ts +17 -0
  14. package/dist/client/types/app/bsky/feed/setVote.d.ts +25 -0
  15. package/dist/client/types/app/bsky/feed/trend.d.ts +9 -0
  16. package/dist/client/types/app/bsky/feed/unsaveFeed.d.ts +17 -0
  17. package/dist/client/types/app/bsky/feed/vote.d.ts +10 -0
  18. package/dist/client/types/app/bsky/graph/assertCreator.d.ts +1 -0
  19. package/dist/client/types/app/bsky/graph/assertMember.d.ts +1 -0
  20. package/dist/client/types/app/bsky/graph/assertion.d.ts +10 -0
  21. package/dist/client/types/app/bsky/graph/confirmation.d.ts +11 -0
  22. package/dist/client/types/app/bsky/graph/getAssertions.d.ts +48 -0
  23. package/dist/client/types/app/bsky/graph/getListBlocks.d.ts +21 -0
  24. package/dist/client/types/app/bsky/graph/getMembers.d.ts +36 -0
  25. package/dist/client/types/app/bsky/graph/getMemberships.d.ts +36 -0
  26. package/dist/client/types/app/bsky/graph/listblock.d.ts +8 -0
  27. package/dist/client/types/app/bsky/graph/mute.d.ts +17 -0
  28. package/dist/client/types/app/bsky/graph/subscribeMuteList.d.ts +17 -0
  29. package/dist/client/types/app/bsky/graph/unmute.d.ts +17 -0
  30. package/dist/client/types/app/bsky/graph/unsubscribeMuteList.d.ts +17 -0
  31. package/dist/client/types/app/bsky/notification/getCount.d.ts +17 -0
  32. package/dist/client/types/app/bsky/notification/list.d.ts +35 -0
  33. package/dist/client/types/app/bsky/system/actorScene.d.ts +1 -0
  34. package/dist/client/types/app/bsky/system/actorUser.d.ts +1 -0
  35. package/dist/client/types/app/bsky/system/declRef.d.ts +8 -0
  36. package/dist/client/types/app/bsky/system/declaration.d.ts +7 -0
  37. package/dist/client/types/app/bsky/unspecced/registerPushNotification.d.ts +16 -0
  38. package/dist/client/types/com/atproto/account/create.d.ts +41 -0
  39. package/dist/client/types/com/atproto/account/createInviteCode.d.ts +22 -0
  40. package/dist/client/types/com/atproto/account/delete.d.ts +25 -0
  41. package/dist/client/types/com/atproto/account/get.d.ts +12 -0
  42. package/dist/client/types/com/atproto/account/requestDelete.d.ts +13 -0
  43. package/dist/client/types/com/atproto/account/requestPasswordReset.d.ts +17 -0
  44. package/dist/client/types/com/atproto/account/resetPassword.d.ts +24 -0
  45. package/dist/client/types/com/atproto/admin/blob.d.ts +37 -0
  46. package/dist/client/types/com/atproto/admin/moderationAction.d.ts +60 -0
  47. package/dist/client/types/com/atproto/admin/moderationReport.d.ts +37 -0
  48. package/dist/client/types/com/atproto/admin/record.d.ts +43 -0
  49. package/dist/client/types/com/atproto/admin/repo.d.ts +45 -0
  50. package/dist/client/types/com/atproto/blob/upload.d.ts +19 -0
  51. package/dist/client/types/com/atproto/handle/resolve.d.ts +18 -0
  52. package/dist/client/types/com/atproto/handle/update.d.ts +17 -0
  53. package/dist/client/types/com/atproto/repo/batchWrite.d.ts +46 -0
  54. package/dist/client/types/com/atproto/repo/describe.d.ts +22 -0
  55. package/dist/client/types/com/atproto/repo/recordRef.d.ts +8 -0
  56. package/dist/client/types/com/atproto/repo/repoRef.d.ts +7 -0
  57. package/dist/client/types/com/atproto/report/create.d.ts +39 -0
  58. package/dist/client/types/com/atproto/report/reasonType.d.ts +3 -0
  59. package/dist/client/types/com/atproto/report/subject.d.ts +23 -0
  60. package/dist/client/types/com/atproto/server/getAccountsConfig.d.ts +27 -0
  61. package/dist/client/types/com/atproto/session/create.d.ts +29 -0
  62. package/dist/client/types/com/atproto/session/delete.d.ts +13 -0
  63. package/dist/client/types/com/atproto/session/get.d.ts +18 -0
  64. package/dist/client/types/com/atproto/session/refresh.d.ts +24 -0
  65. package/dist/client/types/com/atproto/sync/getRoot.d.ts +18 -0
  66. package/dist/client/types/com/atproto/sync/subscribeAllRepos.d.ts +9 -0
  67. package/dist/client/types/com/atproto/sync/updateRepo.d.ts +15 -0
  68. package/dist/helpers/bsky.d.ts +20 -0
  69. package/dist/index.js +175 -85
  70. package/dist/index.js.map +4 -4
  71. package/dist/mixins/bsky.d.ts +23 -0
  72. package/dist/rich-text/sanitize.d.ts +4 -0
  73. package/dist/session.d.ts +42 -0
  74. package/package.json +1 -1
  75. package/src/bsky-agent.ts +3 -0
  76. package/src/client/index.ts +13 -0
  77. package/src/client/lexicons.ts +57 -0
  78. package/src/client/types/app/bsky/feed/getActorLikes.ts +53 -0
  79. package/tsconfig.build.tsbuildinfo +1 -1
@@ -0,0 +1,23 @@
1
+ import { AtpAgentType } from '../types';
2
+ export declare function addBsky<TBase extends AtpAgentType>(Base: TBase): {
3
+ new (...args: any[]): {
4
+ like(uri: string, cid: string): Promise<{
5
+ uri: string;
6
+ cid: string;
7
+ }>;
8
+ unlike(likeUri: string): Promise<void>;
9
+ repost(uri: string, cid: string): Promise<{
10
+ uri: string;
11
+ cid: string;
12
+ }>;
13
+ unrepost(repostUri: string): Promise<void>;
14
+ follow(subjectDid: string): Promise<{
15
+ uri: string;
16
+ cid: string;
17
+ }>;
18
+ unfollow(followUri: string): Promise<void>;
19
+ service: URL;
20
+ api: import("..").AtpServiceClient;
21
+ session?: import("../types").AtpSessionData | undefined;
22
+ };
23
+ } & TBase;
@@ -0,0 +1,4 @@
1
+ import { RichText } from './rich-text';
2
+ export declare function sanitizeRichText(richText: RichText, opts: {
3
+ cleanNewlines?: boolean;
4
+ }): RichText;
@@ -0,0 +1,42 @@
1
+ import { CallOptions, Client as XrpcClient, ServiceClient as XrpcServiceClient, QueryParams, XRPCResponse } from '@atproto/xrpc';
2
+ import TypedEmitter from 'typed-emitter';
3
+ import { Client, ServiceClient } from './client';
4
+ export declare class SessionClient extends Client {
5
+ service(serviceUri: string | URL): SessionServiceClient;
6
+ }
7
+ declare const defaultInst: SessionClient;
8
+ export default defaultInst;
9
+ export declare class SessionServiceClient extends ServiceClient {
10
+ xrpc: SessionXrpcServiceClient;
11
+ sessionManager: SessionManager;
12
+ constructor(baseClient: Client, xrpcService: SessionXrpcServiceClient);
13
+ }
14
+ export declare class SessionXrpcServiceClient extends XrpcServiceClient {
15
+ sessionManager: SessionManager;
16
+ refreshing?: Promise<XRPCResponse>;
17
+ constructor(baseClient: XrpcClient, serviceUri: string | URL);
18
+ call(methodNsid: string, params?: QueryParams, data?: unknown, opts?: CallOptions): Promise<XRPCResponse>;
19
+ refresh(opts?: CallOptions): Promise<XRPCResponse>;
20
+ private _refresh;
21
+ }
22
+ declare const SessionManager_base: new () => TypedEmitter<SessionEvents>;
23
+ export declare class SessionManager extends SessionManager_base {
24
+ session?: Session;
25
+ get(): Session | undefined;
26
+ set(session: Session): void;
27
+ unset(): void;
28
+ active(): boolean;
29
+ accessHeaders(): {
30
+ authorization: string;
31
+ } | undefined;
32
+ refreshHeaders(): {
33
+ authorization: string;
34
+ } | undefined;
35
+ }
36
+ export declare type Session = {
37
+ refreshJwt: string;
38
+ accessJwt: string;
39
+ };
40
+ declare type SessionEvents = {
41
+ session: (session?: Session) => void;
42
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/api",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "codegen": "yarn docgen && node ./scripts/generate-code.mjs && lex gen-api ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*",
package/src/bsky-agent.ts CHANGED
@@ -17,6 +17,9 @@ export class BskyAgent extends AtpAgent {
17
17
  getAuthorFeed: typeof this.api.app.bsky.feed.getAuthorFeed = (params, opts) =>
18
18
  this.api.app.bsky.feed.getAuthorFeed(params, opts)
19
19
 
20
+ getActorLikes: typeof this.api.app.bsky.feed.getActorLikes = (params, opts) =>
21
+ this.api.app.bsky.feed.getActorLikes(params, opts)
22
+
20
23
  getPostThread: typeof this.api.app.bsky.feed.getPostThread = (params, opts) =>
21
24
  this.api.app.bsky.feed.getPostThread(params, opts)
22
25
 
@@ -89,6 +89,7 @@ import * as AppBskyFeedDefs from './types/app/bsky/feed/defs'
89
89
  import * as AppBskyFeedDescribeFeedGenerator from './types/app/bsky/feed/describeFeedGenerator'
90
90
  import * as AppBskyFeedGenerator from './types/app/bsky/feed/generator'
91
91
  import * as AppBskyFeedGetActorFeeds from './types/app/bsky/feed/getActorFeeds'
92
+ import * as AppBskyFeedGetActorLikes from './types/app/bsky/feed/getActorLikes'
92
93
  import * as AppBskyFeedGetAuthorFeed from './types/app/bsky/feed/getAuthorFeed'
93
94
  import * as AppBskyFeedGetFeed from './types/app/bsky/feed/getFeed'
94
95
  import * as AppBskyFeedGetFeedGenerator from './types/app/bsky/feed/getFeedGenerator'
@@ -209,6 +210,7 @@ export * as AppBskyFeedDefs from './types/app/bsky/feed/defs'
209
210
  export * as AppBskyFeedDescribeFeedGenerator from './types/app/bsky/feed/describeFeedGenerator'
210
211
  export * as AppBskyFeedGenerator from './types/app/bsky/feed/generator'
211
212
  export * as AppBskyFeedGetActorFeeds from './types/app/bsky/feed/getActorFeeds'
213
+ export * as AppBskyFeedGetActorLikes from './types/app/bsky/feed/getActorLikes'
212
214
  export * as AppBskyFeedGetAuthorFeed from './types/app/bsky/feed/getAuthorFeed'
213
215
  export * as AppBskyFeedGetFeed from './types/app/bsky/feed/getFeed'
214
216
  export * as AppBskyFeedGetFeedGenerator from './types/app/bsky/feed/getFeedGenerator'
@@ -1246,6 +1248,17 @@ export class FeedNS {
1246
1248
  })
1247
1249
  }
1248
1250
 
1251
+ getActorLikes(
1252
+ params?: AppBskyFeedGetActorLikes.QueryParams,
1253
+ opts?: AppBskyFeedGetActorLikes.CallOptions,
1254
+ ): Promise<AppBskyFeedGetActorLikes.Response> {
1255
+ return this._service.xrpc
1256
+ .call('app.bsky.feed.getActorLikes', params, undefined, opts)
1257
+ .catch((e) => {
1258
+ throw AppBskyFeedGetActorLikes.toKnownErr(e)
1259
+ })
1260
+ }
1261
+
1249
1262
  getAuthorFeed(
1250
1263
  params?: AppBskyFeedGetAuthorFeed.QueryParams,
1251
1264
  opts?: AppBskyFeedGetAuthorFeed.CallOptions,
@@ -4816,6 +4816,62 @@ export const schemaDict = {
4816
4816
  },
4817
4817
  },
4818
4818
  },
4819
+ AppBskyFeedGetActorLikes: {
4820
+ lexicon: 1,
4821
+ id: 'app.bsky.feed.getActorLikes',
4822
+ defs: {
4823
+ main: {
4824
+ type: 'query',
4825
+ description: 'A view of the posts liked by an actor.',
4826
+ parameters: {
4827
+ type: 'params',
4828
+ required: ['actor'],
4829
+ properties: {
4830
+ actor: {
4831
+ type: 'string',
4832
+ format: 'at-identifier',
4833
+ },
4834
+ limit: {
4835
+ type: 'integer',
4836
+ minimum: 1,
4837
+ maximum: 100,
4838
+ default: 50,
4839
+ },
4840
+ cursor: {
4841
+ type: 'string',
4842
+ },
4843
+ },
4844
+ },
4845
+ output: {
4846
+ encoding: 'application/json',
4847
+ schema: {
4848
+ type: 'object',
4849
+ required: ['feed'],
4850
+ properties: {
4851
+ cursor: {
4852
+ type: 'string',
4853
+ },
4854
+ feed: {
4855
+ type: 'array',
4856
+ items: {
4857
+ type: 'ref',
4858
+ ref: 'lex:app.bsky.feed.defs#feedViewPost',
4859
+ },
4860
+ },
4861
+ },
4862
+ },
4863
+ },
4864
+ errors: [
4865
+ {
4866
+ name: 'BlockedActor',
4867
+ },
4868
+ {
4869
+ name: 'BlockedByActor',
4870
+ },
4871
+ ],
4872
+ },
4873
+ },
4874
+ },
4819
4875
  AppBskyFeedGetAuthorFeed: {
4820
4876
  lexicon: 1,
4821
4877
  id: 'app.bsky.feed.getAuthorFeed',
@@ -6657,6 +6713,7 @@ export const ids = {
6657
6713
  AppBskyFeedDescribeFeedGenerator: 'app.bsky.feed.describeFeedGenerator',
6658
6714
  AppBskyFeedGenerator: 'app.bsky.feed.generator',
6659
6715
  AppBskyFeedGetActorFeeds: 'app.bsky.feed.getActorFeeds',
6716
+ AppBskyFeedGetActorLikes: 'app.bsky.feed.getActorLikes',
6660
6717
  AppBskyFeedGetAuthorFeed: 'app.bsky.feed.getAuthorFeed',
6661
6718
  AppBskyFeedGetFeed: 'app.bsky.feed.getFeed',
6662
6719
  AppBskyFeedGetFeedGenerator: 'app.bsky.feed.getFeedGenerator',
@@ -0,0 +1,53 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
9
+ import * as AppBskyFeedDefs from './defs'
10
+
11
+ export interface QueryParams {
12
+ actor: string
13
+ limit?: number
14
+ cursor?: string
15
+ }
16
+
17
+ export type InputSchema = undefined
18
+
19
+ export interface OutputSchema {
20
+ cursor?: string
21
+ feed: AppBskyFeedDefs.FeedViewPost[]
22
+ [k: string]: unknown
23
+ }
24
+
25
+ export interface CallOptions {
26
+ headers?: Headers
27
+ }
28
+
29
+ export interface Response {
30
+ success: boolean
31
+ headers: Headers
32
+ data: OutputSchema
33
+ }
34
+
35
+ export class BlockedActorError extends XRPCError {
36
+ constructor(src: XRPCError) {
37
+ super(src.status, src.error, src.message, src.headers)
38
+ }
39
+ }
40
+
41
+ export class BlockedByActorError extends XRPCError {
42
+ constructor(src: XRPCError) {
43
+ super(src.status, src.error, src.message, src.headers)
44
+ }
45
+ }
46
+
47
+ export function toKnownErr(e: any) {
48
+ if (e instanceof XRPCError) {
49
+ if (e.error === 'BlockedActor') return new BlockedActorError(e)
50
+ if (e.error === 'BlockedByActor') return new BlockedByActorError(e)
51
+ }
52
+ return e
53
+ }