Lexicon refactor (#658)

* remove return in test

* couple of fixups in other pacakges

* Add dummy checks to declaration and follow app migrations, remove paranoid join

* update db nsid migration

* Ensure there are writes in follow app migration

* Add dumy check to votes-to-likes app migration, tidy

* Ensure there are writes in vote-to-like app migration

* update migration name

* pr feedback

* count utf8 & grapheme length

* add maxUtf8

* siwtch max semantics

* plural

* update post schema

* added bytes & cid refs

* add ipld<>json

* fixin up a could tings

* Add app.bsky.richtext.facet, replace post entities with facets

* plural actors

* wip

* Setup backlinks table on pds

* wip

* send & recieve cids/bytes with xrpc

* Track backlinks when indexing records on pds

* handle ipld vals in xrpc server

* added cids & bytes to codegen

* In createRecord, add deletions to avoid duplicate likes/follows/reposts

* Tests and fixes for prevention of dupe follows, likes, reposts

* Backlink migration tidy

* cleanup dag json parser

* Fix dupe backlink inserts

* Tidy

* blob refs + codegen

* Make profile displayName optional

* Test view and updateProfile for empty display name

* working into pds

* Make aggregate counts optional on post and profile views

* Make viewer state optional on post view for consistency

* Remove deprecated myState field on profile view

* Tidy repo method descriptions

* tests & types & fixes

* Implementation and tests for putRecord

* Remove updateProfile method

* Update repo service so that head can be taken for update externally

* Lex updates for compare-and-swap records/commits

* Add error to lex for bad repo compare-and-swaps

* Improve update-at-head thru repo service

* common package

* Implement and test compare-and-swaps on repo write methods

* Use lex discriminator for applyWrites

* Remove post entity/facet index

* Update lex descriptions to clarify repo write semantics

* Make deleteRecord idempotent w/ tests

* cleanup

* fix things up

* adding more formats

* tests

* updating schema

* Only generate tid rkeys on pds, support literal rkeys on client

* Add backlink indexes

* Update format of post embed views, fix external uri validation

* fixing up tests

* Include embeds on record embeds

* cleanup

* Notify users when they are quoted

* Remove determineRkey indirection

* fix api tests

* support concatenated cbor

* integrating to server

* re-enable tests

* fix up tests

* Thread compare-and-swaps down into repo service rather than use pinned storage

* Tidy

* Update packages/common/tests/ipld-multi.test.ts

Co-authored-by: devin ivy <devinivy@gmail.com>

* Update packages/lexicon/src/validators/formats.ts

Co-authored-by: devin ivy <devinivy@gmail.com>

* pr feedback

* pr feedback

* Add postgres-specific migration path for missing profile display names

* Tidy/clarify deep embeds

* Tidy

* rm unused escape

* decrease crud race count

* update subscribeRepos lexicon

* Fix applyWrite lexicon re: collection fields

* sign post event type

* update cids & bytes json encoding

* update lex blob & cid-link types

* updated codegen & pds

* number -> float

* missed a couple

* remove old image constraints

* pr feedback + descripts

* no hardcoded port numbers

* remove separate tooLarge evt

* fix dumb build error

* fixin gup lex + xrpc server

* better parsing of message types

* dont mutate body in subscription

* bugfix in subscription

* rm commented out code

* init feature branch

* undo

* Remove old lexicons

* Remove creator from profile view

* wip

* rework seqs

* fixed up tests

* bug fixing

* sequence handles & notify in dbTxn

* tidy

* update lex to include times

* test syncing handle changes

* one more fix

* handle too big evts

* dont thread sequencer through everything

* Split common into server vs web-friendly versions

* Make lexicon, identifier web-safe using common-web

* Switch api package to be a browser build, fix identifier package for browser bundling

* Fix pds and repo for lexicon package changes, tidy

* Make common-web a browser build, tidy

* fixing up deps

* fix up test

* turn off caching in actions

* Standardize repo write interfaces around repo input

* Update repo write endpoints for repo input field

* Remove scene follows during app migration

* API package updates (#712)

* Add bsky agent and various sugars to the api package

* Add richtext library to api package

* Update richtext to use facets and deprecate entities

* Update richtext to use utf8 indices

* Richtext converts deprecated entity indices from utf16 locations to utf8 locations

* Add note about encodings in the lexicon

* Add RichText facet detection

* Remove dead code

* Add deprecation notices to lexicons

* Usability improvements to RichText

* Update the api package readme

* Add RichText#detectFacetsWithoutResolution

* Add upsertProfile to bsky-agent

* Update packages/pds/src/api/com/atproto/repo/applyWrites.ts

Co-authored-by: devin ivy <devinivy@gmail.com>

* pr feedback

* fix flaky timing streaming tests

* simplify emptyPromise

* fixed up open handles

* fix missed repo syntax

* fix error in test from fkey constraint

* fix another api agent bug

* Embed consistency, add complex record embed

* Tidy embed lex descriptions

* rename pg schemas

* use swc for jest

* fix up deps

* cleanup

* Update pds indexing, views, tests for complex record embeds

* fixing up profile view semantics

* wip

* update snaps

* Rename embed.complexRecord to embed.recordWithMedia

* Tidy aroud record w/ media embeds

* Add grapheme utilities to api RichText (#720)

Co-authored-by: dholms <dtholmgren@gmail.com>

* Fix: app.bsky.feed.getPostThread#... to app.bsky.feed.defs#... (#726)

* Update bskyagent to use repo param

* Minor typing fix

* Add exports to api package: blobref & lex/json converters (#727)

* Add exports to api package: BlobRef & lex/json converters

* Add an example react-native fetch handler

* Switch all lingering references of recordRef to strongRef

* Update lexicon for richtext facets to have multiple features, byte slice rather than text slice

* Implement multi-feature richtext facets on pds

* Update api package to use updated richtext facets

* Minor fixes to admin repo/record views

* Fix app migration exports, remove old app migration

* Fix: sort richtext facets so they can render correctly

* Disable app migration dummy checks that don't work on live deploy

* Optimize lex de/serialization using simple checks

* Tidy comment typos

* App migration to cleanup notifications for likes, follows, old scene notifs

* Fix notification reason for change from vote to like

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>
Co-authored-by: Paul Frazee <pfrazee@gmail.com>
This commit is contained in:
Daniel Holmgren 2023-03-31 12:34:51 -05:00 committed by GitHub
parent 4cf9eeda7b
commit 7f008c05a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
587 changed files with 21016 additions and 15759 deletions

View File

@ -29,10 +29,6 @@ jobs:
with:
node-version: 18
cache: "yarn"
- uses: actions/cache@v3
with:
path: /tmp/jest_rt
key: ${{ hashFiles('**/yarn.lock') }}-${{ matrix.shard }}
- run: yarn install --frozen-lockfile
- run: yarn test:withFlags --maxWorkers=2 --shard=${{ matrix.shard }} --passWithNoTests
verify:

View File

@ -0,0 +1,71 @@
{
"lexicon": 1,
"id": "app.bsky.actor.defs",
"description": "A reference to an actor in the network.",
"defs": {
"profileViewBasic": {
"type": "object",
"required": ["did", "handle"],
"properties": {
"did": {"type": "string", "format": "did"},
"handle": {"type": "string", "format": "handle"},
"displayName": {
"type": "string",
"maxLength": 64
},
"avatar": { "type": "string" },
"viewer": {"type": "ref", "ref": "#viewerState"}
}
},
"profileView": {
"type": "object",
"required": ["did", "handle"],
"properties": {
"did": {"type": "string", "format":"did"},
"handle": {"type": "string", "format":"handle"},
"displayName": {
"type": "string",
"maxLength": 64
},
"description": {
"type": "string",
"maxLength": 256
},
"avatar": { "type": "string" },
"indexedAt": {"type": "string", "format": "datetime"},
"viewer": {"type": "ref", "ref": "#viewerState"}
}
},
"profileViewDetailed": {
"type": "object",
"required": ["did", "handle"],
"properties": {
"did": {"type": "string", "format": "did"},
"handle": {"type": "string", "format": "handle"},
"displayName": {
"type": "string",
"maxLength": 64
},
"description": {
"type": "string",
"maxLength": 256
},
"avatar": { "type": "string" },
"banner": { "type": "string" },
"followersCount": {"type": "integer"},
"followsCount": {"type": "integer"},
"postsCount": {"type": "integer"},
"indexedAt": {"type": "string", "format": "datetime"},
"viewer": {"type": "ref", "ref": "#viewerState"}
}
},
"viewerState": {
"type": "object",
"properties": {
"muted": {"type": "boolean"},
"following": {"type": "string", "format": "at-uri"},
"followedBy": {"type": "string", "format": "at-uri"}
}
}
}
}

View File

@ -8,12 +8,12 @@
"type": "params",
"required": ["actor"],
"properties": {
"actor": {"type": "string"}
"actor": {"type": "string", "format": "at-identifier"}
}
},
"output": {
"encoding": "application/json",
"schema": {"type": "ref", "ref": "app.bsky.actor.profile#view"}
"schema": {"type": "ref", "ref": "app.bsky.actor.defs#profileViewDetailed"}
}
}
}

View File

@ -10,7 +10,7 @@
"properties": {
"actors": {
"type": "array",
"items": {"type": "string"},
"items": {"type": "string", "format": "at-identifier"},
"maxLength": 25
}
}
@ -23,7 +23,7 @@
"properties": {
"profiles": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.actor.profile#view"}
"items": {"type": "ref", "ref": "app.bsky.actor.defs#profileViewDetailed"}
}
}
}

View File

@ -21,7 +21,7 @@
"cursor": {"type": "string"},
"actors": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.actor.profile#viewBasic"}
"items": {"type": "ref", "ref": "app.bsky.actor.defs#profileView"}
}
}
}

View File

@ -7,7 +7,6 @@
"key": "literal:self",
"record": {
"type": "object",
"required": ["displayName"],
"properties": {
"displayName": {
"type": "string",
@ -18,83 +17,17 @@
"maxLength": 256
},
"avatar": {
"type": "image",
"type": "blob",
"accept": ["image/png", "image/jpeg"],
"maxWidth": 2000,
"maxHeight": 2000,
"maxSize": 1000000
},
"banner": {
"type": "image",
"type": "blob",
"accept": ["image/png", "image/jpeg"],
"maxWidth": 6000,
"maxHeight": 2000,
"maxSize": 1000000
}
}
}
},
"view": {
"type": "object",
"required": ["did", "declaration", "handle", "creator", "followersCount", "followsCount", "postsCount"],
"properties": {
"did": {"type": "string"},
"declaration": {"type": "ref", "ref": "app.bsky.system.declRef"},
"handle": {"type": "string"},
"displayName": {
"type": "string",
"maxLength": 64
},
"description": {
"type": "string",
"maxLength": 256
},
"avatar": { "type": "string" },
"banner": { "type": "string" },
"followersCount": {"type": "integer"},
"followsCount": {"type": "integer"},
"postsCount": {"type": "integer"},
"creator": {"type": "string"},
"indexedAt": {"type": "datetime"},
"viewer": {"type": "ref", "ref": "#viewerState"},
"myState": {"type": "ref", "ref": "#myState", "description": "Deprecated"}
}
},
"viewBasic": {
"type": "object",
"required": ["did", "declaration", "handle"],
"properties": {
"did": {"type": "string"},
"declaration": {"type": "ref", "ref": "app.bsky.system.declRef"},
"handle": {"type": "string"},
"displayName": {
"type": "string",
"maxLength": 64
},
"description": {
"type": "string",
"maxLength": 256
},
"avatar": { "type": "string" },
"indexedAt": {"type": "datetime"},
"viewer": {"type": "ref", "ref": "#viewerState"}
}
},
"viewerState": {
"type": "object",
"properties": {
"muted": {"type": "boolean"},
"following": {"type": "string"},
"followedBy": {"type": "string"}
}
},
"myState": {
"type": "object",
"description": "Deprecated in favor of #viewerState",
"properties": {
"follow": {"type": "string"},
"muted": {"type": "boolean"}
}
}
}
}

