Update to the latest APIs

zio/stable
Paul Frazee 2022-11-04 17:39:54 -05:00
parent 8ae6e67eea
commit f333a90fab
165 changed files with 2963 additions and 4747 deletions

View File

@ -1,11 +1,8 @@
import {autorun} from 'mobx'
import AtpApi from '../third-party/api'
import {sessionClient as AtpApi} from '../third-party/api'
import {RootStoreModel} from './models/root-store'
import * as libapi from './lib/api'
import * as storage from './lib/storage'
// import * as auth from './auth' TODO
import {ShellModel} from './models/shell'
const ROOT_STATE_STORAGE_KEY = 'root'
const DEFAULT_SERVICE = 'http://localhost:2583'

View File

@ -4,9 +4,9 @@
*/
// import {ReactNativeStore} from './auth'
import AtpApi from '../../third-party/api'
import * as Profile from '../../third-party/api/src/types/app/bsky/profile'
import * as Post from '../../third-party/api/src/types/app/bsky/post'
import {sessionClient as AtpApi} from '../../third-party/api'
import * as Profile from '../../third-party/api/src/client/types/app/bsky/actor/profile'
import * as Post from '../../third-party/api/src/client/types/app/bsky/feed/post'
import {AtUri} from '../../third-party/uri'
import {RootStoreModel} from '../models/root-store'
import {extractEntities} from '../../view/lib/strings'
@ -23,7 +23,7 @@ export async function post(
let reply
if (replyTo) {
const replyToUrip = new AtUri(replyTo.uri)
const parentPost = await store.api.app.bsky.post.get({
const parentPost = await store.api.app.bsky.feed.post.get({
user: replyToUrip.host,
rkey: replyToUrip.rkey,
})
@ -39,7 +39,7 @@ export async function post(
}
}
const entities = extractEntities(text)
return await store.api.app.bsky.post.create(
return await store.api.app.bsky.feed.post.create(
{did: store.me.did || ''},
{
text,
@ -51,7 +51,7 @@ export async function post(
}
export async function like(store: RootStoreModel, uri: string, cid: string) {
return await store.api.app.bsky.like.create(
return await store.api.app.bsky.feed.like.create(
{did: store.me.did || ''},
{
subject: {uri, cid},
@ -62,14 +62,14 @@ export async function like(store: RootStoreModel, uri: string, cid: string) {
export async function unlike(store: RootStoreModel, likeUri: string) {
const likeUrip = new AtUri(likeUri)
return await store.api.app.bsky.like.delete({
return await store.api.app.bsky.feed.like.delete({
did: likeUrip.hostname,
rkey: likeUrip.rkey,
})
}
export async function repost(store: RootStoreModel, uri: string, cid: string) {
return await store.api.app.bsky.repost.create(
return await store.api.app.bsky.feed.repost.create(
{did: store.me.did || ''},
{
subject: {uri, cid},
@ -80,14 +80,15 @@ export async function repost(store: RootStoreModel, uri: string, cid: string) {
export async function unrepost(store: RootStoreModel, repostUri: string) {
const repostUrip = new AtUri(repostUri)
return await store.api.app.bsky.repost.delete({
return await store.api.app.bsky.feed.repost.delete({
did: repostUrip.hostname,
rkey: repostUrip.rkey,
})
}
export async function follow(store: RootStoreModel, subject: string) {
return await store.api.app.bsky.follow.create(
// TODO NOW needs update
return await store.api.app.bsky.graph.follow.create(
{did: store.me.did || ''},
{
subject,
@ -98,7 +99,7 @@ export async function follow(store: RootStoreModel, subject: string) {
export async function unfollow(store: RootStoreModel, followUri: string) {
const followUrip = new AtUri(followUri)
return await store.api.app.bsky.follow.delete({
return await store.api.app.bsky.graph.follow.delete({
did: followUrip.hostname,
rkey: followUrip.rkey,
})
@ -108,13 +109,13 @@ export async function updateProfile(
store: RootStoreModel,
modifyFn: (existing?: Profile.Record) => Profile.Record,
) {
// TODO: replaceme
const res = await store.api.app.bsky.profile.list({
// TODO NOW replaceme
const res = await store.api.app.bsky.actor.profile.list({
user: store.me.did || '',
})
const existing = res.records[0]
if (existing) {
await store.api.app.bsky.profile.put(
await store.api.app.bsky.actor.profile.put(
{
did: store.me.did || '',
rkey: new AtUri(existing.uri).rkey,
@ -122,7 +123,7 @@ export async function updateProfile(
modifyFn(existing.value),
)
} else {
await store.api.app.bsky.profile.create(
await store.api.app.bsky.actor.profile.create(
{
did: store.me.did || '',
},

View File

@ -1,49 +0,0 @@
import {makeAutoObservable} from 'mobx'
import {RootStoreModel} from './root-store'
// TODO / DEBUG
// this is a temporary fake for the model until the view actually gets implemented in the bsky api
// -prf
export class BadgesViewModel {
// state
isLoading = false
isRefreshing = false
hasLoaded = false
error = ''
constructor(public rootStore: RootStoreModel) {
makeAutoObservable(
this,
{
rootStore: false,
},
{autoBind: true},
)
}
get hasContent() {
return false
}
get hasError() {
return this.error !== ''
}
get isEmpty() {
return this.hasLoaded && !this.hasContent
}
// public api
// =
async setup() {
this.hasLoaded = true
}
async refresh() {}
async loadMore() {}
async update() {}
}

View File

@ -1,6 +1,6 @@
import {makeAutoObservable, runInAction} from 'mobx'
import * as GetHomeFeed from '../../third-party/api/src/types/app/bsky/getHomeFeed'
import * as GetAuthorFeed from '../../third-party/api/src/types/app/bsky/getAuthorFeed'
import * as GetTimeline from '../../third-party/api/src/client/types/app/bsky/feed/getTimeline'
import * as GetAuthorFeed from '../../third-party/api/src/client/types/app/bsky/feed/getAuthorFeed'
import {RootStoreModel} from './root-store'
import * as apilib from '../lib/api'
@ -13,20 +13,20 @@ export class FeedItemMyStateModel {
}
}
export class FeedItemModel implements GetHomeFeed.FeedItem {
export class FeedItemModel implements GetTimeline.FeedItem {
// ui state
_reactKey: string = ''
// data
uri: string = ''
cid: string = ''
author: GetHomeFeed.User = {did: '', name: '', displayName: ''}
repostedBy?: GetHomeFeed.User
author: GetTimeline.User = {did: '', handle: '', displayName: ''}
repostedBy?: GetTimeline.User
record: Record<string, unknown> = {}
embed?:
| GetHomeFeed.RecordEmbed
| GetHomeFeed.ExternalEmbed
| GetHomeFeed.UnknownEmbed
| GetTimeline.RecordEmbed
| GetTimeline.ExternalEmbed
| GetTimeline.UnknownEmbed
replyCount: number = 0
repostCount: number = 0
likeCount: number = 0
@ -36,14 +36,14 @@ export class FeedItemModel implements GetHomeFeed.FeedItem {
constructor(
public rootStore: RootStoreModel,
reactKey: string,
v: GetHomeFeed.FeedItem | GetAuthorFeed.FeedItem,
v: GetTimeline.FeedItem | GetAuthorFeed.FeedItem,
) {
makeAutoObservable(this, {rootStore: false})
this._reactKey = reactKey
this.copy(v)
}
copy(v: GetHomeFeed.FeedItem | GetAuthorFeed.FeedItem) {
copy(v: GetTimeline.FeedItem | GetAuthorFeed.FeedItem) {
this.uri = v.uri
this.cid = v.cid
this.author = v.author
@ -100,7 +100,7 @@ export class FeedModel {
hasLoaded = false
hasReachedEnd = false
error = ''
params: GetHomeFeed.QueryParams | GetAuthorFeed.QueryParams
params: GetTimeline.QueryParams | GetAuthorFeed.QueryParams
loadMoreCursor: string | undefined
_loadPromise: Promise<void> | undefined
_loadMorePromise: Promise<void> | undefined
@ -113,7 +113,7 @@ export class FeedModel {
constructor(
public rootStore: RootStoreModel,
public feedType: 'home' | 'author',
params: GetHomeFeed.QueryParams | GetAuthorFeed.QueryParams,
params: GetTimeline.QueryParams | GetAuthorFeed.QueryParams,
) {
makeAutoObservable(
this,
@ -286,7 +286,7 @@ export class FeedModel {
let cursor = undefined
try {
do {
const res: GetHomeFeed.Response = await this._getFeed({
const res: GetTimeline.Response = await this._getFeed({
before: cursor,
limit: Math.min(numToFetch, 100),
})
@ -304,13 +304,13 @@ export class FeedModel {
}
}
private _replaceAll(res: GetHomeFeed.Response | GetAuthorFeed.Response) {
private _replaceAll(res: GetTimeline.Response | GetAuthorFeed.Response) {
this.feed.length = 0
this.hasReachedEnd = false
this._appendAll(res)
}
private _appendAll(res: GetHomeFeed.Response | GetAuthorFeed.Response) {
private _appendAll(res: GetTimeline.Response | GetAuthorFeed.Response) {
this.loadMoreCursor = res.data.cursor
let counter = this.feed.length
for (const item of res.data.feed) {
@ -320,13 +320,13 @@ export class FeedModel {
private _append(
keyId: number,
item: GetHomeFeed.FeedItem | GetAuthorFeed.FeedItem,
item: GetTimeline.FeedItem | GetAuthorFeed.FeedItem,
) {
// TODO: validate .record
this.feed.push(new FeedItemModel(this.rootStore, `item-${keyId}`, item))
}
private _prependAll(res: GetHomeFeed.Response | GetAuthorFeed.Response) {
private _prependAll(res: GetTimeline.Response | GetAuthorFeed.Response) {
let counter = this.feed.length
for (const item of res.data.feed) {
if (this.feed.find(item2 => item2.uri === item.uri)) {
@ -338,13 +338,13 @@ export class FeedModel {
private _prepend(
keyId: number,
item: GetHomeFeed.FeedItem | GetAuthorFeed.FeedItem,
item: GetTimeline.FeedItem | GetAuthorFeed.FeedItem,
) {
// TODO: validate .record
this.feed.unshift(new FeedItemModel(this.rootStore, `item-${keyId}`, item))
}
private _updateAll(res: GetHomeFeed.Response | GetAuthorFeed.Response) {
private _updateAll(res: GetTimeline.Response | GetAuthorFeed.Response) {
for (const item of res.data.feed) {
const existingItem = this.feed.find(
// this find function has a key subtley- the indexedAt comparison
@ -359,15 +359,15 @@ export class FeedModel {
}
protected _getFeed(
params: GetHomeFeed.QueryParams | GetAuthorFeed.QueryParams = {},
): Promise<GetHomeFeed.Response | GetAuthorFeed.Response> {
params: GetTimeline.QueryParams | GetAuthorFeed.QueryParams = {},
): Promise<GetTimeline.Response | GetAuthorFeed.Response> {
params = Object.assign({}, this.params, params)
if (this.feedType === 'home') {
return this.rootStore.api.app.bsky.getHomeFeed(
params as GetHomeFeed.QueryParams,
return this.rootStore.api.app.bsky.feed.getTimeline(
params as GetTimeline.QueryParams,
)
} else {
return this.rootStore.api.app.bsky.getAuthorFeed(
return this.rootStore.api.app.bsky.feed.getAuthorFeed(
params as GetAuthorFeed.QueryParams,
)
}

View File

@ -1,6 +1,6 @@
import {makeAutoObservable, runInAction} from 'mobx'
import {AtUri} from '../../third-party/uri'
import * as GetLikedBy from '../../third-party/api/src/types/app/bsky/getLikedBy'
import * as GetLikedBy from '../../third-party/api/src/client/types/app/bsky/feed/getLikedBy'
import {RootStoreModel} from './root-store'
type LikedByItem = GetLikedBy.OutputSchema['likedBy'][number]
@ -11,7 +11,7 @@ export class LikedByViewItemModel implements LikedByItem {
// data
did: string = ''
name: string = ''
handle: string = ''
displayName: string = ''
createdAt?: string
indexedAt: string = ''
@ -113,7 +113,7 @@ export class LikedByViewModel {
private async _fetch(isRefreshing = false) {
this._xLoading(isRefreshing)
try {
const res = await this.rootStore.api.app.bsky.getLikedBy(
const res = await this.rootStore.api.app.bsky.feed.getLikedBy(
Object.assign({}, this.params, {uri: this.resolvedUri}),
)
this._replaceAll(res)

View File

@ -3,7 +3,7 @@ import {RootStoreModel} from './root-store'
export class MeModel {
did?: string
name?: string
handle?: string
displayName?: string
description?: string
notificationCount: number = 0
@ -14,7 +14,7 @@ export class MeModel {
clear() {
this.did = undefined
this.name = undefined
this.handle = undefined
this.displayName = undefined
this.description = undefined
this.notificationCount = 0
@ -23,9 +23,9 @@ export class MeModel {
async load() {
const sess = this.rootStore.session
if (sess.isAuthed && sess.data) {
this.did = sess.data.userdid || ''
this.name = sess.data.username
const profile = await this.rootStore.api.app.bsky.getProfile({
this.did = sess.data.did || ''
this.handle = sess.data.handle
const profile = await this.rootStore.api.app.bsky.actor.getProfile({
user: this.did,
})
runInAction(() => {
@ -43,7 +43,7 @@ export class MeModel {
}
async fetchStateUpdate() {
const res = await this.rootStore.api.app.bsky.getNotificationCount({})
const res = await this.rootStore.api.app.bsky.notification.getCount()
runInAction(() => {
this.notificationCount = res.data.count
})

View File

@ -1,10 +1,10 @@
import {makeAutoObservable} from 'mobx'
import * as GetNotifications from '../../third-party/api/src/types/app/bsky/getNotifications'
import * as ListNotifications from '../../third-party/api/src/client/types/app/bsky/notification/list'
import {RootStoreModel} from './root-store'
import {hasProp} from '../lib/type-guards'
export interface GroupedNotification extends GetNotifications.Notification {
additional?: GetNotifications.Notification[]
export interface GroupedNotification extends ListNotifications.Notification {
additional?: ListNotifications.Notification[]
}
export class NotificationsViewItemModel implements GroupedNotification {
@ -16,9 +16,9 @@ export class NotificationsViewItemModel implements GroupedNotification {
cid: string = ''
author: {
did: string
name: string
handle: string
displayName?: string
} = {did: '', name: ''}
} = {did: '', handle: ''}
reason: string = ''
reasonSubject?: string
record: any = {}
@ -93,7 +93,7 @@ export class NotificationsViewModel {
isRefreshing = false
hasLoaded = false
error = ''
params: GetNotifications.QueryParams
params: ListNotifications.QueryParams
loadMoreCursor?: string
_loadPromise: Promise<void> | undefined
_loadMorePromise: Promise<void> | undefined
@ -104,7 +104,7 @@ export class NotificationsViewModel {
constructor(
public rootStore: RootStoreModel,
params: GetNotifications.QueryParams,
params: ListNotifications.QueryParams,
) {
makeAutoObservable(
this,
@ -216,7 +216,7 @@ export class NotificationsViewModel {
private async _initialLoad(isRefreshing = false) {
this._xLoading(isRefreshing)
try {
const res = await this.rootStore.api.app.bsky.getNotifications(
const res = await this.rootStore.api.app.bsky.notification.list(
this.params,
)
this._replaceAll(res)
@ -232,7 +232,7 @@ export class NotificationsViewModel {
const params = Object.assign({}, this.params, {
before: this.loadMoreCursor,
})
const res = await this.rootStore.api.app.bsky.getNotifications(params)
const res = await this.rootStore.api.app.bsky.notification.list(params)
this._appendAll(res)
this._xIdle()
} catch (e: any) {
@ -246,8 +246,8 @@ export class NotificationsViewModel {
let cursor = undefined
try {
do {
const res: GetNotifications.Response =
await this.rootStore.api.app.bsky.getNotifications({
const res: ListNotifications.Response =
await this.rootStore.api.app.bsky.notification.list({
before: cursor,
limit: Math.min(numToFetch, 100),
})
@ -265,12 +265,12 @@ export class NotificationsViewModel {
}
}
private _replaceAll(res: GetNotifications.Response) {
private _replaceAll(res: ListNotifications.Response) {
this.notifications.length = 0
this._appendAll(res)
}
private _appendAll(res: GetNotifications.Response) {
private _appendAll(res: ListNotifications.Response) {
this.loadMoreCursor = res.data.cursor
let counter = this.notifications.length
for (const item of groupNotifications(res.data.notifications)) {
@ -285,7 +285,7 @@ export class NotificationsViewModel {
)
}
private _updateAll(res: GetNotifications.Response) {
private _updateAll(res: ListNotifications.Response) {
for (const item of res.data.notifications) {
const existingItem = this.notifications.find(
// this find function has a key subtlety- the indexedAt comparison
@ -301,10 +301,9 @@ export class NotificationsViewModel {
private async _updateReadState() {
try {
await this.rootStore.api.app.bsky.postNotificationsSeen(
{},
{seenAt: new Date().toISOString()},
)
await this.rootStore.api.app.bsky.notification.updateSeen({
seenAt: new Date().toISOString(),
})
} catch (e) {
console.log('Failed to update notifications read state', e)
}
@ -312,7 +311,7 @@ export class NotificationsViewModel {
}
function groupNotifications(
items: GetNotifications.Notification[],
items: ListNotifications.Notification[],
): GroupedNotification[] {
const items2: GroupedNotification[] = []
for (const item of items) {

View File

@ -1,5 +1,5 @@
import {makeAutoObservable, runInAction} from 'mobx'
import * as GetPostThread from '../../third-party/api/src/types/app/bsky/getPostThread'
import * as GetPostThread from '../../third-party/api/src/client/types/app/bsky/feed/getPostThread'
import {AtUri} from '../../third-party/uri'
import _omit from 'lodash.omit'
import {RootStoreModel} from './root-store'
@ -30,7 +30,7 @@ export class PostThreadViewPostModel implements GetPostThread.Post {
// data
uri: string = ''
cid: string = ''
author: GetPostThread.User = {did: '', name: '', displayName: ''}
author: GetPostThread.User = {did: '', handle: '', displayName: ''}
record: Record<string, unknown> = {}
embed?:
| GetPostThread.RecordEmbed
@ -82,8 +82,8 @@ export class PostThreadViewPostModel implements GetPostThread.Post {
}
this.parent = parentModel
}
if (v.parent?.author.name) {
this.replyingToAuthor = v.parent.author.name
if (v.parent?.author.handle) {
this.replyingToAuthor = v.parent.author.handle
}
// replies
if (includeChildren && v.replies) {
@ -239,7 +239,7 @@ export class PostThreadViewModel {
private async _load(isRefreshing = false) {
this._xLoading(isRefreshing)
try {
const res = await this.rootStore.api.app.bsky.getPostThread(
const res = await this.rootStore.api.app.bsky.feed.getPostThread(
Object.assign({}, this.params, {uri: this.resolvedUri}),
)
this._replaceAll(res)

View File

@ -1,5 +1,5 @@
import {makeAutoObservable} from 'mobx'
import * as Post from '../../third-party/api/src/types/app/bsky/post'
import * as Post from '../../third-party/api/src/client/types/app/bsky/feed/post'
import {AtUri} from '../../third-party/uri'
import {RootStoreModel} from './root-store'
@ -77,7 +77,7 @@ export class PostModel implements RemoveIndex<Post.Record> {
this._xLoading()
try {
const urip = new AtUri(this.uri)
const res = await this.rootStore.api.app.bsky.post.get({
const res = await this.rootStore.api.app.bsky.feed.post.get({
user: urip.host,
rkey: urip.rkey,
})

View File

@ -2,7 +2,6 @@ import {makeAutoObservable} from 'mobx'
import {RootStoreModel} from './root-store'
import {ProfileViewModel} from './profile-view'
import {FeedModel} from './feed-view'
import {BadgesViewModel} from './badges-view'
export const SECTION_IDS = {
POSTS: 0,
@ -20,7 +19,6 @@ export class ProfileUiModel {
// data
profile: ProfileViewModel
feed: FeedModel
badges: BadgesViewModel
// ui state
selectedViewIndex = 0
@ -42,16 +40,12 @@ export class ProfileUiModel {
author: params.user,
limit: 10,
})
this.badges = new BadgesViewModel(rootStore)
}
get currentView(): FeedModel | BadgesViewModel {
get currentView(): FeedModel {
if (this.selectedViewIndex === SECTION_IDS.POSTS) {
return this.feed
}
if (this.selectedViewIndex === SECTION_IDS.BADGES) {
return this.badges
}
throw new Error(`Invalid selector value: ${this.selectedViewIndex}`)
}
@ -79,9 +73,6 @@ export class ProfileUiModel {
this.feed
.setup()
.catch(err => console.error('Failed to fetch feed', err)),
this.badges
.setup()
.catch(err => console.error('Failed to fetch badges', err)),
])
}

View File

@ -1,6 +1,6 @@
import {makeAutoObservable, runInAction} from 'mobx'
import * as GetProfile from '../../third-party/api/src/types/app/bsky/getProfile'
import * as Profile from '../../third-party/api/src/types/app/bsky/profile'
import * as GetProfile from '../../third-party/api/src/client/types/app/bsky/actor/getProfile'
import * as Profile from '../../third-party/api/src/client/types/app/bsky/actor/profile'
import {RootStoreModel} from './root-store'
import * as apilib from '../lib/api'
@ -22,13 +22,12 @@ export class ProfileViewModel {
// data
did: string = ''
name: string = ''
handle: string = ''
displayName?: string
description?: string
followersCount: number = 0
followsCount: number = 0
postsCount: number = 0
pinnedBadges: GetProfile.Badge[] = []
myState = new ProfileViewMyStateModel()
constructor(
@ -118,7 +117,9 @@ export class ProfileViewModel {
private async _load(isRefreshing = false) {
this._xLoading(isRefreshing)
try {
const res = await this.rootStore.api.app.bsky.getProfile(this.params)
const res = await this.rootStore.api.app.bsky.actor.getProfile(
this.params,
)
this._replaceAll(res)
this._xIdle()
} catch (e: any) {
@ -128,13 +129,12 @@ export class ProfileViewModel {
private _replaceAll(res: GetProfile.Response) {
this.did = res.data.did
this.name = res.data.name
this.handle = res.data.handle
this.displayName = res.data.displayName
this.description = res.data.description
this.followersCount = res.data.followersCount
this.followsCount = res.data.followsCount
this.postsCount = res.data.postsCount
this.pinnedBadges = res.data.pinnedBadges
if (res.data.myState) {
Object.assign(this.myState, res.data.myState)
}

View File

@ -1,6 +1,6 @@
import {makeAutoObservable, runInAction} from 'mobx'
import {AtUri} from '../../third-party/uri'
import * as GetRepostedBy from '../../third-party/api/src/types/app/bsky/getRepostedBy'
import * as GetRepostedBy from '../../third-party/api/src/client/types/app/bsky/feed/getRepostedBy'
import {RootStoreModel} from './root-store'
type RepostedByItem = GetRepostedBy.OutputSchema['repostedBy'][number]
@ -11,7 +11,7 @@ export class RepostedByViewItemModel implements RepostedByItem {
// data
did: string = ''
name: string = ''
handle: string = ''
displayName: string = ''
createdAt?: string
indexedAt: string = ''
@ -113,7 +113,7 @@ export class RepostedByViewModel {
private async _fetch(isRefreshing = false) {
this._xLoading(isRefreshing)
try {
const res = await this.rootStore.api.app.bsky.getRepostedBy(
const res = await this.rootStore.api.app.bsky.feed.getRepostedBy(
Object.assign({}, this.params, {uri: this.resolvedUri}),
)
this._replaceAll(res)

View File

@ -3,8 +3,8 @@
*/
import {makeAutoObservable} from 'mobx'
import AtpApi from '../../third-party/api'
import type {ServiceClient} from '../../third-party/api/src/index'
import {sessionClient as AtpApi} from '../../third-party/api'
import type {SessionServiceClient} from '../../third-party/api/src/index'
import {createContext, useContext} from 'react'
import {isObj, hasProp} from '../lib/type-guards'
import {SessionModel} from './session'
@ -18,7 +18,7 @@ export class RootStoreModel {
shell = new ShellModel()
me = new MeModel(this)
constructor(public api: ServiceClient) {
constructor(public api: SessionServiceClient) {
makeAutoObservable(this, {
api: false,
resolveName: false,
@ -27,14 +27,14 @@ export class RootStoreModel {
})
}
async resolveName(didOrName: string) {
if (!didOrName) {
throw new Error('Invalid name: ""')
async resolveName(didOrHandle: string) {
if (!didOrHandle) {
throw new Error('Invalid handle: ""')
}
if (didOrName.startsWith('did:')) {
return didOrName
if (didOrHandle.startsWith('did:')) {
return didOrHandle
}
const res = await this.api.com.atproto.resolveName({name: didOrName})
const res = await this.api.com.atproto.handle.resolve({handle: didOrHandle})
return res.data.did
}

View File

@ -1,6 +1,7 @@
import {makeAutoObservable} from 'mobx'
import AtpApi from '../../third-party/api'
import type * as GetAccountsConfig from '../../third-party/api/src/types/com/atproto/getAccountsConfig'
import {sessionClient as AtpApi} from '../../third-party/api/index'
import type {SessionServiceClient} from '../../third-party/api/src/index'
import type * as GetAccountsConfig from '../../third-party/api/src/client/types/com/atproto/server/getAccountsConfig'
import {isObj, hasProp} from '../lib/type-guards'
import {RootStoreModel} from './root-store'
@ -8,9 +9,10 @@ export type ServiceDescription = GetAccountsConfig.OutputSchema
interface SessionData {
service: string
token: string
username: string
userdid: string
refreshJwt: string
accessJwt: string
handle: string
did: string
}
export enum OnboardingStage {
@ -49,26 +51,39 @@ export class SessionModel {
if (hasProp(v, 'data') && isObj(v.data)) {
const data: SessionData = {
service: '',
token: '',
username: '',
userdid: '',
refreshJwt: '',
accessJwt: '',
handle: '',
did: '',
}
if (hasProp(v.data, 'service') && typeof v.data.service === 'string') {
data.service = v.data.service
}
if (hasProp(v.data, 'token') && typeof v.data.token === 'string') {
data.token = v.data.token
if (
hasProp(v.data, 'refreshJwt') &&
typeof v.data.refreshJwt === 'string'
) {
data.refreshJwt = v.data.refreshJwt
}
if (
hasProp(v.data, 'username') &&
typeof v.data.username === 'string'
hasProp(v.data, 'accessJwt') &&
typeof v.data.accessJwt === 'string'
) {
data.username = v.data.username
data.accessJwt = v.data.accessJwt
}
if (hasProp(v.data, 'userdid') && typeof v.data.userdid === 'string') {
data.userdid = v.data.userdid
if (hasProp(v.data, 'handle') && typeof v.data.handle === 'string') {
data.handle = v.data.handle
}
if (data.service && data.token && data.username && data.userdid) {
if (hasProp(v.data, 'did') && typeof v.data.did === 'string') {
data.did = v.data.did
}
if (
data.service &&
data.refreshJwt &&
data.accessJwt &&
data.handle &&
data.did
) {
this.data = data
}
}
@ -112,7 +127,10 @@ export class SessionModel {
return false
}
this.rootStore.api.setHeader('Authorization', `Bearer ${this.data.token}`)
this.rootStore.api.sessionManager.set({
refreshJwt: this.data.refreshJwt,
accessJwt: this.data.accessJwt,
})
return true
}
@ -122,8 +140,8 @@ export class SessionModel {
}
try {
const sess = await this.rootStore.api.com.atproto.getSession({})
if (sess.success && this.data && this.data.userdid === sess.data.did) {
const sess = await this.rootStore.api.com.atproto.session.get()
if (sess.success && this.data && this.data.did === sess.data.did) {
this.rootStore.me.load().catch(e => {
console.error('Failed to fetch local user information', e)
})
@ -135,28 +153,29 @@ export class SessionModel {
}
async describeService(service: string): Promise<ServiceDescription> {
const api = AtpApi.service(service)
const res = await api.com.atproto.getAccountsConfig({})
const api = AtpApi.service(service) as SessionServiceClient
const res = await api.com.atproto.server.getAccountsConfig({})
return res.data
}
async login({
service,
username,
handle,
password,
}: {
service: string
username: string
handle: string
password: string
}) {
const api = AtpApi.service(service)
const res = await api.com.atproto.createSession({}, {username, password})
if (res.data.jwt) {
const api = AtpApi.service(service) as SessionServiceClient
const res = await api.com.atproto.session.create({handle, password})
if (res.data.accessJwt && res.data.refreshJwt) {
this.setState({
service: service,
token: res.data.jwt,
username: res.data.name,
userdid: res.data.did,
accessJwt: res.data.accessJwt,
refreshJwt: res.data.refreshJwt,
handle: res.data.handle,
did: res.data.did,
})
this.configureApi()
this.rootStore.me.load().catch(e => {
@ -169,26 +188,29 @@ export class SessionModel {
service,
email,
password,
username,
handle,
inviteCode,
}: {
service: string
email: string
password: string
username: string
handle: string
inviteCode?: string
}) {
const api = AtpApi.service(service)
const res = await api.com.atproto.createAccount(
{},
{username, password, email, inviteCode},
)
if (res.data.jwt) {
const api = AtpApi.service(service) as SessionServiceClient
const res = await api.com.atproto.account.create({
handle,
password,
email,
inviteCode,
})
if (res.data.accessJwt && res.data.refreshJwt) {
this.setState({
service: service,
token: res.data.jwt,
username: res.data.name,
userdid: res.data.did,
accessJwt: res.data.accessJwt,
refreshJwt: res.data.refreshJwt,
handle: res.data.handle,
did: res.data.did,
})
this.setOnboardingStage(OnboardingStage.Init)
this.configureApi()
@ -200,7 +222,7 @@ export class SessionModel {
async logout() {
if (this.isAuthed) {
this.rootStore.api.com.atproto.deleteSession({}).catch((e: any) => {
this.rootStore.api.com.atproto.session.delete().catch((e: any) => {
console.error('(Minor issue) Failed to delete session on the server', e)
})
}

View File

@ -1,6 +1,6 @@
import {makeAutoObservable} from 'mobx'
import {ProfileViewModel} from './profile-view'
import * as Post from '../../third-party/api/src/types/app/bsky/post'
import * as Post from '../../third-party/api/src/client/types/app/bsky/feed/post'
export interface LinkActionsModelOpts {
newTab?: boolean

View File

@ -1,10 +1,11 @@
import {makeAutoObservable} from 'mobx'
import * as GetUserFollowers from '../../third-party/api/src/types/app/bsky/getUserFollowers'
import * as GetFollowers from '../../third-party/api/src/client/types/app/bsky/graph/getFollowers'
import {RootStoreModel} from './root-store'
type Subject = GetUserFollowers.OutputSchema['subject']
export type FollowerItem =
GetUserFollowers.OutputSchema['followers'][number] & {_reactKey: string}
type Subject = GetFollowers.OutputSchema['subject']
export type FollowerItem = GetFollowers.OutputSchema['followers'][number] & {
_reactKey: string
}
export class UserFollowersViewModel {
// state
@ -12,15 +13,15 @@ export class UserFollowersViewModel {
isRefreshing = false
hasLoaded = false
error = ''
params: GetUserFollowers.QueryParams
params: GetFollowers.QueryParams
// data
subject: Subject = {did: '', name: '', displayName: ''}
subject: Subject = {did: '', handle: '', displayName: ''}
followers: FollowerItem[] = []
constructor(
public rootStore: RootStoreModel,
params: GetUserFollowers.QueryParams,
params: GetFollowers.QueryParams,
) {
makeAutoObservable(
this,
@ -82,7 +83,7 @@ export class UserFollowersViewModel {
private async _fetch(isRefreshing = false) {
this._xLoading(isRefreshing)
try {
const res = await this.rootStore.api.app.bsky.getUserFollowers(
const res = await this.rootStore.api.app.bsky.graph.getFollowers(
this.params,
)
this._replaceAll(res)
@ -92,9 +93,9 @@ export class UserFollowersViewModel {
}
}
private _replaceAll(res: GetUserFollowers.Response) {
private _replaceAll(res: GetFollowers.Response) {
this.subject.did = res.data.subject.did
this.subject.name = res.data.subject.name
this.subject.handle = res.data.subject.handle
this.subject.displayName = res.data.subject.displayName
this.followers.length = 0
let counter = 0

View File

@ -1,9 +1,9 @@
import {makeAutoObservable} from 'mobx'
import * as GetUserFollows from '../../third-party/api/src/types/app/bsky/getUserFollows'
import * as GetFollows from '../../third-party/api/src/client/types/app/bsky/graph/getFollows'
import {RootStoreModel} from './root-store'
type Subject = GetUserFollows.OutputSchema['subject']
export type FollowItem = GetUserFollows.OutputSchema['follows'][number] & {
type Subject = GetFollows.OutputSchema['subject']
export type FollowItem = GetFollows.OutputSchema['follows'][number] & {
_reactKey: string
}
@ -13,15 +13,15 @@ export class UserFollowsViewModel {
isRefreshing = false
hasLoaded = false
error = ''
params: GetUserFollows.QueryParams
params: GetFollows.QueryParams
// data
subject: Subject = {did: '', name: '', displayName: ''}
subject: Subject = {did: '', handle: '', displayName: ''}
follows: FollowItem[] = []
constructor(
public rootStore: RootStoreModel,
params: GetUserFollows.QueryParams,
params: GetFollows.QueryParams,
) {
makeAutoObservable(
this,
@ -83,7 +83,9 @@ export class UserFollowsViewModel {
private async _fetch(isRefreshing = false) {
this._xLoading(isRefreshing)
try {
const res = await this.rootStore.api.app.bsky.getUserFollows(this.params)
const res = await this.rootStore.api.app.bsky.graph.getFollows(
this.params,
)
this._replaceAll(res)
this._xIdle()
} catch (e: any) {
@ -91,9 +93,9 @@ export class UserFollowsViewModel {
}
}
private _replaceAll(res: GetUserFollows.Response) {
private _replaceAll(res: GetFollows.Response) {
this.subject.did = res.data.subject.did
this.subject.name = res.data.subject.name
this.subject.handle = res.data.subject.handle
this.subject.displayName = res.data.subject.displayName
this.follows.length = 0
let counter = 0

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,417 @@
import { Client as XrpcClient, ServiceClient as XrpcServiceClient } from '@atproto/xrpc';
import * as ComAtprotoAccountCreate from './types/com/atproto/account/create';
import * as ComAtprotoAccountCreateInviteCode from './types/com/atproto/account/createInviteCode';
import * as ComAtprotoAccountDelete from './types/com/atproto/account/delete';
import * as ComAtprotoAccountGet from './types/com/atproto/account/get';
import * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset';
import * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword';
import * as ComAtprotoHandleResolve from './types/com/atproto/handle/resolve';
import * as ComAtprotoRepoBatchWrite from './types/com/atproto/repo/batchWrite';
import * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createRecord';
import * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord';
import * as ComAtprotoRepoDescribe from './types/com/atproto/repo/describe';
import * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord';
import * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords';
import * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord';
import * as ComAtprotoServerGetAccountsConfig from './types/com/atproto/server/getAccountsConfig';
import * as ComAtprotoSessionCreate from './types/com/atproto/session/create';
import * as ComAtprotoSessionDelete from './types/com/atproto/session/delete';
import * as ComAtprotoSessionGet from './types/com/atproto/session/get';
import * as ComAtprotoSessionRefresh from './types/com/atproto/session/refresh';
import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo';
import * as ComAtprotoSyncGetRoot from './types/com/atproto/sync/getRoot';
import * as ComAtprotoSyncUpdateRepo from './types/com/atproto/sync/updateRepo';
import * as AppBskyActorGetProfile from './types/app/bsky/actor/getProfile';
import * as AppBskyActorSearch from './types/app/bsky/actor/search';
import * as AppBskyActorSearchTypeahead from './types/app/bsky/actor/searchTypeahead';
import * as AppBskyActorProfile from './types/app/bsky/actor/profile';
import * as AppBskyActorUpdateProfile from './types/app/bsky/actor/updateProfile';
import * as AppBskyFeedGetAuthorFeed from './types/app/bsky/feed/getAuthorFeed';
import * as AppBskyFeedGetLikedBy from './types/app/bsky/feed/getLikedBy';
import * as AppBskyFeedGetPostThread from './types/app/bsky/feed/getPostThread';
import * as AppBskyFeedGetRepostedBy from './types/app/bsky/feed/getRepostedBy';
import * as AppBskyFeedGetTimeline from './types/app/bsky/feed/getTimeline';
import * as AppBskyFeedLike from './types/app/bsky/feed/like';
import * as AppBskyFeedMediaEmbed from './types/app/bsky/feed/mediaEmbed';
import * as AppBskyFeedPost from './types/app/bsky/feed/post';
import * as AppBskyFeedRepost from './types/app/bsky/feed/repost';
import * as AppBskyGraphFollow from './types/app/bsky/graph/follow';
import * as AppBskyGraphGetFollowers from './types/app/bsky/graph/getFollowers';
import * as AppBskyGraphGetFollows from './types/app/bsky/graph/getFollows';
import * as AppBskyGraphInvite from './types/app/bsky/graph/invite';
import * as AppBskyGraphInviteAccept from './types/app/bsky/graph/inviteAccept';
import * as AppBskyNotificationGetCount from './types/app/bsky/notification/getCount';
import * as AppBskyNotificationList from './types/app/bsky/notification/list';
import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen';
import * as AppBskySystemDeclaration from './types/app/bsky/system/declaration';
export * as ComAtprotoAccountCreate from './types/com/atproto/account/create';
export * as ComAtprotoAccountCreateInviteCode from './types/com/atproto/account/createInviteCode';
export * as ComAtprotoAccountDelete from './types/com/atproto/account/delete';
export * as ComAtprotoAccountGet from './types/com/atproto/account/get';
export * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset';
export * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword';
export * as ComAtprotoHandleResolve from './types/com/atproto/handle/resolve';
export * as ComAtprotoRepoBatchWrite from './types/com/atproto/repo/batchWrite';
export * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createRecord';
export * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord';
export * as ComAtprotoRepoDescribe from './types/com/atproto/repo/describe';
export * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord';
export * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords';
export * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord';
export * as ComAtprotoServerGetAccountsConfig from './types/com/atproto/server/getAccountsConfig';
export * as ComAtprotoSessionCreate from './types/com/atproto/session/create';
export * as ComAtprotoSessionDelete from './types/com/atproto/session/delete';
export * as ComAtprotoSessionGet from './types/com/atproto/session/get';
export * as ComAtprotoSessionRefresh from './types/com/atproto/session/refresh';
export * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo';
export * as ComAtprotoSyncGetRoot from './types/com/atproto/sync/getRoot';
export * as ComAtprotoSyncUpdateRepo from './types/com/atproto/sync/updateRepo';
export * as AppBskyActorGetProfile from './types/app/bsky/actor/getProfile';
export * as AppBskyActorSearch from './types/app/bsky/actor/search';
export * as AppBskyActorSearchTypeahead from './types/app/bsky/actor/searchTypeahead';
export * as AppBskyActorProfile from './types/app/bsky/actor/profile';
export * as AppBskyActorUpdateProfile from './types/app/bsky/actor/updateProfile';
export * as AppBskyFeedGetAuthorFeed from './types/app/bsky/feed/getAuthorFeed';
export * as AppBskyFeedGetLikedBy from './types/app/bsky/feed/getLikedBy';
export * as AppBskyFeedGetPostThread from './types/app/bsky/feed/getPostThread';
export * as AppBskyFeedGetRepostedBy from './types/app/bsky/feed/getRepostedBy';
export * as AppBskyFeedGetTimeline from './types/app/bsky/feed/getTimeline';
export * as AppBskyFeedLike from './types/app/bsky/feed/like';
export * as AppBskyFeedMediaEmbed from './types/app/bsky/feed/mediaEmbed';
export * as AppBskyFeedPost from './types/app/bsky/feed/post';
export * as AppBskyFeedRepost from './types/app/bsky/feed/repost';
export * as AppBskyGraphFollow from './types/app/bsky/graph/follow';
export * as AppBskyGraphGetFollowers from './types/app/bsky/graph/getFollowers';
export * as AppBskyGraphGetFollows from './types/app/bsky/graph/getFollows';
export * as AppBskyGraphInvite from './types/app/bsky/graph/invite';
export * as AppBskyGraphInviteAccept from './types/app/bsky/graph/inviteAccept';
export * as AppBskyNotificationGetCount from './types/app/bsky/notification/getCount';
export * as AppBskyNotificationList from './types/app/bsky/notification/list';
export * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen';
export * as AppBskySystemDeclaration from './types/app/bsky/system/declaration';
export declare const APP_BSKY_SYSTEM: {
ActorScene: string;
ActorUser: string;
};
export declare class Client {
xrpc: XrpcClient;
constructor();
service(serviceUri: string | URL): ServiceClient;
}
declare const defaultInst: Client;
export default defaultInst;
export declare class ServiceClient {
_baseClient: Client;
xrpc: XrpcServiceClient;
com: ComNS;
app: AppNS;
constructor(baseClient: Client, xrpcService: XrpcServiceClient);
setHeader(key: string, value: string): void;
}
export declare class ComNS {
_service: ServiceClient;
atproto: AtprotoNS;
constructor(service: ServiceClient);
}
export declare class AtprotoNS {
_service: ServiceClient;
account: AccountNS;
handle: HandleNS;
repo: RepoNS;
server: ServerNS;
session: SessionNS;
sync: SyncNS;
constructor(service: ServiceClient);
}
export declare class AccountNS {
_service: ServiceClient;
constructor(service: ServiceClient);
create(data?: ComAtprotoAccountCreate.InputSchema, opts?: ComAtprotoAccountCreate.CallOptions): Promise<ComAtprotoAccountCreate.Response>;
createInviteCode(data?: ComAtprotoAccountCreateInviteCode.InputSchema, opts?: ComAtprotoAccountCreateInviteCode.CallOptions): Promise<ComAtprotoAccountCreateInviteCode.Response>;
delete(data?: ComAtprotoAccountDelete.InputSchema, opts?: ComAtprotoAccountDelete.CallOptions): Promise<ComAtprotoAccountDelete.Response>;
get(params?: ComAtprotoAccountGet.QueryParams, opts?: ComAtprotoAccountGet.CallOptions): Promise<ComAtprotoAccountGet.Response>;
requestPasswordReset(data?: ComAtprotoAccountRequestPasswordReset.InputSchema, opts?: ComAtprotoAccountRequestPasswordReset.CallOptions): Promise<ComAtprotoAccountRequestPasswordReset.Response>;
resetPassword(data?: ComAtprotoAccountResetPassword.InputSchema, opts?: ComAtprotoAccountResetPassword.CallOptions): Promise<ComAtprotoAccountResetPassword.Response>;
}
export declare class HandleNS {
_service: ServiceClient;
constructor(service: ServiceClient);
resolve(params?: ComAtprotoHandleResolve.QueryParams, opts?: ComAtprotoHandleResolve.CallOptions): Promise<ComAtprotoHandleResolve.Response>;
}
export declare class RepoNS {
_service: ServiceClient;
constructor(service: ServiceClient);
batchWrite(data?: ComAtprotoRepoBatchWrite.InputSchema, opts?: ComAtprotoRepoBatchWrite.CallOptions): Promise<ComAtprotoRepoBatchWrite.Response>;
createRecord(data?: ComAtprotoRepoCreateRecord.InputSchema, opts?: ComAtprotoRepoCreateRecord.CallOptions): Promise<ComAtprotoRepoCreateRecord.Response>;
deleteRecord(data?: ComAtprotoRepoDeleteRecord.InputSchema, opts?: ComAtprotoRepoDeleteRecord.CallOptions): Promise<ComAtprotoRepoDeleteRecord.Response>;
describe(params?: ComAtprotoRepoDescribe.QueryParams, opts?: ComAtprotoRepoDescribe.CallOptions): Promise<ComAtprotoRepoDescribe.Response>;
getRecord(params?: ComAtprotoRepoGetRecord.QueryParams, opts?: ComAtprotoRepoGetRecord.CallOptions): Promise<ComAtprotoRepoGetRecord.Response>;
listRecords(params?: ComAtprotoRepoListRecords.QueryParams, opts?: ComAtprotoRepoListRecords.CallOptions): Promise<ComAtprotoRepoListRecords.Response>;
putRecord(data?: ComAtprotoRepoPutRecord.InputSchema, opts?: ComAtprotoRepoPutRecord.CallOptions): Promise<ComAtprotoRepoPutRecord.Response>;
}
export declare class ServerNS {
_service: ServiceClient;
constructor(service: ServiceClient);
getAccountsConfig(params?: ComAtprotoServerGetAccountsConfig.QueryParams, opts?: ComAtprotoServerGetAccountsConfig.CallOptions): Promise<ComAtprotoServerGetAccountsConfig.Response>;
}
export declare class SessionNS {
_service: ServiceClient;
constructor(service: ServiceClient);
create(data?: ComAtprotoSessionCreate.InputSchema, opts?: ComAtprotoSessionCreate.CallOptions): Promise<ComAtprotoSessionCreate.Response>;
delete(data?: ComAtprotoSessionDelete.InputSchema, opts?: ComAtprotoSessionDelete.CallOptions): Promise<ComAtprotoSessionDelete.Response>;
get(params?: ComAtprotoSessionGet.QueryParams, opts?: ComAtprotoSessionGet.CallOptions): Promise<ComAtprotoSessionGet.Response>;
refresh(data?: ComAtprotoSessionRefresh.InputSchema, opts?: ComAtprotoSessionRefresh.CallOptions): Promise<ComAtprotoSessionRefresh.Response>;
}
export declare class SyncNS {
_service: ServiceClient;
constructor(service: ServiceClient);
getRepo(params?: ComAtprotoSyncGetRepo.QueryParams, opts?: ComAtprotoSyncGetRepo.CallOptions): Promise<ComAtprotoSyncGetRepo.Response>;
getRoot(params?: ComAtprotoSyncGetRoot.QueryParams, opts?: ComAtprotoSyncGetRoot.CallOptions): Promise<ComAtprotoSyncGetRoot.Response>;
updateRepo(data?: ComAtprotoSyncUpdateRepo.InputSchema, opts?: ComAtprotoSyncUpdateRepo.CallOptions): Promise<ComAtprotoSyncUpdateRepo.Response>;
}
export declare class AppNS {
_service: ServiceClient;
bsky: BskyNS;
constructor(service: ServiceClient);
}
export declare class BskyNS {
_service: ServiceClient;
actor: ActorNS;
feed: FeedNS;
graph: GraphNS;
notification: NotificationNS;
system: SystemNS;
constructor(service: ServiceClient);
}
export declare class ActorNS {
_service: ServiceClient;
profile: ProfileRecord;
constructor(service: ServiceClient);
getProfile(params?: AppBskyActorGetProfile.QueryParams, opts?: AppBskyActorGetProfile.CallOptions): Promise<AppBskyActorGetProfile.Response>;
search(params?: AppBskyActorSearch.QueryParams, opts?: AppBskyActorSearch.CallOptions): Promise<AppBskyActorSearch.Response>;
searchTypeahead(params?: AppBskyActorSearchTypeahead.QueryParams, opts?: AppBskyActorSearchTypeahead.CallOptions): Promise<AppBskyActorSearchTypeahead.Response>;
updateProfile(data?: AppBskyActorUpdateProfile.InputSchema, opts?: AppBskyActorUpdateProfile.CallOptions): Promise<AppBskyActorUpdateProfile.Response>;
}
export declare class ProfileRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyActorProfile.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyActorProfile.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record'>, record: AppBskyActorProfile.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class FeedNS {
_service: ServiceClient;
like: LikeRecord;
mediaEmbed: MediaEmbedRecord;
post: PostRecord;
repost: RepostRecord;
constructor(service: ServiceClient);
getAuthorFeed(params?: AppBskyFeedGetAuthorFeed.QueryParams, opts?: AppBskyFeedGetAuthorFeed.CallOptions): Promise<AppBskyFeedGetAuthorFeed.Response>;
getLikedBy(params?: AppBskyFeedGetLikedBy.QueryParams, opts?: AppBskyFeedGetLikedBy.CallOptions): Promise<AppBskyFeedGetLikedBy.Response>;
getPostThread(params?: AppBskyFeedGetPostThread.QueryParams, opts?: AppBskyFeedGetPostThread.CallOptions): Promise<AppBskyFeedGetPostThread.Response>;
getRepostedBy(params?: AppBskyFeedGetRepostedBy.QueryParams, opts?: AppBskyFeedGetRepostedBy.CallOptions): Promise<AppBskyFeedGetRepostedBy.Response>;
getTimeline(params?: AppBskyFeedGetTimeline.QueryParams, opts?: AppBskyFeedGetTimeline.CallOptions): Promise<AppBskyFeedGetTimeline.Response>;
}
export declare class LikeRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyFeedLike.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyFeedLike.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record'>, record: AppBskyFeedLike.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class MediaEmbedRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyFeedMediaEmbed.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyFeedMediaEmbed.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record'>, record: AppBskyFeedMediaEmbed.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class PostRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyFeedPost.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyFeedPost.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record'>, record: AppBskyFeedPost.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class RepostRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyFeedRepost.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyFeedRepost.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record'>, record: AppBskyFeedRepost.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class GraphNS {
_service: ServiceClient;
follow: FollowRecord;
invite: InviteRecord;
inviteAccept: InviteAcceptRecord;
constructor(service: ServiceClient);
getFollowers(params?: AppBskyGraphGetFollowers.QueryParams, opts?: AppBskyGraphGetFollowers.CallOptions): Promise<AppBskyGraphGetFollowers.Response>;
getFollows(params?: AppBskyGraphGetFollows.QueryParams, opts?: AppBskyGraphGetFollows.CallOptions): Promise<AppBskyGraphGetFollows.Response>;
}
export declare class FollowRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyGraphFollow.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyGraphFollow.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record'>, record: AppBskyGraphFollow.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class InviteRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyGraphInvite.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyGraphInvite.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record'>, record: AppBskyGraphInvite.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class InviteAcceptRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyGraphInviteAccept.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyGraphInviteAccept.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record'>, record: AppBskyGraphInviteAccept.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class NotificationNS {
_service: ServiceClient;
constructor(service: ServiceClient);
getCount(params?: AppBskyNotificationGetCount.QueryParams, opts?: AppBskyNotificationGetCount.CallOptions): Promise<AppBskyNotificationGetCount.Response>;
list(params?: AppBskyNotificationList.QueryParams, opts?: AppBskyNotificationList.CallOptions): Promise<AppBskyNotificationList.Response>;
updateSeen(data?: AppBskyNotificationUpdateSeen.InputSchema, opts?: AppBskyNotificationUpdateSeen.CallOptions): Promise<AppBskyNotificationUpdateSeen.Response>;
}
export declare class SystemNS {
_service: ServiceClient;
declaration: DeclarationRecord;
constructor(service: ServiceClient);
}
export declare class DeclarationRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskySystemDeclaration.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskySystemDeclaration.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.InputSchema, 'collection' | 'record'>, record: AppBskySystemDeclaration.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}

View File

@ -2,15 +2,15 @@ import { MethodSchema, RecordSchema } from '@atproto/lexicon';
export declare const methodSchemaDict: Record<string, MethodSchema>;
export declare const methodSchemas: MethodSchema[];
export declare const ids: {
AppBskyBadge: string;
AppBskyBadgeAccept: string;
AppBskyBadgeOffer: string;
AppBskyFollow: string;
AppBskyLike: string;
AppBskyMediaEmbed: string;
AppBskyPost: string;
AppBskyProfile: string;
AppBskyRepost: string;
AppBskyActorProfile: string;
AppBskyFeedLike: string;
AppBskyFeedMediaEmbed: string;
AppBskyFeedPost: string;
AppBskyFeedRepost: string;
AppBskyGraphFollow: string;
AppBskyGraphInvite: string;
AppBskyGraphInviteAccept: string;
AppBskySystemDeclaration: string;
};
export declare const recordSchemaDict: Record<string, RecordSchema>;
export declare const recordSchemas: RecordSchema[];

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
user: string;
}
@ -8,30 +8,16 @@ export interface CallOptions {
export declare type InputSchema = undefined;
export interface OutputSchema {
did: string;
name: string;
handle: string;
displayName?: string;
description?: string;
followersCount: number;
followsCount: number;
postsCount: number;
badges: Badge[];
myState?: {
follow?: string;
};
}
export interface Badge {
uri: string;
error?: string;
issuer?: {
did: string;
name: string;
displayName: string;
};
assertion?: {
type: string;
};
createdAt?: string;
}
export interface Response {
success: boolean;
headers: Headers;

View File

@ -1,10 +1,5 @@
export interface Record {
displayName: string;
description?: string;
badges?: BadgeRef[];
[k: string]: unknown;
}
export interface BadgeRef {
uri: string;
[k: string]: unknown;
}

View File

@ -12,11 +12,10 @@ export interface OutputSchema {
cursor?: string;
users: {
did: string;
name: string;
handle: string;
displayName?: string;
description?: string;
createdAt: string;
indexedAt: string;
indexedAt?: string;
}[];
}
export interface Response {

View File

@ -10,7 +10,7 @@ export declare type InputSchema = undefined;
export interface OutputSchema {
users: {
did: string;
name: string;
handle: string;
displayName?: string;
}[];
}

View File

@ -3,16 +3,12 @@ export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/json';
}
export interface InputSchema {
displayName?: string;
description?: string;
pinnedBadges?: BadgeRef[];
}
export interface BadgeRef {
uri: string;
cid: string;
}
export interface OutputSchema {
uri: string;

View File

@ -30,7 +30,7 @@ export interface FeedItem {
}
export interface User {
did: string;
name: string;
handle: string;
displayName?: string;
}
export interface RecordEmbed {

View File

@ -15,7 +15,7 @@ export interface OutputSchema {
cursor?: string;
likedBy: {
did: string;
name: string;
handle: string;
displayName?: string;
createdAt?: string;
indexedAt: string;

View File

@ -29,7 +29,7 @@ export interface Post {
}
export interface User {
did: string;
name: string;
handle: string;
displayName?: string;
}
export interface RecordEmbed {

View File

@ -15,7 +15,7 @@ export interface OutputSchema {
cursor?: string;
repostedBy: {
did: string;
name: string;
handle: string;
displayName?: string;
createdAt?: string;
indexedAt: string;

View File

@ -30,7 +30,7 @@ export interface FeedItem {
}
export interface User {
did: string;
name: string;
handle: string;
displayName?: string;
}
export interface RecordEmbed {

View File

@ -1,13 +1,7 @@
export declare type TextSlice = [number, number];
export declare type Entity = {
index: TextSlice;
type: string;
value: string;
[k: string]: unknown;
}[];
export interface Record {
text: string;
entities?: Entity;
entities?: Entity[];
reply?: {
root: PostRef;
parent: PostRef;
@ -16,6 +10,12 @@ export interface Record {
createdAt: string;
[k: string]: unknown;
}
export interface Entity {
index: TextSlice;
type: string;
value: string;
[k: string]: unknown;
}
export interface PostRef {
uri: string;
cid: string;

View File

@ -0,0 +1,9 @@
export interface Record {
subject: {
did: string;
declarationCid: string;
[k: string]: unknown;
};
createdAt: string;
[k: string]: unknown;
}

View File

@ -11,13 +11,13 @@ export declare type InputSchema = undefined;
export interface OutputSchema {
subject: {
did: string;
name: string;
handle: string;
displayName?: string;
};
cursor?: string;
followers: {
did: string;
name: string;
handle: string;
displayName?: string;
createdAt?: string;
indexedAt: string;

View File

@ -11,13 +11,13 @@ export declare type InputSchema = undefined;
export interface OutputSchema {
subject: {
did: string;
name: string;
handle: string;
displayName?: string;
};
cursor?: string;
follows: {
did: string;
name: string;
handle: string;
displayName?: string;
createdAt?: string;
indexedAt: string;

View File

@ -0,0 +1,10 @@
export interface Record {
group: string;
subject: {
did: string;
declarationCid: string;
[k: string]: unknown;
};
createdAt: string;
[k: string]: unknown;
}

View File

@ -0,0 +1,14 @@
export interface Record {
group: {
did: string;
declarationCid: string;
[k: string]: unknown;
};
invite: {
uri: string;
cid: string;
[k: string]: unknown;
};
createdAt: string;
[k: string]: unknown;
}

View File

@ -16,7 +16,7 @@ export interface Notification {
cid: string;
author: {
did: string;
name: string;
handle: string;
displayName?: string;
};
reason: string;

View File

@ -3,6 +3,7 @@ export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/json';
}
export interface InputSchema {

View File

@ -0,0 +1,6 @@
export declare type ActorKnown = 'app.bsky.system.actorUser' | 'app.bsky.system.actorScene';
export declare type ActorUnknown = string;
export interface Record {
actorType: ActorKnown | ActorUnknown;
[k: string]: unknown;
}

View File

@ -3,26 +3,29 @@ export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/json';
}
export interface InputSchema {
email: string;
username: string;
handle: string;
inviteCode?: string;
password: string;
recoveryKey?: string;
}
export interface OutputSchema {
jwt: string;
username: string;
accessJwt: string;
refreshJwt: string;
handle: string;
did: string;
declarationCid: string;
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare class InvalidUsernameError extends XRPCError {
export declare class InvalidHandleError extends XRPCError {
constructor(src: XRPCError);
}
export declare class InvalidPasswordError extends XRPCError {
@ -31,7 +34,7 @@ export declare class InvalidPasswordError extends XRPCError {
export declare class InvalidInviteCodeError extends XRPCError {
constructor(src: XRPCError);
}
export declare class UsernameNotAvailableError extends XRPCError {
export declare class HandleNotAvailableError extends XRPCError {
constructor(src: XRPCError);
}
export declare function toKnownErr(e: any): any;

View File

@ -3,6 +3,7 @@ export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/json';
}
export interface InputSchema {

View File

@ -3,6 +3,7 @@ export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: '';
}
export interface InputSchema {

View File

@ -1,4 +1,4 @@
import { Headers } from '@adxp/xrpc';
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {
@ -6,7 +6,7 @@ export interface CallOptions {
}
export declare type InputSchema = undefined;
export interface OutputSchema {
count: number;
[k: string]: unknown;
}
export interface Response {
success: boolean;

View File

@ -3,6 +3,7 @@ export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/json';
}
export interface InputSchema {

View File

@ -3,6 +3,7 @@ export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/json';
}
export interface InputSchema {

View File

@ -1,12 +1,12 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
handle?: string;
}
export interface CallOptions {
headers?: Headers;
}
export declare type InputSchema = undefined;
export interface OutputSchema {
name: string;
did: string;
}
export interface Response {

View File

@ -1,13 +1,14 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
did: string;
validate?: boolean;
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/json';
}
export interface InputSchema {
did: string;
validate?: boolean;
writes: ({
action: 'create';
collection: string;

View File

@ -1,15 +1,16 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
did: string;
collection: string;
validate?: boolean;
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/json';
}
export interface InputSchema {
[k: string]: unknown;
did: string;
collection: string;
validate?: boolean;
record: {};
}
export interface OutputSchema {
uri: string;

View File

@ -1,13 +1,16 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/json';
}
export interface InputSchema {
did: string;
collection: string;
rkey: string;
}
export interface CallOptions {
headers?: Headers;
}
export declare type InputSchema = undefined;
export interface Response {
success: boolean;
headers: Headers;

View File

@ -7,11 +7,11 @@ export interface CallOptions {
}
export declare type InputSchema = undefined;
export interface OutputSchema {
name: string;
handle: string;
did: string;
didDoc: {};
collections: string[];
nameIsCorrect: boolean;
handleIsCorrect: boolean;
}
export interface Response {
success: boolean;

View File

@ -1,16 +1,17 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/json';
}
export interface InputSchema {
did: string;
collection: string;
rkey: string;
validate?: boolean;
}
export interface CallOptions {
headers?: Headers;
encoding: 'application/json';
}
export interface InputSchema {
[k: string]: unknown;
record: {};
}
export interface OutputSchema {
uri: string;

View File

@ -3,15 +3,17 @@ export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/json';
}
export interface InputSchema {
username: string;
handle: string;
password: string;
}
export interface OutputSchema {
jwt: string;
name: string;
accessJwt: string;
refreshJwt: string;
handle: string;
did: string;
}
export interface Response {

View File

@ -3,11 +3,9 @@ export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: '';
}
export interface InputSchema {
[k: string]: unknown;
qp?: QueryParams;
}
export declare type InputSchema = undefined;
export interface OutputSchema {
[k: string]: unknown;
}

View File

@ -1,12 +1,12 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
name?: string;
}
export interface CallOptions {
headers?: Headers;
}
export declare type InputSchema = undefined;
export interface OutputSchema {
handle: string;
did: string;
}
export interface Response {

View File

@ -0,0 +1,20 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
}
export declare type InputSchema = undefined;
export interface OutputSchema {
accessJwt: string;
refreshJwt: string;
handle: string;
did: string;
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

View File

@ -4,6 +4,7 @@ export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
qp?: QueryParams;
encoding: 'application/cbor';
}
export declare type InputSchema = string | Uint8Array;

View File

@ -1,24 +0,0 @@
export declare enum ErrorCode {
NetworkError = "NetworkError",
DidResolutionFailed = "DidResolutionFailed",
NameResolutionFailed = "NameResolutionFailed"
}
export declare class NameResolutionFailed extends Error {
code: ErrorCode;
constructor(name: string);
}
export declare class DidResolutionFailed extends Error {
code: ErrorCode;
constructor(did: string);
}
export declare class WritePermissionError extends Error {
constructor();
}
export declare class APIResponseError extends Error {
httpStatusCode: number;
httpStatusText: string;
httpHeaders?: Record<string, string> | undefined;
httpResponseBody?: any;
constructor(httpStatusCode: number, httpStatusText: string, httpHeaders?: Record<string, string> | undefined, httpResponseBody?: any);
get code(): ErrorCode;
}

View File

@ -1,180 +0,0 @@
import { z } from 'zod';
export declare const getRepoRequest: z.ZodObject<{
did: z.ZodString;
from: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("multiformats/cid").CID, string>>;
}, "strip", z.ZodTypeAny, {
from?: import("multiformats/cid").CID | undefined;
did: string;
}, {
from?: string | undefined;
did: string;
}>;
export declare type GetRepoRequest = z.infer<typeof getRepoRequest>;
export declare const postRepoRequest: z.ZodObject<{
did: z.ZodString;
}, "strip", z.ZodTypeAny, {
did: string;
}, {
did: string;
}>;
export declare type PostRepoRequest = z.infer<typeof postRepoRequest>;
export declare const describeRepoParams: z.ZodObject<{
confirmName: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
confirmName?: boolean | undefined;
}, {
confirmName?: boolean | undefined;
}>;
export declare type DescribeRepoParams = z.infer<typeof describeRepoParams>;
export declare const describeRepoResponse: z.ZodObject<{
name: z.ZodString;
did: z.ZodString;
didDoc: z.ZodAny;
collections: z.ZodArray<z.ZodString, "many">;
nameIsCorrect: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
didDoc?: any;
nameIsCorrect?: boolean | undefined;
name: string;
did: string;
collections: string[];
}, {
didDoc?: any;
nameIsCorrect?: boolean | undefined;
name: string;
did: string;
collections: string[];
}>;
export declare type DescribeRepoResponse = z.infer<typeof describeRepoResponse>;
export declare const listRecordsParams: z.ZodObject<{
limit: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, number, string>]>>;
before: z.ZodOptional<z.ZodString>;
after: z.ZodOptional<z.ZodString>;
reverse: z.ZodOptional<z.ZodEffects<z.ZodString, boolean, string>>;
}, "strip", z.ZodTypeAny, {
reverse?: boolean | undefined;
limit?: number | undefined;
before?: string | undefined;
after?: string | undefined;
}, {
reverse?: string | undefined;
limit?: string | number | undefined;
before?: string | undefined;
after?: string | undefined;
}>;
export declare type ListRecordsParams = z.infer<typeof listRecordsParams>;
export declare const listRecordsResponse: z.ZodObject<{
records: z.ZodArray<z.ZodObject<{
uri: z.ZodString;
value: z.ZodAny;
}, "strip", z.ZodTypeAny, {
value?: any;
uri: string;
}, {
value?: any;
uri: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
records: {
value?: any;
uri: string;
}[];
}, {
records: {
value?: any;
uri: string;
}[];
}>;
export declare type ListRecordsResponse = z.infer<typeof listRecordsResponse>;
export declare const getRecordResponse: z.ZodObject<{
uri: z.ZodString;
value: z.ZodAny;
}, "strip", z.ZodTypeAny, {
value?: any;
uri: string;
}, {
value?: any;
uri: string;
}>;
export declare type GetRecordResponse = z.infer<typeof getRecordResponse>;
export declare const batchWriteParams: z.ZodObject<{
writes: z.ZodArray<z.ZodUnion<[z.ZodObject<{
action: z.ZodLiteral<"create">;
collection: z.ZodString;
value: z.ZodAny;
}, "strip", z.ZodTypeAny, {
value?: any;
action: "create";
collection: string;
}, {
value?: any;
action: "create";
collection: string;
}>, z.ZodObject<{
action: z.ZodLiteral<"update">;
collection: z.ZodString;
tid: z.ZodString;
value: z.ZodAny;
}, "strip", z.ZodTypeAny, {
value?: any;
action: "update";
collection: string;
tid: string;
}, {
value?: any;
action: "update";
collection: string;
tid: string;
}>, z.ZodObject<{
action: z.ZodLiteral<"delete">;
collection: z.ZodString;
tid: z.ZodString;
}, "strip", z.ZodTypeAny, {
action: "delete";
collection: string;
tid: string;
}, {
action: "delete";
collection: string;
tid: string;
}>]>, "many">;
}, "strip", z.ZodTypeAny, {
writes: ({
value?: any;
action: "create";
collection: string;
} | {
value?: any;
action: "update";
collection: string;
tid: string;
} | {
action: "delete";
collection: string;
tid: string;
})[];
}, {
writes: ({
value?: any;
action: "create";
collection: string;
} | {
value?: any;
action: "update";
collection: string;
tid: string;
} | {
action: "delete";
collection: string;
tid: string;
})[];
}>;
export declare type BatchWriteParams = z.infer<typeof batchWriteParams>;
export declare const createRecordResponse: z.ZodObject<{
uri: z.ZodString;
}, "strip", z.ZodTypeAny, {
uri: string;
}, {
uri: string;
}>;
export declare type CreateRecordResponse = z.infer<typeof createRecordResponse>;

View File

@ -1,358 +1,4 @@
import { Client as XrpcClient, ServiceClient as XrpcServiceClient } from '@atproto/xrpc';
import * as ComAtprotoCreateAccount from './types/com/atproto/createAccount';
import * as ComAtprotoCreateInviteCode from './types/com/atproto/createInviteCode';
import * as ComAtprotoCreateSession from './types/com/atproto/createSession';
import * as ComAtprotoDeleteAccount from './types/com/atproto/deleteAccount';
import * as ComAtprotoDeleteSession from './types/com/atproto/deleteSession';
import * as ComAtprotoGetAccount from './types/com/atproto/getAccount';
import * as ComAtprotoGetAccountsConfig from './types/com/atproto/getAccountsConfig';
import * as ComAtprotoGetSession from './types/com/atproto/getSession';
import * as ComAtprotoRepoBatchWrite from './types/com/atproto/repoBatchWrite';
import * as ComAtprotoRepoCreateRecord from './types/com/atproto/repoCreateRecord';
import * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repoDeleteRecord';
import * as ComAtprotoRepoDescribe from './types/com/atproto/repoDescribe';
import * as ComAtprotoRepoGetRecord from './types/com/atproto/repoGetRecord';
import * as ComAtprotoRepoListRecords from './types/com/atproto/repoListRecords';
import * as ComAtprotoRepoPutRecord from './types/com/atproto/repoPutRecord';
import * as ComAtprotoRequestAccountPasswordReset from './types/com/atproto/requestAccountPasswordReset';
import * as ComAtprotoResetAccountPassword from './types/com/atproto/resetAccountPassword';
import * as ComAtprotoResolveName from './types/com/atproto/resolveName';
import * as ComAtprotoSyncGetRepo from './types/com/atproto/syncGetRepo';
import * as ComAtprotoSyncGetRoot from './types/com/atproto/syncGetRoot';
import * as ComAtprotoSyncUpdateRepo from './types/com/atproto/syncUpdateRepo';
import * as AppBskyBadge from './types/app/bsky/badge';
import * as AppBskyBadgeAccept from './types/app/bsky/badgeAccept';
import * as AppBskyBadgeOffer from './types/app/bsky/badgeOffer';
import * as AppBskyFollow from './types/app/bsky/follow';
import * as AppBskyGetAuthorFeed from './types/app/bsky/getAuthorFeed';
import * as AppBskyGetBadgeMembers from './types/app/bsky/getBadgeMembers';
import * as AppBskyGetHomeFeed from './types/app/bsky/getHomeFeed';
import * as AppBskyGetLikedBy from './types/app/bsky/getLikedBy';
import * as AppBskyGetNotificationCount from './types/app/bsky/getNotificationCount';
import * as AppBskyGetNotifications from './types/app/bsky/getNotifications';
import * as AppBskyGetPostThread from './types/app/bsky/getPostThread';
import * as AppBskyGetProfile from './types/app/bsky/getProfile';
import * as AppBskyGetRepostedBy from './types/app/bsky/getRepostedBy';
import * as AppBskyGetUserFollowers from './types/app/bsky/getUserFollowers';
import * as AppBskyGetUserFollows from './types/app/bsky/getUserFollows';
import * as AppBskyGetUsersSearch from './types/app/bsky/getUsersSearch';
import * as AppBskyGetUsersTypeahead from './types/app/bsky/getUsersTypeahead';
import * as AppBskyLike from './types/app/bsky/like';
import * as AppBskyMediaEmbed from './types/app/bsky/mediaEmbed';
import * as AppBskyPost from './types/app/bsky/post';
import * as AppBskyPostNotificationsSeen from './types/app/bsky/postNotificationsSeen';
import * as AppBskyProfile from './types/app/bsky/profile';
import * as AppBskyRepost from './types/app/bsky/repost';
import * as AppBskyUpdateProfile from './types/app/bsky/updateProfile';
export * as ComAtprotoCreateAccount from './types/com/atproto/createAccount';
export * as ComAtprotoCreateInviteCode from './types/com/atproto/createInviteCode';
export * as ComAtprotoCreateSession from './types/com/atproto/createSession';
export * as ComAtprotoDeleteAccount from './types/com/atproto/deleteAccount';
export * as ComAtprotoDeleteSession from './types/com/atproto/deleteSession';
export * as ComAtprotoGetAccount from './types/com/atproto/getAccount';
export * as ComAtprotoGetAccountsConfig from './types/com/atproto/getAccountsConfig';
export * as ComAtprotoGetSession from './types/com/atproto/getSession';
export * as ComAtprotoRepoBatchWrite from './types/com/atproto/repoBatchWrite';
export * as ComAtprotoRepoCreateRecord from './types/com/atproto/repoCreateRecord';
export * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repoDeleteRecord';
export * as ComAtprotoRepoDescribe from './types/com/atproto/repoDescribe';
export * as ComAtprotoRepoGetRecord from './types/com/atproto/repoGetRecord';
export * as ComAtprotoRepoListRecords from './types/com/atproto/repoListRecords';
export * as ComAtprotoRepoPutRecord from './types/com/atproto/repoPutRecord';
export * as ComAtprotoRequestAccountPasswordReset from './types/com/atproto/requestAccountPasswordReset';
export * as ComAtprotoResetAccountPassword from './types/com/atproto/resetAccountPassword';
export * as ComAtprotoResolveName from './types/com/atproto/resolveName';
export * as ComAtprotoSyncGetRepo from './types/com/atproto/syncGetRepo';
export * as ComAtprotoSyncGetRoot from './types/com/atproto/syncGetRoot';
export * as ComAtprotoSyncUpdateRepo from './types/com/atproto/syncUpdateRepo';
export * as AppBskyBadge from './types/app/bsky/badge';
export * as AppBskyBadgeAccept from './types/app/bsky/badgeAccept';
export * as AppBskyBadgeOffer from './types/app/bsky/badgeOffer';
export * as AppBskyFollow from './types/app/bsky/follow';
export * as AppBskyGetAuthorFeed from './types/app/bsky/getAuthorFeed';
export * as AppBskyGetBadgeMembers from './types/app/bsky/getBadgeMembers';
export * as AppBskyGetHomeFeed from './types/app/bsky/getHomeFeed';
export * as AppBskyGetLikedBy from './types/app/bsky/getLikedBy';
export * as AppBskyGetNotificationCount from './types/app/bsky/getNotificationCount';
export * as AppBskyGetNotifications from './types/app/bsky/getNotifications';
export * as AppBskyGetPostThread from './types/app/bsky/getPostThread';
export * as AppBskyGetProfile from './types/app/bsky/getProfile';
export * as AppBskyGetRepostedBy from './types/app/bsky/getRepostedBy';
export * as AppBskyGetUserFollowers from './types/app/bsky/getUserFollowers';
export * as AppBskyGetUserFollows from './types/app/bsky/getUserFollows';
export * as AppBskyGetUsersSearch from './types/app/bsky/getUsersSearch';
export * as AppBskyGetUsersTypeahead from './types/app/bsky/getUsersTypeahead';
export * as AppBskyLike from './types/app/bsky/like';
export * as AppBskyMediaEmbed from './types/app/bsky/mediaEmbed';
export * as AppBskyPost from './types/app/bsky/post';
export * as AppBskyPostNotificationsSeen from './types/app/bsky/postNotificationsSeen';
export * as AppBskyProfile from './types/app/bsky/profile';
export * as AppBskyRepost from './types/app/bsky/repost';
export * as AppBskyUpdateProfile from './types/app/bsky/updateProfile';
export declare class Client {
xrpc: XrpcClient;
constructor();
service(serviceUri: string | URL): ServiceClient;
}
declare const defaultInst: Client;
export default defaultInst;
export declare class ServiceClient {
_baseClient: Client;
xrpc: XrpcServiceClient;
com: ComNS;
app: AppNS;
constructor(baseClient: Client, xrpcService: XrpcServiceClient);
setHeader(key: string, value: string): void;
}
export declare class ComNS {
_service: ServiceClient;
atproto: AtprotoNS;
constructor(service: ServiceClient);
}
export declare class AtprotoNS {
_service: ServiceClient;
constructor(service: ServiceClient);
createAccount(params: ComAtprotoCreateAccount.QueryParams, data?: ComAtprotoCreateAccount.InputSchema, opts?: ComAtprotoCreateAccount.CallOptions): Promise<ComAtprotoCreateAccount.Response>;
createInviteCode(params: ComAtprotoCreateInviteCode.QueryParams, data?: ComAtprotoCreateInviteCode.InputSchema, opts?: ComAtprotoCreateInviteCode.CallOptions): Promise<ComAtprotoCreateInviteCode.Response>;
createSession(params: ComAtprotoCreateSession.QueryParams, data?: ComAtprotoCreateSession.InputSchema, opts?: ComAtprotoCreateSession.CallOptions): Promise<ComAtprotoCreateSession.Response>;
deleteAccount(params: ComAtprotoDeleteAccount.QueryParams, data?: ComAtprotoDeleteAccount.InputSchema, opts?: ComAtprotoDeleteAccount.CallOptions): Promise<ComAtprotoDeleteAccount.Response>;
deleteSession(params: ComAtprotoDeleteSession.QueryParams, data?: ComAtprotoDeleteSession.InputSchema, opts?: ComAtprotoDeleteSession.CallOptions): Promise<ComAtprotoDeleteSession.Response>;
getAccount(params: ComAtprotoGetAccount.QueryParams, data?: ComAtprotoGetAccount.InputSchema, opts?: ComAtprotoGetAccount.CallOptions): Promise<ComAtprotoGetAccount.Response>;
getAccountsConfig(params: ComAtprotoGetAccountsConfig.QueryParams, data?: ComAtprotoGetAccountsConfig.InputSchema, opts?: ComAtprotoGetAccountsConfig.CallOptions): Promise<ComAtprotoGetAccountsConfig.Response>;
getSession(params: ComAtprotoGetSession.QueryParams, data?: ComAtprotoGetSession.InputSchema, opts?: ComAtprotoGetSession.CallOptions): Promise<ComAtprotoGetSession.Response>;
repoBatchWrite(params: ComAtprotoRepoBatchWrite.QueryParams, data?: ComAtprotoRepoBatchWrite.InputSchema, opts?: ComAtprotoRepoBatchWrite.CallOptions): Promise<ComAtprotoRepoBatchWrite.Response>;
repoCreateRecord(params: ComAtprotoRepoCreateRecord.QueryParams, data?: ComAtprotoRepoCreateRecord.InputSchema, opts?: ComAtprotoRepoCreateRecord.CallOptions): Promise<ComAtprotoRepoCreateRecord.Response>;
repoDeleteRecord(params: ComAtprotoRepoDeleteRecord.QueryParams, data?: ComAtprotoRepoDeleteRecord.InputSchema, opts?: ComAtprotoRepoDeleteRecord.CallOptions): Promise<ComAtprotoRepoDeleteRecord.Response>;
repoDescribe(params: ComAtprotoRepoDescribe.QueryParams, data?: ComAtprotoRepoDescribe.InputSchema, opts?: ComAtprotoRepoDescribe.CallOptions): Promise<ComAtprotoRepoDescribe.Response>;
repoGetRecord(params: ComAtprotoRepoGetRecord.QueryParams, data?: ComAtprotoRepoGetRecord.InputSchema, opts?: ComAtprotoRepoGetRecord.CallOptions): Promise<ComAtprotoRepoGetRecord.Response>;
repoListRecords(params: ComAtprotoRepoListRecords.QueryParams, data?: ComAtprotoRepoListRecords.InputSchema, opts?: ComAtprotoRepoListRecords.CallOptions): Promise<ComAtprotoRepoListRecords.Response>;
repoPutRecord(params: ComAtprotoRepoPutRecord.QueryParams, data?: ComAtprotoRepoPutRecord.InputSchema, opts?: ComAtprotoRepoPutRecord.CallOptions): Promise<ComAtprotoRepoPutRecord.Response>;
requestAccountPasswordReset(params: ComAtprotoRequestAccountPasswordReset.QueryParams, data?: ComAtprotoRequestAccountPasswordReset.InputSchema, opts?: ComAtprotoRequestAccountPasswordReset.CallOptions): Promise<ComAtprotoRequestAccountPasswordReset.Response>;
resetAccountPassword(params: ComAtprotoResetAccountPassword.QueryParams, data?: ComAtprotoResetAccountPassword.InputSchema, opts?: ComAtprotoResetAccountPassword.CallOptions): Promise<ComAtprotoResetAccountPassword.Response>;
resolveName(params: ComAtprotoResolveName.QueryParams, data?: ComAtprotoResolveName.InputSchema, opts?: ComAtprotoResolveName.CallOptions): Promise<ComAtprotoResolveName.Response>;
syncGetRepo(params: ComAtprotoSyncGetRepo.QueryParams, data?: ComAtprotoSyncGetRepo.InputSchema, opts?: ComAtprotoSyncGetRepo.CallOptions): Promise<ComAtprotoSyncGetRepo.Response>;
syncGetRoot(params: ComAtprotoSyncGetRoot.QueryParams, data?: ComAtprotoSyncGetRoot.InputSchema, opts?: ComAtprotoSyncGetRoot.CallOptions): Promise<ComAtprotoSyncGetRoot.Response>;
syncUpdateRepo(params: ComAtprotoSyncUpdateRepo.QueryParams, data?: ComAtprotoSyncUpdateRepo.InputSchema, opts?: ComAtprotoSyncUpdateRepo.CallOptions): Promise<ComAtprotoSyncUpdateRepo.Response>;
}
export declare class AppNS {
_service: ServiceClient;
bsky: BskyNS;
constructor(service: ServiceClient);
}
export declare class BskyNS {
_service: ServiceClient;
badge: BadgeRecord;
badgeAccept: BadgeAcceptRecord;
badgeOffer: BadgeOfferRecord;
follow: FollowRecord;
like: LikeRecord;
mediaEmbed: MediaEmbedRecord;
post: PostRecord;
profile: ProfileRecord;
repost: RepostRecord;
constructor(service: ServiceClient);
getAuthorFeed(params: AppBskyGetAuthorFeed.QueryParams, data?: AppBskyGetAuthorFeed.InputSchema, opts?: AppBskyGetAuthorFeed.CallOptions): Promise<AppBskyGetAuthorFeed.Response>;
getBadgeMembers(params: AppBskyGetBadgeMembers.QueryParams, data?: AppBskyGetBadgeMembers.InputSchema, opts?: AppBskyGetBadgeMembers.CallOptions): Promise<AppBskyGetBadgeMembers.Response>;
getHomeFeed(params: AppBskyGetHomeFeed.QueryParams, data?: AppBskyGetHomeFeed.InputSchema, opts?: AppBskyGetHomeFeed.CallOptions): Promise<AppBskyGetHomeFeed.Response>;
getLikedBy(params: AppBskyGetLikedBy.QueryParams, data?: AppBskyGetLikedBy.InputSchema, opts?: AppBskyGetLikedBy.CallOptions): Promise<AppBskyGetLikedBy.Response>;
getNotificationCount(params: AppBskyGetNotificationCount.QueryParams, data?: AppBskyGetNotificationCount.InputSchema, opts?: AppBskyGetNotificationCount.CallOptions): Promise<AppBskyGetNotificationCount.Response>;
getNotifications(params: AppBskyGetNotifications.QueryParams, data?: AppBskyGetNotifications.InputSchema, opts?: AppBskyGetNotifications.CallOptions): Promise<AppBskyGetNotifications.Response>;
getPostThread(params: AppBskyGetPostThread.QueryParams, data?: AppBskyGetPostThread.InputSchema, opts?: AppBskyGetPostThread.CallOptions): Promise<AppBskyGetPostThread.Response>;
getProfile(params: AppBskyGetProfile.QueryParams, data?: AppBskyGetProfile.InputSchema, opts?: AppBskyGetProfile.CallOptions): Promise<AppBskyGetProfile.Response>;
getRepostedBy(params: AppBskyGetRepostedBy.QueryParams, data?: AppBskyGetRepostedBy.InputSchema, opts?: AppBskyGetRepostedBy.CallOptions): Promise<AppBskyGetRepostedBy.Response>;
getUserFollowers(params: AppBskyGetUserFollowers.QueryParams, data?: AppBskyGetUserFollowers.InputSchema, opts?: AppBskyGetUserFollowers.CallOptions): Promise<AppBskyGetUserFollowers.Response>;
getUserFollows(params: AppBskyGetUserFollows.QueryParams, data?: AppBskyGetUserFollows.InputSchema, opts?: AppBskyGetUserFollows.CallOptions): Promise<AppBskyGetUserFollows.Response>;
getUsersSearch(params: AppBskyGetUsersSearch.QueryParams, data?: AppBskyGetUsersSearch.InputSchema, opts?: AppBskyGetUsersSearch.CallOptions): Promise<AppBskyGetUsersSearch.Response>;
getUsersTypeahead(params: AppBskyGetUsersTypeahead.QueryParams, data?: AppBskyGetUsersTypeahead.InputSchema, opts?: AppBskyGetUsersTypeahead.CallOptions): Promise<AppBskyGetUsersTypeahead.Response>;
postNotificationsSeen(params: AppBskyPostNotificationsSeen.QueryParams, data?: AppBskyPostNotificationsSeen.InputSchema, opts?: AppBskyPostNotificationsSeen.CallOptions): Promise<AppBskyPostNotificationsSeen.Response>;
updateProfile(params: AppBskyUpdateProfile.QueryParams, data?: AppBskyUpdateProfile.InputSchema, opts?: AppBskyUpdateProfile.CallOptions): Promise<AppBskyUpdateProfile.Response>;
}
export declare class BadgeRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyBadge.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyBadge.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyBadge.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class BadgeAcceptRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyBadgeAccept.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyBadgeAccept.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyBadgeAccept.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class BadgeOfferRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyBadgeOffer.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyBadgeOffer.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyBadgeOffer.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class FollowRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyFollow.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyFollow.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyFollow.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class LikeRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyLike.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyLike.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyLike.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class MediaEmbedRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyMediaEmbed.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyMediaEmbed.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyMediaEmbed.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class PostRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyPost.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyPost.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyPost.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class ProfileRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyProfile.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyProfile.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyProfile.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class RepostRecord {
_service: ServiceClient;
constructor(service: ServiceClient);
list(params: Omit<ComAtprotoRepoListRecords.QueryParams, 'collection'>): Promise<{
cursor?: string;
records: {
uri: string;
value: AppBskyRepost.Record;
}[];
}>;
get(params: Omit<ComAtprotoRepoGetRecord.QueryParams, 'collection'>): Promise<{
uri: string;
cid: string;
value: AppBskyRepost.Record;
}>;
create(params: Omit<ComAtprotoRepoCreateRecord.QueryParams, 'collection'>, record: AppBskyRepost.Record, headers?: Record<string, string>): Promise<{
uri: string;
cid: string;
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.QueryParams, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export * from './client';
export { default } from './client';
export * from './session';
export { default as sessionClient } from './session';

View File

@ -0,0 +1,42 @@
import { CallOptions, Client as XrpcClient, ServiceClient as XrpcServiceClient, QueryParams, XRPCResponse } from '@atproto/xrpc';
import TypedEmitter from 'typed-emitter';
import { Client, ServiceClient } from './client';
export declare class SessionClient extends Client {
service(serviceUri: string | URL): SessionServiceClient;
}
declare const defaultInst: SessionClient;
export default defaultInst;
export declare class SessionServiceClient extends ServiceClient {
xrpc: SessionXrpcServiceClient;
sessionManager: SessionManager;
constructor(baseClient: Client, xrpcService: SessionXrpcServiceClient);
}
export declare class SessionXrpcServiceClient extends XrpcServiceClient {
sessionManager: SessionManager;
refreshing?: Promise<XRPCResponse>;
constructor(baseClient: XrpcClient, serviceUri: string | URL);
call(methodNsid: string, params?: QueryParams, data?: unknown, opts?: CallOptions): Promise<XRPCResponse>;
refresh(opts?: CallOptions): Promise<XRPCResponse>;
private _refresh;
}
declare const SessionManager_base: new () => TypedEmitter<SessionEvents>;
export declare class SessionManager extends SessionManager_base {
session?: Session;
get(): Session | undefined;
set(session: Session): void;
unset(): void;
active(): boolean;
accessHeaders(): {
authorization: string;
} | undefined;
refreshHeaders(): {
authorization: string;
} | undefined;
}
export declare type Session = {
refreshJwt: string;
accessJwt: string;
};
declare type SessionEvents = {
session: (session?: Session) => void;
};

View File

@ -1,28 +0,0 @@
import { AdxRecordValidator, AdxRecordValidatorDescription } from '@adxp/schemas';
import { GetRecordResponse } from './http-types.js';
export declare type SchemaOpt = string | string[] | AdxRecordValidator | AdxRecordValidatorDescription | '*';
export interface AdxClientOpts {
pds?: string;
locale?: string;
schemas?: any[];
}
export interface RegisterRepoParams {
did: string;
username: string;
}
export interface GetRecordResponseValidated extends GetRecordResponse {
valid?: boolean;
fullySupported?: boolean;
compatible?: boolean;
error?: string | undefined;
fallbacks?: string[] | undefined;
}
export interface ListRecordsResponseValidated {
records: GetRecordResponseValidated[];
}
export interface BatchWrite {
action: 'create' | 'put' | 'del';
collection: string;
key?: string;
value?: any;
}

View File

@ -1,22 +0,0 @@
export interface Record {
assertion: InviteAssertion | EmployeeAssertion | TagAssertion | UnknownAssertion;
createdAt: string;
[k: string]: unknown;
}
export interface InviteAssertion {
type: 'invite';
[k: string]: unknown;
}
export interface EmployeeAssertion {
type: 'employee';
[k: string]: unknown;
}
export interface TagAssertion {
type: 'tag';
tag: string;
[k: string]: unknown;
}
export interface UnknownAssertion {
type: string;
[k: string]: unknown;
}

View File

@ -1,11 +0,0 @@
export interface Record {
badge: Subject;
offer: Subject;
createdAt: string;
[k: string]: unknown;
}
export interface Subject {
uri: string;
cid: string;
[k: string]: unknown;
}

View File

@ -1,11 +0,0 @@
export interface Record {
badge: Badge;
subject: string;
createdAt: string;
[k: string]: unknown;
}
export interface Badge {
uri: string;
cid: string;
[k: string]: unknown;
}

View File

@ -1,5 +0,0 @@
export interface Record {
subject: string;
createdAt: string;
[k: string]: unknown;
}

View File

@ -1,29 +0,0 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
uri: string;
cid?: string;
limit?: number;
before?: string;
}
export interface CallOptions {
headers?: Headers;
}
export declare type InputSchema = undefined;
export interface OutputSchema {
uri: string;
cid?: string;
cursor?: string;
members: {
did: string;
name: string;
displayName?: string;
offeredAt: string;
acceptedAt: string;
}[];
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

View File

@ -1,42 +0,0 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
user: string;
}
export interface CallOptions {
headers?: Headers;
}
export declare type InputSchema = undefined;
export interface OutputSchema {
did: string;
name: string;
displayName?: string;
description?: string;
followersCount: number;
followsCount: number;
postsCount: number;
pinnedBadges: Badge[];
myState?: {
follow?: string;
};
}
export interface Badge {
uri: string;
cid: string;
error?: string;
issuer?: {
did: string;
name: string;
displayName?: string;
};
assertion?: {
type: string;
tag?: string;
};
createdAt?: string;
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

View File

@ -1,11 +0,0 @@
export interface Record {
displayName: string;
description?: string;
pinnedBadges?: BadgeRef[];
[k: string]: unknown;
}
export interface BadgeRef {
uri: string;
cid: string;
[k: string]: unknown;
}

View File

@ -1,19 +0,0 @@
import { Headers } from '@atproto/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: '';
}
export interface InputSchema {
[k: string]: unknown;
}
export interface OutputSchema {
[k: string]: unknown;
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

View File

@ -1,17 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: 'application/json';
data: InputSchema;
}
export interface InputSchema {
username: string;
did: string;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
}

View File

@ -1,20 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: '';
data: InputSchema;
}
export interface InputSchema {
[k: string]: unknown;
}
export interface OutputSchema {
[k: string]: unknown;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,20 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: '';
data: InputSchema;
}
export interface InputSchema {
[k: string]: unknown;
}
export interface OutputSchema {
[k: string]: unknown;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,20 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: '';
data: InputSchema;
}
export interface InputSchema {
[k: string]: unknown;
}
export interface OutputSchema {
[k: string]: unknown;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,20 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: '';
data: InputSchema;
}
export interface InputSchema {
[k: string]: unknown;
}
export interface OutputSchema {
[k: string]: unknown;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,20 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: '';
data: InputSchema;
}
export interface InputSchema {
[k: string]: unknown;
}
export interface OutputSchema {
[k: string]: unknown;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,35 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
did: string;
validate?: boolean;
}
export interface CallOptions {
headers?: Headers;
encoding: 'application/json';
data: InputSchema;
}
export interface InputSchema {
writes: ({
action: 'create';
collection: string;
value: unknown;
} | {
action: 'update';
collection: string;
tid: string;
value: unknown;
} | {
action: 'delete';
collection: string;
tid: string;
})[];
}
export interface OutputSchema {
[k: string]: unknown;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,23 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
did: string;
type: string;
validate?: boolean;
}
export interface CallOptions {
headers?: Headers;
encoding: 'application/json';
data: InputSchema;
}
export interface InputSchema {
[k: string]: unknown;
}
export interface OutputSchema {
uri: string;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,14 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
did: string;
type: string;
tid: string;
}
export interface CallOptions {
headers?: Headers;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
}

View File

@ -1,20 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
nameOrDid: string;
}
export interface CallOptions {
headers?: Headers;
}
export interface OutputSchema {
name: string;
did: string;
didDoc: {};
collections: string[];
nameIsCorrect: boolean;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,19 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
nameOrDid: string;
type: string;
tid: string;
}
export interface CallOptions {
headers?: Headers;
}
export interface OutputSchema {
uri: string;
value: {};
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,24 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
nameOrDid: string;
type: string;
limit?: number;
before?: string;
after?: string;
reverse?: boolean;
}
export interface CallOptions {
headers?: Headers;
}
export interface OutputSchema {
records: {
uri: string;
value: {};
}[];
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,24 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
did: string;
type: string;
tid: string;
validate?: boolean;
}
export interface CallOptions {
headers?: Headers;
encoding: 'application/json';
data: InputSchema;
}
export interface InputSchema {
[k: string]: unknown;
}
export interface OutputSchema {
uri: string;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,16 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
name: string;
}
export interface CallOptions {
headers?: Headers;
}
export interface OutputSchema {
did: string;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,14 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
did: string;
from?: string;
}
export interface CallOptions {
headers?: Headers;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: Uint8Array;
}

View File

@ -1,16 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
did: string;
}
export interface CallOptions {
headers?: Headers;
}
export interface OutputSchema {
root: string;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
data: OutputSchema;
}

View File

@ -1,14 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
did: string;
}
export interface CallOptions {
headers?: Headers;
encoding: 'application/cbor';
data: Uint8Array;
}
export interface Response {
success: boolean;
error: boolean;
headers: Headers;
}

View File

@ -1,36 +0,0 @@
import { Headers, XRPCError } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: 'application/json';
}
export interface InputSchema {
email: string;
username: string;
inviteCode?: string;
password: string;
}
export interface OutputSchema {
jwt: string;
username: string;
did: string;
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare class InvalidUsernameError extends XRPCError {
constructor(src: XRPCError);
}
export declare class InvalidPasswordError extends XRPCError {
constructor(src: XRPCError);
}
export declare class InvalidInviteCodeError extends XRPCError {
constructor(src: XRPCError);
}
export declare class UsernameNotAvailableError extends XRPCError {
constructor(src: XRPCError);
}
export declare function toKnownErr(e: any): any;

View File

@ -1,19 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: 'application/json';
}
export interface InputSchema {
useCount: number;
}
export interface OutputSchema {
code: string;
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

View File

@ -1,22 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: 'application/json';
}
export interface InputSchema {
username: string;
password: string;
}
export interface OutputSchema {
jwt: string;
name: string;
did: string;
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

View File

@ -1,19 +0,0 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: '';
}
export interface InputSchema {
[k: string]: unknown;
}
export interface OutputSchema {
[k: string]: unknown;
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

Some files were not shown because too many files have changed in this diff Show More