@atproto/api 0.3.0 → 0.3.2
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/client/index.d.ts +67 -0
- package/dist/client/lexicons.d.ts +385 -0
- package/dist/client/types/app/bsky/actor/defs.d.ts +2 -0
- package/dist/client/types/app/bsky/feed/generator.d.ts +1 -0
- package/dist/client/types/app/bsky/graph/defs.d.ts +42 -0
- package/dist/client/types/app/bsky/graph/getList.d.ts +23 -0
- package/dist/client/types/app/bsky/graph/getListMutes.d.ts +21 -0
- package/dist/client/types/app/bsky/graph/getLists.d.ts +22 -0
- package/dist/client/types/app/bsky/graph/list.d.ts +14 -0
- package/dist/client/types/app/bsky/graph/listitem.d.ts +9 -0
- package/dist/client/types/app/bsky/graph/muteActorList.d.ts +17 -0
- package/dist/client/types/app/bsky/graph/unmuteActorList.d.ts +17 -0
- package/dist/index.js +1547 -268
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/src/client/index.ts +200 -0
- package/src/client/lexicons.ts +386 -0
- package/src/client/types/app/bsky/actor/defs.ts +2 -0
- package/src/client/types/app/bsky/graph/defs.ts +95 -0
- package/src/client/types/app/bsky/graph/getList.ts +40 -0
- package/src/client/types/app/bsky/graph/getListMutes.ts +38 -0
- package/src/client/types/app/bsky/graph/getLists.ts +39 -0
- package/src/client/types/app/bsky/graph/list.ts +32 -0
- package/src/client/types/app/bsky/graph/listitem.ts +27 -0
- package/src/client/types/app/bsky/graph/muteActorList.ts +32 -0
- package/src/client/types/app/bsky/graph/unmuteActorList.ts +32 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
package/src/client/index.ts
CHANGED
|
@@ -92,13 +92,21 @@ import * as AppBskyFeedLike from './types/app/bsky/feed/like'
|
|
|
92
92
|
import * as AppBskyFeedPost from './types/app/bsky/feed/post'
|
|
93
93
|
import * as AppBskyFeedRepost from './types/app/bsky/feed/repost'
|
|
94
94
|
import * as AppBskyGraphBlock from './types/app/bsky/graph/block'
|
|
95
|
+
import * as AppBskyGraphDefs from './types/app/bsky/graph/defs'
|
|
95
96
|
import * as AppBskyGraphFollow from './types/app/bsky/graph/follow'
|
|
96
97
|
import * as AppBskyGraphGetBlocks from './types/app/bsky/graph/getBlocks'
|
|
97
98
|
import * as AppBskyGraphGetFollowers from './types/app/bsky/graph/getFollowers'
|
|
98
99
|
import * as AppBskyGraphGetFollows from './types/app/bsky/graph/getFollows'
|
|
100
|
+
import * as AppBskyGraphGetList from './types/app/bsky/graph/getList'
|
|
101
|
+
import * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes'
|
|
102
|
+
import * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists'
|
|
99
103
|
import * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes'
|
|
104
|
+
import * as AppBskyGraphList from './types/app/bsky/graph/list'
|
|
105
|
+
import * as AppBskyGraphListitem from './types/app/bsky/graph/listitem'
|
|
100
106
|
import * as AppBskyGraphMuteActor from './types/app/bsky/graph/muteActor'
|
|
107
|
+
import * as AppBskyGraphMuteActorList from './types/app/bsky/graph/muteActorList'
|
|
101
108
|
import * as AppBskyGraphUnmuteActor from './types/app/bsky/graph/unmuteActor'
|
|
109
|
+
import * as AppBskyGraphUnmuteActorList from './types/app/bsky/graph/unmuteActorList'
|
|
102
110
|
import * as AppBskyNotificationGetUnreadCount from './types/app/bsky/notification/getUnreadCount'
|
|
103
111
|
import * as AppBskyNotificationListNotifications from './types/app/bsky/notification/listNotifications'
|
|
104
112
|
import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'
|
|
@@ -190,13 +198,21 @@ export * as AppBskyFeedLike from './types/app/bsky/feed/like'
|
|
|
190
198
|
export * as AppBskyFeedPost from './types/app/bsky/feed/post'
|
|
191
199
|
export * as AppBskyFeedRepost from './types/app/bsky/feed/repost'
|
|
192
200
|
export * as AppBskyGraphBlock from './types/app/bsky/graph/block'
|
|
201
|
+
export * as AppBskyGraphDefs from './types/app/bsky/graph/defs'
|
|
193
202
|
export * as AppBskyGraphFollow from './types/app/bsky/graph/follow'
|
|
194
203
|
export * as AppBskyGraphGetBlocks from './types/app/bsky/graph/getBlocks'
|
|
195
204
|
export * as AppBskyGraphGetFollowers from './types/app/bsky/graph/getFollowers'
|
|
196
205
|
export * as AppBskyGraphGetFollows from './types/app/bsky/graph/getFollows'
|
|
206
|
+
export * as AppBskyGraphGetList from './types/app/bsky/graph/getList'
|
|
207
|
+
export * as AppBskyGraphGetListMutes from './types/app/bsky/graph/getListMutes'
|
|
208
|
+
export * as AppBskyGraphGetLists from './types/app/bsky/graph/getLists'
|
|
197
209
|
export * as AppBskyGraphGetMutes from './types/app/bsky/graph/getMutes'
|
|
210
|
+
export * as AppBskyGraphList from './types/app/bsky/graph/list'
|
|
211
|
+
export * as AppBskyGraphListitem from './types/app/bsky/graph/listitem'
|
|
198
212
|
export * as AppBskyGraphMuteActor from './types/app/bsky/graph/muteActor'
|
|
213
|
+
export * as AppBskyGraphMuteActorList from './types/app/bsky/graph/muteActorList'
|
|
199
214
|
export * as AppBskyGraphUnmuteActor from './types/app/bsky/graph/unmuteActor'
|
|
215
|
+
export * as AppBskyGraphUnmuteActorList from './types/app/bsky/graph/unmuteActorList'
|
|
200
216
|
export * as AppBskyNotificationGetUnreadCount from './types/app/bsky/notification/getUnreadCount'
|
|
201
217
|
export * as AppBskyNotificationListNotifications from './types/app/bsky/notification/listNotifications'
|
|
202
218
|
export * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'
|
|
@@ -217,6 +233,9 @@ export const COM_ATPROTO_MODERATION = {
|
|
|
217
233
|
DefsReasonRude: 'com.atproto.moderation.defs#reasonRude',
|
|
218
234
|
DefsReasonOther: 'com.atproto.moderation.defs#reasonOther',
|
|
219
235
|
}
|
|
236
|
+
export const APP_BSKY_GRAPH = {
|
|
237
|
+
DefsModlist: 'app.bsky.graph.defs#modlist',
|
|
238
|
+
}
|
|
220
239
|
|
|
221
240
|
export class AtpBaseClient {
|
|
222
241
|
xrpc: XrpcClient = new XrpcClient()
|
|
@@ -1385,11 +1404,15 @@ export class GraphNS {
|
|
|
1385
1404
|
_service: AtpServiceClient
|
|
1386
1405
|
block: BlockRecord
|
|
1387
1406
|
follow: FollowRecord
|
|
1407
|
+
list: ListRecord
|
|
1408
|
+
listitem: ListitemRecord
|
|
1388
1409
|
|
|
1389
1410
|
constructor(service: AtpServiceClient) {
|
|
1390
1411
|
this._service = service
|
|
1391
1412
|
this.block = new BlockRecord(service)
|
|
1392
1413
|
this.follow = new FollowRecord(service)
|
|
1414
|
+
this.list = new ListRecord(service)
|
|
1415
|
+
this.listitem = new ListitemRecord(service)
|
|
1393
1416
|
}
|
|
1394
1417
|
|
|
1395
1418
|
getBlocks(
|
|
@@ -1425,6 +1448,39 @@ export class GraphNS {
|
|
|
1425
1448
|
})
|
|
1426
1449
|
}
|
|
1427
1450
|
|
|
1451
|
+
getList(
|
|
1452
|
+
params?: AppBskyGraphGetList.QueryParams,
|
|
1453
|
+
opts?: AppBskyGraphGetList.CallOptions,
|
|
1454
|
+
): Promise<AppBskyGraphGetList.Response> {
|
|
1455
|
+
return this._service.xrpc
|
|
1456
|
+
.call('app.bsky.graph.getList', params, undefined, opts)
|
|
1457
|
+
.catch((e) => {
|
|
1458
|
+
throw AppBskyGraphGetList.toKnownErr(e)
|
|
1459
|
+
})
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
getListMutes(
|
|
1463
|
+
params?: AppBskyGraphGetListMutes.QueryParams,
|
|
1464
|
+
opts?: AppBskyGraphGetListMutes.CallOptions,
|
|
1465
|
+
): Promise<AppBskyGraphGetListMutes.Response> {
|
|
1466
|
+
return this._service.xrpc
|
|
1467
|
+
.call('app.bsky.graph.getListMutes', params, undefined, opts)
|
|
1468
|
+
.catch((e) => {
|
|
1469
|
+
throw AppBskyGraphGetListMutes.toKnownErr(e)
|
|
1470
|
+
})
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
getLists(
|
|
1474
|
+
params?: AppBskyGraphGetLists.QueryParams,
|
|
1475
|
+
opts?: AppBskyGraphGetLists.CallOptions,
|
|
1476
|
+
): Promise<AppBskyGraphGetLists.Response> {
|
|
1477
|
+
return this._service.xrpc
|
|
1478
|
+
.call('app.bsky.graph.getLists', params, undefined, opts)
|
|
1479
|
+
.catch((e) => {
|
|
1480
|
+
throw AppBskyGraphGetLists.toKnownErr(e)
|
|
1481
|
+
})
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1428
1484
|
getMutes(
|
|
1429
1485
|
params?: AppBskyGraphGetMutes.QueryParams,
|
|
1430
1486
|
opts?: AppBskyGraphGetMutes.CallOptions,
|
|
@@ -1447,6 +1503,17 @@ export class GraphNS {
|
|
|
1447
1503
|
})
|
|
1448
1504
|
}
|
|
1449
1505
|
|
|
1506
|
+
muteActorList(
|
|
1507
|
+
data?: AppBskyGraphMuteActorList.InputSchema,
|
|
1508
|
+
opts?: AppBskyGraphMuteActorList.CallOptions,
|
|
1509
|
+
): Promise<AppBskyGraphMuteActorList.Response> {
|
|
1510
|
+
return this._service.xrpc
|
|
1511
|
+
.call('app.bsky.graph.muteActorList', opts?.qp, data, opts)
|
|
1512
|
+
.catch((e) => {
|
|
1513
|
+
throw AppBskyGraphMuteActorList.toKnownErr(e)
|
|
1514
|
+
})
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1450
1517
|
unmuteActor(
|
|
1451
1518
|
data?: AppBskyGraphUnmuteActor.InputSchema,
|
|
1452
1519
|
opts?: AppBskyGraphUnmuteActor.CallOptions,
|
|
@@ -1457,6 +1524,17 @@ export class GraphNS {
|
|
|
1457
1524
|
throw AppBskyGraphUnmuteActor.toKnownErr(e)
|
|
1458
1525
|
})
|
|
1459
1526
|
}
|
|
1527
|
+
|
|
1528
|
+
unmuteActorList(
|
|
1529
|
+
data?: AppBskyGraphUnmuteActorList.InputSchema,
|
|
1530
|
+
opts?: AppBskyGraphUnmuteActorList.CallOptions,
|
|
1531
|
+
): Promise<AppBskyGraphUnmuteActorList.Response> {
|
|
1532
|
+
return this._service.xrpc
|
|
1533
|
+
.call('app.bsky.graph.unmuteActorList', opts?.qp, data, opts)
|
|
1534
|
+
.catch((e) => {
|
|
1535
|
+
throw AppBskyGraphUnmuteActorList.toKnownErr(e)
|
|
1536
|
+
})
|
|
1537
|
+
}
|
|
1460
1538
|
}
|
|
1461
1539
|
|
|
1462
1540
|
export class BlockRecord {
|
|
@@ -1581,6 +1659,128 @@ export class FollowRecord {
|
|
|
1581
1659
|
}
|
|
1582
1660
|
}
|
|
1583
1661
|
|
|
1662
|
+
export class ListRecord {
|
|
1663
|
+
_service: AtpServiceClient
|
|
1664
|
+
|
|
1665
|
+
constructor(service: AtpServiceClient) {
|
|
1666
|
+
this._service = service
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
async list(
|
|
1670
|
+
params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
|
|
1671
|
+
): Promise<{
|
|
1672
|
+
cursor?: string
|
|
1673
|
+
records: { uri: string; value: AppBskyGraphList.Record }[]
|
|
1674
|
+
}> {
|
|
1675
|
+
const res = await this._service.xrpc.call('com.atproto.repo.listRecords', {
|
|
1676
|
+
collection: 'app.bsky.graph.list',
|
|
1677
|
+
...params,
|
|
1678
|
+
})
|
|
1679
|
+
return res.data
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
async get(
|
|
1683
|
+
params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
|
|
1684
|
+
): Promise<{ uri: string; cid: string; value: AppBskyGraphList.Record }> {
|
|
1685
|
+
const res = await this._service.xrpc.call('com.atproto.repo.getRecord', {
|
|
1686
|
+
collection: 'app.bsky.graph.list',
|
|
1687
|
+
...params,
|
|
1688
|
+
})
|
|
1689
|
+
return res.data
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
async create(
|
|
1693
|
+
params: Omit<
|
|
1694
|
+
ComAtprotoRepoCreateRecord.InputSchema,
|
|
1695
|
+
'collection' | 'record'
|
|
1696
|
+
>,
|
|
1697
|
+
record: AppBskyGraphList.Record,
|
|
1698
|
+
headers?: Record<string, string>,
|
|
1699
|
+
): Promise<{ uri: string; cid: string }> {
|
|
1700
|
+
record.$type = 'app.bsky.graph.list'
|
|
1701
|
+
const res = await this._service.xrpc.call(
|
|
1702
|
+
'com.atproto.repo.createRecord',
|
|
1703
|
+
undefined,
|
|
1704
|
+
{ collection: 'app.bsky.graph.list', ...params, record },
|
|
1705
|
+
{ encoding: 'application/json', headers },
|
|
1706
|
+
)
|
|
1707
|
+
return res.data
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
async delete(
|
|
1711
|
+
params: Omit<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
|
|
1712
|
+
headers?: Record<string, string>,
|
|
1713
|
+
): Promise<void> {
|
|
1714
|
+
await this._service.xrpc.call(
|
|
1715
|
+
'com.atproto.repo.deleteRecord',
|
|
1716
|
+
undefined,
|
|
1717
|
+
{ collection: 'app.bsky.graph.list', ...params },
|
|
1718
|
+
{ headers },
|
|
1719
|
+
)
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
export class ListitemRecord {
|
|
1724
|
+
_service: AtpServiceClient
|
|
1725
|
+
|
|
1726
|
+
constructor(service: AtpServiceClient) {
|
|
1727
|
+
this._service = service
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
async list(
|
|
1731
|
+
params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
|
|
1732
|
+
): Promise<{
|
|
1733
|
+
cursor?: string
|
|
1734
|
+
records: { uri: string; value: AppBskyGraphListitem.Record }[]
|
|
1735
|
+
}> {
|
|
1736
|
+
const res = await this._service.xrpc.call('com.atproto.repo.listRecords', {
|
|
1737
|
+
collection: 'app.bsky.graph.listitem',
|
|
1738
|
+
...params,
|
|
1739
|
+
})
|
|
1740
|
+
return res.data
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
async get(
|
|
1744
|
+
params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
|
|
1745
|
+
): Promise<{ uri: string; cid: string; value: AppBskyGraphListitem.Record }> {
|
|
1746
|
+
const res = await this._service.xrpc.call('com.atproto.repo.getRecord', {
|
|
1747
|
+
collection: 'app.bsky.graph.listitem',
|
|
1748
|
+
...params,
|
|
1749
|
+
})
|
|
1750
|
+
return res.data
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
async create(
|
|
1754
|
+
params: Omit<
|
|
1755
|
+
ComAtprotoRepoCreateRecord.InputSchema,
|
|
1756
|
+
'collection' | 'record'
|
|
1757
|
+
>,
|
|
1758
|
+
record: AppBskyGraphListitem.Record,
|
|
1759
|
+
headers?: Record<string, string>,
|
|
1760
|
+
): Promise<{ uri: string; cid: string }> {
|
|
1761
|
+
record.$type = 'app.bsky.graph.listitem'
|
|
1762
|
+
const res = await this._service.xrpc.call(
|
|
1763
|
+
'com.atproto.repo.createRecord',
|
|
1764
|
+
undefined,
|
|
1765
|
+
{ collection: 'app.bsky.graph.listitem', ...params, record },
|
|
1766
|
+
{ encoding: 'application/json', headers },
|
|
1767
|
+
)
|
|
1768
|
+
return res.data
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
async delete(
|
|
1772
|
+
params: Omit<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
|
|
1773
|
+
headers?: Record<string, string>,
|
|
1774
|
+
): Promise<void> {
|
|
1775
|
+
await this._service.xrpc.call(
|
|
1776
|
+
'com.atproto.repo.deleteRecord',
|
|
1777
|
+
undefined,
|
|
1778
|
+
{ collection: 'app.bsky.graph.listitem', ...params },
|
|
1779
|
+
{ headers },
|
|
1780
|
+
)
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1584
1784
|
export class NotificationNS {
|
|
1585
1785
|
_service: AtpServiceClient
|
|
1586
1786
|
|