diff --git a/packages/lexicon/src/index.ts b/packages/lexicon/src/index.ts index a3816db..fdd55b1 100644 --- a/packages/lexicon/src/index.ts +++ b/packages/lexicon/src/index.ts @@ -7,6 +7,18 @@ import { CID } from 'multiformats/cid' import { schemas } from './lexicons.js' import * as AppBskyActorDefs from './types/app/bsky/actor/defs.js' import * as AppBskyActorProfile from './types/app/bsky/actor/profile.js' +import * as AppBskyEmbedDefs from './types/app/bsky/embed/defs.js' +import * as AppBskyEmbedExternal from './types/app/bsky/embed/external.js' +import * as AppBskyEmbedImages from './types/app/bsky/embed/images.js' +import * as AppBskyEmbedRecord from './types/app/bsky/embed/record.js' +import * as AppBskyEmbedRecordWithMedia from './types/app/bsky/embed/recordWithMedia.js' +import * as AppBskyEmbedVideo from './types/app/bsky/embed/video.js' +import * as AppBskyFeedDefs from './types/app/bsky/feed/defs.js' +import * as AppBskyFeedPostgate from './types/app/bsky/feed/postgate.js' +import * as AppBskyFeedThreadgate from './types/app/bsky/feed/threadgate.js' +import * as AppBskyGraphDefs from './types/app/bsky/graph/defs.js' +import * as AppBskyLabelerDefs from './types/app/bsky/labeler/defs.js' +import * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet.js' import * as ComAtprotoLabelDefs from './types/com/atproto/label/defs.js' import * as ComAtprotoRepoApplyWrites from './types/com/atproto/repo/applyWrites.js' import * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createRecord.js' @@ -47,6 +59,40 @@ export * as ComAtprotoRepoStrongRef from './types/com/atproto/repo/strongRef.js' export * as ComAtprotoRepoUploadBlob from './types/com/atproto/repo/uploadBlob.js' export * as AppBskyActorDefs from './types/app/bsky/actor/defs.js' export * as AppBskyActorProfile from './types/app/bsky/actor/profile.js' +export * as AppBskyEmbedDefs from './types/app/bsky/embed/defs.js' +export * as AppBskyEmbedExternal from './types/app/bsky/embed/external.js' +export * as AppBskyEmbedImages from './types/app/bsky/embed/images.js' +export * as AppBskyEmbedRecord from './types/app/bsky/embed/record.js' +export * as AppBskyEmbedRecordWithMedia from './types/app/bsky/embed/recordWithMedia.js' +export * as AppBskyEmbedVideo from './types/app/bsky/embed/video.js' +export * as AppBskyFeedDefs from './types/app/bsky/feed/defs.js' +export * as AppBskyFeedPostgate from './types/app/bsky/feed/postgate.js' +export * as AppBskyFeedThreadgate from './types/app/bsky/feed/threadgate.js' +export * as AppBskyGraphDefs from './types/app/bsky/graph/defs.js' +export * as AppBskyLabelerDefs from './types/app/bsky/labeler/defs.js' +export * as AppBskyRichtextFacet from './types/app/bsky/richtext/facet.js' + +export const APP_BSKY_FEED = { + DefsRequestLess: 'app.bsky.feed.defs#requestLess', + DefsRequestMore: 'app.bsky.feed.defs#requestMore', + DefsInteractionLike: 'app.bsky.feed.defs#interactionLike', + DefsInteractionSeen: 'app.bsky.feed.defs#interactionSeen', + DefsClickthroughItem: 'app.bsky.feed.defs#clickthroughItem', + DefsContentModeVideo: 'app.bsky.feed.defs#contentModeVideo', + DefsInteractionQuote: 'app.bsky.feed.defs#interactionQuote', + DefsInteractionReply: 'app.bsky.feed.defs#interactionReply', + DefsInteractionShare: 'app.bsky.feed.defs#interactionShare', + DefsClickthroughEmbed: 'app.bsky.feed.defs#clickthroughEmbed', + DefsInteractionRepost: 'app.bsky.feed.defs#interactionRepost', + DefsClickthroughAuthor: 'app.bsky.feed.defs#clickthroughAuthor', + DefsClickthroughReposter: 'app.bsky.feed.defs#clickthroughReposter', + DefsContentModeUnspecified: 'app.bsky.feed.defs#contentModeUnspecified', +} +export const APP_BSKY_GRAPH = { + DefsModlist: 'app.bsky.graph.defs#modlist', + DefsCuratelist: 'app.bsky.graph.defs#curatelist', + DefsReferencelist: 'app.bsky.graph.defs#referencelist', +} export class AtpBaseClient extends XrpcClient { xyz: XyzNS @@ -329,10 +375,16 @@ export class AppNS { export class AppBskyNS { _client: XrpcClient actor: AppBskyActorNS + embed: AppBskyEmbedNS + feed: AppBskyFeedNS + richtext: AppBskyRichtextNS constructor(client: XrpcClient) { this._client = client this.actor = new AppBskyActorNS(client) + this.embed = new AppBskyEmbedNS(client) + this.feed = new AppBskyFeedNS(client) + this.richtext = new AppBskyRichtextNS(client) } } @@ -411,3 +463,157 @@ export class ProfileRecord { ) } } + +export class AppBskyEmbedNS { + _client: XrpcClient + + constructor(client: XrpcClient) { + this._client = client + } +} + +export class AppBskyFeedNS { + _client: XrpcClient + postgate: PostgateRecord + threadgate: ThreadgateRecord + + constructor(client: XrpcClient) { + this._client = client + this.postgate = new PostgateRecord(client) + this.threadgate = new ThreadgateRecord(client) + } +} + +export class PostgateRecord { + _client: XrpcClient + + constructor(client: XrpcClient) { + this._client = client + } + + async list( + params: OmitKey, + ): Promise<{ + cursor?: string + records: { uri: string; value: AppBskyFeedPostgate.Record }[] + }> { + const res = await this._client.call('com.atproto.repo.listRecords', { + collection: 'app.bsky.feed.postgate', + ...params, + }) + return res.data + } + + async get( + params: OmitKey, + ): Promise<{ uri: string; cid: string; value: AppBskyFeedPostgate.Record }> { + const res = await this._client.call('com.atproto.repo.getRecord', { + collection: 'app.bsky.feed.postgate', + ...params, + }) + return res.data + } + + async create( + params: OmitKey< + ComAtprotoRepoCreateRecord.InputSchema, + 'collection' | 'record' + >, + record: Un$Typed, + headers?: Record, + ): Promise<{ uri: string; cid: string }> { + const collection = 'app.bsky.feed.postgate' + const res = await this._client.call( + 'com.atproto.repo.createRecord', + undefined, + { collection, ...params, record: { ...record, $type: collection } }, + { encoding: 'application/json', headers }, + ) + return res.data + } + + async delete( + params: OmitKey, + headers?: Record, + ): Promise { + await this._client.call( + 'com.atproto.repo.deleteRecord', + undefined, + { collection: 'app.bsky.feed.postgate', ...params }, + { headers }, + ) + } +} + +export class ThreadgateRecord { + _client: XrpcClient + + constructor(client: XrpcClient) { + this._client = client + } + + async list( + params: OmitKey, + ): Promise<{ + cursor?: string + records: { uri: string; value: AppBskyFeedThreadgate.Record }[] + }> { + const res = await this._client.call('com.atproto.repo.listRecords', { + collection: 'app.bsky.feed.threadgate', + ...params, + }) + return res.data + } + + async get( + params: OmitKey, + ): Promise<{ + uri: string + cid: string + value: AppBskyFeedThreadgate.Record + }> { + const res = await this._client.call('com.atproto.repo.getRecord', { + collection: 'app.bsky.feed.threadgate', + ...params, + }) + return res.data + } + + async create( + params: OmitKey< + ComAtprotoRepoCreateRecord.InputSchema, + 'collection' | 'record' + >, + record: Un$Typed, + headers?: Record, + ): Promise<{ uri: string; cid: string }> { + const collection = 'app.bsky.feed.threadgate' + const res = await this._client.call( + 'com.atproto.repo.createRecord', + undefined, + { collection, ...params, record: { ...record, $type: collection } }, + { encoding: 'application/json', headers }, + ) + return res.data + } + + async delete( + params: OmitKey, + headers?: Record, + ): Promise { + await this._client.call( + 'com.atproto.repo.deleteRecord', + undefined, + { collection: 'app.bsky.feed.threadgate', ...params }, + { headers }, + ) + } +} + +export class AppBskyRichtextNS { + _client: XrpcClient + + constructor(client: XrpcClient) { + this._client = client + } +} diff --git a/packages/lexicon/src/lexicons.ts b/packages/lexicon/src/lexicons.ts index c6c06cc..114ae70 100644 --- a/packages/lexicon/src/lexicons.ts +++ b/packages/lexicon/src/lexicons.ts @@ -193,13 +193,33 @@ export const schemaDict = { defs: { label: { type: 'object', - description: - 'Metadata tag on an atproto resource (eg, repo or record).', required: ['src', 'uri', 'val', 'cts'], properties: { - ver: { - type: 'integer', - description: 'The AT Protocol version of the label object.', + cid: { + type: 'string', + format: 'cid', + description: + "Optionally, CID specifying the specific version of 'uri' resource this label applies to.", + }, + cts: { + type: 'string', + format: 'datetime', + description: 'Timestamp when this label was created.', + }, + exp: { + type: 'string', + format: 'datetime', + description: + 'Timestamp at which this label expires (no longer applies).', + }, + neg: { + type: 'boolean', + description: + 'If true, this is a negation label, overwriting a previous label.', + }, + sig: { + type: 'bytes', + description: 'Signature of dag-cbor encoded label.', }, src: { type: 'string', @@ -212,82 +232,82 @@ export const schemaDict = { description: 'AT URI of the record, repository (account), or other resource that this label applies to.', }, - cid: { - type: 'string', - format: 'cid', - description: - "Optionally, CID specifying the specific version of 'uri' resource this label applies to.", - }, val: { type: 'string', maxLength: 128, description: 'The short string name of the value or type of this label.', }, - neg: { - type: 'boolean', - description: - 'If true, this is a negation label, overwriting a previous label.', - }, - cts: { - type: 'string', - format: 'datetime', - description: 'Timestamp when this label was created.', + ver: { + type: 'integer', + description: 'The AT Protocol version of the label object.', }, - exp: { + }, + description: + 'Metadata tag on an atproto resource (eg, repo or record).', + }, + selfLabel: { + type: 'object', + required: ['val'], + properties: { + val: { type: 'string', - format: 'datetime', + maxLength: 128, description: - 'Timestamp at which this label expires (no longer applies).', - }, - sig: { - type: 'bytes', - description: 'Signature of dag-cbor encoded label.', + 'The short string name of the value or type of this label.', }, }, + description: + 'Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.', + }, + labelValue: { + type: 'string', + knownValues: [ + '!hide', + '!no-promote', + '!warn', + '!no-unauthenticated', + 'dmca-violation', + 'doxxing', + 'porn', + 'sexual', + 'nudity', + 'nsfl', + 'gore', + ], }, selfLabels: { type: 'object', - description: - 'Metadata tags on an atproto record, published by the author within the record.', required: ['values'], properties: { values: { type: 'array', items: { - type: 'ref', ref: 'lex:com.atproto.label.defs#selfLabel', + type: 'ref', }, maxLength: 10, }, }, - }, - selfLabel: { - type: 'object', description: - 'Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.', - required: ['val'], - properties: { - val: { - type: 'string', - maxLength: 128, - description: - 'The short string name of the value or type of this label.', - }, - }, + 'Metadata tags on an atproto record, published by the author within the record.', }, labelValueDefinition: { type: 'object', - description: - 'Declares a label value and its expected interpretations and behaviors.', required: ['identifier', 'severity', 'blurs', 'locales'], properties: { - identifier: { + blurs: { type: 'string', description: - "The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).", - maxLength: 100, - maxGraphemes: 100, + "What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing.", + knownValues: ['content', 'media', 'none'], + }, + locales: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#labelValueDefinitionStrings', + type: 'ref', + }, }, severity: { type: 'string', @@ -295,74 +315,54 @@ export const schemaDict = { "How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing.", knownValues: ['inform', 'alert', 'none'], }, - blurs: { + adultOnly: { + type: 'boolean', + description: + 'Does the user need to have adult content enabled in order to configure this label?', + }, + identifier: { type: 'string', + maxLength: 100, description: - "What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing.", - knownValues: ['content', 'media', 'none'], + "The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).", + maxGraphemes: 100, }, defaultSetting: { type: 'string', + default: 'warn', description: 'The default setting for this label.', knownValues: ['ignore', 'warn', 'hide'], - default: 'warn', - }, - adultOnly: { - type: 'boolean', - description: - 'Does the user need to have adult content enabled in order to configure this label?', - }, - locales: { - type: 'array', - items: { - type: 'ref', - ref: 'lex:com.atproto.label.defs#labelValueDefinitionStrings', - }, }, }, + description: + 'Declares a label value and its expected interpretations and behaviors.', }, labelValueDefinitionStrings: { type: 'object', - description: - 'Strings which describe the label in the UI, localized into a specific language.', required: ['lang', 'name', 'description'], properties: { lang: { type: 'string', + format: 'language', description: 'The code of the language these strings are written in.', - format: 'language', }, name: { type: 'string', + maxLength: 640, description: 'A short human-readable name for the label.', maxGraphemes: 64, - maxLength: 640, }, description: { type: 'string', + maxLength: 100000, description: 'A longer description of what the label means and why it might be applied.', maxGraphemes: 10000, - maxLength: 100000, }, }, - }, - labelValue: { - type: 'string', - knownValues: [ - '!hide', - '!no-promote', - '!warn', - '!no-unauthenticated', - 'dmca-violation', - 'doxxing', - 'porn', - 'sexual', - 'nudity', - 'nsfl', - 'gore', - ], + description: + 'Strings which describe the label in the UI, localized into a specific language.', }, }, }, @@ -372,10 +372,7 @@ export const schemaDict = { defs: { main: { type: 'procedure', - description: - 'Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS.', input: { - encoding: 'application/json', schema: { type: 'object', required: ['repo', 'writes'], @@ -386,95 +383,108 @@ export const schemaDict = { description: 'The handle or DID of the repo (aka, current account).', }, - validate: { - type: 'boolean', - description: - "Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons.", - }, writes: { type: 'array', items: { - type: 'union', refs: [ 'lex:com.atproto.repo.applyWrites#create', 'lex:com.atproto.repo.applyWrites#update', 'lex:com.atproto.repo.applyWrites#delete', ], + type: 'union', closed: true, }, }, + validate: { + type: 'boolean', + description: + "Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons.", + }, swapCommit: { type: 'string', + format: 'cid', description: 'If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations.', - format: 'cid', }, }, }, + encoding: 'application/json', }, + errors: [ + { + name: 'InvalidSwap', + description: + "Indicates that the 'swapCommit' parameter did not match current commit.", + }, + ], output: { - encoding: 'application/json', schema: { type: 'object', required: [], properties: { commit: { - type: 'ref', ref: 'lex:com.atproto.repo.defs#commitMeta', + type: 'ref', }, results: { type: 'array', items: { - type: 'union', refs: [ 'lex:com.atproto.repo.applyWrites#createResult', 'lex:com.atproto.repo.applyWrites#updateResult', 'lex:com.atproto.repo.applyWrites#deleteResult', ], + type: 'union', closed: true, }, }, }, }, + encoding: 'application/json', }, - errors: [ - { - name: 'InvalidSwap', - description: - "Indicates that the 'swapCommit' parameter did not match current commit.", - }, - ], + description: + 'Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS.', }, create: { type: 'object', - description: 'Operation which creates a new record.', required: ['collection', 'value'], properties: { - collection: { - type: 'string', - format: 'nsid', - }, rkey: { type: 'string', - maxLength: 512, format: 'record-key', + maxLength: 512, description: 'NOTE: maxLength is redundant with record-key format. Keeping it temporarily to ensure backwards compatibility.', }, value: { type: 'unknown', }, + collection: { + type: 'string', + format: 'nsid', + }, }, + description: 'Operation which creates a new record.', }, - update: { + delete: { type: 'object', - description: 'Operation which updates an existing record.', - required: ['collection', 'rkey', 'value'], + required: ['collection', 'rkey'], properties: { + rkey: { + type: 'string', + format: 'record-key', + }, collection: { type: 'string', format: 'nsid', }, + }, + description: 'Operation which deletes an existing record.', + }, + update: { + type: 'object', + required: ['collection', 'rkey', 'value'], + properties: { rkey: { type: 'string', format: 'record-key', @@ -482,64 +492,54 @@ export const schemaDict = { value: { type: 'unknown', }, - }, - }, - delete: { - type: 'object', - description: 'Operation which deletes an existing record.', - required: ['collection', 'rkey'], - properties: { collection: { type: 'string', format: 'nsid', }, - rkey: { - type: 'string', - format: 'record-key', - }, }, + description: 'Operation which updates an existing record.', }, createResult: { type: 'object', required: ['uri', 'cid'], properties: { - uri: { - type: 'string', - format: 'at-uri', - }, cid: { type: 'string', format: 'cid', }, + uri: { + type: 'string', + format: 'at-uri', + }, validationStatus: { type: 'string', knownValues: ['valid', 'unknown'], }, }, }, + deleteResult: { + type: 'object', + required: [], + properties: {}, + }, updateResult: { type: 'object', required: ['uri', 'cid'], properties: { - uri: { - type: 'string', - format: 'at-uri', - }, cid: { type: 'string', format: 'cid', }, + uri: { + type: 'string', + format: 'at-uri', + }, validationStatus: { type: 'string', knownValues: ['valid', 'unknown'], }, }, }, - deleteResult: { - type: 'object', - required: [], - properties: {}, - }, }, }, ComAtprotoRepoCreateRecord: { @@ -548,10 +548,7 @@ export const schemaDict = { defs: { main: { type: 'procedure', - description: - 'Create a single new repository record. Requires auth, implemented by PDS.', input: { - encoding: 'application/json', schema: { type: 'object', required: ['repo', 'collection', 'record'], @@ -562,25 +559,25 @@ export const schemaDict = { description: 'The handle or DID of the repo (aka, current account).', }, - collection: { - type: 'string', - format: 'nsid', - description: 'The NSID of the record collection.', - }, rkey: { type: 'string', format: 'record-key', - description: 'The Record Key.', maxLength: 512, + description: 'The Record Key.', + }, + record: { + type: 'unknown', + description: 'The record itself. Must contain a $type field.', }, validate: { type: 'boolean', description: "Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons.", }, - record: { - type: 'unknown', - description: 'The record itself. Must contain a $type field.', + collection: { + type: 'string', + format: 'nsid', + description: 'The NSID of the record collection.', }, swapCommit: { type: 'string', @@ -590,24 +587,31 @@ export const schemaDict = { }, }, }, + encoding: 'application/json', }, + errors: [ + { + name: 'InvalidSwap', + description: + "Indicates that 'swapCommit' didn't match current repo commit.", + }, + ], output: { - encoding: 'application/json', schema: { type: 'object', required: ['uri', 'cid'], properties: { - uri: { - type: 'string', - format: 'at-uri', - }, cid: { type: 'string', format: 'cid', }, + uri: { + type: 'string', + format: 'at-uri', + }, commit: { - type: 'ref', ref: 'lex:com.atproto.repo.defs#commitMeta', + type: 'ref', }, validationStatus: { type: 'string', @@ -615,14 +619,10 @@ export const schemaDict = { }, }, }, + encoding: 'application/json', }, - errors: [ - { - name: 'InvalidSwap', - description: - "Indicates that 'swapCommit' didn't match current repo commit.", - }, - ], + description: + 'Create a single new repository record. Requires auth, implemented by PDS.', }, }, }, @@ -652,10 +652,7 @@ export const schemaDict = { defs: { main: { type: 'procedure', - description: - "Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.", input: { - encoding: 'application/json', schema: { type: 'object', required: ['repo', 'collection', 'rkey'], @@ -666,21 +663,15 @@ export const schemaDict = { description: 'The handle or DID of the repo (aka, current account).', }, - collection: { - type: 'string', - format: 'nsid', - description: 'The NSID of the record collection.', - }, rkey: { type: 'string', format: 'record-key', description: 'The Record Key.', }, - swapRecord: { + collection: { type: 'string', - format: 'cid', - description: - 'Compare and swap with the previous record by CID.', + format: 'nsid', + description: 'The NSID of the record collection.', }, swapCommit: { type: 'string', @@ -688,26 +679,35 @@ export const schemaDict = { description: 'Compare and swap with the previous commit by CID.', }, + swapRecord: { + type: 'string', + format: 'cid', + description: + 'Compare and swap with the previous record by CID.', + }, }, }, + encoding: 'application/json', }, + errors: [ + { + name: 'InvalidSwap', + }, + ], output: { - encoding: 'application/json', schema: { type: 'object', properties: { commit: { - type: 'ref', ref: 'lex:com.atproto.repo.defs#commitMeta', + type: 'ref', }, }, }, + encoding: 'application/json', }, - errors: [ - { - name: 'InvalidSwap', - }, - ], + description: + "Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.", }, }, }, @@ -717,21 +717,7 @@ export const schemaDict = { defs: { main: { type: 'query', - description: - 'Get information about an account and repository, including the list of collections. Does not require auth.', - parameters: { - type: 'params', - required: ['repo'], - properties: { - repo: { - type: 'string', - format: 'at-identifier', - description: 'The handle or DID of the repo.', - }, - }, - }, output: { - encoding: 'application/json', schema: { type: 'object', required: [ @@ -742,10 +728,6 @@ export const schemaDict = { 'handleIsCorrect', ], properties: { - handle: { - type: 'string', - format: 'handle', - }, did: { type: 'string', format: 'did', @@ -754,14 +736,18 @@ export const schemaDict = { type: 'unknown', description: 'The complete DID document for this account.', }, + handle: { + type: 'string', + format: 'handle', + }, collections: { type: 'array', - description: - 'List of all the collections (NSIDs) for which this repo contains at least one record.', items: { type: 'string', format: 'nsid', }, + description: + 'List of all the collections (NSIDs) for which this repo contains at least one record.', }, handleIsCorrect: { type: 'boolean', @@ -770,70 +756,84 @@ export const schemaDict = { }, }, }, + encoding: 'application/json', }, - }, - }, - }, - ComAtprotoRepoGetRecord: { - lexicon: 1, - id: 'com.atproto.repo.getRecord', - defs: { - main: { - type: 'query', - description: - 'Get a single record from a repository. Does not require auth.', parameters: { type: 'params', - required: ['repo', 'collection', 'rkey'], + required: ['repo'], properties: { 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 Record Key.', - format: 'record-key', - }, - cid: { - type: 'string', - format: 'cid', - description: - 'The CID of the version of the record. If not specified, then return the most recent version.', - }, }, }, + description: + 'Get information about an account and repository, including the list of collections. Does not require auth.', + }, + }, + }, + ComAtprotoRepoGetRecord: { + lexicon: 1, + id: 'com.atproto.repo.getRecord', + defs: { + main: { + type: 'query', + errors: [ + { + name: 'RecordNotFound', + }, + ], output: { - encoding: 'application/json', schema: { type: 'object', required: ['uri', 'value'], properties: { - uri: { - type: 'string', - format: 'at-uri', - }, cid: { type: 'string', format: 'cid', }, + uri: { + type: 'string', + format: 'at-uri', + }, value: { type: 'unknown', }, }, }, + encoding: 'application/json', }, - errors: [ - { - name: 'RecordNotFound', + parameters: { + type: 'params', + required: ['repo', 'collection', 'rkey'], + properties: { + cid: { + type: 'string', + format: 'cid', + description: + 'The CID of the version of the record. If not specified, then return the most recent version.', + }, + repo: { + type: 'string', + format: 'at-identifier', + description: 'The handle or DID of the repo.', + }, + rkey: { + type: 'string', + format: 'record-key', + description: 'The Record Key.', + }, + collection: { + type: 'string', + format: 'nsid', + description: 'The NSID of the record collection.', + }, }, - ], + }, + description: + 'Get a single record from a repository. Does not require auth.', }, }, }, @@ -843,11 +843,11 @@ export const schemaDict = { defs: { main: { type: 'procedure', - description: - 'Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.', input: { encoding: 'application/vnd.ipld.car', }, + description: + 'Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.', }, }, }, @@ -857,43 +857,43 @@ export const schemaDict = { defs: { main: { type: 'query', - description: - 'Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.', - parameters: { - type: 'params', - properties: { - limit: { - type: 'integer', - minimum: 1, - maximum: 1000, - default: 500, - }, - cursor: { - type: 'string', - }, - }, - }, output: { - encoding: 'application/json', schema: { type: 'object', required: ['blobs'], properties: { - cursor: { - type: 'string', - }, blobs: { type: 'array', items: { - type: 'ref', ref: 'lex:com.atproto.repo.listMissingBlobs#recordBlob', + type: 'ref', }, }, + cursor: { + type: 'string', + }, }, }, + encoding: 'application/json', }, - }, - recordBlob: { + parameters: { + type: 'params', + properties: { + limit: { + type: 'integer', + default: 500, + maximum: 1000, + minimum: 1, + }, + cursor: { + type: 'string', + }, + }, + }, + description: + 'Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.', + }, + recordBlob: { type: 'object', required: ['cid', 'recordUri'], properties: { @@ -915,8 +915,25 @@ export const schemaDict = { defs: { main: { type: 'query', - description: - 'List a range of records in a repository, matching a specific collection. Does not require auth.', + output: { + schema: { + type: 'object', + required: ['records'], + properties: { + cursor: { + type: 'string', + }, + records: { + type: 'array', + items: { + ref: 'lex:com.atproto.repo.listRecords#record', + type: 'ref', + }, + }, + }, + }, + encoding: 'application/json', + }, parameters: { type: 'params', required: ['repo', 'collection'], @@ -926,69 +943,42 @@ export const schemaDict = { 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, + maximum: 100, + minimum: 1, description: 'The number of records to return.', }, cursor: { type: 'string', }, - rkeyStart: { - type: 'string', - description: - 'DEPRECATED: The lowest sort-ordered rkey to start from (exclusive)', - }, - rkeyEnd: { - type: 'string', - description: - 'DEPRECATED: The highest sort-ordered rkey to stop at (exclusive)', - }, reverse: { type: 'boolean', description: 'Flag to reverse the order of the returned records.', }, - }, - }, - output: { - encoding: 'application/json', - schema: { - type: 'object', - required: ['records'], - properties: { - cursor: { - type: 'string', - }, - records: { - type: 'array', - items: { - type: 'ref', - ref: 'lex:com.atproto.repo.listRecords#record', - }, - }, + collection: { + type: 'string', + format: 'nsid', + description: 'The NSID of the record type.', }, }, }, + description: + 'List a range of records in a repository, matching a specific collection. Does not require auth.', }, record: { type: 'object', required: ['uri', 'cid', 'value'], properties: { - uri: { - type: 'string', - format: 'at-uri', - }, cid: { type: 'string', format: 'cid', }, + uri: { + type: 'string', + format: 'at-uri', + }, value: { type: 'unknown', }, @@ -1002,14 +992,11 @@ export const schemaDict = { defs: { main: { type: 'procedure', - description: - 'Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.', input: { - encoding: 'application/json', schema: { type: 'object', - required: ['repo', 'collection', 'rkey', 'record'], nullable: ['swapRecord'], + required: ['repo', 'collection', 'rkey', 'record'], properties: { repo: { type: 'string', @@ -1017,58 +1004,63 @@ export const schemaDict = { description: 'The handle or DID of the repo (aka, current account).', }, - collection: { - type: 'string', - format: 'nsid', - description: 'The NSID of the record collection.', - }, rkey: { type: 'string', format: 'record-key', - description: 'The Record Key.', maxLength: 512, + description: 'The Record Key.', + }, + record: { + type: 'unknown', + description: 'The record to write.', }, validate: { type: 'boolean', description: "Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons.", }, - record: { - type: 'unknown', - description: 'The record to write.', + collection: { + type: 'string', + format: 'nsid', + description: 'The NSID of the record collection.', }, - swapRecord: { + swapCommit: { type: 'string', format: 'cid', description: - 'Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation', + 'Compare and swap with the previous commit by CID.', }, - swapCommit: { + swapRecord: { type: 'string', format: 'cid', description: - 'Compare and swap with the previous commit by CID.', + 'Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation', }, }, }, + encoding: 'application/json', }, + errors: [ + { + name: 'InvalidSwap', + }, + ], output: { - encoding: 'application/json', schema: { type: 'object', required: ['uri', 'cid'], properties: { - uri: { - type: 'string', - format: 'at-uri', - }, cid: { type: 'string', format: 'cid', }, + uri: { + type: 'string', + format: 'at-uri', + }, commit: { - type: 'ref', ref: 'lex:com.atproto.repo.defs#commitMeta', + type: 'ref', }, validationStatus: { type: 'string', @@ -1076,12 +1068,10 @@ export const schemaDict = { }, }, }, + encoding: 'application/json', }, - errors: [ - { - name: 'InvalidSwap', - }, - ], + description: + 'Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.', }, }, }, @@ -1094,14 +1084,14 @@ export const schemaDict = { type: 'object', required: ['uri', 'cid'], properties: { - uri: { - type: 'string', - format: 'at-uri', - }, cid: { type: 'string', format: 'cid', }, + uri: { + type: 'string', + format: 'at-uri', + }, }, }, }, @@ -1112,13 +1102,10 @@ export const schemaDict = { defs: { main: { type: 'procedure', - description: - 'Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS.', input: { encoding: '*/*', }, output: { - encoding: 'application/json', schema: { type: 'object', required: ['blob'], @@ -1128,7 +1115,10 @@ export const schemaDict = { }, }, }, + encoding: 'application/json', }, + description: + 'Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS.', }, }, }, @@ -1136,108 +1126,2260 @@ export const schemaDict = { lexicon: 1, id: 'app.bsky.actor.defs', defs: { - profileView: { + nux: { type: 'object', - required: ['did', 'handle'], + required: ['id', 'completed'], properties: { - did: { + id: { type: 'string', - format: 'did', + maxLength: 100, }, - handle: { + data: { type: 'string', - format: 'handle', + maxLength: 3000, + description: + 'Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters.', + maxGraphemes: 300, }, - displayName: { + completed: { + type: 'boolean', + default: false, + }, + expiresAt: { type: 'string', - maxGraphemes: 64, - maxLength: 640, + format: 'datetime', + description: + 'The date and time at which the NUX will expire and should be considered completed.', }, - description: { + }, + description: 'A new user experiences (NUX) storage object', + }, + mutedWord: { + type: 'object', + required: ['value', 'targets'], + properties: { + id: { type: 'string', - maxGraphemes: 256, - maxLength: 2560, }, - avatar: { + value: { type: 'string', - format: 'uri', + maxLength: 10000, + description: 'The muted word itself.', + maxGraphemes: 1000, }, - indexedAt: { + targets: { + type: 'array', + items: { + ref: 'lex:app.bsky.actor.defs#mutedWordTarget', + type: 'ref', + }, + description: 'The intended targets of the muted word.', + }, + expiresAt: { type: 'string', format: 'datetime', + description: + 'The date and time at which the muted word will expire and no longer be applied.', }, - createdAt: { + actorTarget: { type: 'string', - format: 'datetime', + default: 'all', + description: + 'Groups of users to apply the muted word to. If undefined, applies to all users.', + knownValues: ['all', 'exclude-following'], + }, + }, + description: 'A word that the account owner has muted.', + }, + savedFeed: { + type: 'object', + required: ['id', 'type', 'value', 'pinned'], + properties: { + id: { + type: 'string', + }, + type: { + type: 'string', + knownValues: ['feed', 'list', 'timeline'], + }, + value: { + type: 'string', + }, + pinned: { + type: 'boolean', + }, + }, + }, + preferences: { + type: 'array', + items: { + refs: [ + 'lex:app.bsky.actor.defs#adultContentPref', + 'lex:app.bsky.actor.defs#contentLabelPref', + 'lex:app.bsky.actor.defs#savedFeedsPref', + 'lex:app.bsky.actor.defs#savedFeedsPrefV2', + 'lex:app.bsky.actor.defs#personalDetailsPref', + 'lex:app.bsky.actor.defs#feedViewPref', + 'lex:app.bsky.actor.defs#threadViewPref', + 'lex:app.bsky.actor.defs#interestsPref', + 'lex:app.bsky.actor.defs#mutedWordsPref', + 'lex:app.bsky.actor.defs#hiddenPostsPref', + 'lex:app.bsky.actor.defs#bskyAppStatePref', + 'lex:app.bsky.actor.defs#labelersPref', + 'lex:app.bsky.actor.defs#postInteractionSettingsPref', + ], + type: 'union', + }, + }, + profileView: { + type: 'object', + required: ['did', 'handle'], + properties: { + did: { + type: 'string', + format: 'did', + }, + avatar: { + type: 'string', + format: 'uri', + }, + handle: { + type: 'string', + format: 'handle', }, labels: { type: 'array', items: { - type: 'ref', ref: 'lex:com.atproto.label.defs#label', + type: 'ref', }, }, + viewer: { + ref: 'lex:app.bsky.actor.defs#viewerState', + type: 'ref', + }, + createdAt: { + type: 'string', + format: 'datetime', + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + associated: { + ref: 'lex:app.bsky.actor.defs#profileAssociated', + type: 'ref', + }, + description: { + type: 'string', + maxLength: 2560, + maxGraphemes: 256, + }, + displayName: { + type: 'string', + maxLength: 640, + maxGraphemes: 64, + }, }, }, - }, - }, - AppBskyActorProfile: { - lexicon: 1, - id: 'app.bsky.actor.profile', - defs: { - main: { - type: 'record', - description: 'A declaration of a Bluesky account profile.', - key: 'literal:self', - record: { - type: 'object', - properties: { - displayName: { + viewerState: { + type: 'object', + properties: { + muted: { + type: 'boolean', + }, + blocking: { + type: 'string', + format: 'at-uri', + }, + blockedBy: { + type: 'boolean', + }, + following: { + type: 'string', + format: 'at-uri', + }, + followedBy: { + type: 'string', + format: 'at-uri', + }, + mutedByList: { + ref: 'lex:app.bsky.graph.defs#listViewBasic', + type: 'ref', + }, + blockingByList: { + ref: 'lex:app.bsky.graph.defs#listViewBasic', + type: 'ref', + }, + knownFollowers: { + ref: 'lex:app.bsky.actor.defs#knownFollowers', + type: 'ref', + }, + }, + description: + "Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests.", + }, + feedViewPref: { + type: 'object', + required: ['feed'], + properties: { + feed: { + type: 'string', + description: + 'The URI of the feed, or an identifier which describes the feed.', + }, + hideReplies: { + type: 'boolean', + description: 'Hide replies in the feed.', + }, + hideReposts: { + type: 'boolean', + description: 'Hide reposts in the feed.', + }, + hideQuotePosts: { + type: 'boolean', + description: 'Hide quote posts in the feed.', + }, + hideRepliesByLikeCount: { + type: 'integer', + description: + 'Hide replies in the feed if they do not have this number of likes.', + }, + hideRepliesByUnfollowed: { + type: 'boolean', + default: true, + description: + 'Hide replies in the feed if they are not by followed users.', + }, + }, + }, + labelersPref: { + type: 'object', + required: ['labelers'], + properties: { + labelers: { + type: 'array', + items: { + ref: 'lex:app.bsky.actor.defs#labelerPrefItem', + type: 'ref', + }, + }, + }, + }, + interestsPref: { + type: 'object', + required: ['tags'], + properties: { + tags: { + type: 'array', + items: { type: 'string', - maxGraphemes: 64, maxLength: 640, + maxGraphemes: 64, }, - description: { - type: 'string', - description: 'Free-form profile description text.', - maxGraphemes: 256, - maxLength: 2560, + maxLength: 100, + description: + "A list of tags which describe the account owner's interests gathered during onboarding.", + }, + }, + }, + knownFollowers: { + type: 'object', + required: ['count', 'followers'], + properties: { + count: { + type: 'integer', + }, + followers: { + type: 'array', + items: { + ref: 'lex:app.bsky.actor.defs#profileViewBasic', + type: 'ref', }, - avatar: { - type: 'blob', - description: - "Small image to be displayed next to posts from account. AKA, 'profile picture'", - accept: ['image/png', 'image/jpeg'], - maxSize: 1000000, + maxLength: 5, + minLength: 0, + }, + }, + description: "The subject's followers whom you also follow", + }, + mutedWordsPref: { + type: 'object', + required: ['items'], + properties: { + items: { + type: 'array', + items: { + ref: 'lex:app.bsky.actor.defs#mutedWord', + type: 'ref', }, - banner: { - type: 'blob', - description: - 'Larger horizontal image to display behind profile view.', - accept: ['image/png', 'image/jpeg'], - maxSize: 1000000, + description: 'A list of words the account owner has muted.', + }, + }, + }, + savedFeedsPref: { + type: 'object', + required: ['pinned', 'saved'], + properties: { + saved: { + type: 'array', + items: { + type: 'string', + format: 'at-uri', }, - labels: { - type: 'union', - description: - 'Self-label values, specific to the Bluesky application, on the overall account.', - refs: ['lex:com.atproto.label.defs#selfLabels'], + }, + pinned: { + type: 'array', + items: { + type: 'string', + format: 'at-uri', }, - joinedViaStarterPack: { - type: 'ref', - ref: 'lex:com.atproto.repo.strongRef', + }, + timelineIndex: { + type: 'integer', + }, + }, + }, + threadViewPref: { + type: 'object', + properties: { + sort: { + type: 'string', + description: 'Sorting mode for threads.', + knownValues: [ + 'oldest', + 'newest', + 'most-likes', + 'random', + 'hotness', + ], + }, + prioritizeFollowedUsers: { + type: 'boolean', + description: 'Show followed users at the top of all replies.', + }, + }, + }, + hiddenPostsPref: { + type: 'object', + required: ['items'], + properties: { + items: { + type: 'array', + items: { + type: 'string', + format: 'at-uri', }, - pinnedPost: { + description: + 'A list of URIs of posts the account owner has hidden.', + }, + }, + }, + labelerPrefItem: { + type: 'object', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + }, + }, + }, + mutedWordTarget: { + type: 'string', + maxLength: 640, + knownValues: ['content', 'tag'], + maxGraphemes: 64, + }, + adultContentPref: { + type: 'object', + required: ['enabled'], + properties: { + enabled: { + type: 'boolean', + default: false, + }, + }, + }, + bskyAppStatePref: { + type: 'object', + properties: { + nuxs: { + type: 'array', + items: { + ref: 'lex:app.bsky.actor.defs#nux', type: 'ref', - ref: 'lex:com.atproto.repo.strongRef', }, - createdAt: { + maxLength: 100, + description: 'Storage for NUXs the user has encountered.', + }, + queuedNudges: { + type: 'array', + items: { type: 'string', - format: 'datetime', + maxLength: 100, + }, + maxLength: 1000, + description: + 'An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user.', + }, + activeProgressGuide: { + ref: 'lex:app.bsky.actor.defs#bskyAppProgressGuide', + type: 'ref', + }, + }, + description: + "A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this.", + }, + contentLabelPref: { + type: 'object', + required: ['label', 'visibility'], + properties: { + label: { + type: 'string', + }, + labelerDid: { + type: 'string', + format: 'did', + description: + 'Which labeler does this preference apply to? If undefined, applies globally.', + }, + visibility: { + type: 'string', + knownValues: ['ignore', 'show', 'warn', 'hide'], + }, + }, + }, + profileViewBasic: { + type: 'object', + required: ['did', 'handle'], + properties: { + did: { + type: 'string', + format: 'did', + }, + avatar: { + type: 'string', + format: 'uri', + }, + handle: { + type: 'string', + format: 'handle', + }, + labels: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#label', + type: 'ref', + }, + }, + viewer: { + ref: 'lex:app.bsky.actor.defs#viewerState', + type: 'ref', + }, + createdAt: { + type: 'string', + format: 'datetime', + }, + associated: { + ref: 'lex:app.bsky.actor.defs#profileAssociated', + type: 'ref', + }, + displayName: { + type: 'string', + maxLength: 640, + maxGraphemes: 64, + }, + }, + }, + savedFeedsPrefV2: { + type: 'object', + required: ['items'], + properties: { + items: { + type: 'array', + items: { + ref: 'lex:app.bsky.actor.defs#savedFeed', + type: 'ref', }, }, }, }, + profileAssociated: { + type: 'object', + properties: { + chat: { + ref: 'lex:app.bsky.actor.defs#profileAssociatedChat', + type: 'ref', + }, + lists: { + type: 'integer', + }, + labeler: { + type: 'boolean', + }, + feedgens: { + type: 'integer', + }, + starterPacks: { + type: 'integer', + }, + }, + }, + personalDetailsPref: { + type: 'object', + properties: { + birthDate: { + type: 'string', + format: 'datetime', + description: 'The birth date of account owner.', + }, + }, + }, + profileViewDetailed: { + type: 'object', + required: ['did', 'handle'], + properties: { + did: { + type: 'string', + format: 'did', + }, + avatar: { + type: 'string', + format: 'uri', + }, + banner: { + type: 'string', + format: 'uri', + }, + handle: { + type: 'string', + format: 'handle', + }, + labels: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#label', + type: 'ref', + }, + }, + viewer: { + ref: 'lex:app.bsky.actor.defs#viewerState', + type: 'ref', + }, + createdAt: { + type: 'string', + format: 'datetime', + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + associated: { + ref: 'lex:app.bsky.actor.defs#profileAssociated', + type: 'ref', + }, + pinnedPost: { + ref: 'lex:com.atproto.repo.strongRef', + type: 'ref', + }, + postsCount: { + type: 'integer', + }, + description: { + type: 'string', + maxLength: 2560, + maxGraphemes: 256, + }, + displayName: { + type: 'string', + maxLength: 640, + maxGraphemes: 64, + }, + followsCount: { + type: 'integer', + }, + followersCount: { + type: 'integer', + }, + joinedViaStarterPack: { + ref: 'lex:app.bsky.graph.defs#starterPackViewBasic', + type: 'ref', + }, + }, + }, + bskyAppProgressGuide: { + type: 'object', + required: ['guide'], + properties: { + guide: { + type: 'string', + maxLength: 100, + }, + }, + description: + 'If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress.', + }, + profileAssociatedChat: { + type: 'object', + required: ['allowIncoming'], + properties: { + allowIncoming: { + type: 'string', + knownValues: ['all', 'none', 'following'], + }, + }, + }, + postInteractionSettingsPref: { + type: 'object', + required: [], + properties: { + threadgateAllowRules: { + type: 'array', + items: { + refs: [ + 'lex:app.bsky.feed.threadgate#mentionRule', + 'lex:app.bsky.feed.threadgate#followerRule', + 'lex:app.bsky.feed.threadgate#followingRule', + 'lex:app.bsky.feed.threadgate#listRule', + ], + type: 'union', + }, + maxLength: 5, + description: + 'Matches threadgate record. List of rules defining who can reply to this users posts. If value is an empty array, no one can reply. If value is undefined, anyone can reply.', + }, + postgateEmbeddingRules: { + type: 'array', + items: { + refs: ['lex:app.bsky.feed.postgate#disableRule'], + type: 'union', + }, + maxLength: 5, + description: + 'Matches postgate record. List of rules defining who can embed this users posts. If value is an empty array or is undefined, no particular rules apply and anyone can embed.', + }, + }, + description: + 'Default post interaction settings for the account. These values should be applied as default values when creating new posts. These refs should mirror the threadgate and postgate records exactly.', + }, + }, + }, + AppBskyActorProfile: { + lexicon: 1, + id: 'app.bsky.actor.profile', + defs: { + main: { + type: 'record', + description: 'A declaration of a Bluesky account profile.', + key: 'literal:self', + record: { + type: 'object', + properties: { + displayName: { + type: 'string', + maxGraphemes: 64, + maxLength: 640, + }, + description: { + type: 'string', + description: 'Free-form profile description text.', + maxGraphemes: 256, + maxLength: 2560, + }, + avatar: { + type: 'blob', + description: + "Small image to be displayed next to posts from account. AKA, 'profile picture'", + accept: ['image/png', 'image/jpeg'], + maxSize: 1000000, + }, + banner: { + type: 'blob', + description: + 'Larger horizontal image to display behind profile view.', + accept: ['image/png', 'image/jpeg'], + maxSize: 1000000, + }, + labels: { + type: 'union', + description: + 'Self-label values, specific to the Bluesky application, on the overall account.', + refs: ['lex:com.atproto.label.defs#selfLabels'], + }, + joinedViaStarterPack: { + type: 'ref', + ref: 'lex:com.atproto.repo.strongRef', + }, + pinnedPost: { + type: 'ref', + ref: 'lex:com.atproto.repo.strongRef', + }, + createdAt: { + type: 'string', + format: 'datetime', + }, + }, + }, + }, + }, + }, + AppBskyEmbedDefs: { + lexicon: 1, + id: 'app.bsky.embed.defs', + defs: { + aspectRatio: { + type: 'object', + required: ['width', 'height'], + properties: { + width: { + type: 'integer', + minimum: 1, + }, + height: { + type: 'integer', + minimum: 1, + }, + }, + description: + 'width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit.', + }, + }, + }, + AppBskyEmbedExternal: { + lexicon: 1, + id: 'app.bsky.embed.external', + defs: { + main: { + type: 'object', + required: ['external'], + properties: { + external: { + ref: 'lex:app.bsky.embed.external#external', + type: 'ref', + }, + }, + description: + "A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post).", + }, + view: { + type: 'object', + required: ['external'], + properties: { + external: { + ref: 'lex:app.bsky.embed.external#viewExternal', + type: 'ref', + }, + }, + }, + external: { + type: 'object', + required: ['uri', 'title', 'description'], + properties: { + uri: { + type: 'string', + format: 'uri', + }, + thumb: { + type: 'blob', + accept: ['image/*'], + maxSize: 1000000, + }, + title: { + type: 'string', + }, + description: { + type: 'string', + }, + }, + }, + viewExternal: { + type: 'object', + required: ['uri', 'title', 'description'], + properties: { + uri: { + type: 'string', + format: 'uri', + }, + thumb: { + type: 'string', + format: 'uri', + }, + title: { + type: 'string', + }, + description: { + type: 'string', + }, + }, + }, + }, + }, + AppBskyEmbedImages: { + lexicon: 1, + id: 'app.bsky.embed.images', + description: 'A set of images embedded in a Bluesky record (eg, a post).', + defs: { + main: { + type: 'object', + required: ['images'], + properties: { + images: { + type: 'array', + items: { + ref: 'lex:app.bsky.embed.images#image', + type: 'ref', + }, + maxLength: 4, + }, + }, + }, + view: { + type: 'object', + required: ['images'], + properties: { + images: { + type: 'array', + items: { + ref: 'lex:app.bsky.embed.images#viewImage', + type: 'ref', + }, + maxLength: 4, + }, + }, + }, + image: { + type: 'object', + required: ['image', 'alt'], + properties: { + alt: { + type: 'string', + description: + 'Alt text description of the image, for accessibility.', + }, + image: { + type: 'blob', + accept: ['image/*'], + maxSize: 1000000, + }, + aspectRatio: { + ref: 'lex:app.bsky.embed.defs#aspectRatio', + type: 'ref', + }, + }, + }, + viewImage: { + type: 'object', + required: ['thumb', 'fullsize', 'alt'], + properties: { + alt: { + type: 'string', + description: + 'Alt text description of the image, for accessibility.', + }, + thumb: { + type: 'string', + format: 'uri', + description: + 'Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View.', + }, + fullsize: { + type: 'string', + format: 'uri', + description: + 'Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View.', + }, + aspectRatio: { + ref: 'lex:app.bsky.embed.defs#aspectRatio', + type: 'ref', + }, + }, + }, + }, + }, + AppBskyEmbedRecord: { + lexicon: 1, + id: 'app.bsky.embed.record', + description: + 'A representation of a record embedded in a Bluesky record (eg, a post). For example, a quote-post, or sharing a feed generator record.', + defs: { + main: { + type: 'object', + required: ['record'], + properties: { + record: { + ref: 'lex:com.atproto.repo.strongRef', + type: 'ref', + }, + }, + }, + view: { + type: 'object', + required: ['record'], + properties: { + record: { + refs: [ + 'lex:app.bsky.embed.record#viewRecord', + 'lex:app.bsky.embed.record#viewNotFound', + 'lex:app.bsky.embed.record#viewBlocked', + 'lex:app.bsky.embed.record#viewDetached', + 'lex:app.bsky.feed.defs#generatorView', + 'lex:app.bsky.graph.defs#listView', + 'lex:app.bsky.labeler.defs#labelerView', + 'lex:app.bsky.graph.defs#starterPackViewBasic', + ], + type: 'union', + }, + }, + }, + viewRecord: { + type: 'object', + required: ['uri', 'cid', 'author', 'value', 'indexedAt'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + uri: { + type: 'string', + format: 'at-uri', + }, + value: { + type: 'unknown', + description: 'The record data itself.', + }, + author: { + ref: 'lex:app.bsky.actor.defs#profileViewBasic', + type: 'ref', + }, + embeds: { + type: 'array', + items: { + refs: [ + 'lex:app.bsky.embed.images#view', + 'lex:app.bsky.embed.video#view', + 'lex:app.bsky.embed.external#view', + 'lex:app.bsky.embed.record#view', + 'lex:app.bsky.embed.recordWithMedia#view', + ], + type: 'union', + }, + }, + labels: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#label', + type: 'ref', + }, + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + likeCount: { + type: 'integer', + }, + quoteCount: { + type: 'integer', + }, + replyCount: { + type: 'integer', + }, + repostCount: { + type: 'integer', + }, + }, + }, + viewBlocked: { + type: 'object', + required: ['uri', 'blocked', 'author'], + properties: { + uri: { + type: 'string', + format: 'at-uri', + }, + author: { + ref: 'lex:app.bsky.feed.defs#blockedAuthor', + type: 'ref', + }, + blocked: { + type: 'boolean', + const: true, + }, + }, + }, + viewDetached: { + type: 'object', + required: ['uri', 'detached'], + properties: { + uri: { + type: 'string', + format: 'at-uri', + }, + detached: { + type: 'boolean', + const: true, + }, + }, + }, + viewNotFound: { + type: 'object', + required: ['uri', 'notFound'], + properties: { + uri: { + type: 'string', + format: 'at-uri', + }, + notFound: { + type: 'boolean', + const: true, + }, + }, + }, + }, + }, + AppBskyEmbedRecordWithMedia: { + lexicon: 1, + id: 'app.bsky.embed.recordWithMedia', + description: + 'A representation of a record embedded in a Bluesky record (eg, a post), alongside other compatible embeds. For example, a quote post and image, or a quote post and external URL card.', + defs: { + main: { + type: 'object', + required: ['record', 'media'], + properties: { + media: { + refs: [ + 'lex:app.bsky.embed.images', + 'lex:app.bsky.embed.video', + 'lex:app.bsky.embed.external', + ], + type: 'union', + }, + record: { + ref: 'lex:app.bsky.embed.record', + type: 'ref', + }, + }, + }, + view: { + type: 'object', + required: ['record', 'media'], + properties: { + media: { + refs: [ + 'lex:app.bsky.embed.images#view', + 'lex:app.bsky.embed.video#view', + 'lex:app.bsky.embed.external#view', + ], + type: 'union', + }, + record: { + ref: 'lex:app.bsky.embed.record#view', + type: 'ref', + }, + }, + }, + }, + }, + AppBskyEmbedVideo: { + lexicon: 1, + id: 'app.bsky.embed.video', + description: 'A video embedded in a Bluesky record (eg, a post).', + defs: { + main: { + type: 'object', + required: ['video'], + properties: { + alt: { + type: 'string', + maxLength: 10000, + description: + 'Alt text description of the video, for accessibility.', + maxGraphemes: 1000, + }, + video: { + type: 'blob', + accept: ['video/mp4'], + maxSize: 50000000, + }, + captions: { + type: 'array', + items: { + ref: 'lex:app.bsky.embed.video#caption', + type: 'ref', + }, + maxLength: 20, + }, + aspectRatio: { + ref: 'lex:app.bsky.embed.defs#aspectRatio', + type: 'ref', + }, + }, + }, + view: { + type: 'object', + required: ['cid', 'playlist'], + properties: { + alt: { + type: 'string', + maxLength: 10000, + maxGraphemes: 1000, + }, + cid: { + type: 'string', + format: 'cid', + }, + playlist: { + type: 'string', + format: 'uri', + }, + thumbnail: { + type: 'string', + format: 'uri', + }, + aspectRatio: { + ref: 'lex:app.bsky.embed.defs#aspectRatio', + type: 'ref', + }, + }, + }, + caption: { + type: 'object', + required: ['lang', 'file'], + properties: { + file: { + type: 'blob', + accept: ['text/vtt'], + maxSize: 20000, + }, + lang: { + type: 'string', + format: 'language', + }, + }, + }, + }, + }, + AppBskyFeedDefs: { + lexicon: 1, + id: 'app.bsky.feed.defs', + defs: { + postView: { + type: 'object', + required: ['uri', 'cid', 'author', 'record', 'indexedAt'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + uri: { + type: 'string', + format: 'at-uri', + }, + embed: { + refs: [ + 'lex:app.bsky.embed.images#view', + 'lex:app.bsky.embed.video#view', + 'lex:app.bsky.embed.external#view', + 'lex:app.bsky.embed.record#view', + 'lex:app.bsky.embed.recordWithMedia#view', + ], + type: 'union', + }, + author: { + ref: 'lex:app.bsky.actor.defs#profileViewBasic', + type: 'ref', + }, + labels: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#label', + type: 'ref', + }, + }, + record: { + type: 'unknown', + }, + viewer: { + ref: 'lex:app.bsky.feed.defs#viewerState', + type: 'ref', + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + likeCount: { + type: 'integer', + }, + quoteCount: { + type: 'integer', + }, + replyCount: { + type: 'integer', + }, + threadgate: { + ref: 'lex:app.bsky.feed.defs#threadgateView', + type: 'ref', + }, + repostCount: { + type: 'integer', + }, + }, + }, + replyRef: { + type: 'object', + required: ['root', 'parent'], + properties: { + root: { + refs: [ + 'lex:app.bsky.feed.defs#postView', + 'lex:app.bsky.feed.defs#notFoundPost', + 'lex:app.bsky.feed.defs#blockedPost', + ], + type: 'union', + }, + parent: { + refs: [ + 'lex:app.bsky.feed.defs#postView', + 'lex:app.bsky.feed.defs#notFoundPost', + 'lex:app.bsky.feed.defs#blockedPost', + ], + type: 'union', + }, + grandparentAuthor: { + ref: 'lex:app.bsky.actor.defs#profileViewBasic', + type: 'ref', + description: + 'When parent is a reply to another post, this is the author of that post.', + }, + }, + }, + reasonPin: { + type: 'object', + properties: {}, + }, + blockedPost: { + type: 'object', + required: ['uri', 'blocked', 'author'], + properties: { + uri: { + type: 'string', + format: 'at-uri', + }, + author: { + ref: 'lex:app.bsky.feed.defs#blockedAuthor', + type: 'ref', + }, + blocked: { + type: 'boolean', + const: true, + }, + }, + }, + interaction: { + type: 'object', + properties: { + item: { + type: 'string', + format: 'at-uri', + }, + event: { + type: 'string', + knownValues: [ + 'app.bsky.feed.defs#requestLess', + 'app.bsky.feed.defs#requestMore', + 'app.bsky.feed.defs#clickthroughItem', + 'app.bsky.feed.defs#clickthroughAuthor', + 'app.bsky.feed.defs#clickthroughReposter', + 'app.bsky.feed.defs#clickthroughEmbed', + 'app.bsky.feed.defs#interactionSeen', + 'app.bsky.feed.defs#interactionLike', + 'app.bsky.feed.defs#interactionRepost', + 'app.bsky.feed.defs#interactionReply', + 'app.bsky.feed.defs#interactionQuote', + 'app.bsky.feed.defs#interactionShare', + ], + }, + feedContext: { + type: 'string', + maxLength: 2000, + description: + 'Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton.', + }, + }, + }, + requestLess: { + type: 'token', + description: + 'Request that less content like the given feed item be shown in the feed', + }, + requestMore: { + type: 'token', + description: + 'Request that more content like the given feed item be shown in the feed', + }, + viewerState: { + type: 'object', + properties: { + like: { + type: 'string', + format: 'at-uri', + }, + pinned: { + type: 'boolean', + }, + repost: { + type: 'string', + format: 'at-uri', + }, + threadMuted: { + type: 'boolean', + }, + replyDisabled: { + type: 'boolean', + }, + embeddingDisabled: { + type: 'boolean', + }, + }, + description: + "Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests.", + }, + feedViewPost: { + type: 'object', + required: ['post'], + properties: { + post: { + ref: 'lex:app.bsky.feed.defs#postView', + type: 'ref', + }, + reply: { + ref: 'lex:app.bsky.feed.defs#replyRef', + type: 'ref', + }, + reason: { + refs: [ + 'lex:app.bsky.feed.defs#reasonRepost', + 'lex:app.bsky.feed.defs#reasonPin', + ], + type: 'union', + }, + feedContext: { + type: 'string', + maxLength: 2000, + description: + 'Context provided by feed generator that may be passed back alongside interactions.', + }, + }, + }, + notFoundPost: { + type: 'object', + required: ['uri', 'notFound'], + properties: { + uri: { + type: 'string', + format: 'at-uri', + }, + notFound: { + type: 'boolean', + const: true, + }, + }, + }, + reasonRepost: { + type: 'object', + required: ['by', 'indexedAt'], + properties: { + by: { + ref: 'lex:app.bsky.actor.defs#profileViewBasic', + type: 'ref', + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + }, + }, + blockedAuthor: { + type: 'object', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + }, + viewer: { + ref: 'lex:app.bsky.actor.defs#viewerState', + type: 'ref', + }, + }, + }, + generatorView: { + type: 'object', + required: ['uri', 'cid', 'did', 'creator', 'displayName', 'indexedAt'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + did: { + type: 'string', + format: 'did', + }, + uri: { + type: 'string', + format: 'at-uri', + }, + avatar: { + type: 'string', + format: 'uri', + }, + labels: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#label', + type: 'ref', + }, + }, + viewer: { + ref: 'lex:app.bsky.feed.defs#generatorViewerState', + type: 'ref', + }, + creator: { + ref: 'lex:app.bsky.actor.defs#profileView', + type: 'ref', + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + likeCount: { + type: 'integer', + minimum: 0, + }, + contentMode: { + type: 'string', + knownValues: [ + 'app.bsky.feed.defs#contentModeUnspecified', + 'app.bsky.feed.defs#contentModeVideo', + ], + }, + description: { + type: 'string', + maxLength: 3000, + maxGraphemes: 300, + }, + displayName: { + type: 'string', + }, + descriptionFacets: { + type: 'array', + items: { + ref: 'lex:app.bsky.richtext.facet', + type: 'ref', + }, + }, + acceptsInteractions: { + type: 'boolean', + }, + }, + }, + threadContext: { + type: 'object', + properties: { + rootAuthorLike: { + type: 'string', + format: 'at-uri', + }, + }, + description: + 'Metadata about this post within the context of the thread it is in.', + }, + threadViewPost: { + type: 'object', + required: ['post'], + properties: { + post: { + ref: 'lex:app.bsky.feed.defs#postView', + type: 'ref', + }, + parent: { + refs: [ + 'lex:app.bsky.feed.defs#threadViewPost', + 'lex:app.bsky.feed.defs#notFoundPost', + 'lex:app.bsky.feed.defs#blockedPost', + ], + type: 'union', + }, + replies: { + type: 'array', + items: { + refs: [ + 'lex:app.bsky.feed.defs#threadViewPost', + 'lex:app.bsky.feed.defs#notFoundPost', + 'lex:app.bsky.feed.defs#blockedPost', + ], + type: 'union', + }, + }, + threadContext: { + ref: 'lex:app.bsky.feed.defs#threadContext', + type: 'ref', + }, + }, + }, + threadgateView: { + type: 'object', + properties: { + cid: { + type: 'string', + format: 'cid', + }, + uri: { + type: 'string', + format: 'at-uri', + }, + lists: { + type: 'array', + items: { + ref: 'lex:app.bsky.graph.defs#listViewBasic', + type: 'ref', + }, + }, + record: { + type: 'unknown', + }, + }, + }, + interactionLike: { + type: 'token', + description: 'User liked the feed item', + }, + interactionSeen: { + type: 'token', + description: 'Feed item was seen by user', + }, + clickthroughItem: { + type: 'token', + description: 'User clicked through to the feed item', + }, + contentModeVideo: { + type: 'token', + description: + 'Declares the feed generator returns posts containing app.bsky.embed.video embeds.', + }, + interactionQuote: { + type: 'token', + description: 'User quoted the feed item', + }, + interactionReply: { + type: 'token', + description: 'User replied to the feed item', + }, + interactionShare: { + type: 'token', + description: 'User shared the feed item', + }, + skeletonFeedPost: { + type: 'object', + required: ['post'], + properties: { + post: { + type: 'string', + format: 'at-uri', + }, + reason: { + refs: [ + 'lex:app.bsky.feed.defs#skeletonReasonRepost', + 'lex:app.bsky.feed.defs#skeletonReasonPin', + ], + type: 'union', + }, + feedContext: { + type: 'string', + maxLength: 2000, + description: + 'Context that will be passed through to client and may be passed to feed generator back alongside interactions.', + }, + }, + }, + clickthroughEmbed: { + type: 'token', + description: + 'User clicked through to the embedded content of the feed item', + }, + interactionRepost: { + type: 'token', + description: 'User reposted the feed item', + }, + skeletonReasonPin: { + type: 'object', + properties: {}, + }, + clickthroughAuthor: { + type: 'token', + description: 'User clicked through to the author of the feed item', + }, + clickthroughReposter: { + type: 'token', + description: 'User clicked through to the reposter of the feed item', + }, + generatorViewerState: { + type: 'object', + properties: { + like: { + type: 'string', + format: 'at-uri', + }, + }, + }, + skeletonReasonRepost: { + type: 'object', + required: ['repost'], + properties: { + repost: { + type: 'string', + format: 'at-uri', + }, + }, + }, + contentModeUnspecified: { + type: 'token', + description: 'Declares the feed generator returns any types of posts.', + }, + }, + }, + AppBskyFeedPostgate: { + lexicon: 1, + id: 'app.bsky.feed.postgate', + defs: { + main: { + key: 'tid', + type: 'record', + record: { + type: 'object', + required: ['post', 'createdAt'], + properties: { + post: { + type: 'string', + format: 'at-uri', + description: 'Reference (AT-URI) to the post record.', + }, + createdAt: { + type: 'string', + format: 'datetime', + }, + embeddingRules: { + type: 'array', + items: { + refs: ['lex:app.bsky.feed.postgate#disableRule'], + type: 'union', + }, + maxLength: 5, + description: + 'List of rules defining who can embed this post. If value is an empty array or is undefined, no particular rules apply and anyone can embed.', + }, + detachedEmbeddingUris: { + type: 'array', + items: { + type: 'string', + format: 'at-uri', + }, + maxLength: 50, + description: + 'List of AT-URIs embedding this post that the author has detached from.', + }, + }, + }, + description: + 'Record defining interaction rules for a post. The record key (rkey) of the postgate record must match the record key of the post, and that record must be in the same repository.', + }, + disableRule: { + type: 'object', + properties: {}, + description: 'Disables embedding of this post.', + }, + }, + }, + AppBskyFeedThreadgate: { + lexicon: 1, + id: 'app.bsky.feed.threadgate', + defs: { + main: { + key: 'tid', + type: 'record', + record: { + type: 'object', + required: ['post', 'createdAt'], + properties: { + post: { + type: 'string', + format: 'at-uri', + description: 'Reference (AT-URI) to the post record.', + }, + allow: { + type: 'array', + items: { + refs: [ + 'lex:app.bsky.feed.threadgate#mentionRule', + 'lex:app.bsky.feed.threadgate#followerRule', + 'lex:app.bsky.feed.threadgate#followingRule', + 'lex:app.bsky.feed.threadgate#listRule', + ], + type: 'union', + }, + maxLength: 5, + description: + 'List of rules defining who can reply to this post. If value is an empty array, no one can reply. If value is undefined, anyone can reply.', + }, + createdAt: { + type: 'string', + format: 'datetime', + }, + hiddenReplies: { + type: 'array', + items: { + type: 'string', + format: 'at-uri', + }, + maxLength: 50, + description: 'List of hidden reply URIs.', + }, + }, + }, + description: + "Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository.", + }, + listRule: { + type: 'object', + required: ['list'], + properties: { + list: { + type: 'string', + format: 'at-uri', + }, + }, + description: 'Allow replies from actors on a list.', + }, + mentionRule: { + type: 'object', + properties: {}, + description: 'Allow replies from actors mentioned in your post.', + }, + followerRule: { + type: 'object', + properties: {}, + description: 'Allow replies from actors who follow you.', + }, + followingRule: { + type: 'object', + properties: {}, + description: 'Allow replies from actors you follow.', + }, + }, + }, + AppBskyGraphDefs: { + lexicon: 1, + id: 'app.bsky.graph.defs', + defs: { + modlist: { + type: 'token', + description: + 'A list of actors to apply an aggregate moderation action (mute/block) on.', + }, + listView: { + type: 'object', + required: ['uri', 'cid', 'creator', 'name', 'purpose', 'indexedAt'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + uri: { + type: 'string', + format: 'at-uri', + }, + name: { + type: 'string', + maxLength: 64, + minLength: 1, + }, + avatar: { + type: 'string', + format: 'uri', + }, + labels: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#label', + type: 'ref', + }, + }, + viewer: { + ref: 'lex:app.bsky.graph.defs#listViewerState', + type: 'ref', + }, + creator: { + ref: 'lex:app.bsky.actor.defs#profileView', + type: 'ref', + }, + purpose: { + ref: 'lex:app.bsky.graph.defs#listPurpose', + type: 'ref', + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + description: { + type: 'string', + maxLength: 3000, + maxGraphemes: 300, + }, + listItemCount: { + type: 'integer', + minimum: 0, + }, + descriptionFacets: { + type: 'array', + items: { + ref: 'lex:app.bsky.richtext.facet', + type: 'ref', + }, + }, + }, + }, + curatelist: { + type: 'token', + description: + 'A list of actors used for curation purposes such as list feeds or interaction gating.', + }, + listPurpose: { + type: 'string', + knownValues: [ + 'app.bsky.graph.defs#modlist', + 'app.bsky.graph.defs#curatelist', + 'app.bsky.graph.defs#referencelist', + ], + }, + listItemView: { + type: 'object', + required: ['uri', 'subject'], + properties: { + uri: { + type: 'string', + format: 'at-uri', + }, + subject: { + ref: 'lex:app.bsky.actor.defs#profileView', + type: 'ref', + }, + }, + }, + relationship: { + type: 'object', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + }, + following: { + type: 'string', + format: 'at-uri', + description: + 'if the actor follows this DID, this is the AT-URI of the follow record', + }, + followedBy: { + type: 'string', + format: 'at-uri', + description: + 'if the actor is followed by this DID, contains the AT-URI of the follow record', + }, + }, + description: + 'lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object)', + }, + listViewBasic: { + type: 'object', + required: ['uri', 'cid', 'name', 'purpose'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + uri: { + type: 'string', + format: 'at-uri', + }, + name: { + type: 'string', + maxLength: 64, + minLength: 1, + }, + avatar: { + type: 'string', + format: 'uri', + }, + labels: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#label', + type: 'ref', + }, + }, + viewer: { + ref: 'lex:app.bsky.graph.defs#listViewerState', + type: 'ref', + }, + purpose: { + ref: 'lex:app.bsky.graph.defs#listPurpose', + type: 'ref', + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + listItemCount: { + type: 'integer', + minimum: 0, + }, + }, + }, + notFoundActor: { + type: 'object', + required: ['actor', 'notFound'], + properties: { + actor: { + type: 'string', + format: 'at-identifier', + }, + notFound: { + type: 'boolean', + const: true, + }, + }, + description: 'indicates that a handle or DID could not be resolved', + }, + referencelist: { + type: 'token', + description: + 'A list of actors used for only for reference purposes such as within a starter pack.', + }, + listViewerState: { + type: 'object', + properties: { + muted: { + type: 'boolean', + }, + blocked: { + type: 'string', + format: 'at-uri', + }, + }, + }, + starterPackView: { + type: 'object', + required: ['uri', 'cid', 'record', 'creator', 'indexedAt'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + uri: { + type: 'string', + format: 'at-uri', + }, + list: { + ref: 'lex:app.bsky.graph.defs#listViewBasic', + type: 'ref', + }, + feeds: { + type: 'array', + items: { + ref: 'lex:app.bsky.feed.defs#generatorView', + type: 'ref', + }, + maxLength: 3, + }, + labels: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#label', + type: 'ref', + }, + }, + record: { + type: 'unknown', + }, + creator: { + ref: 'lex:app.bsky.actor.defs#profileViewBasic', + type: 'ref', + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + joinedWeekCount: { + type: 'integer', + minimum: 0, + }, + listItemsSample: { + type: 'array', + items: { + ref: 'lex:app.bsky.graph.defs#listItemView', + type: 'ref', + }, + maxLength: 12, + }, + joinedAllTimeCount: { + type: 'integer', + minimum: 0, + }, + }, + }, + starterPackViewBasic: { + type: 'object', + required: ['uri', 'cid', 'record', 'creator', 'indexedAt'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + uri: { + type: 'string', + format: 'at-uri', + }, + labels: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#label', + type: 'ref', + }, + }, + record: { + type: 'unknown', + }, + creator: { + ref: 'lex:app.bsky.actor.defs#profileViewBasic', + type: 'ref', + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + listItemCount: { + type: 'integer', + minimum: 0, + }, + joinedWeekCount: { + type: 'integer', + minimum: 0, + }, + joinedAllTimeCount: { + type: 'integer', + minimum: 0, + }, + }, + }, + }, + }, + AppBskyLabelerDefs: { + lexicon: 1, + id: 'app.bsky.labeler.defs', + defs: { + labelerView: { + type: 'object', + required: ['uri', 'cid', 'creator', 'indexedAt'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + uri: { + type: 'string', + format: 'at-uri', + }, + labels: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#label', + type: 'ref', + }, + }, + viewer: { + ref: 'lex:app.bsky.labeler.defs#labelerViewerState', + type: 'ref', + }, + creator: { + ref: 'lex:app.bsky.actor.defs#profileView', + type: 'ref', + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + likeCount: { + type: 'integer', + minimum: 0, + }, + }, + }, + labelerPolicies: { + type: 'object', + required: ['labelValues'], + properties: { + labelValues: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#labelValue', + type: 'ref', + }, + description: + 'The label values which this labeler publishes. May include global or custom labels.', + }, + labelValueDefinitions: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#labelValueDefinition', + type: 'ref', + }, + description: + 'Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler.', + }, + }, + }, + labelerViewerState: { + type: 'object', + properties: { + like: { + type: 'string', + format: 'at-uri', + }, + }, + }, + labelerViewDetailed: { + type: 'object', + required: ['uri', 'cid', 'creator', 'policies', 'indexedAt'], + properties: { + cid: { + type: 'string', + format: 'cid', + }, + uri: { + type: 'string', + format: 'at-uri', + }, + labels: { + type: 'array', + items: { + ref: 'lex:com.atproto.label.defs#label', + type: 'ref', + }, + }, + viewer: { + ref: 'lex:app.bsky.labeler.defs#labelerViewerState', + type: 'ref', + }, + creator: { + ref: 'lex:app.bsky.actor.defs#profileView', + type: 'ref', + }, + policies: { + ref: 'lex:app.bsky.labeler.defs#labelerPolicies', + type: 'ref', + }, + indexedAt: { + type: 'string', + format: 'datetime', + }, + likeCount: { + type: 'integer', + minimum: 0, + }, + }, + }, + }, + }, + AppBskyRichtextFacet: { + lexicon: 1, + id: 'app.bsky.richtext.facet', + defs: { + tag: { + type: 'object', + required: ['tag'], + properties: { + tag: { + type: 'string', + maxLength: 640, + maxGraphemes: 64, + }, + }, + description: + "Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags').", + }, + link: { + type: 'object', + required: ['uri'], + properties: { + uri: { + type: 'string', + format: 'uri', + }, + }, + description: + 'Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.', + }, + main: { + type: 'object', + required: ['index', 'features'], + properties: { + index: { + ref: 'lex:app.bsky.richtext.facet#byteSlice', + type: 'ref', + }, + features: { + type: 'array', + items: { + refs: [ + 'lex:app.bsky.richtext.facet#mention', + 'lex:app.bsky.richtext.facet#link', + 'lex:app.bsky.richtext.facet#tag', + ], + type: 'union', + }, + }, + }, + description: 'Annotation of a sub-string within rich text.', + }, + mention: { + type: 'object', + required: ['did'], + properties: { + did: { + type: 'string', + format: 'did', + }, + }, + description: + "Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID.", + }, + byteSlice: { + type: 'object', + required: ['byteStart', 'byteEnd'], + properties: { + byteEnd: { + type: 'integer', + minimum: 0, + }, + byteStart: { + type: 'integer', + minimum: 0, + }, + }, + description: + 'Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets.', + }, }, }, } as const satisfies Record @@ -1294,4 +3436,16 @@ export const ids = { ComAtprotoRepoUploadBlob: 'com.atproto.repo.uploadBlob', AppBskyActorDefs: 'app.bsky.actor.defs', AppBskyActorProfile: 'app.bsky.actor.profile', + AppBskyEmbedDefs: 'app.bsky.embed.defs', + AppBskyEmbedExternal: 'app.bsky.embed.external', + AppBskyEmbedImages: 'app.bsky.embed.images', + AppBskyEmbedRecord: 'app.bsky.embed.record', + AppBskyEmbedRecordWithMedia: 'app.bsky.embed.recordWithMedia', + AppBskyEmbedVideo: 'app.bsky.embed.video', + AppBskyFeedDefs: 'app.bsky.feed.defs', + AppBskyFeedPostgate: 'app.bsky.feed.postgate', + AppBskyFeedThreadgate: 'app.bsky.feed.threadgate', + AppBskyGraphDefs: 'app.bsky.graph.defs', + AppBskyLabelerDefs: 'app.bsky.labeler.defs', + AppBskyRichtextFacet: 'app.bsky.richtext.facet', } as const diff --git a/packages/lexicon/src/types/app/bsky/actor/defs.ts b/packages/lexicon/src/types/app/bsky/actor/defs.ts index 5f65150..b7c119c 100644 --- a/packages/lexicon/src/types/app/bsky/actor/defs.ts +++ b/packages/lexicon/src/types/app/bsky/actor/defs.ts @@ -7,21 +7,107 @@ import { CID } from 'multiformats/cid' import { validate as _validate } from '../../../../lexicons' import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' import type * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs.js' +import type * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef.js' +import type * as AppBskyFeedPostgate from '../feed/postgate.js' +import type * as AppBskyFeedThreadgate from '../feed/threadgate.js' +import type * as AppBskyGraphDefs from '../graph/defs.js' const is$typed = _is$typed, validate = _validate const id = 'app.bsky.actor.defs' +/** A new user experiences (NUX) storage object */ +export interface Nux { + $type?: 'app.bsky.actor.defs#nux' + id: string + /** Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters. */ + data?: string + completed: boolean + /** The date and time at which the NUX will expire and should be considered completed. */ + expiresAt?: string +} + +const hashNux = 'nux' + +export function isNux(v: V) { + return is$typed(v, id, hashNux) +} + +export function validateNux(v: V) { + return validate(v, id, hashNux) +} + +/** A word that the account owner has muted. */ +export interface MutedWord { + $type?: 'app.bsky.actor.defs#mutedWord' + id?: string + /** The muted word itself. */ + value: string + /** The intended targets of the muted word. */ + targets: MutedWordTarget[] + /** The date and time at which the muted word will expire and no longer be applied. */ + expiresAt?: string + /** Groups of users to apply the muted word to. If undefined, applies to all users. */ + actorTarget: 'all' | 'exclude-following' | (string & {}) +} + +const hashMutedWord = 'mutedWord' + +export function isMutedWord(v: V) { + return is$typed(v, id, hashMutedWord) +} + +export function validateMutedWord(v: V) { + return validate(v, id, hashMutedWord) +} + +export interface SavedFeed { + $type?: 'app.bsky.actor.defs#savedFeed' + id: string + type: 'feed' | 'list' | 'timeline' | (string & {}) + value: string + pinned: boolean +} + +const hashSavedFeed = 'savedFeed' + +export function isSavedFeed(v: V) { + return is$typed(v, id, hashSavedFeed) +} + +export function validateSavedFeed(v: V) { + return validate(v, id, hashSavedFeed) +} + +export type Preferences = ( + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | { $type: string } +)[] + export interface ProfileView { $type?: 'app.bsky.actor.defs#profileView' did: string - handle: string - displayName?: string - description?: string avatar?: string - indexedAt?: string - createdAt?: string + handle: string labels?: ComAtprotoLabelDefs.Label[] + viewer?: ViewerState + createdAt?: string + indexedAt?: string + associated?: ProfileAssociated + description?: string + displayName?: string } const hashProfileView = 'profileView' @@ -33,3 +119,408 @@ export function isProfileView(v: V) { export function validateProfileView(v: V) { return validate(v, id, hashProfileView) } + +/** Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests. */ +export interface ViewerState { + $type?: 'app.bsky.actor.defs#viewerState' + muted?: boolean + blocking?: string + blockedBy?: boolean + following?: string + followedBy?: string + mutedByList?: AppBskyGraphDefs.ListViewBasic + blockingByList?: AppBskyGraphDefs.ListViewBasic + knownFollowers?: KnownFollowers +} + +const hashViewerState = 'viewerState' + +export function isViewerState(v: V) { + return is$typed(v, id, hashViewerState) +} + +export function validateViewerState(v: V) { + return validate(v, id, hashViewerState) +} + +export interface FeedViewPref { + $type?: 'app.bsky.actor.defs#feedViewPref' + /** The URI of the feed, or an identifier which describes the feed. */ + feed: string + /** Hide replies in the feed. */ + hideReplies?: boolean + /** Hide reposts in the feed. */ + hideReposts?: boolean + /** Hide quote posts in the feed. */ + hideQuotePosts?: boolean + /** Hide replies in the feed if they do not have this number of likes. */ + hideRepliesByLikeCount?: number + /** Hide replies in the feed if they are not by followed users. */ + hideRepliesByUnfollowed: boolean +} + +const hashFeedViewPref = 'feedViewPref' + +export function isFeedViewPref(v: V) { + return is$typed(v, id, hashFeedViewPref) +} + +export function validateFeedViewPref(v: V) { + return validate(v, id, hashFeedViewPref) +} + +export interface LabelersPref { + $type?: 'app.bsky.actor.defs#labelersPref' + labelers: LabelerPrefItem[] +} + +const hashLabelersPref = 'labelersPref' + +export function isLabelersPref(v: V) { + return is$typed(v, id, hashLabelersPref) +} + +export function validateLabelersPref(v: V) { + return validate(v, id, hashLabelersPref) +} + +export interface InterestsPref { + $type?: 'app.bsky.actor.defs#interestsPref' + /** A list of tags which describe the account owner's interests gathered during onboarding. */ + tags: string[] +} + +const hashInterestsPref = 'interestsPref' + +export function isInterestsPref(v: V) { + return is$typed(v, id, hashInterestsPref) +} + +export function validateInterestsPref(v: V) { + return validate(v, id, hashInterestsPref) +} + +/** The subject's followers whom you also follow */ +export interface KnownFollowers { + $type?: 'app.bsky.actor.defs#knownFollowers' + count: number + followers: ProfileViewBasic[] +} + +const hashKnownFollowers = 'knownFollowers' + +export function isKnownFollowers(v: V) { + return is$typed(v, id, hashKnownFollowers) +} + +export function validateKnownFollowers(v: V) { + return validate(v, id, hashKnownFollowers) +} + +export interface MutedWordsPref { + $type?: 'app.bsky.actor.defs#mutedWordsPref' + /** A list of words the account owner has muted. */ + items: MutedWord[] +} + +const hashMutedWordsPref = 'mutedWordsPref' + +export function isMutedWordsPref(v: V) { + return is$typed(v, id, hashMutedWordsPref) +} + +export function validateMutedWordsPref(v: V) { + return validate(v, id, hashMutedWordsPref) +} + +export interface SavedFeedsPref { + $type?: 'app.bsky.actor.defs#savedFeedsPref' + saved: string[] + pinned: string[] + timelineIndex?: number +} + +const hashSavedFeedsPref = 'savedFeedsPref' + +export function isSavedFeedsPref(v: V) { + return is$typed(v, id, hashSavedFeedsPref) +} + +export function validateSavedFeedsPref(v: V) { + return validate(v, id, hashSavedFeedsPref) +} + +export interface ThreadViewPref { + $type?: 'app.bsky.actor.defs#threadViewPref' + /** Sorting mode for threads. */ + sort?: + | 'oldest' + | 'newest' + | 'most-likes' + | 'random' + | 'hotness' + | (string & {}) + /** Show followed users at the top of all replies. */ + prioritizeFollowedUsers?: boolean +} + +const hashThreadViewPref = 'threadViewPref' + +export function isThreadViewPref(v: V) { + return is$typed(v, id, hashThreadViewPref) +} + +export function validateThreadViewPref(v: V) { + return validate(v, id, hashThreadViewPref) +} + +export interface HiddenPostsPref { + $type?: 'app.bsky.actor.defs#hiddenPostsPref' + /** A list of URIs of posts the account owner has hidden. */ + items: string[] +} + +const hashHiddenPostsPref = 'hiddenPostsPref' + +export function isHiddenPostsPref(v: V) { + return is$typed(v, id, hashHiddenPostsPref) +} + +export function validateHiddenPostsPref(v: V) { + return validate(v, id, hashHiddenPostsPref) +} + +export interface LabelerPrefItem { + $type?: 'app.bsky.actor.defs#labelerPrefItem' + did: string +} + +const hashLabelerPrefItem = 'labelerPrefItem' + +export function isLabelerPrefItem(v: V) { + return is$typed(v, id, hashLabelerPrefItem) +} + +export function validateLabelerPrefItem(v: V) { + return validate(v, id, hashLabelerPrefItem) +} + +export type MutedWordTarget = 'content' | 'tag' | (string & {}) + +export interface AdultContentPref { + $type?: 'app.bsky.actor.defs#adultContentPref' + enabled: boolean +} + +const hashAdultContentPref = 'adultContentPref' + +export function isAdultContentPref(v: V) { + return is$typed(v, id, hashAdultContentPref) +} + +export function validateAdultContentPref(v: V) { + return validate(v, id, hashAdultContentPref) +} + +/** A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this. */ +export interface BskyAppStatePref { + $type?: 'app.bsky.actor.defs#bskyAppStatePref' + /** Storage for NUXs the user has encountered. */ + nuxs?: Nux[] + /** An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user. */ + queuedNudges?: string[] + activeProgressGuide?: BskyAppProgressGuide +} + +const hashBskyAppStatePref = 'bskyAppStatePref' + +export function isBskyAppStatePref(v: V) { + return is$typed(v, id, hashBskyAppStatePref) +} + +export function validateBskyAppStatePref(v: V) { + return validate(v, id, hashBskyAppStatePref) +} + +export interface ContentLabelPref { + $type?: 'app.bsky.actor.defs#contentLabelPref' + label: string + /** Which labeler does this preference apply to? If undefined, applies globally. */ + labelerDid?: string + visibility: 'ignore' | 'show' | 'warn' | 'hide' | (string & {}) +} + +const hashContentLabelPref = 'contentLabelPref' + +export function isContentLabelPref(v: V) { + return is$typed(v, id, hashContentLabelPref) +} + +export function validateContentLabelPref(v: V) { + return validate(v, id, hashContentLabelPref) +} + +export interface ProfileViewBasic { + $type?: 'app.bsky.actor.defs#profileViewBasic' + did: string + avatar?: string + handle: string + labels?: ComAtprotoLabelDefs.Label[] + viewer?: ViewerState + createdAt?: string + associated?: ProfileAssociated + displayName?: string +} + +const hashProfileViewBasic = 'profileViewBasic' + +export function isProfileViewBasic(v: V) { + return is$typed(v, id, hashProfileViewBasic) +} + +export function validateProfileViewBasic(v: V) { + return validate(v, id, hashProfileViewBasic) +} + +export interface SavedFeedsPrefV2 { + $type?: 'app.bsky.actor.defs#savedFeedsPrefV2' + items: SavedFeed[] +} + +const hashSavedFeedsPrefV2 = 'savedFeedsPrefV2' + +export function isSavedFeedsPrefV2(v: V) { + return is$typed(v, id, hashSavedFeedsPrefV2) +} + +export function validateSavedFeedsPrefV2(v: V) { + return validate(v, id, hashSavedFeedsPrefV2) +} + +export interface ProfileAssociated { + $type?: 'app.bsky.actor.defs#profileAssociated' + chat?: ProfileAssociatedChat + lists?: number + labeler?: boolean + feedgens?: number + starterPacks?: number +} + +const hashProfileAssociated = 'profileAssociated' + +export function isProfileAssociated(v: V) { + return is$typed(v, id, hashProfileAssociated) +} + +export function validateProfileAssociated(v: V) { + return validate(v, id, hashProfileAssociated) +} + +export interface PersonalDetailsPref { + $type?: 'app.bsky.actor.defs#personalDetailsPref' + /** The birth date of account owner. */ + birthDate?: string +} + +const hashPersonalDetailsPref = 'personalDetailsPref' + +export function isPersonalDetailsPref(v: V) { + return is$typed(v, id, hashPersonalDetailsPref) +} + +export function validatePersonalDetailsPref(v: V) { + return validate(v, id, hashPersonalDetailsPref) +} + +export interface ProfileViewDetailed { + $type?: 'app.bsky.actor.defs#profileViewDetailed' + did: string + avatar?: string + banner?: string + handle: string + labels?: ComAtprotoLabelDefs.Label[] + viewer?: ViewerState + createdAt?: string + indexedAt?: string + associated?: ProfileAssociated + pinnedPost?: ComAtprotoRepoStrongRef.Main + postsCount?: number + description?: string + displayName?: string + followsCount?: number + followersCount?: number + joinedViaStarterPack?: AppBskyGraphDefs.StarterPackViewBasic +} + +const hashProfileViewDetailed = 'profileViewDetailed' + +export function isProfileViewDetailed(v: V) { + return is$typed(v, id, hashProfileViewDetailed) +} + +export function validateProfileViewDetailed(v: V) { + return validate(v, id, hashProfileViewDetailed) +} + +/** If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress. */ +export interface BskyAppProgressGuide { + $type?: 'app.bsky.actor.defs#bskyAppProgressGuide' + guide: string +} + +const hashBskyAppProgressGuide = 'bskyAppProgressGuide' + +export function isBskyAppProgressGuide(v: V) { + return is$typed(v, id, hashBskyAppProgressGuide) +} + +export function validateBskyAppProgressGuide(v: V) { + return validate(v, id, hashBskyAppProgressGuide) +} + +export interface ProfileAssociatedChat { + $type?: 'app.bsky.actor.defs#profileAssociatedChat' + allowIncoming: 'all' | 'none' | 'following' | (string & {}) +} + +const hashProfileAssociatedChat = 'profileAssociatedChat' + +export function isProfileAssociatedChat(v: V) { + return is$typed(v, id, hashProfileAssociatedChat) +} + +export function validateProfileAssociatedChat(v: V) { + return validate(v, id, hashProfileAssociatedChat) +} + +/** Default post interaction settings for the account. These values should be applied as default values when creating new posts. These refs should mirror the threadgate and postgate records exactly. */ +export interface PostInteractionSettingsPref { + $type?: 'app.bsky.actor.defs#postInteractionSettingsPref' + /** Matches threadgate record. List of rules defining who can reply to this users posts. If value is an empty array, no one can reply. If value is undefined, anyone can reply. */ + threadgateAllowRules?: ( + | $Typed + | $Typed + | $Typed + | $Typed + | { $type: string } + )[] + /** Matches postgate record. List of rules defining who can embed this users posts. If value is an empty array or is undefined, no particular rules apply and anyone can embed. */ + postgateEmbeddingRules?: ( + | $Typed + | { $type: string } + )[] +} + +const hashPostInteractionSettingsPref = 'postInteractionSettingsPref' + +export function isPostInteractionSettingsPref(v: V) { + return is$typed(v, id, hashPostInteractionSettingsPref) +} + +export function validatePostInteractionSettingsPref(v: V) { + return validate( + v, + id, + hashPostInteractionSettingsPref, + ) +} diff --git a/packages/lexicon/src/types/app/bsky/embed/defs.ts b/packages/lexicon/src/types/app/bsky/embed/defs.ts new file mode 100644 index 0000000..a888fb0 --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/embed/defs.ts @@ -0,0 +1,29 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.embed.defs' + +/** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */ +export interface AspectRatio { + $type?: 'app.bsky.embed.defs#aspectRatio' + width: number + height: number +} + +const hashAspectRatio = 'aspectRatio' + +export function isAspectRatio(v: V) { + return is$typed(v, id, hashAspectRatio) +} + +export function validateAspectRatio(v: V) { + return validate(v, id, hashAspectRatio) +} diff --git a/packages/lexicon/src/types/app/bsky/embed/external.ts b/packages/lexicon/src/types/app/bsky/embed/external.ts new file mode 100644 index 0000000..7b00bb7 --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/embed/external.ts @@ -0,0 +1,79 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.embed.external' + +/** A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post). */ +export interface Main { + $type?: 'app.bsky.embed.external' + external: External +} + +const hashMain = 'main' + +export function isMain(v: V) { + return is$typed(v, id, hashMain) +} + +export function validateMain(v: V) { + return validate
(v, id, hashMain) +} + +export interface View { + $type?: 'app.bsky.embed.external#view' + external: ViewExternal +} + +const hashView = 'view' + +export function isView(v: V) { + return is$typed(v, id, hashView) +} + +export function validateView(v: V) { + return validate(v, id, hashView) +} + +export interface External { + $type?: 'app.bsky.embed.external#external' + uri: string + thumb?: BlobRef + title: string + description: string +} + +const hashExternal = 'external' + +export function isExternal(v: V) { + return is$typed(v, id, hashExternal) +} + +export function validateExternal(v: V) { + return validate(v, id, hashExternal) +} + +export interface ViewExternal { + $type?: 'app.bsky.embed.external#viewExternal' + uri: string + thumb?: string + title: string + description: string +} + +const hashViewExternal = 'viewExternal' + +export function isViewExternal(v: V) { + return is$typed(v, id, hashViewExternal) +} + +export function validateViewExternal(v: V) { + return validate(v, id, hashViewExternal) +} diff --git a/packages/lexicon/src/types/app/bsky/embed/images.ts b/packages/lexicon/src/types/app/bsky/embed/images.ts new file mode 100644 index 0000000..fffb489 --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/embed/images.ts @@ -0,0 +1,82 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' +import type * as AppBskyEmbedDefs from './defs.js' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.embed.images' + +export interface Main { + $type?: 'app.bsky.embed.images' + images: Image[] +} + +const hashMain = 'main' + +export function isMain(v: V) { + return is$typed(v, id, hashMain) +} + +export function validateMain(v: V) { + return validate
(v, id, hashMain) +} + +export interface View { + $type?: 'app.bsky.embed.images#view' + images: ViewImage[] +} + +const hashView = 'view' + +export function isView(v: V) { + return is$typed(v, id, hashView) +} + +export function validateView(v: V) { + return validate(v, id, hashView) +} + +export interface Image { + $type?: 'app.bsky.embed.images#image' + /** Alt text description of the image, for accessibility. */ + alt: string + image: BlobRef + aspectRatio?: AppBskyEmbedDefs.AspectRatio +} + +const hashImage = 'image' + +export function isImage(v: V) { + return is$typed(v, id, hashImage) +} + +export function validateImage(v: V) { + return validate(v, id, hashImage) +} + +export interface ViewImage { + $type?: 'app.bsky.embed.images#viewImage' + /** Alt text description of the image, for accessibility. */ + alt: string + /** Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View. */ + thumb: string + /** Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. */ + fullsize: string + aspectRatio?: AppBskyEmbedDefs.AspectRatio +} + +const hashViewImage = 'viewImage' + +export function isViewImage(v: V) { + return is$typed(v, id, hashViewImage) +} + +export function validateViewImage(v: V) { + return validate(v, id, hashViewImage) +} diff --git a/packages/lexicon/src/types/app/bsky/embed/record.ts b/packages/lexicon/src/types/app/bsky/embed/record.ts new file mode 100644 index 0000000..3c21871 --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/embed/record.ts @@ -0,0 +1,143 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' +import type * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs.js' +import type * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef.js' +import type * as AppBskyActorDefs from '../actor/defs.js' +import type * as AppBskyFeedDefs from '../feed/defs.js' +import type * as AppBskyGraphDefs from '../graph/defs.js' +import type * as AppBskyLabelerDefs from '../labeler/defs.js' +import type * as AppBskyEmbedExternal from './external.js' +import type * as AppBskyEmbedImages from './images.js' +import type * as AppBskyEmbedRecordWithMedia from './recordWithMedia.js' +import type * as AppBskyEmbedVideo from './video.js' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.embed.record' + +export interface Main { + $type?: 'app.bsky.embed.record' + record: ComAtprotoRepoStrongRef.Main +} + +const hashMain = 'main' + +export function isMain(v: V) { + return is$typed(v, id, hashMain) +} + +export function validateMain(v: V) { + return validate
(v, id, hashMain) +} + +export interface View { + $type?: 'app.bsky.embed.record#view' + record: + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | { $type: string } +} + +const hashView = 'view' + +export function isView(v: V) { + return is$typed(v, id, hashView) +} + +export function validateView(v: V) { + return validate(v, id, hashView) +} + +export interface ViewRecord { + $type?: 'app.bsky.embed.record#viewRecord' + cid: string + uri: string + /** The record data itself. */ + value: { [_ in string]: unknown } + author: AppBskyActorDefs.ProfileViewBasic + embeds?: ( + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | { $type: string } + )[] + labels?: ComAtprotoLabelDefs.Label[] + indexedAt: string + likeCount?: number + quoteCount?: number + replyCount?: number + repostCount?: number +} + +const hashViewRecord = 'viewRecord' + +export function isViewRecord(v: V) { + return is$typed(v, id, hashViewRecord) +} + +export function validateViewRecord(v: V) { + return validate(v, id, hashViewRecord) +} + +export interface ViewBlocked { + $type?: 'app.bsky.embed.record#viewBlocked' + uri: string + author: AppBskyFeedDefs.BlockedAuthor + blocked: true +} + +const hashViewBlocked = 'viewBlocked' + +export function isViewBlocked(v: V) { + return is$typed(v, id, hashViewBlocked) +} + +export function validateViewBlocked(v: V) { + return validate(v, id, hashViewBlocked) +} + +export interface ViewDetached { + $type?: 'app.bsky.embed.record#viewDetached' + uri: string + detached: true +} + +const hashViewDetached = 'viewDetached' + +export function isViewDetached(v: V) { + return is$typed(v, id, hashViewDetached) +} + +export function validateViewDetached(v: V) { + return validate(v, id, hashViewDetached) +} + +export interface ViewNotFound { + $type?: 'app.bsky.embed.record#viewNotFound' + uri: string + notFound: true +} + +const hashViewNotFound = 'viewNotFound' + +export function isViewNotFound(v: V) { + return is$typed(v, id, hashViewNotFound) +} + +export function validateViewNotFound(v: V) { + return validate(v, id, hashViewNotFound) +} diff --git a/packages/lexicon/src/types/app/bsky/embed/recordWithMedia.ts b/packages/lexicon/src/types/app/bsky/embed/recordWithMedia.ts new file mode 100644 index 0000000..2ad844e --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/embed/recordWithMedia.ts @@ -0,0 +1,56 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' +import type * as AppBskyEmbedExternal from './external.js' +import type * as AppBskyEmbedImages from './images.js' +import type * as AppBskyEmbedRecord from './record.js' +import type * as AppBskyEmbedVideo from './video.js' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.embed.recordWithMedia' + +export interface Main { + $type?: 'app.bsky.embed.recordWithMedia' + media: + | $Typed + | $Typed + | $Typed + | { $type: string } + record: AppBskyEmbedRecord.Main +} + +const hashMain = 'main' + +export function isMain(v: V) { + return is$typed(v, id, hashMain) +} + +export function validateMain(v: V) { + return validate
(v, id, hashMain) +} + +export interface View { + $type?: 'app.bsky.embed.recordWithMedia#view' + media: + | $Typed + | $Typed + | $Typed + | { $type: string } + record: AppBskyEmbedRecord.View +} + +const hashView = 'view' + +export function isView(v: V) { + return is$typed(v, id, hashView) +} + +export function validateView(v: V) { + return validate(v, id, hashView) +} diff --git a/packages/lexicon/src/types/app/bsky/embed/video.ts b/packages/lexicon/src/types/app/bsky/embed/video.ts new file mode 100644 index 0000000..a905d29 --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/embed/video.ts @@ -0,0 +1,67 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' +import type * as AppBskyEmbedDefs from './defs.js' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.embed.video' + +export interface Main { + $type?: 'app.bsky.embed.video' + /** Alt text description of the video, for accessibility. */ + alt?: string + video: BlobRef + captions?: Caption[] + aspectRatio?: AppBskyEmbedDefs.AspectRatio +} + +const hashMain = 'main' + +export function isMain(v: V) { + return is$typed(v, id, hashMain) +} + +export function validateMain(v: V) { + return validate
(v, id, hashMain) +} + +export interface View { + $type?: 'app.bsky.embed.video#view' + alt?: string + cid: string + playlist: string + thumbnail?: string + aspectRatio?: AppBskyEmbedDefs.AspectRatio +} + +const hashView = 'view' + +export function isView(v: V) { + return is$typed(v, id, hashView) +} + +export function validateView(v: V) { + return validate(v, id, hashView) +} + +export interface Caption { + $type?: 'app.bsky.embed.video#caption' + file: BlobRef + lang: string +} + +const hashCaption = 'caption' + +export function isCaption(v: V) { + return is$typed(v, id, hashCaption) +} + +export function validateCaption(v: V) { + return validate(v, id, hashCaption) +} diff --git a/packages/lexicon/src/types/app/bsky/feed/defs.ts b/packages/lexicon/src/types/app/bsky/feed/defs.ts new file mode 100644 index 0000000..c6873ad --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/feed/defs.ts @@ -0,0 +1,419 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' +import type * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs.js' +import type * as AppBskyActorDefs from '../actor/defs.js' +import type * as AppBskyEmbedExternal from '../embed/external.js' +import type * as AppBskyEmbedImages from '../embed/images.js' +import type * as AppBskyEmbedRecord from '../embed/record.js' +import type * as AppBskyEmbedRecordWithMedia from '../embed/recordWithMedia.js' +import type * as AppBskyEmbedVideo from '../embed/video.js' +import type * as AppBskyGraphDefs from '../graph/defs.js' +import type * as AppBskyRichtextFacet from '../richtext/facet.js' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.feed.defs' + +export interface PostView { + $type?: 'app.bsky.feed.defs#postView' + cid: string + uri: string + embed?: + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed + | { $type: string } + author: AppBskyActorDefs.ProfileViewBasic + labels?: ComAtprotoLabelDefs.Label[] + record: { [_ in string]: unknown } + viewer?: ViewerState + indexedAt: string + likeCount?: number + quoteCount?: number + replyCount?: number + threadgate?: ThreadgateView + repostCount?: number +} + +const hashPostView = 'postView' + +export function isPostView(v: V) { + return is$typed(v, id, hashPostView) +} + +export function validatePostView(v: V) { + return validate(v, id, hashPostView) +} + +export interface ReplyRef { + $type?: 'app.bsky.feed.defs#replyRef' + root: + | $Typed + | $Typed + | $Typed + | { $type: string } + parent: + | $Typed + | $Typed + | $Typed + | { $type: string } + grandparentAuthor?: AppBskyActorDefs.ProfileViewBasic +} + +const hashReplyRef = 'replyRef' + +export function isReplyRef(v: V) { + return is$typed(v, id, hashReplyRef) +} + +export function validateReplyRef(v: V) { + return validate(v, id, hashReplyRef) +} + +export interface ReasonPin { + $type?: 'app.bsky.feed.defs#reasonPin' +} + +const hashReasonPin = 'reasonPin' + +export function isReasonPin(v: V) { + return is$typed(v, id, hashReasonPin) +} + +export function validateReasonPin(v: V) { + return validate(v, id, hashReasonPin) +} + +export interface BlockedPost { + $type?: 'app.bsky.feed.defs#blockedPost' + uri: string + author: BlockedAuthor + blocked: true +} + +const hashBlockedPost = 'blockedPost' + +export function isBlockedPost(v: V) { + return is$typed(v, id, hashBlockedPost) +} + +export function validateBlockedPost(v: V) { + return validate(v, id, hashBlockedPost) +} + +export interface Interaction { + $type?: 'app.bsky.feed.defs#interaction' + item?: string + event?: + | 'app.bsky.feed.defs#requestLess' + | 'app.bsky.feed.defs#requestMore' + | 'app.bsky.feed.defs#clickthroughItem' + | 'app.bsky.feed.defs#clickthroughAuthor' + | 'app.bsky.feed.defs#clickthroughReposter' + | 'app.bsky.feed.defs#clickthroughEmbed' + | 'app.bsky.feed.defs#interactionSeen' + | 'app.bsky.feed.defs#interactionLike' + | 'app.bsky.feed.defs#interactionRepost' + | 'app.bsky.feed.defs#interactionReply' + | 'app.bsky.feed.defs#interactionQuote' + | 'app.bsky.feed.defs#interactionShare' + | (string & {}) + /** Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton. */ + feedContext?: string +} + +const hashInteraction = 'interaction' + +export function isInteraction(v: V) { + return is$typed(v, id, hashInteraction) +} + +export function validateInteraction(v: V) { + return validate(v, id, hashInteraction) +} + +/** Request that less content like the given feed item be shown in the feed */ +export const REQUESTLESS = `${id}#requestLess` +/** Request that more content like the given feed item be shown in the feed */ +export const REQUESTMORE = `${id}#requestMore` + +/** Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests. */ +export interface ViewerState { + $type?: 'app.bsky.feed.defs#viewerState' + like?: string + pinned?: boolean + repost?: string + threadMuted?: boolean + replyDisabled?: boolean + embeddingDisabled?: boolean +} + +const hashViewerState = 'viewerState' + +export function isViewerState(v: V) { + return is$typed(v, id, hashViewerState) +} + +export function validateViewerState(v: V) { + return validate(v, id, hashViewerState) +} + +export interface FeedViewPost { + $type?: 'app.bsky.feed.defs#feedViewPost' + post: PostView + reply?: ReplyRef + reason?: $Typed | $Typed | { $type: string } + /** Context provided by feed generator that may be passed back alongside interactions. */ + feedContext?: string +} + +const hashFeedViewPost = 'feedViewPost' + +export function isFeedViewPost(v: V) { + return is$typed(v, id, hashFeedViewPost) +} + +export function validateFeedViewPost(v: V) { + return validate(v, id, hashFeedViewPost) +} + +export interface NotFoundPost { + $type?: 'app.bsky.feed.defs#notFoundPost' + uri: string + notFound: true +} + +const hashNotFoundPost = 'notFoundPost' + +export function isNotFoundPost(v: V) { + return is$typed(v, id, hashNotFoundPost) +} + +export function validateNotFoundPost(v: V) { + return validate(v, id, hashNotFoundPost) +} + +export interface ReasonRepost { + $type?: 'app.bsky.feed.defs#reasonRepost' + by: AppBskyActorDefs.ProfileViewBasic + indexedAt: string +} + +const hashReasonRepost = 'reasonRepost' + +export function isReasonRepost(v: V) { + return is$typed(v, id, hashReasonRepost) +} + +export function validateReasonRepost(v: V) { + return validate(v, id, hashReasonRepost) +} + +export interface BlockedAuthor { + $type?: 'app.bsky.feed.defs#blockedAuthor' + did: string + viewer?: AppBskyActorDefs.ViewerState +} + +const hashBlockedAuthor = 'blockedAuthor' + +export function isBlockedAuthor(v: V) { + return is$typed(v, id, hashBlockedAuthor) +} + +export function validateBlockedAuthor(v: V) { + return validate(v, id, hashBlockedAuthor) +} + +export interface GeneratorView { + $type?: 'app.bsky.feed.defs#generatorView' + cid: string + did: string + uri: string + avatar?: string + labels?: ComAtprotoLabelDefs.Label[] + viewer?: GeneratorViewerState + creator: AppBskyActorDefs.ProfileView + indexedAt: string + likeCount?: number + contentMode?: + | 'app.bsky.feed.defs#contentModeUnspecified' + | 'app.bsky.feed.defs#contentModeVideo' + | (string & {}) + description?: string + displayName: string + descriptionFacets?: AppBskyRichtextFacet.Main[] + acceptsInteractions?: boolean +} + +const hashGeneratorView = 'generatorView' + +export function isGeneratorView(v: V) { + return is$typed(v, id, hashGeneratorView) +} + +export function validateGeneratorView(v: V) { + return validate(v, id, hashGeneratorView) +} + +/** Metadata about this post within the context of the thread it is in. */ +export interface ThreadContext { + $type?: 'app.bsky.feed.defs#threadContext' + rootAuthorLike?: string +} + +const hashThreadContext = 'threadContext' + +export function isThreadContext(v: V) { + return is$typed(v, id, hashThreadContext) +} + +export function validateThreadContext(v: V) { + return validate(v, id, hashThreadContext) +} + +export interface ThreadViewPost { + $type?: 'app.bsky.feed.defs#threadViewPost' + post: PostView + parent?: + | $Typed + | $Typed + | $Typed + | { $type: string } + replies?: ( + | $Typed + | $Typed + | $Typed + | { $type: string } + )[] + threadContext?: ThreadContext +} + +const hashThreadViewPost = 'threadViewPost' + +export function isThreadViewPost(v: V) { + return is$typed(v, id, hashThreadViewPost) +} + +export function validateThreadViewPost(v: V) { + return validate(v, id, hashThreadViewPost) +} + +export interface ThreadgateView { + $type?: 'app.bsky.feed.defs#threadgateView' + cid?: string + uri?: string + lists?: AppBskyGraphDefs.ListViewBasic[] + record?: { [_ in string]: unknown } +} + +const hashThreadgateView = 'threadgateView' + +export function isThreadgateView(v: V) { + return is$typed(v, id, hashThreadgateView) +} + +export function validateThreadgateView(v: V) { + return validate(v, id, hashThreadgateView) +} + +/** User liked the feed item */ +export const INTERACTIONLIKE = `${id}#interactionLike` +/** Feed item was seen by user */ +export const INTERACTIONSEEN = `${id}#interactionSeen` +/** User clicked through to the feed item */ +export const CLICKTHROUGHITEM = `${id}#clickthroughItem` +/** Declares the feed generator returns posts containing app.bsky.embed.video embeds. */ +export const CONTENTMODEVIDEO = `${id}#contentModeVideo` +/** User quoted the feed item */ +export const INTERACTIONQUOTE = `${id}#interactionQuote` +/** User replied to the feed item */ +export const INTERACTIONREPLY = `${id}#interactionReply` +/** User shared the feed item */ +export const INTERACTIONSHARE = `${id}#interactionShare` + +export interface SkeletonFeedPost { + $type?: 'app.bsky.feed.defs#skeletonFeedPost' + post: string + reason?: + | $Typed + | $Typed + | { $type: string } + /** Context that will be passed through to client and may be passed to feed generator back alongside interactions. */ + feedContext?: string +} + +const hashSkeletonFeedPost = 'skeletonFeedPost' + +export function isSkeletonFeedPost(v: V) { + return is$typed(v, id, hashSkeletonFeedPost) +} + +export function validateSkeletonFeedPost(v: V) { + return validate(v, id, hashSkeletonFeedPost) +} + +/** User clicked through to the embedded content of the feed item */ +export const CLICKTHROUGHEMBED = `${id}#clickthroughEmbed` +/** User reposted the feed item */ +export const INTERACTIONREPOST = `${id}#interactionRepost` + +export interface SkeletonReasonPin { + $type?: 'app.bsky.feed.defs#skeletonReasonPin' +} + +const hashSkeletonReasonPin = 'skeletonReasonPin' + +export function isSkeletonReasonPin(v: V) { + return is$typed(v, id, hashSkeletonReasonPin) +} + +export function validateSkeletonReasonPin(v: V) { + return validate(v, id, hashSkeletonReasonPin) +} + +/** User clicked through to the author of the feed item */ +export const CLICKTHROUGHAUTHOR = `${id}#clickthroughAuthor` +/** User clicked through to the reposter of the feed item */ +export const CLICKTHROUGHREPOSTER = `${id}#clickthroughReposter` + +export interface GeneratorViewerState { + $type?: 'app.bsky.feed.defs#generatorViewerState' + like?: string +} + +const hashGeneratorViewerState = 'generatorViewerState' + +export function isGeneratorViewerState(v: V) { + return is$typed(v, id, hashGeneratorViewerState) +} + +export function validateGeneratorViewerState(v: V) { + return validate(v, id, hashGeneratorViewerState) +} + +export interface SkeletonReasonRepost { + $type?: 'app.bsky.feed.defs#skeletonReasonRepost' + repost: string +} + +const hashSkeletonReasonRepost = 'skeletonReasonRepost' + +export function isSkeletonReasonRepost(v: V) { + return is$typed(v, id, hashSkeletonReasonRepost) +} + +export function validateSkeletonReasonRepost(v: V) { + return validate(v, id, hashSkeletonReasonRepost) +} + +/** Declares the feed generator returns any types of posts. */ +export const CONTENTMODEUNSPECIFIED = `${id}#contentModeUnspecified` diff --git a/packages/lexicon/src/types/app/bsky/feed/postgate.ts b/packages/lexicon/src/types/app/bsky/feed/postgate.ts new file mode 100644 index 0000000..56077e0 --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/feed/postgate.ts @@ -0,0 +1,49 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.feed.postgate' + +export interface Record { + $type: 'app.bsky.feed.postgate' + /** Reference (AT-URI) to the post record. */ + post: string + createdAt: string + /** List of rules defining who can embed this post. If value is an empty array or is undefined, no particular rules apply and anyone can embed. */ + embeddingRules?: ($Typed | { $type: string })[] + /** List of AT-URIs embedding this post that the author has detached from. */ + detachedEmbeddingUris?: string[] + [k: string]: unknown +} + +const hashRecord = 'main' + +export function isRecord(v: V) { + return is$typed(v, id, hashRecord) +} + +export function validateRecord(v: V) { + return validate(v, id, hashRecord, true) +} + +/** Disables embedding of this post. */ +export interface DisableRule { + $type?: 'app.bsky.feed.postgate#disableRule' +} + +const hashDisableRule = 'disableRule' + +export function isDisableRule(v: V) { + return is$typed(v, id, hashDisableRule) +} + +export function validateDisableRule(v: V) { + return validate(v, id, hashDisableRule) +} diff --git a/packages/lexicon/src/types/app/bsky/feed/threadgate.ts b/packages/lexicon/src/types/app/bsky/feed/threadgate.ts new file mode 100644 index 0000000..2fb47f9 --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/feed/threadgate.ts @@ -0,0 +1,101 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.feed.threadgate' + +export interface Record { + $type: 'app.bsky.feed.threadgate' + /** Reference (AT-URI) to the post record. */ + post: string + /** List of rules defining who can reply to this post. If value is an empty array, no one can reply. If value is undefined, anyone can reply. */ + allow?: ( + | $Typed + | $Typed + | $Typed + | $Typed + | { $type: string } + )[] + createdAt: string + /** List of hidden reply URIs. */ + hiddenReplies?: string[] + [k: string]: unknown +} + +const hashRecord = 'main' + +export function isRecord(v: V) { + return is$typed(v, id, hashRecord) +} + +export function validateRecord(v: V) { + return validate(v, id, hashRecord, true) +} + +/** Allow replies from actors on a list. */ +export interface ListRule { + $type?: 'app.bsky.feed.threadgate#listRule' + list: string +} + +const hashListRule = 'listRule' + +export function isListRule(v: V) { + return is$typed(v, id, hashListRule) +} + +export function validateListRule(v: V) { + return validate(v, id, hashListRule) +} + +/** Allow replies from actors mentioned in your post. */ +export interface MentionRule { + $type?: 'app.bsky.feed.threadgate#mentionRule' +} + +const hashMentionRule = 'mentionRule' + +export function isMentionRule(v: V) { + return is$typed(v, id, hashMentionRule) +} + +export function validateMentionRule(v: V) { + return validate(v, id, hashMentionRule) +} + +/** Allow replies from actors who follow you. */ +export interface FollowerRule { + $type?: 'app.bsky.feed.threadgate#followerRule' +} + +const hashFollowerRule = 'followerRule' + +export function isFollowerRule(v: V) { + return is$typed(v, id, hashFollowerRule) +} + +export function validateFollowerRule(v: V) { + return validate(v, id, hashFollowerRule) +} + +/** Allow replies from actors you follow. */ +export interface FollowingRule { + $type?: 'app.bsky.feed.threadgate#followingRule' +} + +const hashFollowingRule = 'followingRule' + +export function isFollowingRule(v: V) { + return is$typed(v, id, hashFollowingRule) +} + +export function validateFollowingRule(v: V) { + return validate(v, id, hashFollowingRule) +} diff --git a/packages/lexicon/src/types/app/bsky/graph/defs.ts b/packages/lexicon/src/types/app/bsky/graph/defs.ts new file mode 100644 index 0000000..ed8fcaf --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/graph/defs.ts @@ -0,0 +1,196 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' +import type * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs.js' +import type * as AppBskyActorDefs from '../actor/defs.js' +import type * as AppBskyFeedDefs from '../feed/defs.js' +import type * as AppBskyRichtextFacet from '../richtext/facet.js' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.graph.defs' +/** A list of actors to apply an aggregate moderation action (mute/block) on. */ +export const MODLIST = `${id}#modlist` + +export interface ListView { + $type?: 'app.bsky.graph.defs#listView' + cid: string + uri: string + name: string + avatar?: string + labels?: ComAtprotoLabelDefs.Label[] + viewer?: ListViewerState + creator: AppBskyActorDefs.ProfileView + purpose: ListPurpose + indexedAt: string + description?: string + listItemCount?: number + descriptionFacets?: AppBskyRichtextFacet.Main[] +} + +const hashListView = 'listView' + +export function isListView(v: V) { + return is$typed(v, id, hashListView) +} + +export function validateListView(v: V) { + return validate(v, id, hashListView) +} + +/** A list of actors used for curation purposes such as list feeds or interaction gating. */ +export const CURATELIST = `${id}#curatelist` + +export type ListPurpose = + | 'app.bsky.graph.defs#modlist' + | 'app.bsky.graph.defs#curatelist' + | 'app.bsky.graph.defs#referencelist' + | (string & {}) + +export interface ListItemView { + $type?: 'app.bsky.graph.defs#listItemView' + uri: string + subject: AppBskyActorDefs.ProfileView +} + +const hashListItemView = 'listItemView' + +export function isListItemView(v: V) { + return is$typed(v, id, hashListItemView) +} + +export function validateListItemView(v: V) { + return validate(v, id, hashListItemView) +} + +/** lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object) */ +export interface Relationship { + $type?: 'app.bsky.graph.defs#relationship' + did: string + /** if the actor follows this DID, this is the AT-URI of the follow record */ + following?: string + /** if the actor is followed by this DID, contains the AT-URI of the follow record */ + followedBy?: string +} + +const hashRelationship = 'relationship' + +export function isRelationship(v: V) { + return is$typed(v, id, hashRelationship) +} + +export function validateRelationship(v: V) { + return validate(v, id, hashRelationship) +} + +export interface ListViewBasic { + $type?: 'app.bsky.graph.defs#listViewBasic' + cid: string + uri: string + name: string + avatar?: string + labels?: ComAtprotoLabelDefs.Label[] + viewer?: ListViewerState + purpose: ListPurpose + indexedAt?: string + listItemCount?: number +} + +const hashListViewBasic = 'listViewBasic' + +export function isListViewBasic(v: V) { + return is$typed(v, id, hashListViewBasic) +} + +export function validateListViewBasic(v: V) { + return validate(v, id, hashListViewBasic) +} + +/** indicates that a handle or DID could not be resolved */ +export interface NotFoundActor { + $type?: 'app.bsky.graph.defs#notFoundActor' + actor: string + notFound: true +} + +const hashNotFoundActor = 'notFoundActor' + +export function isNotFoundActor(v: V) { + return is$typed(v, id, hashNotFoundActor) +} + +export function validateNotFoundActor(v: V) { + return validate(v, id, hashNotFoundActor) +} + +/** A list of actors used for only for reference purposes such as within a starter pack. */ +export const REFERENCELIST = `${id}#referencelist` + +export interface ListViewerState { + $type?: 'app.bsky.graph.defs#listViewerState' + muted?: boolean + blocked?: string +} + +const hashListViewerState = 'listViewerState' + +export function isListViewerState(v: V) { + return is$typed(v, id, hashListViewerState) +} + +export function validateListViewerState(v: V) { + return validate(v, id, hashListViewerState) +} + +export interface StarterPackView { + $type?: 'app.bsky.graph.defs#starterPackView' + cid: string + uri: string + list?: ListViewBasic + feeds?: AppBskyFeedDefs.GeneratorView[] + labels?: ComAtprotoLabelDefs.Label[] + record: { [_ in string]: unknown } + creator: AppBskyActorDefs.ProfileViewBasic + indexedAt: string + joinedWeekCount?: number + listItemsSample?: ListItemView[] + joinedAllTimeCount?: number +} + +const hashStarterPackView = 'starterPackView' + +export function isStarterPackView(v: V) { + return is$typed(v, id, hashStarterPackView) +} + +export function validateStarterPackView(v: V) { + return validate(v, id, hashStarterPackView) +} + +export interface StarterPackViewBasic { + $type?: 'app.bsky.graph.defs#starterPackViewBasic' + cid: string + uri: string + labels?: ComAtprotoLabelDefs.Label[] + record: { [_ in string]: unknown } + creator: AppBskyActorDefs.ProfileViewBasic + indexedAt: string + listItemCount?: number + joinedWeekCount?: number + joinedAllTimeCount?: number +} + +const hashStarterPackViewBasic = 'starterPackViewBasic' + +export function isStarterPackViewBasic(v: V) { + return is$typed(v, id, hashStarterPackViewBasic) +} + +export function validateStarterPackViewBasic(v: V) { + return validate(v, id, hashStarterPackViewBasic) +} diff --git a/packages/lexicon/src/types/app/bsky/labeler/defs.ts b/packages/lexicon/src/types/app/bsky/labeler/defs.ts new file mode 100644 index 0000000..a01a898 --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/labeler/defs.ts @@ -0,0 +1,90 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' +import type * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs.js' +import type * as AppBskyActorDefs from '../actor/defs.js' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.labeler.defs' + +export interface LabelerView { + $type?: 'app.bsky.labeler.defs#labelerView' + cid: string + uri: string + labels?: ComAtprotoLabelDefs.Label[] + viewer?: LabelerViewerState + creator: AppBskyActorDefs.ProfileView + indexedAt: string + likeCount?: number +} + +const hashLabelerView = 'labelerView' + +export function isLabelerView(v: V) { + return is$typed(v, id, hashLabelerView) +} + +export function validateLabelerView(v: V) { + return validate(v, id, hashLabelerView) +} + +export interface LabelerPolicies { + $type?: 'app.bsky.labeler.defs#labelerPolicies' + /** The label values which this labeler publishes. May include global or custom labels. */ + labelValues: ComAtprotoLabelDefs.LabelValue[] + /** Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. */ + labelValueDefinitions?: ComAtprotoLabelDefs.LabelValueDefinition[] +} + +const hashLabelerPolicies = 'labelerPolicies' + +export function isLabelerPolicies(v: V) { + return is$typed(v, id, hashLabelerPolicies) +} + +export function validateLabelerPolicies(v: V) { + return validate(v, id, hashLabelerPolicies) +} + +export interface LabelerViewerState { + $type?: 'app.bsky.labeler.defs#labelerViewerState' + like?: string +} + +const hashLabelerViewerState = 'labelerViewerState' + +export function isLabelerViewerState(v: V) { + return is$typed(v, id, hashLabelerViewerState) +} + +export function validateLabelerViewerState(v: V) { + return validate(v, id, hashLabelerViewerState) +} + +export interface LabelerViewDetailed { + $type?: 'app.bsky.labeler.defs#labelerViewDetailed' + cid: string + uri: string + labels?: ComAtprotoLabelDefs.Label[] + viewer?: LabelerViewerState + creator: AppBskyActorDefs.ProfileView + policies: LabelerPolicies + indexedAt: string + likeCount?: number +} + +const hashLabelerViewDetailed = 'labelerViewDetailed' + +export function isLabelerViewDetailed(v: V) { + return is$typed(v, id, hashLabelerViewDetailed) +} + +export function validateLabelerViewDetailed(v: V) { + return validate(v, id, hashLabelerViewDetailed) +} diff --git a/packages/lexicon/src/types/app/bsky/richtext/facet.ts b/packages/lexicon/src/types/app/bsky/richtext/facet.ts new file mode 100644 index 0000000..fa18c10 --- /dev/null +++ b/packages/lexicon/src/types/app/bsky/richtext/facet.ts @@ -0,0 +1,94 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { BlobRef, ValidationResult } from '@atproto/lexicon' +import { CID } from 'multiformats/cid' + +import { validate as _validate } from '../../../../lexicons' +import { is$typed as _is$typed, $Typed, OmitKey } from '../../../../util' + +const is$typed = _is$typed, + validate = _validate +const id = 'app.bsky.richtext.facet' + +/** Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags'). */ +export interface Tag { + $type?: 'app.bsky.richtext.facet#tag' + tag: string +} + +const hashTag = 'tag' + +export function isTag(v: V) { + return is$typed(v, id, hashTag) +} + +export function validateTag(v: V) { + return validate(v, id, hashTag) +} + +/** Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. */ +export interface Link { + $type?: 'app.bsky.richtext.facet#link' + uri: string +} + +const hashLink = 'link' + +export function isLink(v: V) { + return is$typed(v, id, hashLink) +} + +export function validateLink(v: V) { + return validate(v, id, hashLink) +} + +/** Annotation of a sub-string within rich text. */ +export interface Main { + $type?: 'app.bsky.richtext.facet' + index: ByteSlice + features: ($Typed | $Typed | $Typed | { $type: string })[] +} + +const hashMain = 'main' + +export function isMain(v: V) { + return is$typed(v, id, hashMain) +} + +export function validateMain(v: V) { + return validate
(v, id, hashMain) +} + +/** Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID. */ +export interface Mention { + $type?: 'app.bsky.richtext.facet#mention' + did: string +} + +const hashMention = 'mention' + +export function isMention(v: V) { + return is$typed(v, id, hashMention) +} + +export function validateMention(v: V) { + return validate(v, id, hashMention) +} + +/** Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. */ +export interface ByteSlice { + $type?: 'app.bsky.richtext.facet#byteSlice' + byteEnd: number + byteStart: number +} + +const hashByteSlice = 'byteSlice' + +export function isByteSlice(v: V) { + return is$typed(v, id, hashByteSlice) +} + +export function validateByteSlice(v: V) { + return validate(v, id, hashByteSlice) +} diff --git a/packages/lexicon/src/types/com/atproto/label/defs.ts b/packages/lexicon/src/types/com/atproto/label/defs.ts index af45f4a..b2c44ee 100644 --- a/packages/lexicon/src/types/com/atproto/label/defs.ts +++ b/packages/lexicon/src/types/com/atproto/label/defs.ts @@ -14,24 +14,24 @@ const id = 'com.atproto.label.defs' /** Metadata tag on an atproto resource (eg, repo or record). */ export interface Label { $type?: 'com.atproto.label.defs#label' - /** The AT Protocol version of the label object. */ - ver?: number - /** DID of the actor who created this label. */ - src: string - /** AT URI of the record, repository (account), or other resource that this label applies to. */ - uri: string /** Optionally, CID specifying the specific version of 'uri' resource this label applies to. */ cid?: string - /** The short string name of the value or type of this label. */ - val: string - /** If true, this is a negation label, overwriting a previous label. */ - neg?: boolean /** Timestamp when this label was created. */ cts: string /** Timestamp at which this label expires (no longer applies). */ exp?: string + /** If true, this is a negation label, overwriting a previous label. */ + neg?: boolean /** Signature of dag-cbor encoded label. */ sig?: Uint8Array + /** DID of the actor who created this label. */ + src: string + /** AT URI of the record, repository (account), or other resource that this label applies to. */ + uri: string + /** The short string name of the value or type of this label. */ + val: string + /** The AT Protocol version of the label object. */ + ver?: number } const hashLabel = 'label' @@ -44,22 +44,6 @@ export function validateLabel(v: V) { return validate