view release on metacpan or search on metacpan
## How it works
When you call a method like `app.bsky.actor.getProfile`, the library:
- 1. **Checks user-provided paths:** It looks in any directories passed to `lexicon_paths`.
- 2. **Checks local storage:** It looks for the schema in the distribution's `share` directory.
- 3. **Checks user cache:** It looks in `~/.cache/atproto/lexicons/`.
- 4. **Downloads if missing:** If not found, it automatically downloads the schema from the
official AT Protocol repository and saves it to your user cache.
This system ensures that the library can support new or updated features without requiring a new release of the Perl
module.
# METHODS
## `new( [ host =` ..., share => ... \] )>
Constructor.
Expected parameters include:
eg/bsky_legacy.pl view on Meta::CPAN
say 'Authenticated as ' . $at->did;
# Create a simple text post
say 'Sending post...';
my $res = $at->post(
'com.atproto.repo.createRecord' => {
repo => $at->did,
collection => 'app.bsky.feed.post',
record => {
'$type' => 'app.bsky.feed.post',
text => "Hello from At.pm! ð¦\n\nThis post was generated using the updated Perl client.",
createdAt => At::_now->to_string
}
}
);
# Handle response
if ( $res && !builtin::blessed $res ) {
say 'Post successful!';
say 'URI: ' . $res->{uri};
say 'CID: ' . $res->{cid};
=item 2. B<Checks local storage:> It looks for the schema in the distribution's C<share> directory.
=item 3. B<Checks user cache:> It looks in C<~/.cache/atproto/lexicons/>.
=item 4. B<Downloads if missing:> If not found, it automatically downloads the schema from the
official AT Protocol repository and saves it to your user cache.
=back
This system ensures that the library can support new or updated features without requiring a new release of the Perl
module.
=head1 METHODS
=head2 C<new( [ host => ..., share => ... ] )>
Constructor.
Expected parameters include:
lib/At/Protocol/Handle.pm view on Meta::CPAN
require Carp;
Carp::carp 'development or testing TLD used in handle: ' . $id;
$warned = 1;
}
bless \$id, $class;
}
# Taken from https://github.com/bluesky-social/atproto/blob/main/packages/syntax/src/handle.ts
# Handle constraints, in English:
# - must be a possible domain name
# - RFC-1035 is commonly referenced, but has been updated. eg, RFC-3696,
# section 2. and RFC-3986, section 3. can now have leading numbers (eg,
# 4chan.org)
# - "labels" (sub-names) are made of ASCII letters, digits, hyphens
# - can not start or end with a hyphen
# - TLD (last component) should not start with a digit
# - can't end with a hyphen (can end with digit)
# - each segment must be between 1 and 63 characters (not including any periods)
# - overall length can't be more than 253 characters
# - separated by (ASCII) periods; does not start or end with period
# - case insensitive
share/lexicons/app/bsky/ageassurance/defs.json view on Meta::CPAN
"knownValues": ["unknown", "pending", "assured", "blocked"]
},
"state": {
"type": "object",
"description": "The user's computed Age Assurance state.",
"required": ["status", "access"],
"properties": {
"lastInitiatedAt": {
"type": "string",
"format": "datetime",
"description": "The timestamp when this state was last updated."
},
"status": {
"type": "ref",
"ref": "app.bsky.ageassurance.defs#status"
},
"access": {
"type": "ref",
"ref": "app.bsky.ageassurance.defs#access"
}
}
share/lexicons/app/bsky/draft/defs.json view on Meta::CPAN
"type": "array",
"items": { "type": "ref", "ref": "#draftEmbedRecord" },
"maxLength": 1
}
}
},
"draftView": {
"description": "View to present drafts data to users.",
"type": "object",
"required": ["id", "draft", "createdAt", "updatedAt"],
"properties": {
"id": {
"description": "A TID to be used as a draft identifier.",
"type": "string",
"format": "tid"
},
"draft": {
"type": "ref",
"ref": "#draft"
},
"createdAt": {
"description": "The time the draft was created.",
"type": "string",
"format": "datetime"
},
"updatedAt": {
"description": "The time the draft was last updated.",
"type": "string",
"format": "datetime"
}
}
},
"draftEmbedLocalRef": {
"type": "object",
"required": ["path"],
"properties": {
share/lexicons/app/bsky/unspecced/defs.json view on Meta::CPAN
}
},
"ageAssuranceState": {
"type": "object",
"description": "The computed state of the age assurance process, returned to the user in question on certain authenticated requests.",
"required": ["status"],
"properties": {
"lastInitiatedAt": {
"type": "string",
"format": "datetime",
"description": "The timestamp when this state was last updated."
},
"status": {
"type": "string",
"description": "The status of the age assurance process.",
"knownValues": ["unknown", "pending", "assured", "blocked"]
}
}
},
"ageAssuranceEvent": {
"type": "object",
share/lexicons/chat/bsky/convo/updateAllRead.json view on Meta::CPAN
"type": "string",
"knownValues": ["request", "accepted"]
}
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["updatedCount"],
"properties": {
"updatedCount": {
"description": "The count of updated convos.",
"type": "integer"
}
}
}
}
}
}
}
share/lexicons/com/atproto/server/createAccount.json view on Meta::CPAN
"password": {
"type": "string",
"description": "Initial account password. May need to meet instance-specific password strength requirements."
},
"recoveryKey": {
"type": "string",
"description": "DID PLC rotation key (aka, recovery key) to be included in PLC creation operation."
},
"plcOp": {
"type": "unknown",
"description": "A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented."
}
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"description": "Account login session returned on successful account creation.",
"required": ["accessJwt", "refreshJwt", "handle", "did"],
share/lexicons/com/atproto/sync/subscribeRepos.json view on Meta::CPAN
"blocks": {
"type": "bytes",
"description": "CAR file containing relevant blocks, as a diff since the previous repo state. The commit must be included as a block, and the commit block CID must be the first entry in the CAR header 'roots' list.",
"maxLength": 2000000
},
"ops": {
"type": "array",
"items": {
"type": "ref",
"ref": "#repoOp",
"description": "List of repo mutation operations in this commit (eg, records created, updated, or deleted)."
},
"maxLength": 200
},
"blobs": {
"type": "array",
"items": {
"type": "cid-link",
"description": "DEPRECATED -- will soon always be empty. List of new blobs (by CID) referenced by records in this commit."
}
},
share/lexicons/com/atproto/sync/subscribeRepos.json view on Meta::CPAN
},
"time": {
"type": "string",
"format": "datetime",
"description": "Timestamp of when this message was originally broadcast."
}
}
},
"identity": {
"type": "object",
"description": "Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache.",
"required": ["seq", "did", "time"],
"properties": {
"seq": { "type": "integer" },
"did": { "type": "string", "format": "did" },
"time": { "type": "string", "format": "datetime" },
"handle": {
"type": "string",
"format": "handle",
"description": "The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in...
}
share/lexicons/tools/ozone/communication/defs.json view on Meta::CPAN
"defs": {
"templateView": {
"type": "object",
"required": [
"id",
"name",
"contentMarkdown",
"disabled",
"lastUpdatedBy",
"createdAt",
"updatedAt"
],
"properties": {
"id": { "type": "string" },
"name": { "type": "string", "description": "Name of the template." },
"subject": {
"type": "string",
"description": "Content of the template, can contain markdown and variable placeholders."
},
"contentMarkdown": {
"type": "string",
share/lexicons/tools/ozone/communication/defs.json view on Meta::CPAN
},
"disabled": { "type": "boolean" },
"lang": {
"type": "string",
"format": "language",
"description": "Message language."
},
"lastUpdatedBy": {
"type": "string",
"format": "did",
"description": "DID of the user who last updated the template."
},
"createdAt": { "type": "string", "format": "datetime" },
"updatedAt": { "type": "string", "format": "datetime" }
}
}
}
}
share/lexicons/tools/ozone/communication/updateTemplate.json view on Meta::CPAN
"type": "procedure",
"description": "Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only.",
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["id"],
"properties": {
"id": {
"type": "string",
"description": "ID of the template to be updated."
},
"name": {
"type": "string",
"description": "Name of the template."
},
"lang": {
"type": "string",
"format": "language",
"description": "Message language."
},
"contentMarkdown": {
"type": "string",
"description": "Content of the template, markdown supported, can contain variable placeholders."
},
"subject": {
"type": "string",
"description": "Subject of the message, used in emails."
},
"updatedBy": {
"type": "string",
"format": "did",
"description": "DID of the user who is updating the template."
},
"disabled": {
"type": "boolean"
}
}
}
},
share/lexicons/tools/ozone/hosting/getAccountHistory.json view on Meta::CPAN
{
"lexicon": 1,
"id": "tools.ozone.hosting.getAccountHistory",
"defs": {
"main": {
"type": "query",
"description": "Get account history, e.g. log of updated email addresses or other identity information.",
"parameters": {
"type": "params",
"required": ["did"],
"properties": {
"did": { "type": "string", "format": "did" },
"events": {
"type": "array",
"items": {
"type": "string",
"knownValues": [
share/lexicons/tools/ozone/moderation/defs.json view on Meta::CPAN
"type": "array",
"items": { "type": "ref", "ref": "#blobView" }
},
"createdBy": { "type": "string", "format": "did" },
"createdAt": { "type": "string", "format": "datetime" },
"modTool": { "type": "ref", "ref": "#modTool" }
}
},
"subjectStatusView": {
"type": "object",
"required": ["id", "subject", "createdAt", "updatedAt", "reviewState"],
"properties": {
"id": { "type": "integer" },
"subject": {
"type": "union",
"refs": [
"com.atproto.admin.defs#repoRef",
"com.atproto.repo.strongRef",
"chat.bsky.convo.defs#messageRef"
]
},
"hosting": {
"type": "union",
"refs": ["#accountHosting", "#recordHosting"]
},
"subjectBlobCids": {
"type": "array",
"items": { "type": "string", "format": "cid" }
},
"subjectRepoHandle": { "type": "string" },
"updatedAt": {
"type": "string",
"format": "datetime",
"description": "Timestamp referencing when the last update was made to the moderation status of the subject"
},
"createdAt": {
"type": "string",
"format": "datetime",
"description": "Timestamp referencing the first moderation status impacting event was emitted on the subject"
},
"reviewState": {
share/lexicons/tools/ozone/moderation/defs.json view on Meta::CPAN
"status": {
"type": "string",
"knownValues": [
"takendown",
"suspended",
"deleted",
"deactivated",
"unknown"
]
},
"updatedAt": {
"type": "string",
"format": "datetime"
},
"createdAt": {
"type": "string",
"format": "datetime"
},
"deletedAt": {
"type": "string",
"format": "datetime"
share/lexicons/tools/ozone/moderation/defs.json view on Meta::CPAN
}
},
"recordHosting": {
"type": "object",
"required": ["status"],
"properties": {
"status": {
"type": "string",
"knownValues": ["deleted", "unknown"]
},
"updatedAt": {
"type": "string",
"format": "datetime"
},
"createdAt": {
"type": "string",
"format": "datetime"
},
"deletedAt": {
"type": "string",
"format": "datetime"
share/lexicons/tools/ozone/moderation/defs.json view on Meta::CPAN
"createdBy": {
"type": "string",
"format": "did",
"description": "DID of the user who created this scheduled action"
},
"createdAt": {
"type": "string",
"format": "datetime",
"description": "When the scheduled action was created"
},
"updatedAt": {
"type": "string",
"format": "datetime",
"description": "When the scheduled action was last updated"
},
"status": {
"type": "string",
"knownValues": ["pending", "executed", "cancelled", "failed"],
"description": "Current status of the scheduled action"
},
"lastExecutedAt": {
"type": "string",
"format": "datetime",
"description": "When the action was last attempted to be executed"
share/lexicons/tools/ozone/moderation/queryStatuses.json view on Meta::CPAN
"description": "Search subjects where the associated record/account was deleted after a given timestamp"
},
"hostingDeletedBefore": {
"type": "string",
"format": "datetime",
"description": "Search subjects where the associated record/account was deleted before a given timestamp"
},
"hostingUpdatedAfter": {
"type": "string",
"format": "datetime",
"description": "Search subjects where the associated record/account was updated after a given timestamp"
},
"hostingUpdatedBefore": {
"type": "string",
"format": "datetime",
"description": "Search subjects where the associated record/account was updated before a given timestamp"
},
"hostingStatuses": {
"type": "array",
"items": {
"type": "string"
},
"description": "Search subjects by the status of the associated record/account"
},
"reviewedBefore": {
"type": "string",
share/lexicons/tools/ozone/safelink/defs.json view on Meta::CPAN
"urlRule": {
"type": "object",
"description": "Input for creating a URL safety rule",
"required": [
"url",
"pattern",
"action",
"reason",
"createdBy",
"createdAt",
"updatedAt"
],
"properties": {
"url": {
"type": "string",
"description": "The URL or domain to apply the rule to"
},
"pattern": {
"type": "ref",
"ref": "#patternType"
},
share/lexicons/tools/ozone/safelink/defs.json view on Meta::CPAN
"createdBy": {
"type": "string",
"format": "did",
"description": "DID of the user added the rule."
},
"createdAt": {
"type": "string",
"format": "datetime",
"description": "Timestamp when the rule was created"
},
"updatedAt": {
"type": "string",
"format": "datetime",
"description": "Timestamp when the rule was last updated"
}
}
}
}
}
share/lexicons/tools/ozone/set/defs.json view on Meta::CPAN
},
"description": {
"type": "string",
"maxGraphemes": 1024,
"maxLength": 10240
}
}
},
"setView": {
"type": "object",
"required": ["name", "setSize", "createdAt", "updatedAt"],
"properties": {
"name": {
"type": "string",
"minLength": 3,
"maxLength": 128
},
"description": {
"type": "string",
"maxGraphemes": 1024,
"maxLength": 10240
},
"setSize": {
"type": "integer"
},
"createdAt": {
"type": "string",
"format": "datetime"
},
"updatedAt": {
"type": "string",
"format": "datetime"
}
}
}
}
}
share/lexicons/tools/ozone/set/querySets.json view on Meta::CPAN
"default": 50
},
"cursor": {
"type": "string"
},
"namePrefix": {
"type": "string"
},
"sortBy": {
"type": "string",
"enum": ["name", "createdAt", "updatedAt"],
"default": "name"
},
"sortDirection": {
"type": "string",
"default": "asc",
"enum": ["asc", "desc"],
"description": "Defaults to ascending order of name field."
}
}
},
share/lexicons/tools/ozone/setting/defs.json view on Meta::CPAN
},
"description": {
"type": "string",
"maxGraphemes": 1024,
"maxLength": 10240
},
"createdAt": {
"type": "string",
"format": "datetime"
},
"updatedAt": {
"type": "string",
"format": "datetime"
},
"managerRole": {
"type": "string",
"knownValues": [
"tools.ozone.team.defs#roleModerator",
"tools.ozone.team.defs#roleTriage",
"tools.ozone.team.defs#roleAdmin",
"tools.ozone.team.defs#roleVerifier"
share/lexicons/tools/ozone/team/defs.json view on Meta::CPAN
"type": "object",
"required": ["did", "role"],
"properties": {
"did": { "type": "string", "format": "did" },
"disabled": { "type": "boolean" },
"profile": {
"type": "ref",
"ref": "app.bsky.actor.defs#profileViewDetailed"
},
"createdAt": { "type": "string", "format": "datetime" },
"updatedAt": { "type": "string", "format": "datetime" },
"lastUpdatedBy": { "type": "string" },
"role": {
"type": "string",
"knownValues": [
"tools.ozone.team.defs#roleAdmin",
"tools.ozone.team.defs#roleModerator",
"tools.ozone.team.defs#roleTriage",
"tools.ozone.team.defs#roleVerifier"
]
}
share/lexicons/tools/ozone/team/updateMember.json view on Meta::CPAN
"output": {
"encoding": "application/json",
"schema": {
"type": "ref",
"ref": "tools.ozone.team.defs#member"
}
},
"errors": [
{
"name": "MemberNotFound",
"description": "The member being updated does not exist in the team"
}
]
}
}
}