View File

@ -1,38 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.actor.ref",
"description": "A reference to an actor in the network.",
"defs": {
"main": {
"type": "object",
"required": ["did", "declarationCid"],
"properties": {
"did": {"type": "string"},
"declarationCid": {"type": "string"}
}
},
"withInfo": {
"type": "object",
"required": ["did", "declaration", "handle"],
"properties": {
"did": {"type": "string"},
"declaration": {"type": "ref", "ref": "app.bsky.system.declRef"},
"handle": {"type": "string"},
"displayName": {
"type": "string",
"maxLength": 64
},
"avatar": { "type": "string" },
"viewer": {"type": "ref", "ref": "#viewerState"}
}
},
"viewerState": {
"type": "object",
"properties": {
"muted": {"type": "boolean"},
"following": {"type": "string"},
"followedBy": {"type": "string"}
}
}
}
}

View File

@ -1,28 +1,28 @@
{
"lexicon": 1,
"id": "app.bsky.actor.search",
"id": "app.bsky.actor.searchActors",
"defs": {
"main": {
"type": "query",
"description": "Find users matching search criteria.",
"description": "Find actors matching search criteria.",
"parameters": {
"type": "params",
"properties": {
"term": {"type": "string"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["users"],
"required": ["actors"],
"properties": {
"cursor": {"type": "string"},
"users": {
"actors": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.actor.profile#viewBasic"}
"items": {"type": "ref", "ref": "app.bsky.actor.defs#profileView"}
}
}
}

View File

@ -1,10 +1,10 @@
{
"lexicon": 1,
"id": "app.bsky.actor.searchTypeahead",
"id": "app.bsky.actor.searchActorsTypeahead",
"defs": {
"main": {
"type": "query",
"description": "Find user suggestions for a search term.",
"description": "Find actor suggestions for a search term.",
"parameters": {
"type": "params",
"properties": {
@ -16,11 +16,11 @@
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["users"],
"required": ["actors"],
"properties": {
"users": {
"actors": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"}
"items": {"type": "ref", "ref": "app.bsky.actor.defs#profileViewBasic"}
}
}
}

View File

@ -1,59 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.actor.updateProfile",
"defs": {
"main": {
"type": "procedure",
"description": "Notify server that the user has seen notifications.",
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"nullable": ["description", "avatar", "banner"],
"properties": {
"displayName": {
"type": "string",
"maxLength": 64
},
"description": {
"type": "string",
"maxLength": 256
},
"avatar": {
"type": "image",
"accept": ["image/png", "image/jpeg"],
"maxWidth": 500,
"maxHeight": 500,
"maxSize": 100000
},
"banner": {
"type": "image",
"accept": ["image/png", "image/jpeg"],
"maxWidth": 1500,
"maxHeight": 500,
"maxSize": 500000
}
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["uri", "cid", "record"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"record": {"type": "unknown"}
}
}
},
"errors": [
{"name": "InvalidBlob"},
{"name": "BlobTooLarge"},
{"name": "InvalidMimeType"},
{"name": "InvalidImageDimensions"}
]
}
}
}

View File

@ -1,7 +1,7 @@
{
"lexicon": 1,
"id": "app.bsky.embed.external",
"description": "An representation of some externally linked content, embedded in another form of content",
"description": "A representation of some externally linked content, embedded in another form of content",
"defs": {
"main": {
"type": "object",
@ -17,37 +17,35 @@
"type": "object",
"required": ["uri", "title", "description"],
"properties": {
"uri": {"type": "string"},
"uri": {"type": "string", "format": "uri"},
"title": {"type": "string"},
"description": {"type": "string"},
"thumb": {
"type": "image",
"type": "blob",
"accept": ["image/*"],
"maxWidth": 2000,
"maxHeight": 2000,
"maxSize": 1000000
}
}
},
"presented": {
"view": {
"type": "object",
"required": ["external"],
"properties": {
"external": {
"type": "ref",
"ref": "#presentedExternal"
"ref": "#viewExternal"
}
}
},
"presentedExternal": {
"viewExternal": {
"type": "object",
"required": ["uri", "title", "description"],
"properties": {
"uri": {"type": "string"},
"uri": {"type": "string", "format": "uri"},
"title": {"type": "string"},
"description": {"type": "string"},
"thumb": {"type": "string"}
}
}
}
}
}

View File

@ -19,27 +19,25 @@
"required": ["image", "alt"],
"properties": {
"image": {
"type": "image",
"accept": ["image/*"],
"maxWidth": 2000,
"maxHeight": 2000,
"maxSize": 1000000
"type": "blob",
"accept": ["image/*"],
"maxSize": 1000000
},
"alt": {"type": "string"}
}
},
"presented": {
"view": {
"type": "object",
"required": ["images"],
"properties": {
"images": {
"type": "array",
"items": {"type": "ref", "ref": "#presentedImage"},
"items": {"type": "ref", "ref": "#viewImage"},
"maxLength": 4
}
}
},
"presentedImage": {
"viewImage": {
"type": "object",
"required": ["thumb", "fullsize", "alt"],
"properties": {
@ -49,4 +47,4 @@
}
}
}
}
}

View File

@ -1,7 +1,7 @@
{
"lexicon": 1,
"id": "app.bsky.embed.record",
"description": "An representation of a record embedded in another form of content",
"description": "A representation of a record embedded in another form of content",
"defs": {
"main": {
"type": "object",
@ -10,28 +10,41 @@
"record": {"type": "ref", "ref": "com.atproto.repo.strongRef"}
}
},
"presented": {
"view": {
"type": "object",
"required": ["record"],
"properties": {
"record": {"type": "union", "refs": ["#presentedRecord", "#presentedNotFound"]}
"record": {"type": "union", "refs": ["#viewRecord", "#viewNotFound"]}
}
},
"presentedRecord": {
"viewRecord": {
"type": "object",
"required": ["uri", "cid", "author", "record"],
"required": ["uri", "cid", "author", "value", "indexedAt"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"author": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"},
"record": {"type": "unknown"}
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"},
"author": {"type": "ref", "ref": "app.bsky.actor.defs#profileViewBasic"},
"value": {"type": "unknown"},
"embeds": {
"type": "array",
"items": {
"type": "union",
"refs": [
"app.bsky.embed.images#view",
"app.bsky.embed.external#view",
"app.bsky.embed.record#view",
"app.bsky.embed.recordWithMedia#view"
]
}
},
"indexedAt": {"type": "string", "format": "datetime"}
}
},
"presentedNotFound": {
"viewNotFound": {
"type": "object",
"required": ["uri"],
"properties": {
"uri": {"type": "string"}
"uri": {"type": "string", "format": "at-uri"}
}
}
}

View File

@ -0,0 +1,41 @@
{
"lexicon": 1,
"id": "app.bsky.embed.recordWithMedia",
"description": "A representation of a record embedded in another form of content, alongside other compatible embeds",
"defs": {
"main": {
"type": "object",
"required": ["record", "media"],
"properties": {
"record": {
"type": "ref",
"ref": "app.bsky.embed.record"
},
"media": {
"type": "union",
"refs": [
"app.bsky.embed.images",
"app.bsky.embed.external"
]
}
}
},
"view": {
"type": "object",
"required": ["record", "media"],
"properties": {
"record": {
"type": "ref",
"ref": "app.bsky.embed.record#view"
},
"media": {
"type": "union",
"refs": [
"app.bsky.embed.images#view",
"app.bsky.embed.external#view"
]
}
}
}
}
}

View File

@ -0,0 +1,82 @@
{
"lexicon": 1,
"id": "app.bsky.feed.defs",
"defs": {
"postView": {
"type": "object",
"required": ["uri", "cid", "author", "record", "indexedAt"],
"properties": {
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"},
"author": {"type": "ref", "ref": "app.bsky.actor.defs#profileViewBasic"},
"record": {"type": "unknown"},
"embed": {
"type": "union",
"refs": [
"app.bsky.embed.images#view",
"app.bsky.embed.external#view",
"app.bsky.embed.record#view",
"app.bsky.embed.recordWithMedia#view"
]
},
"replyCount": {"type": "integer"},
"repostCount": {"type": "integer"},
"likeCount": {"type": "integer"},
"indexedAt": {"type": "string", "format": "datetime"},
"viewer": {"type": "ref", "ref": "#viewerState"}
}
},
"viewerState": {
"type": "object",
"properties": {
"repost": {"type": "string", "format": "at-uri"},
"like": {"type": "string", "format": "at-uri"}
}
},
"feedViewPost": {
"type": "object",
"required": ["post"],
"properties": {
"post": {"type": "ref", "ref": "app.bsky.feed.defs#postView"},
"reply": {"type": "ref", "ref": "#replyRef"},
"reason": {"type": "union", "refs": ["#reasonRepost"]}
}
},
"replyRef": {
"type": "object",
"required": ["root", "parent"],
"properties": {
"root": {"type": "ref", "ref": "app.bsky.feed.defs#postView"},
"parent": {"type": "ref", "ref": "app.bsky.feed.defs#postView"}
}
},
"reasonRepost": {
"type": "object",
"required": ["by", "indexedAt"],
"properties": {
"by": {"type": "ref", "ref": "app.bsky.actor.defs#profileViewBasic"},
"indexedAt": {"type": "string", "format": "datetime"}
}
},
"threadViewPost": {
"type": "object",
"required": ["post"],
"properties": {
"post": {"type": "ref", "ref": "#postView"},
"parent": {"type": "union", "refs": ["#threadViewPost", "#notFoundPost"]},
"replies": {
"type": "array",
"items": {"type": "union", "refs": ["#threadViewPost", "#notFoundPost"]}
}
}
},
"notFoundPost": {
"type": "object",
"required": ["uri", "notFound"],
"properties": {
"uri": {"type": "string", "format": "at-uri"},
"notFound": {"type": "boolean", "const": true}
}
}
}
}

View File

@ -1,31 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.feed.feedViewPost",
"defs": {
"main": {
"type": "object",
"required": ["post"],
"properties": {
"post": {"type": "ref", "ref": "app.bsky.feed.post#view"},
"reply": {"type": "ref", "ref": "#replyRef"},
"reason": {"type": "union", "refs": ["#reasonRepost"]}
}
},
"replyRef": {
"type": "object",
"required": ["root", "parent"],
"properties": {
"root": {"type": "ref", "ref": "app.bsky.feed.post#view"},
"parent": {"type": "ref", "ref": "app.bsky.feed.post#view"}
}
},
"reasonRepost": {
"type": "object",
"required": ["by", "indexedAt"],
"properties": {
"by": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"},
"indexedAt": {"type": "datetime"}
}
}
}
}

View File

@ -4,14 +4,14 @@
"defs": {
"main": {
"type": "query",
"description": "A view of a user's feed.",
"description": "A view of an actor's feed.",
"parameters": {
"type": "params",
"required": ["author"],
"required": ["actor"],
"properties": {
"author": {"type": "string"},
"actor": {"type": "string", "format": "at-identifier"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
@ -23,7 +23,7 @@
"cursor": {"type": "string"},
"feed": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.feed.feedViewPost"}
"items": {"type": "ref", "ref": "app.bsky.feed.defs#feedViewPost"}
}
}
}

View File

@ -0,0 +1,44 @@
{
"lexicon": 1,
"id": "app.bsky.feed.getLikes",
"defs": {
"main": {
"type": "query",
"parameters": {
"type": "params",
"required": ["uri"],
"properties": {
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"cursor": {"type": "string"}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["uri", "likes"],
"properties": {
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"},
"cursor": {"type": "string"},
"likes": {
"type": "array",
"items": {"type": "ref", "ref": "#like"}
}
}
}
}
},
"like": {
"type": "object",
"required": ["indexedAt", "createdAt", "actor"],
"properties": {
"indexedAt": {"type": "string", "format": "datetime"},
"createdAt": {"type": "string", "format": "datetime"},
"actor": {"type": "ref", "ref": "app.bsky.actor.defs#profileView"}
}
}
}
}

View File

@ -8,7 +8,7 @@
"type": "params",
"required": ["uri"],
"properties": {
"uri": {"type": "string"},
"uri": {"type": "string", "format": "at-uri"},
"depth": {"type": "integer"}
}
},
@ -20,7 +20,7 @@
"properties": {
"thread": {
"type": "union",
"refs": ["#threadViewPost", "#notFoundPost"]
"refs": ["app.bsky.feed.defs#threadViewPost", "app.bsky.feed.defs#notFoundPost"]
}
}
}
@ -28,26 +28,6 @@
"errors": [
{"name": "NotFound"}
]
},
"threadViewPost": {
"type": "object",
"required": ["post"],
"properties": {
"post": {"type": "ref", "ref": "app.bsky.feed.post#view"},
"parent": {"type": "union", "refs": ["#threadViewPost", "#notFoundPost"]},
"replies": {
"type": "array",
"items": {"type": "union", "refs": ["#threadViewPost", "#notFoundPost"]}
}
}
},
"notFoundPost": {
"type": "object",
"required": ["uri", "notFound"],
"properties": {
"uri": {"type": "string"},
"notFound": {"type": "boolean", "const": true}
}
}
}
}

View File

@ -8,10 +8,10 @@
"type": "params",
"required": ["uri"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
@ -20,12 +20,12 @@
"type": "object",
"required": ["uri", "repostedBy"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"},
"cursor": {"type": "string"},
"repostedBy": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"}
"items": {"type": "ref", "ref": "app.bsky.actor.defs#profileView"}
}
}
}

View File

@ -10,7 +10,7 @@
"properties": {
"algorithm": {"type": "string"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
@ -22,7 +22,7 @@
"cursor": {"type": "string"},
"feed": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.feed.feedViewPost"}
"items": {"type": "ref", "ref": "app.bsky.feed.defs#feedViewPost"}
}
}
}

View File

@ -1,46 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.feed.getVotes",
"defs": {
"main": {
"type": "query",
"parameters": {
"type": "params",
"required": ["uri"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"direction": {"type": "string", "enum": ["up", "down"]},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["uri", "votes"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"cursor": {"type": "string"},
"votes": {
"type": "array",
"items": {"type": "ref", "ref": "#vote"}
}
}
}
}
},
"vote": {
"type": "object",
"required": ["direction", "indexedAt", "createdAt", "actor"],
"properties": {
"direction": {"type": "string", "enum": ["up", "down"]},
"indexedAt": {"type": "datetime"},
"createdAt": {"type": "datetime"},
"actor": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"}
}
}
}
}

View File

@ -1,17 +1,16 @@
{
"lexicon": 1,
"id": "app.bsky.feed.vote",
"id": "app.bsky.feed.like",
"defs": {
"main": {
"type": "record",
"key": "tid",
"record": {
"type": "object",
"required": ["subject", "direction", "createdAt"],
"required": ["subject", "createdAt"],
"properties": {
"subject": {"type": "ref", "ref": "com.atproto.repo.strongRef"},
"direction": {"type": "string", "enum": ["up", "down"]},
"createdAt": {"type": "datetime"}
"createdAt": {"type": "string", "format": "datetime"}
}
}
}

View File

@ -9,21 +9,27 @@
"type": "object",
"required": ["text", "createdAt"],
"properties": {
"text": {"type": "string", "maxLength": 256},
"text": {"type": "string", "maxLength": 3000, "maxGraphemes": 300},
"entities": {
"type": "array",
"description": "Deprecated: replaced by app.bsky.richtext.facet.",
"items": {"type": "ref", "ref": "#entity"}
},
"facets": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.richtext.facet"}
},
"reply": {"type": "ref", "ref": "#replyRef"},
"embed": {
"type": "union",
"refs": [
"app.bsky.embed.images",
"app.bsky.embed.external",
"app.bsky.embed.record"
"app.bsky.embed.record",
"app.bsky.embed.recordWithMedia"
]
},
"createdAt": {"type": "datetime"}
"createdAt": {"type": "string", "format": "datetime"}
}
}
},
@ -37,56 +43,25 @@
},
"entity": {
"type": "object",
"description": "Deprecated: use facets instead.",
"required": ["index", "type", "value"],
"properties": {
"index": {"type": "ref", "ref": "#textSlice"},
"type": {
"type": "string",
"description": "Expected values are 'mention', 'hashtag', and 'link'."
"description": "Expected values are 'mention' and 'link'."
},
"value": {"type": "string"}
}
},
"textSlice": {
"type": "object",
"description": "A text segment. Start is inclusive, end is exclusive.",
"description": "Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings.",
"required": ["start", "end"],
"properties": {
"start": {"type": "integer", "minimum": 0},
"end": {"type": "integer", "minimum": 0}
}
},
"view": {
"type": "object",
"required": ["uri", "cid", "author", "record", "replyCount", "repostCount", "upvoteCount", "downvoteCount", "indexedAt", "viewer"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"author": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"},
"record": {"type": "unknown"},
"embed": {
"type": "union",
"refs": [
"app.bsky.embed.images#presented",
"app.bsky.embed.external#presented",
"app.bsky.embed.record#presented"
]
},
"replyCount": {"type": "integer"},
"repostCount": {"type": "integer"},
"upvoteCount": {"type": "integer"},
"downvoteCount": {"type": "integer"},
"indexedAt": {"type": "datetime"},
"viewer": {"type": "ref", "ref": "#viewerState"}
}
},
"viewerState": {
"type": "object",
"properties": {
"repost": {"type": "string"},
"upvote": {"type": "string"},
"downvote": {"type": "string"}
}
}
}
}

