UNPKG

@atproto/api

Version:

Client library for atproto and Bluesky

1,317 lines (1,316 loc) 693 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ids = exports.lexicons = exports.schemas = exports.schemaDict = void 0; exports.validate = validate; /** * GENERATED CODE - DO NOT MODIFY */ const lexicon_1 = require("@atproto/lexicon"); const util_js_1 = require("./util.js"); exports.schemaDict = { ComAtprotoAdminDefs: { lexicon: 1, id: 'com.atproto.admin.defs', defs: { statusAttr: { type: 'object', required: ['applied'], properties: { applied: { type: 'boolean', }, ref: { type: 'string', }, }, }, accountView: { type: 'object', required: ['did', 'handle', 'indexedAt'], properties: { did: { type: 'string', format: 'did', }, handle: { type: 'string', format: 'handle', }, email: { type: 'string', }, relatedRecords: { type: 'array', items: { type: 'unknown', }, }, indexedAt: { type: 'string', format: 'datetime', }, invitedBy: { type: 'ref', ref: 'lex:com.atproto.server.defs#inviteCode', }, invites: { type: 'array', items: { type: 'ref', ref: 'lex:com.atproto.server.defs#inviteCode', }, }, invitesDisabled: { type: 'boolean', }, emailConfirmedAt: { type: 'string', format: 'datetime', }, inviteNote: { type: 'string', }, deactivatedAt: { type: 'string', format: 'datetime', }, threatSignatures: { type: 'array', items: { type: 'ref', ref: 'lex:com.atproto.admin.defs#threatSignature', }, }, }, }, repoRef: { type: 'object', required: ['did'], properties: { did: { type: 'string', format: 'did', }, }, }, repoBlobRef: { type: 'object', required: ['did', 'cid'], properties: { did: { type: 'string', format: 'did', }, cid: { type: 'string', format: 'cid', }, recordUri: { type: 'string', format: 'at-uri', }, }, }, threatSignature: { type: 'object', required: ['property', 'value'], properties: { property: { type: 'string', }, value: { type: 'string', }, }, }, }, }, ComAtprotoAdminDeleteAccount: { lexicon: 1, id: 'com.atproto.admin.deleteAccount', defs: { main: { type: 'procedure', description: 'Delete a user account as an administrator.', input: { encoding: 'application/json', schema: { type: 'object', required: ['did'], properties: { did: { type: 'string', format: 'did', }, }, }, }, }, }, }, ComAtprotoAdminDisableAccountInvites: { lexicon: 1, id: 'com.atproto.admin.disableAccountInvites', defs: { main: { type: 'procedure', description: 'Disable an account from receiving new invite codes, but does not invalidate existing codes.', input: { encoding: 'application/json', schema: { type: 'object', required: ['account'], properties: { account: { type: 'string', format: 'did', }, note: { type: 'string', description: 'Optional reason for disabled invites.', }, }, }, }, }, }, }, ComAtprotoAdminDisableInviteCodes: { lexicon: 1, id: 'com.atproto.admin.disableInviteCodes', defs: { main: { type: 'procedure', description: 'Disable some set of codes and/or all codes associated with a set of users.', input: { encoding: 'application/json', schema: { type: 'object', properties: { codes: { type: 'array', items: { type: 'string', }, }, accounts: { type: 'array', items: { type: 'string', }, }, }, }, }, }, }, }, ComAtprotoAdminEnableAccountInvites: { lexicon: 1, id: 'com.atproto.admin.enableAccountInvites', defs: { main: { type: 'procedure', description: "Re-enable an account's ability to receive invite codes.", input: { encoding: 'application/json', schema: { type: 'object', required: ['account'], properties: { account: { type: 'string', format: 'did', }, note: { type: 'string', description: 'Optional reason for enabled invites.', }, }, }, }, }, }, }, ComAtprotoAdminGetAccountInfo: { lexicon: 1, id: 'com.atproto.admin.getAccountInfo', defs: { main: { type: 'query', description: 'Get details about an account.', parameters: { type: 'params', required: ['did'], properties: { did: { type: 'string', format: 'did', }, }, }, output: { encoding: 'application/json', schema: { type: 'ref', ref: 'lex:com.atproto.admin.defs#accountView', }, }, }, }, }, ComAtprotoAdminGetAccountInfos: { lexicon: 1, id: 'com.atproto.admin.getAccountInfos', defs: { main: { type: 'query', description: 'Get details about some accounts.', parameters: { type: 'params', required: ['dids'], properties: { dids: { type: 'array', items: { type: 'string', format: 'did', }, }, }, }, output: { encoding: 'application/json', schema: { type: 'object', required: ['infos'], properties: { infos: { type: 'array', items: { type: 'ref', ref: 'lex:com.atproto.admin.defs#accountView', }, }, }, }, }, }, }, }, ComAtprotoAdminGetInviteCodes: { lexicon: 1, id: 'com.atproto.admin.getInviteCodes', defs: { main: { type: 'query', description: 'Get an admin view of invite codes.', parameters: { type: 'params', properties: { sort: { type: 'string', knownValues: ['recent', 'usage'], default: 'recent', }, limit: { type: 'integer', minimum: 1, maximum: 500, default: 100, }, cursor: { type: 'string', }, }, }, output: { encoding: 'application/json', schema: { type: 'object', required: ['codes'], properties: { cursor: { type: 'string', }, codes: { type: 'array', items: { type: 'ref', ref: 'lex:com.atproto.server.defs#inviteCode', }, }, }, }, }, }, }, }, ComAtprotoAdminGetSubjectStatus: { lexicon: 1, id: 'com.atproto.admin.getSubjectStatus', defs: { main: { type: 'query', description: 'Get the service-specific admin status of a subject (account, record, or blob).', parameters: { type: 'params', properties: { did: { type: 'string', format: 'did', }, uri: { type: 'string', format: 'at-uri', }, blob: { type: 'string', format: 'cid', }, }, }, output: { encoding: 'application/json', schema: { type: 'object', required: ['subject'], properties: { subject: { type: 'union', refs: [ 'lex:com.atproto.admin.defs#repoRef', 'lex:com.atproto.repo.strongRef', 'lex:com.atproto.admin.defs#repoBlobRef', ], }, takedown: { type: 'ref', ref: 'lex:com.atproto.admin.defs#statusAttr', }, deactivated: { type: 'ref', ref: 'lex:com.atproto.admin.defs#statusAttr', }, }, }, }, }, }, }, ComAtprotoAdminSearchAccounts: { lexicon: 1, id: 'com.atproto.admin.searchAccounts', defs: { main: { type: 'query', description: 'Get list of accounts that matches your search query.', parameters: { type: 'params', properties: { email: { type: 'string', }, cursor: { type: 'string', }, limit: { type: 'integer', minimum: 1, maximum: 100, default: 50, }, }, }, output: { encoding: 'application/json', schema: { type: 'object', required: ['accounts'], properties: { cursor: { type: 'string', }, accounts: { type: 'array', items: { type: 'ref', ref: 'lex:com.atproto.admin.defs#accountView', }, }, }, }, }, }, }, }, ComAtprotoAdminSendEmail: { lexicon: 1, id: 'com.atproto.admin.sendEmail', defs: { main: { type: 'procedure', description: "Send email to a user's account email address.", input: { encoding: 'application/json', schema: { type: 'object', required: ['recipientDid', 'content', 'senderDid'], properties: { recipientDid: { type: 'string', format: 'did', }, content: { type: 'string', }, subject: { type: 'string', }, senderDid: { type: 'string', format: 'did', }, comment: { type: 'string', description: "Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers", }, }, }, }, output: { encoding: 'application/json', schema: { type: 'object', required: ['sent'], properties: { sent: { type: 'boolean', }, }, }, }, }, }, }, ComAtprotoAdminUpdateAccountEmail: { lexicon: 1, id: 'com.atproto.admin.updateAccountEmail', defs: { main: { type: 'procedure', description: "Administrative action to update an account's email.", input: { encoding: 'application/json', schema: { type: 'object', required: ['account', 'email'], properties: { account: { type: 'string', format: 'at-identifier', description: 'The handle or DID of the repo.', }, email: { type: 'string', }, }, }, }, }, }, }, ComAtprotoAdminUpdateAccountHandle: { lexicon: 1, id: 'com.atproto.admin.updateAccountHandle', defs: { main: { type: 'procedure', description: "Administrative action to update an account's handle.", input: { encoding: 'application/json', schema: { type: 'object', required: ['did', 'handle'], properties: { did: { type: 'string', format: 'did', }, handle: { type: 'string', format: 'handle', }, }, }, }, }, }, }, ComAtprotoAdminUpdateAccountPassword: { lexicon: 1, id: 'com.atproto.admin.updateAccountPassword', defs: { main: { type: 'procedure', description: 'Update the password for a user account as an administrator.', input: { encoding: 'application/json', schema: { type: 'object', required: ['did', 'password'], properties: { did: { type: 'string', format: 'did', }, password: { type: 'string', }, }, }, }, }, }, }, ComAtprotoAdminUpdateAccountSigningKey: { lexicon: 1, id: 'com.atproto.admin.updateAccountSigningKey', defs: { main: { type: 'procedure', description: "Administrative action to update an account's signing key in their Did document.", input: { encoding: 'application/json', schema: { type: 'object', required: ['did', 'signingKey'], properties: { did: { type: 'string', format: 'did', }, signingKey: { type: 'string', format: 'did', description: 'Did-key formatted public key', }, }, }, }, }, }, }, ComAtprotoAdminUpdateSubjectStatus: { lexicon: 1, id: 'com.atproto.admin.updateSubjectStatus', defs: { main: { type: 'procedure', description: 'Update the service-specific admin status of a subject (account, record, or blob).', input: { encoding: 'application/json', schema: { type: 'object', required: ['subject'], properties: { subject: { type: 'union', refs: [ 'lex:com.atproto.admin.defs#repoRef', 'lex:com.atproto.repo.strongRef', 'lex:com.atproto.admin.defs#repoBlobRef', ], }, takedown: { type: 'ref', ref: 'lex:com.atproto.admin.defs#statusAttr', }, deactivated: { type: 'ref', ref: 'lex:com.atproto.admin.defs#statusAttr', }, }, }, }, output: { encoding: 'application/json', schema: { type: 'object', required: ['subject'], properties: { subject: { type: 'union', refs: [ 'lex:com.atproto.admin.defs#repoRef', 'lex:com.atproto.repo.strongRef', 'lex:com.atproto.admin.defs#repoBlobRef', ], }, takedown: { type: 'ref', ref: 'lex:com.atproto.admin.defs#statusAttr', }, }, }, }, }, }, }, ComAtprotoIdentityDefs: { lexicon: 1, id: 'com.atproto.identity.defs', defs: { identityInfo: { type: 'object', required: ['did', 'handle', 'didDoc'], properties: { did: { type: 'string', format: 'did', }, handle: { type: 'string', format: 'handle', description: "The validated handle of the account; or 'handle.invalid' if the handle did not bi-directionally match the DID document.", }, didDoc: { type: 'unknown', description: 'The complete DID document for the identity.', }, }, }, }, }, ComAtprotoIdentityGetRecommendedDidCredentials: { lexicon: 1, id: 'com.atproto.identity.getRecommendedDidCredentials', defs: { main: { type: 'query', description: 'Describe the credentials that should be included in the DID doc of an account that is migrating to this service.', output: { encoding: 'application/json', schema: { type: 'object', properties: { rotationKeys: { description: 'Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs.', type: 'array', items: { type: 'string', }, }, alsoKnownAs: { type: 'array', items: { type: 'string', }, }, verificationMethods: { type: 'unknown', }, services: { type: 'unknown', }, }, }, }, }, }, }, ComAtprotoIdentityRefreshIdentity: { lexicon: 1, id: 'com.atproto.identity.refreshIdentity', defs: { main: { type: 'procedure', description: 'Request that the server re-resolve an identity (DID and handle). The server may ignore this request, or require authentication, depending on the role, implementation, and policy of the server.', input: { encoding: 'application/json', schema: { type: 'object', required: ['identifier'], properties: { identifier: { type: 'string', format: 'at-identifier', }, }, }, }, output: { encoding: 'application/json', schema: { type: 'ref', ref: 'lex:com.atproto.identity.defs#identityInfo', }, }, errors: [ { name: 'HandleNotFound', description: 'The resolution process confirmed that the handle does not resolve to any DID.', }, { name: 'DidNotFound', description: 'The DID resolution process confirmed that there is no current DID.', }, { name: 'DidDeactivated', description: 'The DID previously existed, but has been deactivated.', }, ], }, }, }, ComAtprotoIdentityRequestPlcOperationSignature: { lexicon: 1, id: 'com.atproto.identity.requestPlcOperationSignature', defs: { main: { type: 'procedure', description: 'Request an email with a code to in order to request a signed PLC operation. Requires Auth.', }, }, }, ComAtprotoIdentityResolveDid: { lexicon: 1, id: 'com.atproto.identity.resolveDid', defs: { main: { type: 'query', description: 'Resolves DID to DID document. Does not bi-directionally verify handle.', parameters: { type: 'params', required: ['did'], properties: { did: { type: 'string', format: 'did', description: 'DID to resolve.', }, }, }, output: { encoding: 'application/json', schema: { type: 'object', required: ['didDoc'], properties: { didDoc: { type: 'unknown', description: 'The complete DID document for the identity.', }, }, }, }, errors: [ { name: 'DidNotFound', description: 'The DID resolution process confirmed that there is no current DID.', }, { name: 'DidDeactivated', description: 'The DID previously existed, but has been deactivated.', }, ], }, }, }, ComAtprotoIdentityResolveHandle: { lexicon: 1, id: 'com.atproto.identity.resolveHandle', defs: { main: { type: 'query', description: 'Resolves an atproto handle (hostname) to a DID. Does not necessarily bi-directionally verify against the the DID document.', parameters: { type: 'params', required: ['handle'], properties: { handle: { type: 'string', format: 'handle', description: 'The handle to resolve.', }, }, }, output: { encoding: 'application/json', schema: { type: 'object', required: ['did'], properties: { did: { type: 'string', format: 'did', }, }, }, }, errors: [ { name: 'HandleNotFound', description: 'The resolution process confirmed that the handle does not resolve to any DID.', }, ], }, }, }, ComAtprotoIdentityResolveIdentity: { lexicon: 1, id: 'com.atproto.identity.resolveIdentity', defs: { main: { type: 'query', description: 'Resolves an identity (DID or Handle) to a full identity (DID document and verified handle).', parameters: { type: 'params', required: ['identifier'], properties: { identifier: { type: 'string', format: 'at-identifier', description: 'Handle or DID to resolve.', }, }, }, output: { encoding: 'application/json', schema: { type: 'ref', ref: 'lex:com.atproto.identity.defs#identityInfo', }, }, errors: [ { name: 'HandleNotFound', description: 'The resolution process confirmed that the handle does not resolve to any DID.', }, { name: 'DidNotFound', description: 'The DID resolution process confirmed that there is no current DID.', }, { name: 'DidDeactivated', description: 'The DID previously existed, but has been deactivated.', }, ], }, }, }, ComAtprotoIdentitySignPlcOperation: { lexicon: 1, id: 'com.atproto.identity.signPlcOperation', defs: { main: { type: 'procedure', description: "Signs a PLC operation to update some value(s) in the requesting DID's document.", input: { encoding: 'application/json', schema: { type: 'object', properties: { token: { description: 'A token received through com.atproto.identity.requestPlcOperationSignature', type: 'string', }, rotationKeys: { type: 'array', items: { type: 'string', }, }, alsoKnownAs: { type: 'array', items: { type: 'string', }, }, verificationMethods: { type: 'unknown', }, services: { type: 'unknown', }, }, }, }, output: { encoding: 'application/json', schema: { type: 'object', required: ['operation'], properties: { operation: { type: 'unknown', description: 'A signed DID PLC operation.', }, }, }, }, }, }, }, ComAtprotoIdentitySubmitPlcOperation: { lexicon: 1, id: 'com.atproto.identity.submitPlcOperation', defs: { main: { type: 'procedure', description: "Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry", input: { encoding: 'application/json', schema: { type: 'object', required: ['operation'], properties: { operation: { type: 'unknown', }, }, }, }, }, }, }, ComAtprotoIdentityUpdateHandle: { lexicon: 1, id: 'com.atproto.identity.updateHandle', defs: { main: { type: 'procedure', description: "Updates the current account's handle. Verifies handle validity, and updates did:plc document if necessary. Implemented by PDS, and requires auth.", input: { encoding: 'application/json', schema: { type: 'object', required: ['handle'], properties: { handle: { type: 'string', format: 'handle', description: 'The new handle.', }, }, }, }, }, }, }, ComAtprotoLabelDefs: { lexicon: 1, id: 'com.atproto.label.defs', 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.', }, src: { type: 'string', format: 'did', description: 'DID of the actor who created this label.', }, uri: { type: 'string', format: 'uri', 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.', }, exp: { type: 'string', format: 'datetime', description: 'Timestamp at which this label expires (no longer applies).', }, sig: { type: 'bytes', description: 'Signature of dag-cbor encoded label.', }, }, }, 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', }, 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.', }, }, }, labelValueDefinition: { type: 'object', description: 'Declares a label value and its expected interpretations and behaviors.', required: ['identifier', 'severity', 'blurs', 'locales'], properties: { identifier: { type: 'string', description: "The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).", maxLength: 100, maxGraphemes: 100, }, severity: { type: 'string', description: "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: { type: 'string', 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'], }, defaultSetting: { type: 'string', 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', }, }, }, }, 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', description: 'The code of the language these strings are written in.', format: 'language', }, name: { type: 'string', description: 'A short human-readable name for the label.', maxGraphemes: 64, maxLength: 640, }, description: { type: 'string', 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', ], }, }, }, ComAtprotoLabelQueryLabels: { lexicon: 1, id: 'com.atproto.label.queryLabels', defs: { main: { type: 'query', description: 'Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth.', parameters: { type: 'params', required: ['uriPatterns'], properties: { uriPatterns: { type: 'array', items: { type: 'string', }, description: "List of AT URI patterns to match (boolean 'OR'). Each may be a prefix (ending with '*'; will match inclusive of the string leading to '*'), or a full URI.", }, sources: { type: 'array', items: { type: 'string', format: 'did', }, description: 'Optional list of label sources (DIDs) to filter on.', }, limit: { type: 'integer', minimum: 1, maximum: 250, default: 50, }, cursor: { type: 'string', }, }, }, output: { encoding: 'application/json', schema: { type: 'object', required: ['labels'], properties: { cursor: { type: 'string', }, labels: { type: 'array', items: { type: 'ref', ref: 'lex:com.atproto.label.defs#label', }, }, }, }, }, }, }, }, ComAtprotoLabelSubscribeLabels: { lexicon: 1, id: 'com.atproto.label.subscribeLabels', defs: { main: { type: 'subscription', description: 'Subscribe to stream of labels (and negations). Public endpoint implemented by mod services. Uses same sequencing scheme as repo event stream.', parameters: { type: 'params', properties: { cursor: { type: 'integer', description: 'The last known event seq number to backfill from.', }, }, }, message: { schema: { type: 'union', refs: [ 'lex:com.atproto.label.subscribeLabels#labels', 'lex:com.atproto.label.subscribeLabels#info', ], }, }, errors: [ { name: 'FutureCursor', }, ], }, labels: { type: 'object', required: ['seq', 'labels'], properties: { seq: { type: 'integer', }, labels: { type: 'array', items: { type: 'ref', ref: 'lex:com.atproto.label.defs#label', }, }, }, }, info: { type: 'object', required: ['name'], properties: { name: { type: 'string', knownValues: ['OutdatedCursor'], }, message: { type: 'string', }, }, }, }, }, ComAtprotoLexiconSchema: { lexicon: 1, id: 'com.atproto.lexicon.schema', defs: { main: { type: 'record', description: "Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc).", key: 'nsid', record: { type: 'object', required: ['lexicon'], properties: { lexicon: { type: 'integer', description: "Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system.", }, }, }, }, }, }, ComAtprotoModerationCreateReport: { lexicon: 1, id: 'com.atproto.moderation.createReport', defs: { main: { type: 'procedure', description: 'Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth.', input: { encoding: 'application/json', schema: { type: 'object', required: ['reasonType', 'subject'],