View File

@ -10,7 +10,7 @@
"required": ["subject", "createdAt"],
"properties": {
"subject": {"type": "ref", "ref": "com.atproto.repo.strongRef"},
"createdAt": {"type": "datetime"}
"createdAt": {"type": "string", "format": "datetime"}
}
}
}

View File

@ -1,34 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.feed.setVote",
"defs": {
"main": {
"type": "procedure",
"description": "Upvote, downvote, or clear the user's vote for a post.",
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["subject", "direction"],
"properties": {
"subject": {"type": "ref", "ref": "com.atproto.repo.strongRef"},
"direction": {
"type": "string",
"enum": ["up", "down", "none"]
}
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"properties": {
"upvote": {"type": "string"},
"downvote": {"type": "string"}
}
}
}
}
}
}

View File

@ -1,10 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.graph.assertCreator",
"defs": {
"main": {
"type": "token",
"description": "Assertion type: Creator. Defined for app.bsky.graph.assertions's assertion."
}
}
}

View File

@ -1,10 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.graph.assertMember",
"defs": {
"main": {
"type": "token",
"description": "Assertion type: Member. Defined for app.bsky.graph.assertions's assertion."
}
}
}

View File

@ -1,19 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.graph.assertion",
"defs": {
"main": {
"type": "record",
"key": "tid",
"record": {
"type": "object",
"required": ["assertion", "subject", "createdAt"],
"properties": {
"assertion": {"type": "string"},
"subject": {"type": "ref", "ref": "app.bsky.actor.ref"},
"createdAt": {"type": "datetime"}
}
}
}
}
}

View File

@ -1,19 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.graph.confirmation",
"defs": {
"main": {
"type": "record",
"key": "tid",
"record": {
"type": "object",
"required": ["originator", "assertion", "createdAt"],
"properties": {
"originator": {"type": "ref", "ref": "app.bsky.actor.ref"},
"assertion": {"type": "ref", "ref": "com.atproto.repo.strongRef"},
"createdAt": {"type": "datetime"}
}
}
}
}
}

View File

@ -10,8 +10,8 @@
"type": "object",
"required": ["subject", "createdAt"],
"properties": {
"subject": {"type": "ref", "ref": "app.bsky.actor.ref"},
"createdAt": {"type": "datetime"}
"subject": {"type": "string", "format": "did"},
"createdAt": {"type": "string", "format": "datetime"}
}
}
}

View File

@ -4,14 +4,14 @@
"defs": {
"main": {
"type": "query",
"description": "Who is following a user?",
"description": "Who is following an actor?",
"parameters": {
"type": "params",
"required": ["user"],
"required": ["actor"],
"properties": {
"user": {"type": "string"},
"actor": {"type": "string", "format": "at-identifier"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
@ -20,11 +20,11 @@
"type": "object",
"required": ["subject", "followers"],
"properties": {
"subject": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"},
"subject": {"type": "ref", "ref": "app.bsky.actor.defs#profileView"},
"cursor": {"type": "string"},
"followers": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"}
"items": {"type": "ref", "ref": "app.bsky.actor.defs#profileView"}
}
}
}

View File

@ -4,14 +4,14 @@
"defs": {
"main": {
"type": "query",
"description": "Who is a user following?",
"description": "Who is an actor following?",
"parameters": {
"type": "params",
"required": ["user"],
"required": ["actor"],
"properties": {
"user": {"type": "string"},
"actor": {"type": "string", "format": "at-identifier"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
@ -20,11 +20,11 @@
"type": "object",
"required": ["subject", "follows"],
"properties": {
"subject": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"},
"subject": {"type": "ref", "ref": "app.bsky.actor.defs#profileView"},
"cursor": {"type": "string"},
"follows": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"}
"items": {"type": "ref", "ref": "app.bsky.actor.defs#profileView"}
}
}
}

View File

@ -9,7 +9,7 @@
"type": "params",
"properties": {
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
@ -21,7 +21,7 @@
"cursor": {"type": "string"},
"mutes": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"}
"items": {"type": "ref", "ref": "app.bsky.actor.defs#profileView"}
}
}
}

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "app.bsky.graph.mute",
"id": "app.bsky.graph.muteActor",
"defs": {
"main": {
"type": "procedure",
@ -9,9 +9,9 @@
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["user"],
"required": ["actor"],
"properties": {
"user": { "type": "string" }
"actor": { "type": "string", "format": "at-identifier" }
}
}
}

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "app.bsky.graph.unmute",
"id": "app.bsky.graph.unmuteActor",
"defs": {
"main": {
"type": "procedure",
@ -9,9 +9,9 @@
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["user"],
"required": ["actor"],
"properties": {
"user": { "type": "string" }
"actor": { "type": "string", "format": "at-identifier" }
}
}
}

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "app.bsky.notification.getCount",
"id": "app.bsky.notification.getUnreadCount",
"defs": {
"main": {
"type": "query",

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "app.bsky.notification.list",
"id": "app.bsky.notification.listNotifications",
"defs": {
"main": {
"type": "query",
@ -8,7 +8,7 @@
"type": "params",
"properties": {
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
@ -30,18 +30,18 @@
"type": "object",
"required": ["uri", "cid", "author", "reason", "record", "isRead", "indexedAt"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string" },
"author": {"type": "ref", "ref": "app.bsky.actor.ref#withInfo"},
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid" },
"author": {"type": "ref", "ref": "app.bsky.actor.defs#profileView"},
"reason": {
"type": "string",
"description": "Expected values are 'vote', 'repost', 'follow', 'invite', 'mention' and 'reply'.",
"knownValues": ["vote", "repost", "follow", "invite", "mention", "reply"]
"description": "Expected values are 'like', 'repost', 'follow', 'mention', 'reply', and 'quote'.",
"knownValues": ["like", "repost", "follow", "mention", "reply", "quote"]
},
"reasonSubject": {"type": "string"},
"reasonSubject": {"type": "string", "format": "at-uri"},
"record": {"type": "unknown"},
"isRead": {"type": "boolean"},
"indexedAt": {"type": "datetime"}
"indexedAt": {"type": "string", "format": "datetime"}
}
}
}

View File

@ -11,7 +11,7 @@
"type": "object",
"required": ["seenAt"],
"properties": {
"seenAt": { "type": "datetime" }
"seenAt": { "type": "string", "format": "datetime"}
}
}
}

View File

@ -0,0 +1,42 @@
{
"lexicon": 1,
"id": "app.bsky.richtext.facet",
"defs": {
"main": {
"type": "object",
"required": ["index", "features"],
"properties": {
"index": {"type": "ref", "ref": "#byteSlice"},
"features": {
"type": "array",
"items": {"type": "union", "refs": ["#mention", "#link"]}
}
}
},
"mention": {
"type": "object",
"description": "A facet feature for actor mentions.",
"required": ["did"],
"properties": {
"did": {"type": "string", "format": "did"}
}
},
"link": {
"type": "object",
"description": "A facet feature for links.",
"required": ["uri"],
"properties": {
"uri": {"type": "string", "format": "uri"}
}
},
"byteSlice": {
"type": "object",
"description": "A text segment. Start is inclusive, end is exclusive. Indices are for utf8-encoded strings.",
"required": ["byteStart", "byteEnd"],
"properties": {
"byteStart": {"type": "integer", "minimum": 0},
"byteEnd": {"type": "integer", "minimum": 0}
}
}
}
}

View File

@ -1,10 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.system.actorUser",
"defs": {
"main": {
"type": "token",
"description": "Actor type: User. Defined for app.bsky.system.declaration's actorType."
}
}
}

View File

@ -1,18 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.system.declRef",
"defs": {
"main": {
"description": "A reference to a app.bsky.system.declaration record.",
"type": "object",
"required": ["cid", "actorType"],
"properties": {
"cid": {"type": "string"},
"actorType": {
"type": "string",
"knownValues": ["app.bsky.system.actorUser"]
}
}
}
}
}

View File

@ -1,21 +0,0 @@
{
"lexicon": 1,
"id": "app.bsky.system.declaration",
"defs": {
"main": {
"description": "Context for an account that is considered intrinsic to it and alters the fundamental understanding of an account of changed. A declaration should be treated as immutable.",
"type": "record",
"key": "literal:self",
"record": {
"type": "object",
"required": ["actorType"],
"properties": {
"actorType": {
"type": "string",
"knownValues": ["app.bsky.system.actorUser"]
}
}
}
}
}
}

View File

@ -9,7 +9,7 @@
"type": "params",
"properties": {
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
@ -21,7 +21,7 @@
"cursor": {"type": "string"},
"feed": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.feed.feedViewPost"}
"items": {"type": "ref", "ref": "app.bsky.feed.defs#feedViewPost"}
}
}
}

View File

@ -1,10 +0,0 @@
{
"lexicon": 1,
"id": "com.atproto.account.get",
"defs": {
"main": {
"type": "query",
"description": "Get information about an account."
}
}
}

View File

@ -1,45 +0,0 @@
{
"lexicon": 1,
"id": "com.atproto.admin.blob",
"defs": {
"view": {
"type": "object",
"required": ["cid", "mimeType", "size", "createdAt"],
"properties": {
"cid": {"type": "string"},
"mimeType": {"type": "string"},
"size": {"type": "integer"},
"createdAt": {"type": "datetime"},
"details": {
"type": "union",
"refs": ["#imageDetails", "#videoDetails"]
},
"moderation": {"type": "ref", "ref": "#moderation"}
}
},
"imageDetails": {
"type": "object",
"required": ["width", "height"],
"properties": {
"width": {"type": "integer"},
"height": {"type": "integer"}
}
},
"videoDetails": {
"type": "object",
"required": ["width", "height", "length"],
"properties": {
"width": {"type": "integer"},
"height": {"type": "integer"},
"length": {"type": "integer"}
}
},
"moderation": {
"type": "object",
"required": [],
"properties": {
"currentAction": {"type": "ref", "ref": "com.atproto.admin.moderationAction#viewCurrent"}
}
}
}
}

View File

@ -0,0 +1,228 @@
{
"lexicon": 1,
"id": "com.atproto.admin.defs",
"defs": {
"actionView": {
"type": "object",
"required": ["id", "action", "subject", "subjectBlobCids", "reason", "createdBy", "createdAt", "resolvedReportIds"],
"properties": {
"id": {"type": "integer"},
"action": {"type": "ref", "ref": "#actionType"},
"subject": {
"type": "union",
"refs": [
"#repoRef",
"com.atproto.repo.strongRef"
]
},
"subjectBlobCids": {"type": "array", "items": {"type": "string"}},
"reason": {"type": "string"},
"createdBy": {"type": "string", "format": "did"},
"createdAt": {"type": "string", "format": "datetime"},
"reversal": {"type": "ref", "ref": "#actionReversal"},
"resolvedReportIds": {"type": "array", "items": {"type": "integer"}}
}
},
"actionViewDetail": {
"type": "object",
"required": ["id", "action", "subject", "subjectBlobs", "reason", "createdBy", "createdAt", "resolvedReports"],
"properties": {
"id": {"type": "integer"},
"action": {"type": "ref", "ref": "#actionType"},
"subject": {
"type": "union",
"refs": [
"#repoView",
"#recordView"
]
},
"subjectBlobs": {"type": "array", "items": {"type": "ref", "ref": "#blobView"}},
"reason": {"type": "string"},
"createdBy": {"type": "string", "format": "did"},
"createdAt": {"type": "string", "format": "datetime"},
"reversal": {"type": "ref", "ref": "#actionReversal"},
"resolvedReports": {"type": "array", "items": {"type": "ref", "ref": "#reportView"}}
}
},
"actionViewCurrent": {
"type": "object",
"required": ["id", "action"],
"properties": {
"id": {"type": "integer"},
"action": {"type": "ref", "ref": "#actionType"}
}
},
"actionReversal": {
"type": "object",
"required": ["reason", "createdBy", "createdAt"],
"properties": {
"reason": {"type": "string"},
"createdBy": {"type": "string", "format": "did"},
"createdAt": {"type": "string", "format": "datetime"}
}
},
"actionType": {
"type": "string",
"knownValues": [
"#takedown",
"#flag",
"#acknowledge"
]
},
"takedown": {
"type": "token",
"description": "Moderation action type: Takedown. Indicates that content should not be served by the PDS."
},
"flag": {
"type": "token",
"description": "Moderation action type: Flag. Indicates that the content was reviewed and considered to violate PDS rules, but may still be served."
},
"acknowledge": {
"type": "token",
"description": "Moderation action type: Acknowledge. Indicates that the content was reviewed and not considered to violate PDS rules."
},
"reportView": {
"type": "object",
"required": ["id", "reasonType", "subject", "reportedBy", "createdAt", "resolvedByActionIds"],
"properties": {
"id": {"type": "integer"},
"reasonType": {"type": "ref", "ref": "com.atproto.moderation.defs#reasonType"},
"reason": {"type": "string"},
"subject": {
"type": "union",
"refs": [
"#repoRef",
"com.atproto.repo.strongRef"
]
},
"reportedBy": {"type": "string", "format": "did"},
"createdAt": {"type": "string", "format": "datetime"},
"resolvedByActionIds": {"type": "array", "items": {"type": "integer"}}
}
},
"reportViewDetail": {
"type": "object",
"required": ["id", "reasonType", "subject", "reportedBy", "createdAt", "resolvedByActions"],
"properties": {
"id": {"type": "integer"},
"reasonType": {"type": "ref", "ref": "com.atproto.moderation.defs#reasonType"},
"reason": {"type": "string"},
"subject": {
"type": "union",
"refs": [
"#repoView",
"#recordView"
]
},
"reportedBy": {"type": "string", "format": "did"},
"createdAt": {"type": "string", "format": "datetime"},
"resolvedByActions": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.defs#actionView"}}
}
},
"repoView": {
"type": "object",
"required": ["did", "handle", "relatedRecords", "indexedAt", "moderation"],
"properties": {
"did": {"type": "string", "format": "did"},
"handle": {"type": "string", "format": "handle"},
"email": {"type": "string"},
"relatedRecords": {"type": "array", "items": {"type": "unknown"}},
"indexedAt": {"type": "string", "format": "datetime"},
"moderation": {"type": "ref", "ref": "#moderation"}
}
},
"repoViewDetail": {
"type": "object",
"required": ["did", "handle", "relatedRecords", "indexedAt", "moderation"],
"properties": {
"did": {"type": "string", "format": "did"},
"handle": {"type": "string", "format": "handle"},
"email": {"type": "string"},
"relatedRecords": {"type": "array", "items": {"type": "unknown"}},
"indexedAt": {"type": "string", "format": "datetime"},
"moderation": {"type": "ref", "ref": "#moderationDetail"}
}
},
"repoRef": {
"type": "object",
"required": ["did"],
"properties": {
"did": {"type": "string", "format": "did"}
}
},
"recordView": {
"type": "object",
"required": ["uri", "cid", "value", "blobCids", "indexedAt", "moderation", "repo"],
"properties": {
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"},
"value": {"type": "unknown"},
"blobCids": {"type": "array", "items": {"type": "string", "format": "cid"}},
"indexedAt": {"type": "string", "format": "datetime"},
"moderation": {"type": "ref", "ref": "#moderation"},
"repo": {"type": "ref", "ref": "#repoView"}
}
},
"recordViewDetail": {
"type": "object",
"required": ["uri", "cid", "value", "blobs", "indexedAt", "moderation", "repo"],
"properties": {
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"},
"value": {"type": "unknown"},
"blobs": {"type": "array", "items": {"type": "ref", "ref": "#blobView"}},
"indexedAt": {"type": "string", "format": "datetime"},
"moderation": {"type": "ref", "ref": "#moderationDetail"},
"repo": {"type": "ref", "ref": "#repoView"}
}
},
"moderation": {
"type": "object",
"required": [],
"properties": {
"currentAction": {"type": "ref", "ref": "#actionViewCurrent"}
}
},
"moderationDetail": {
"type": "object",
"required": ["actions", "reports"],
"properties": {
"currentAction": {"type": "ref", "ref": "#actionViewCurrent"},
"actions": {"type": "array", "items": {"type": "ref", "ref": "#actionView"}},
"reports": {"type": "array", "items": {"type": "ref", "ref": "#reportView"}}
}
},
"blobView": {
"type": "object",
"required": ["cid", "mimeType", "size", "createdAt"],
"properties": {
"cid": {"type": "string", "format": "cid"},
"mimeType": {"type": "string"},
"size": {"type": "integer"},
"createdAt": {"type": "string", "format": "datetime"},
"details": {
"type": "union",
"refs": ["#imageDetails", "#videoDetails"]
},
"moderation": {"type": "ref", "ref": "#moderation"}
}
},
"imageDetails": {
"type": "object",
"required": ["width", "height"],
"properties": {
"width": {"type": "integer"},
"height": {"type": "integer"}
}
},
"videoDetails": {
"type": "object",
"required": ["width", "height", "length"],
"properties": {
"width": {"type": "integer"},
"height": {"type": "integer"},
"length": {"type": "integer"}
}
}
}
}

View File

@ -14,7 +14,7 @@
},
"output": {
"encoding": "application/json",
"schema": {"type": "ref", "ref": "com.atproto.admin.moderationAction#viewDetail"}
"schema": {"type": "ref", "ref": "com.atproto.admin.defs#actionViewDetail"}
}
}
}

View File

@ -10,7 +10,7 @@
"properties": {
"subject": {"type": "string"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
@ -20,7 +20,7 @@
"required": ["actions"],
"properties": {
"cursor": {"type": "string"},
"actions": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationAction#view"}}
"actions": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.defs#actionView"}}
}
}
}

View File

@ -14,7 +14,7 @@
},
"output": {
"encoding": "application/json",
"schema": {"type": "ref", "ref": "com.atproto.admin.moderationReport#viewDetail"}
"schema": {"type": "ref", "ref": "com.atproto.admin.defs#reportViewDetail"}
}
}
}

View File

@ -11,7 +11,7 @@
"subject": {"type": "string"},
"resolved": {"type": "boolean"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
@ -21,7 +21,7 @@
"required": ["reports"],
"properties": {
"cursor": {"type": "string"},
"reports": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationReport#view"}}
"reports": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.defs#reportView"}}
}
}
}

View File

@ -9,13 +9,13 @@
"type": "params",
"required": ["uri"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"}
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"}
}
},
"output": {
"encoding": "application/json",
"schema": {"type": "ref", "ref": "com.atproto.admin.record#viewDetail"}
"schema": {"type": "ref", "ref": "com.atproto.admin.defs#recordViewDetail"}
}
}
}

View File

@ -9,12 +9,12 @@
"type": "params",
"required": ["did"],
"properties": {
"did": {"type": "string"}
"did": {"type": "string", "format":"did"}
}
},
"output": {
"encoding": "application/json",
"schema": {"type": "ref", "ref": "com.atproto.admin.repo#viewDetail"}
"schema": {"type": "ref", "ref": "com.atproto.admin.defs#repoViewDetail"}
}
}
}

View File

@ -1,85 +0,0 @@
{
"lexicon": 1,
"id": "com.atproto.admin.moderationAction",
"defs": {
"view": {
"type": "object",
"required": ["id", "action", "subject", "subjectBlobCids", "reason", "createdBy", "createdAt", "resolvedReportIds"],
"properties": {
"id": {"type": "integer"},
"action": {"type": "ref", "ref": "#actionType"},
"subject": {
"type": "union",
"refs": [
"com.atproto.repo.repoRef",
"com.atproto.repo.strongRef"
]
},
"subjectBlobCids": {"type": "array", "items": {"type": "string"}},
"reason": {"type": "string"},
"createdBy": {"type": "string"},
"createdAt": {"type": "string"},
"reversal": {"type": "ref", "ref": "#reversal"},
"resolvedReportIds": {"type": "array", "items": {"type": "integer"}}
}
},
"viewDetail": {
"type": "object",
"required": ["id", "action", "subject", "subjectBlobs", "reason", "createdBy", "createdAt", "resolvedReports"],
"properties": {
"id": {"type": "integer"},
"action": {"type": "ref", "ref": "#actionType"},
"subject": {
"type": "union",
"refs": [
"com.atproto.admin.repo#view",
"com.atproto.admin.record#view"
]
},
"subjectBlobs": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.blob#view"}},
"reason": {"type": "string"},
"createdBy": {"type": "string"},
"createdAt": {"type": "string"},
"reversal": {"type": "ref", "ref": "#reversal"},
"resolvedReports": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationReport#view"}}
}
},
"viewCurrent": {
"type": "object",
"required": ["id", "action"],
"properties": {
"id": {"type": "integer"},
"action": {"type": "ref", "ref": "#actionType"}
}
},
"reversal": {
"type": "object",
"required": ["reason", "createdBy", "createdAt"],
"properties": {
"reason": {"type": "string"},
"createdBy": {"type": "string"},
"createdAt": {"type": "string"}
}
},
"actionType": {
"type": "string",
"knownValues": [
"com.atproto.admin.moderationAction#takedown",
"com.atproto.admin.moderationAction#flag",
"com.atproto.admin.moderationAction#acknowledge"
]
},
"takedown": {
"type": "token",
"description": "Moderation action type: Takedown. Indicates that content should not be served by the PDS."
},
"flag": {
"type": "token",
"description": "Moderation action type: Flag. Indicates that the content was reviewed and considered to violate PDS rules, but may still be served."
},
"acknowledge": {
"type": "token",
"description": "Moderation action type: Acknowledge. Indicates that the content was reviewed and not considered to violate PDS rules."
}
}
}

View File

@ -1,44 +0,0 @@
{
"lexicon": 1,
"id": "com.atproto.admin.moderationReport",
"defs": {
"view": {
"type": "object",
"required": ["id", "reasonType", "subject", "reportedByDid", "createdAt", "resolvedByActionIds"],
"properties": {
"id": {"type": "integer"},
"reasonType": {"type": "ref", "ref": "com.atproto.report.reasonType"},
"reason": {"type": "string"},
"subject": {
"type": "union",
"refs": [
"com.atproto.repo.repoRef",
"com.atproto.repo.strongRef"
]
},
"reportedByDid": {"type": "string"},
"createdAt": {"type": "datetime"},
"resolvedByActionIds": {"type": "array", "items": {"type": "integer"}}
}
},
"viewDetail": {
"type": "object",
"required": ["id", "reasonType", "subject", "reportedByDid", "createdAt", "resolvedByActions"],
"properties": {
"id": {"type": "integer"},
"reasonType": {"type": "ref", "ref": "com.atproto.report.reasonType"},
"reason": {"type": "string"},
"subject": {
"type": "union",
"refs": [
"com.atproto.admin.repo#view",
"com.atproto.admin.record#view"
]
},
"reportedByDid": {"type": "string"},
"createdAt": {"type": "datetime"},
"resolvedByActions": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationAction#view"}}
}
}
}
}

View File

@ -1,48 +0,0 @@
{
"lexicon": 1,
"id": "com.atproto.admin.record",
"defs": {
"view": {
"type": "object",
"required": ["uri", "cid", "value", "blobCids", "indexedAt", "moderation", "repo"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"value": {"type": "unknown"},
"blobCids": {"type": "array", "items": {"type": "string"}},
"indexedAt": {"type": "string"},
"moderation": {"type": "ref", "ref": "#moderation"},
"repo": {"type": "ref", "ref": "com.atproto.admin.repo#view"}
}
},
"viewDetail": {
"type": "object",
"required": ["uri", "cid", "value", "blobs", "indexedAt", "moderation", "repo"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"value": {"type": "unknown"},
"blobs": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.blob#view"}},
"indexedAt": {"type": "string"},
"moderation": {"type": "ref", "ref": "#moderationDetail"},
"repo": {"type": "ref", "ref": "com.atproto.admin.repo#view"}
}
},
"moderation": {
"type": "object",
"required": [],
"properties": {
"currentAction": {"type": "ref", "ref": "com.atproto.admin.moderationAction#viewCurrent"}
}
},
"moderationDetail": {
"type": "object",
"required": ["actions", "reports"],
"properties": {
"currentAction": {"type": "ref", "ref": "com.atproto.admin.moderationAction#viewCurrent"},
"actions": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationAction#view"}},
"reports": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationReport#view"}}
}
}
}
}

View File

@ -1,53 +0,0 @@
{
"lexicon": 1,
"id": "com.atproto.admin.repo",
"defs": {
"view": {
"type": "object",
"required": ["did", "handle", "relatedRecords", "indexedAt", "moderation"],
"properties": {
"did": {"type": "string"},
"handle": {"type": "string"},
"account": {"type": "ref", "ref": "#account"},
"relatedRecords": {"type": "array", "items": {"type": "unknown"}},
"indexedAt": {"type": "string"},
"moderation": {"type": "ref", "ref": "#moderation"}
}
},
"viewDetail": {
"type": "object",
"required": ["did", "handle", "relatedRecords", "indexedAt", "moderation"],
"properties": {
"did": {"type": "string"},
"handle": {"type": "string"},
"account": {"type": "ref", "ref": "#account"},
"relatedRecords": {"type": "array", "items": {"type": "unknown"}},
"indexedAt": {"type": "string"},
"moderation": {"type": "ref", "ref": "#moderationDetail"}
}
},
"account": {
"type": "object",
"required": ["email"],
"properties": {
"email": {"type": "string"}
}
},
"moderation": {
"type": "object",
"required": [],
"properties": {
"currentAction": {"type": "ref", "ref": "com.atproto.admin.moderationAction#viewCurrent"}
}
},
"moderationDetail": {
"type": "object",
"required": ["actions", "reports"],
"properties": {
"currentAction": {"type": "ref", "ref": "com.atproto.admin.moderationAction#viewCurrent"},
"actions": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationAction#view"}},
"reports": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.moderationReport#view"}}
}
}
}
}

View File

@ -13,7 +13,7 @@
"properties": {
"actionId": {"type": "integer"},
"reportIds": {"type": "array", "items": {"type": "integer"}},
"createdBy": {"type": "string"}
"createdBy": {"type": "string", "format": "did"}
}
}
},
@ -21,7 +21,7 @@
"encoding": "application/json",
"schema": {
"type": "ref",
"ref": "com.atproto.admin.moderationAction#view"
"ref": "com.atproto.admin.defs#actionView"
}
}
}

View File

@ -13,7 +13,7 @@
"properties": {
"id": {"type": "integer"},
"reason": {"type": "string"},
"createdBy": {"type": "string"}
"createdBy": {"type": "string", "format": "did"}
}
}
},
@ -21,7 +21,7 @@
"encoding": "application/json",
"schema": {
"type": "ref",
"ref": "com.atproto.admin.moderationAction#view"
"ref": "com.atproto.admin.defs#actionView"
}
}
}

View File

@ -10,7 +10,7 @@
"properties": {
"term": {"type": "string"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"before": {"type": "string"}
"cursor": {"type": "string"}
}
},
"output": {
@ -20,7 +20,7 @@
"required": ["repos"],
"properties": {
"cursor": {"type": "string"},
"repos": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.repo#view"}}
"repos": {"type": "array", "items": {"type": "ref", "ref": "com.atproto.admin.defs#repoView"}}
}
}
}

View File

@ -14,21 +14,21 @@
"action": {
"type": "string",
"knownValues": [
"com.atproto.admin.moderationAction#takedown",
"com.atproto.admin.moderationAction#flag",
"com.atproto.admin.moderationAction#acknowledge"
"com.atproto.admin.defs#takedown",
"com.atproto.admin.defs#flag",
"com.atproto.admin.defs#acknowledge"
]
},
"subject": {
"type": "union",
"refs": [
"com.atproto.repo.repoRef",
"com.atproto.repo.recordRef"
"com.atproto.admin.defs#repoRef",
"com.atproto.repo.strongRef"
]
},
"subjectBlobCids": {"type": "array", "items": {"type": "string"}},
"subjectBlobCids": {"type": "array", "items": {"type": "string", "format": "cid"}},
"reason": {"type": "string"},
"createdBy": {"type": "string"}
"createdBy": {"type": "string", "format": "did"}
}
}
},
@ -36,7 +36,7 @@
"encoding": "application/json",
"schema": {
"type": "ref",
"ref": "com.atproto.admin.moderationAction#view"
"ref": "com.atproto.admin.defs#actionView"
}
},
"errors": [{ "name": "SubjectHasAction" }]

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.handle.resolve",
"id": "com.atproto.identity.resolveHandle",
"defs": {
"main": {
"type": "query",
@ -8,7 +8,11 @@
"parameters": {
"type": "params",
"properties": {
"handle": {"type": "string", "description": "The handle to resolve. If not supplied, will resolve the host's own handle."}
"handle": {
"type": "string",
"format": "handle",
"description": "The handle to resolve. If not supplied, will resolve the host's own handle."
}
}
},
"output": {
@ -17,7 +21,7 @@
"type": "object",
"required": ["did"],
"properties": {
"did": {"type": "string"}
"did": {"type": "string", "format": "did"}
}
}
}

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.handle.update",
"id": "com.atproto.identity.updateHandle",
"defs": {
"main": {
"type": "procedure",
@ -11,7 +11,7 @@
"type": "object",
"required": ["handle"],
"properties": {
"handle": {"type": "string"}
"handle": {"type": "string", "format": "handle"}
}
}
}

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.report.create",
"id": "com.atproto.moderation.createReport",
"defs": {
"main": {
"type": "procedure",
@ -11,13 +11,13 @@
"type": "object",
"required": ["reasonType", "subject"],
"properties": {
"reasonType": {"type": "ref", "ref": "com.atproto.report.reasonType"},
"reasonType": {"type": "ref", "ref": "com.atproto.moderation.defs#reasonType"},
"reason": {"type": "string"},
"subject": {
"type": "union",
"refs": [
"com.atproto.repo.repoRef",
"com.atproto.repo.recordRef"
"com.atproto.admin.defs#repoRef",
"com.atproto.repo.strongRef"
]
}
}
@ -27,20 +27,20 @@
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["id", "reasonType", "subject", "reportedByDid", "createdAt"],
"required": ["id", "reasonType", "subject", "reportedBy", "createdAt"],
"properties": {
"id": {"type": "integer"},
"reasonType": {"type": "ref", "ref": "com.atproto.report.reasonType"},
"reasonType": {"type": "ref", "ref": "com.atproto.moderation.defs#reasonType"},
"reason": {"type": "string"},
"subject": {
"type": "union",
"refs": [
"com.atproto.repo.repoRef",
"com.atproto.admin.defs#repoRef",
"com.atproto.repo.strongRef"
]
},
"reportedByDid": {"type": "string"},
"createdAt": {"type": "datetime"}
"reportedBy": {"type": "string", "format": "did"},
"createdAt": {"type": "string", "format": "datetime"}
}
}
}

View File

@ -1,19 +1,19 @@
{
"lexicon": 1,
"id": "com.atproto.report.reasonType",
"id": "com.atproto.moderation.defs",
"defs": {
"main": {
"reasonType": {
"type": "string",
"knownValues": [
"com.atproto.report.reasonType#spam",
"com.atproto.report.reasonType#other"
"com.atproto.moderation.defs#reasonSpam",
"com.atproto.moderation.defs#reasonOther"
]
},
"spam": {
"reasonSpam": {
"type": "token",
"description": "Moderation report reason: Spam."
},
"other": {
"reasonOther": {
"type": "token",
"description": "Moderation report reason: Other."
}

View File

@ -1,19 +1,20 @@
{
"lexicon": 1,
"id": "com.atproto.repo.batchWrite",
"id": "com.atproto.repo.applyWrites",
"defs": {
"main": {
"type": "procedure",
"description": "Apply a batch transaction of creates, puts, and deletes.",
"description": "Apply a batch transaction of creates, updates, and deletes.",
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["did", "writes"],
"required": ["repo", "writes"],
"properties": {
"did": {
"repo": {
"type": "string",
"description": "The DID of the repo."
"format": "at-identifier",
"description": "The handle or DID of the repo."
},
"validate": {
"type": "boolean",
@ -23,39 +24,46 @@
"writes": {
"type": "array",
"items": {"type": "union", "refs": ["#create", "#update", "#delete"], "closed": true}
},
"swapCommit": {
"type": "string",
"format": "cid"
}
}
}
}
},
"errors": [
{"name": "InvalidSwap"}
]
},
"create": {
"type": "object",
"description": "Create a new record.",
"required": ["action", "collection", "value"],
"properties": {
"action": {"type": "string", "const": "create"},
"collection": {"type": "string"},
"collection": {"type": "string", "format": "nsid"},
"rkey": {"type": "string"},
"value": {"type": "unknown"}
}
},
"update": {
"type": "object",
"description": "Update an existing record.",
"required": ["action", "collection", "rkey", "value"],
"properties": {
"action": {"type": "string", "const": "update"},
"collection": {"type": "string"},
"collection": {"type": "string", "format": "nsid"},
"rkey": {"type": "string"},
"value": {"type": "unknown"}
}
},
"delete": {
"type": "object",
"description": "Delete an existing record.",
"required": ["action", "collection", "rkey"],
"properties": {
"action": {"type": "string", "const": "delete"},
"collection": {"type": "string"},
"collection": {"type": "string", "format": "nsid"},
"rkey": {"type": "string"}
}
}
}
}
}

View File

@ -9,16 +9,22 @@
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["did", "collection", "record"],
"required": ["repo", "collection", "record"],
"properties": {
"did": {
"repo": {
"type": "string",
"description": "The DID of the repo."
"format": "at-identifier",
"description": "The handle or DID of the repo."
},
"collection": {
"type": "string",
"format": "nsid",
"description": "The NSID of the record collection."
},
"rkey": {
"type": "string",
"description": "The key of the record."
},
"validate": {
"type": "boolean",
"default": true,
@ -27,6 +33,11 @@
"record": {
"type": "unknown",
"description": "The record to create."
},
"swapCommit": {
"type": "string",
"format": "cid",
"description": "Compare and swap with the previous commit by cid."
}
}
}
@ -37,11 +48,14 @@
"type": "object",
"required": ["uri", "cid"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"}
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"}
}
}
}
},
"errors": [
{"name": "InvalidSwap"}
]
}
}
}

View File

@ -4,28 +4,43 @@
"defs": {
"main": {
"type": "procedure",
"description": "Delete a record.",
"description": "Delete a record, or ensure it doesn't exist.",
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["did", "collection", "rkey"],
"required": ["repo", "collection", "rkey"],
"properties": {
"did": {
"repo": {
"type": "string",
"description": "The DID of the repo."
"format": "at-identifier",
"description": "The handle or DID of the repo."
},
"collection": {
"type": "string",
"format": "nsid",
"description": "The NSID of the record collection."
},
"rkey": {
"type": "string",
"description": "The key of the record."
},
"swapRecord": {
"type": "string",
"format": "cid",
"description": "Compare and swap with the previous record by cid."
},
"swapCommit": {
"type": "string",
"format": "cid",
"description": "Compare and swap with the previous commit by cid."
}
}
}
}
},
"errors": [
{"name": "InvalidSwap"}
]
}
}
}
}

View File

@ -1,15 +1,19 @@
{
"lexicon": 1,
"id": "com.atproto.repo.describe",
"id": "com.atproto.repo.describeRepo",
"defs": {
"main": {
"type": "query",
"description": "Get information about the repo, including the list of collections.",
"parameters": {
"type": "params",
"required": ["user"],
"required": ["repo"],
"properties": {
"user": {"type": "string", "description": "The handle or DID of the repo."}
"repo": {
"type": "string",
"format": "at-identifier",
"description": "The handle or DID of the repo."
}
}
},
"output": {
@ -18,10 +22,10 @@
"type": "object",
"required": ["handle", "did", "didDoc", "collections", "handleIsCorrect"],
"properties": {
"handle": {"type": "string"},
"did": {"type": "string"},
"handle": {"type": "string", "format": "handle"},
"did": {"type": "string", "format": "did"},
"didDoc": {"type": "unknown"},
"collections": {"type": "array", "items": {"type": "string"}},
"collections": {"type": "array", "items": {"type": "string", "format": "nsid"}},
"handleIsCorrect": {"type": "boolean"}
}
}

View File

@ -4,15 +4,27 @@
"defs": {
"main": {
"type": "query",
"description": "Fetch a record.",
"description": "Get a record.",
"parameters": {
"type": "params",
"required": ["user", "collection", "rkey"],
"required": ["repo", "collection", "rkey"],
"properties": {
"user": {"type": "string", "description": "The handle or DID of the repo."},
"collection": {"type": "string", "description": "The NSID of the collection."},
"repo": {
"type": "string",
"format": "at-identifier",
"description": "The handle or DID of the repo."
},
"collection": {
"type": "string",
"format": "nsid",
"description": "The NSID of the record collection."
},
"rkey": {"type": "string", "description": "The key of the record."},
"cid": {"type": "string", "description": "The CID of the version of the record. If not specified, then return the most recent version."}
"cid": {
"type": "string",
"format": "cid",
"description": "The CID of the version of the record. If not specified, then return the most recent version."
}
}
},
"output": {
@ -21,8 +33,8 @@
"type": "object",
"required": ["uri", "value"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"},
"value": {"type": "unknown"}
}
}

View File

@ -7,13 +7,13 @@
"description": "List a range of records in a collection.",
"parameters": {
"type": "params",
"required": ["user", "collection"],
"required": ["repo", "collection"],
"properties": {
"user": {"type": "string", "description": "The handle or DID of the repo."},
"collection": {"type": "string", "description": "The NSID of the record type."},
"repo": {"type": "string", "format": "at-identifier", "description": "The handle or DID of the repo."},
"collection": {"type": "string", "format": "nsid", "description": "The NSID of the record type."},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50, "description": "The number of records to return."},
"before": {"type": "string", "description": "A TID to filter the range of records returned."},
"after": {"type": "string", "description": "A TID to filter the range of records returned."},
"rkeyStart": {"type": "string", "description": "The lowest sort-ordered rkey to start from (exclusive)"},
"rkeyEnd": {"type": "string", "description": "The highest sort-ordered rkey to stop at (exclusive)"},
"reverse": {"type": "boolean", "description": "Reverse the order of the returned records?"}
}
},
@ -36,8 +36,8 @@
"type": "object",
"required": ["uri", "cid", "value"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"},
"value": {"type": "unknown"}
}
}

View File

@ -4,24 +4,27 @@
"defs": {
"main": {
"type": "procedure",
"description": "Write a record.",
"description": "Write a record, creating or updating it as needed.",
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["did", "collection", "rkey", "record"],
"required": ["repo", "collection", "rkey", "record"],
"nullable": ["swapRecord"],
"properties": {
"did": {
"repo": {
"type": "string",
"description": "The DID of the repo."
"format": "at-identifier",
"description": "The handle or DID of the repo."
},
"collection": {
"type": "string",
"description": "The NSID of the record type."
"format": "nsid",
"description": "The NSID of the record collection."
},
"rkey": {
"type": "string",
"description": "The TID of the record."
"description": "The key of the record."
},
"validate": {
"type": "boolean",
@ -30,7 +33,17 @@
},
"record": {
"type": "unknown",
"description": "The record to create."
"description": "The record to write."
},
"swapRecord": {
"type": "string",
"format": "cid",
"description": "Compare and swap with the previous record by cid."
},
"swapCommit": {
"type": "string",
"format": "cid",
"description": "Compare and swap with the previous commit by cid."
}
}
}
@ -41,11 +54,14 @@
"type": "object",
"required": ["uri", "cid"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"}
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"}
}
}
}
},
"errors": [
{"name": "InvalidSwap"}
]
}
}
}

View File

@ -1,15 +0,0 @@
{
"lexicon": 1,
"id": "com.atproto.repo.recordRef",
"description": "A URI with optional content-hash fingerprint.",
"defs": {
"main": {
"type": "object",
"required": ["uri"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"}
}
}
}
}

View File

@ -1,14 +0,0 @@
{
"lexicon": 1,
"id": "com.atproto.repo.repoRef",
"description": "A did identifying a repository.",
"defs": {
"main": {
"type": "object",
"required": ["did"],
"properties": {
"did": {"type": "string"}
}
}
}
}

View File

@ -7,8 +7,8 @@
"type": "object",
"required": ["uri", "cid"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"}
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"}
}
}
}

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.blob.upload",
"id": "com.atproto.repo.uploadBlob",
"defs": {
"main": {
"type": "procedure",
@ -12,9 +12,9 @@
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["cid"],
"required": ["blob"],
"properties": {
"cid": {"type": "string"}
"blob": {"type": "blob"}
}
}
}

View File

@ -1,31 +0,0 @@
{
"lexicon": 1,
"id": "com.atproto.report.subject",
"defs": {
"repo": {
"type": "object",
"required": ["did"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."}
}
},
"record": {
"type": "object",
"required": ["did", "collection", "rkey"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"collection": {"type": "string", "description": "The NSID of the collection."},
"rkey": {"type": "string", "description": "The key of the record."},
"cid": {"type": "string", "description": "The CID of the version of the record. If not specified, defaults to the most recent version."}
}
},
"recordRef": {
"type": "object",
"required": ["uri", "cid"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"}
}
}
}
}

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.account.create",
"id": "com.atproto.server.createAccount",
"defs": {
"main": {
"type": "procedure",
@ -12,7 +12,7 @@
"required": ["handle", "email", "password"],
"properties": {
"email": {"type": "string"},
"handle": {"type": "string"},
"handle": {"type": "string", "format": "handle"},
"inviteCode": {"type": "string"},
"password": {"type": "string"},
"recoveryKey": {"type": "string"}
@ -27,8 +27,8 @@
"properties": {
"accessJwt": { "type": "string" },
"refreshJwt": { "type": "string" },
"handle": { "type": "string" },
"did": { "type": "string" }
"handle": { "type": "string", "format": "handle" },
"did": { "type": "string", "format": "did" }
}
}
},
@ -36,7 +36,8 @@
{"name": "InvalidHandle"},
{"name": "InvalidPassword"},
{"name": "InvalidInviteCode"},
{"name": "HandleNotAvailable"}
{"name": "HandleNotAvailable"},
{"name": "UnsupportedDomain"}
]
}
}

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.account.createInviteCode",
"id": "com.atproto.server.createInviteCode",
"defs": {
"main": {
"type": "procedure",

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.session.create",
"id": "com.atproto.server.createSession",
"defs": {
"main": {
"type": "procedure",
@ -11,7 +11,10 @@
"type": "object",
"required": ["password"],
"properties": {
"identifier": {"type": "string", "description": "Handle or other identifier supported by the server for the authenticating user."},
"identifier": {
"type": "string",
"description": "Handle or other identifier supported by the server for the authenticating user."
},
"password": {"type": "string"}
}
}
@ -24,8 +27,8 @@
"properties": {
"accessJwt": {"type": "string"},
"refreshJwt": {"type": "string"},
"handle": {"type": "string"},
"did": {"type": "string"}
"handle": {"type": "string", "format": "handle"},
"did": {"type": "string", "format": "did"}
}
}
},

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.account.delete",
"id": "com.atproto.server.deleteAccount",
"defs": {
"main": {
"type": "procedure",
@ -11,7 +11,7 @@
"type": "object",
"required": ["did", "password", "token"],
"properties": {
"did": { "type": "string" },
"did": { "type": "string", "format": "did" },
"password": { "type": "string" },
"token": { "type": "string" }
}

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.session.delete",
"id": "com.atproto.server.deleteSession",
"defs": {
"main": {
"type": "procedure",

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.server.getAccountsConfig",
"id": "com.atproto.server.describeServer",
"defs": {
"main": {
"type": "query",

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.session.get",
"id": "com.atproto.server.getSession",
"defs": {
"main": {
"type": "query",
@ -11,8 +11,8 @@
"type": "object",
"required": ["handle", "did"],
"properties": {
"handle": {"type": "string"},
"did": {"type": "string"}
"handle": {"type": "string", "format": "handle"},
"did": {"type": "string", "format": "did"}
}
}
}

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.session.refresh",
"id": "com.atproto.server.refreshSession",
"defs": {
"main": {
"type": "procedure",
@ -13,8 +13,8 @@
"properties": {
"accessJwt": {"type": "string"},
"refreshJwt": {"type": "string"},
"handle": {"type": "string"},
"did": {"type": "string"}
"handle": {"type": "string", "format": "handle"},
"did": {"type": "string", "format": "did"}
}
}
},

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.account.requestDelete",
"id": "com.atproto.server.requestAccountDelete",
"defs": {
"main": {
"type": "procedure",

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.account.requestPasswordReset",
"id": "com.atproto.server.requestPasswordReset",
"defs": {
"main": {
"type": "procedure",

View File

@ -1,6 +1,6 @@
{
"lexicon": 1,
"id": "com.atproto.account.resetPassword",
"id": "com.atproto.server.resetPassword",
"defs": {
"main": {
"type": "procedure",

View File

@ -9,8 +9,8 @@
"type": "params",
"required": ["did", "cid"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"cid": {"type": "string", "description": "The CID of the blob to fetch"}
"did": {"type": "string", "format": "did", "description": "The DID of the repo."},
"cid": {"type": "string", "format": "cid", "description": "The CID of the blob to fetch"}
}
},
"output": {

View File

@ -9,10 +9,14 @@
"type": "params",
"required": ["did", "cids"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
},
"cids": {
"type": "array",
"items": {"type": "string"}
"items": {"type": "string", "format": "cid"}
}
}
},

View File

@ -9,8 +9,16 @@
"type": "params",
"required": ["did"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"commit": {"type": "string", "description": "The commit to get the checkout from. Defaults to current HEAD."}
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
},
"commit": {
"type": "string",
"format": "cid",
"description": "The commit to get the checkout from. Defaults to current HEAD."
}
}
},
"output": {

View File

@ -9,9 +9,21 @@
"type": "params",
"required": ["did"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"latest": { "type": "string", "description": "The most recent commit"},
"earliest": { "type": "string", "description": "The earliest commit to start from"}
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
},
"latest": {
"type": "string",
"format": "cid",
"description": "The most recent commit"
},
"earliest": {
"type": "string",
"format": "cid",
"description": "The earliest commit to start from"
}
}
},
"output": {
@ -22,7 +34,7 @@
"properties": {
"commits": {
"type": "array",
"items": { "type": "string" }
"items": { "type": "string", "format": "cid" }
}
}
}

View File

@ -9,7 +9,11 @@
"type": "params",
"required": ["did"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."}
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
}
}
},
"output": {
@ -18,7 +22,7 @@
"type": "object",
"required": ["root"],
"properties": {
"root": {"type": "string"}
"root": {"type": "string", "format": "cid"}
}
}
}

View File

@ -9,10 +9,18 @@
"type": "params",
"required": ["did", "collection", "rkey"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"collection": {"type": "string" },
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
},
"collection": {"type": "string", "format": "nsid"},
"rkey": {"type": "string" },
"commit": {"type": "string", "description": "An optional past commit CID."}
"commit": {
"type": "string",
"format": "cid",
"description": "An optional past commit CID."
}
}
},
"output": {

View File

@ -9,9 +9,21 @@
"type": "params",
"required": ["did"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"earliest": {"type": "string", "description": "The earliest commit in the commit range (not inclusive)"},
"latest": {"type": "string", "description": "The latest commit you in the commit range (inclusive"}
"did": {
"type": "string",
"format": "did",
"description": "The DID of the repo."
},
"earliest": {
"type": "string",
"format": "cid",
"description": "The earliest commit in the commit range (not inclusive)"
},
"latest": {
"type": "string",
"format": "cid",
"description": "The latest commit you in the commit range (inclusive"
}
}
},
"output": {

View File

@ -9,9 +9,9 @@
"type": "params",
"required": ["did"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"latest": { "type": "string", "description": "The most recent commit"},
"earliest": { "type": "string", "description": "The earliest commit to start from"}
"did": {"type": "string", "format": "did", "description": "The DID of the repo."},
"latest": { "type": "string", "format": "cid", "description": "The most recent commit"},
"earliest": { "type": "string", "format": "cid", "description": "The earliest commit to start from"}
}
},
"output": {
@ -22,7 +22,7 @@
"properties": {
"cids": {
"type": "array",
"items": { "type": "string" }
"items": { "type": "string", "format": "cid" }
}
}
}

View File

@ -1,72 +0,0 @@
{
"lexicon": 1,
"id": "com.atproto.sync.subscribeAllRepos",
"defs": {
"main": {
"type": "subscription",
"description": "Subscribe to repo updates",
"parameters": {
"type": "params",
"properties": {
"cursor": {
"type": "integer",
"description": "The last known event to backfill from."
}
}
},
"message": {
"schema": {
"type": "object",
"required": ["seq", "event", "repo", "commit", "prev", "blocks", "ops", "blobs", "time"],
"nullable": ["prev"],
"properties": {
"seq": {"type": "integer"},
"event": {
"type": "string",
"knownValues": [
"repo_append",
"rebase"
]
},
"repo": {"type": "string"},
"commit": {"type": "string"},
"prev": {"type": "string"},
"blocks": {"type": "unknown"},
"ops": {
"type": "array",
"items": { "type": "ref", "ref": "#repoOp"}
},
"blobs": {
"type": "array",
"items": {"type": "string"}
},
"time": {"type": "datetime"}
}
}
},
"infos": [
{"name": "OutdatedCursor"}
],
"errors": [
{"name": "FutureCursor"}
]
},
"repoOp": {
"type": "object",
"required": ["action", "path", "cid"],
"nullable": ["cid"],
"properties": {
"action": {
"type": "string",
"knownValues": [
"create",
"update",
"delete"
]
},
"path": {"type": "string"},
"cid": {"type": "string"}
}
}
}
}

View File

@ -0,0 +1,122 @@
{
"lexicon": 1,
"id": "com.atproto.sync.subscribeRepos",
"defs": {
"main": {
"type": "subscription",
"description": "Subscribe to repo updates",
"parameters": {
"type": "params",
"properties": {
"cursor": {
"type": "integer",
"description": "The last known event to backfill from."
}
}
},
"message": {
"schema": {
"type": "union",
"refs": [
"#commit",
"#handle",
"#migrate",
"#tombstone",
"#info"
]
}
},
"errors": [
{"name": "FutureCursor"}
]
},
"commit": {
"type": "object",
"required": ["seq", "rebase", "tooBig", "repo", "commit", "prev", "blocks", "ops", "blobs", "time"],
"nullable": ["prev"],
"properties": {
"seq": {"type": "integer"},
"rebase": {"type": "boolean"},
"tooBig": {"type": "boolean"},
"repo": {"type": "string", "format": "did"},
"commit": {"type": "cid-link"},
"prev": {"type": "cid-link"},
"blocks": {
"type": "bytes",
"description": "CAR file containing relevant blocks",
"maxLength": 1000000
},
"ops": {
"type": "array",
"items": { "type": "ref", "ref": "#repoOp"},
"maxLength": 200
},
"blobs": {
"type": "array",
"items": {"type": "cid-link"}
},
"time": {"type": "string", "format": "datetime"}
}
},
"handle": {
"type": "object",
"required": ["seq", "did", "handle", "time"],
"properties": {
"seq": {"type": "integer"},
"did": {"type": "string", "format": "did"},
"handle": {"type": "string", "format": "handle"},
"time": {"type": "string", "format": "datetime"}
}
},
"migrate": {
"type": "object",
"required": ["seq", "did", "migrateTo", "time"],
"nullable": ["migrateTo"],
"properties": {
"seq": {"type": "integer"},
"did": {"type": "string", "format": "did"},
"migrateTo": {"type": "string"},
"time": {"type": "string", "format": "datetime"}
}
},
"tombstone": {
"type": "object",
"required": ["seq", "did", "time"],
"properties": {
"seq": {"type": "integer"},
"did": {"type": "string", "format": "did"},
"time": {"type": "string", "format": "datetime"}
}
},
"info": {
"type": "object",
"required": ["name"],
"properties": {
"name": {
"type": "string",
"knownValues": ["OutdatedCursor"]
},
"message": {
"type": "string"
}
}
},
"repoOp": {
"type": "object",
"required": ["action", "path", "cid"],
"nullable": ["cid"],
"properties": {
"action": {
"type": "string",
"knownValues": [
"create",
"update",
"delete"
]
},
"path": {"type": "string"},
"cid": {"type": "cid-link"}
}
}
}
}

View File

@ -1,32 +1,37 @@
# ATP API
This API is a client for ATProtocol servers. It communicates using HTTP. It includes:
- ✔️ APIs for ATProto and Bluesky.
- ✔️ Validation and complete typescript types.
- ✔️ Session management.
- ✔️ A RichText library.
## Getting started
First install the package:
```
yarn add @atproto/api
```
Then in your application:
```typescript
import { BskyAgent } from '@atproto/api'
const agent = new BskyAgent({ service: 'https://example.com' })
```
## Usage
```typescript
import AtpAgent from '@atproto/api'
const agent = new AtpAgent({service: 'https://example.com'})
// provide a custom fetch implementation (shouldnt be needed in node or the browser)
import {AtpAgentFetchHeaders, AtpAgentFetchHandlerResponse} from '@atproto/api'
AtpAgent.configure({
async fetch(
httpUri: string,
httpMethod: string,
httpHeaders: AtpAgentFetchHeaders,
httpReqBody: any,
): Promise<AtpAgentFetchHandlerResponse> {
// insert definition here...
return {status: 200, /*...*/}
}
})
```
### Session management
Log into a server or create accounts using these APIs. You'll need an active session for most methods.
```typescript
import AtpAgent, {AtpSessionEvent, AtpSessionData} from '@atproto/api'
const agent = new AtpAgent({
import { BskyAgent, AtpSessionEvent, AtpSessionData } from '@atproto/api'
const agent = new BskyAgent({
service: 'https://example.com',
persistSession: (evt: AtpSessionEvent, sess?: AtpSessionData) {
// store the session-data for reuse
@ -44,9 +49,125 @@ await agent.createAccount({
### API calls
The agent includes methods for many common operations, including:
```typescript
// xrpc methods
const res1 = await agent.api.com.atproto.repo.createRecord(
// Feeds and content
await agent.getTimeline(params, opts)
await agent.getAuthorFeed(params, opts)
await agent.getPostThread(params, opts)
await agent.getPost(params)
await agent.getLikes(params, opts)
await agent.getRepostedBy(params, opts)
await agent.post(record)
await agent.deletePost(postUri)
await agent.like(uri, cid)
await agent.deleteLike(likeUri)
await agent.repost(uri, cid)
await agent.deleteRepost(repostUri)
await agent.uploadBlob(data, opts)
// Social graph
await agent.getFollows(params, opts)
await agent.getFollowers(params, opts)
await agent.follow(did)
await agent.deleteFollow(followUri)
// Actors
await agent.getProfile(params, opts)
await agent.upsertProfile(updateFn)
await agent.getProfiles(params, opts)
await agent.searchActors(params, opts)
await agent.searchActorsTypeahead(params, opts)
await agent.mute(did)
await agent.unmute(did)
// Notifications
await agent.listNotifications(params, opts)
await agent.countUnreadNotifications(params, opts)
await agent.updateSeenNotifications()
// Identity
await agent.resolveHandle(params, opts)
await agent.updateHandle(params, opts)
// Session management
await agent.createAccount(params)
await agent.login(params)
await agent.resumeSession(session)
```
### Validation and types
The package includes a complete types system which includes validation and type-guards. For example, to validate a post record:
```typescript
import { AppBskyFeedPost } from '@atproto/api'
const post = {...}
if (AppBskyFeedPost.isRecord(post)) {
// typescript now recognizes `post` as a AppBskyFeedPost.Record
// however -- we still need to validate it
const res = AppBskyFeedPost.validateRecord(post)
if (res.success) {
// a valid record
} else {
// something is wrong
console.log(res.error)
}
}
```
### Rich text
Some records (ie posts) use the `app.bsky.richtext` lexicon. At the moment richtext is only used for links and mentions, but it will be extended over time to include bold, italic, and so on.
It is **strongly** recommended to use this package's `RichText` library. Javascript encodes strings in utf16 while the protocol (and most other programming environments) use utf8. Converting between the two is challenging, but `RichText` handles that for you.
```typescript
import {RichText} from '@atproto/api'
// creating richtext
const rt = new RichText({text: 'Hello @alice.com, check out this link: https://example.com'})
await rt.detectFacets(agent) // automatically detects mentions and links
const postRecord = {
$type: 'app.bsky.feed.post',
text: rt.text,
facets: rt.facets,
createdAt: new Date().toISOString()
}
// rendering as markdown
let markdown = ''
for (const segment of rt.segments()) {
if (segment.isLink()) {
markdown += `[${segment.text}](${segment.link?.uri})`
} else if (segment.isMention()) {
markdown += `[${segment.text}](https://my-bsky-app.com/user/${segment.mention?.did})`
} else {
markdown += segment.text
}
}
// calculating string lengths
const rt2 = new RichText({text: 'Hello'})
console.log(rt2.length) // => 5
console.log(rt2.graphemeLength) // => 5
const rt3 = new RichText({text: '👨‍👩‍👧‍👧'})
console.log(rt3.length) // => 25
console.log(rt3.graphemeLength) // => 1
```
## Advanced
### Advanced API calls
The methods above are convenience wrappers. It covers most but not all available methods.
The AT Protocol identifies methods and records with reverse-DNS names. You can use them on the agent as well:
```typescript
const res1 = await agent.com.atproto.repo.createRecord(
{
did: alice.did,
collection: 'app.bsky.feed.post',
@ -57,14 +178,47 @@ const res1 = await agent.api.com.atproto.repo.createRecord(
}
}
)
const res2 = await agent.api.com.atproto.repo.listRecords({user: alice.did, collection: 'app.bsky.feed.post'})
const res2 = await agent.com.atproto.repo.listRecords({user: alice.did, collection: 'app.bsky.feed.post'})
// repo record methods
const res3 = await agent.api.app.bsky.feed.post.create({did: alice.did}, {
const res3 = await agent.app.bsky.feed.post.create({did: alice.did}, {
text: 'Hello, world!',
createdAt: (new Date()).toISOString()
})
const res4 = await agent.api.app.bsky.feed.post.list({did: alice.did})
const res4 = await agent.app.bsky.feed.post.list({did: alice.did})
```
### Generic agent
If you want a generic AT Protocol agent without methods related to the Bluesky social lexicon, use the `AtpAgent` instead of the `BskyAgent`.
```typescript
import { AtpAgent } from '@atproto/api'
const agent = new AtpAgent({service: 'https://example.com'})
```
### Non-browser configuration
In non-browser environments you'll need to specify a fetch polyfill. [See the example react-native polyfill here.](./docs/rn-fetch-handler.ts)
```typescript
import { BskyAgent } from '@atproto/api'
const agent = new BskyAgent({service: 'https://example.com'})
// provide a custom fetch implementation (shouldnt be needed in node or the browser)
import {AtpAgentFetchHeaders, AtpAgentFetchHandlerResponse} from '@atproto/api'
BskyAgent.configure({
async fetch(
httpUri: string,
httpMethod: string,
httpHeaders: AtpAgentFetchHeaders,
httpReqBody: any,
): Promise<AtpAgentFetchHandlerResponse> {
// insert definition here...
return {status: 200, /*...*/}
}
})
```
## License

View File

@ -17,6 +17,7 @@ require('esbuild').build({
bundle: true,
sourcemap: true,
outdir: 'dist',
platform: 'node',
platform: 'browser',
format: 'cjs',
plugins: buildShallow ? [nodeExternalsPlugin()] : [],
})

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