From 3c7e68b2ffd58866feba7e7d1619ca4e191e4a43 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Wed, 27 May 2026 15:49:39 -0700 Subject: [PATCH] initial cobalt label lexicons --- .gitignore | 3 - .../at/nsid/cobalt/label/createLabel.json | 24 +++ lexicons/at/nsid/cobalt/label/defs.json | 36 ++++ .../at/nsid/cobalt/label/negateLabel.json | 24 +++ lexicons/com/atproto/label/defs.json | 189 ++++++++++++++++++ 5 files changed, 273 insertions(+), 3 deletions(-) create mode 100644 lexicons/at/nsid/cobalt/label/createLabel.json create mode 100644 lexicons/at/nsid/cobalt/label/defs.json create mode 100644 lexicons/at/nsid/cobalt/label/negateLabel.json create mode 100644 lexicons/com/atproto/label/defs.json diff --git a/.gitignore b/.gitignore index 3da0eda..476fb4b 100644 --- a/.gitignore +++ b/.gitignore @@ -23,8 +23,5 @@ src/build/ /lexidex /slinky -# glot files -/lexicons - # Don't ignore this file itself !.gitignore diff --git a/lexicons/at/nsid/cobalt/label/createLabel.json b/lexicons/at/nsid/cobalt/label/createLabel.json new file mode 100644 index 0000000..3372d07 --- /dev/null +++ b/lexicons/at/nsid/cobalt/label/createLabel.json @@ -0,0 +1,24 @@ +{ + "lexicon": 1, + "id": "at.nsid.cobalt.label.createLabel", + "defs": { + "main": { + "type": "procedure", + "description": "Generates and persists a single new label. Overwrites any existing label with the same (src, uri, cid, val).", + "input": { + "encoding": "application/json", + "schema": { + "type": "ref", + "ref": "at.nsid.cobalt.label.defs#labelRequest" + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "ref", + "ref": "com.atproto.label.def#label" + } + } + } + } +} diff --git a/lexicons/at/nsid/cobalt/label/defs.json b/lexicons/at/nsid/cobalt/label/defs.json new file mode 100644 index 0000000..9d12fd0 --- /dev/null +++ b/lexicons/at/nsid/cobalt/label/defs.json @@ -0,0 +1,36 @@ +{ + "lexicon": 1, + "id": "at.nsid.cobalt.label.defs", + "defs": { + "labelRequest": { + "type": "object", + "description": "Request body for creation/negation of a label", + "required": [ "uri", "val" ], + "properties": { + "src": { + "type": "string", + "format": "did", + "description": "Label authority DID. Some servers might support only a single label authority, in which case this can be omitted, or must match exactly. Other servers might support multiple authorities." + }, + "uri": { + "type": "string", + "format": "uri", + "description": "Subject URI. May be an AT-URI or DID. Support for other URI schemes is indeterminate." + }, + "cid": { + "type": "string", + "format": "cid" + }, + "val": { + "type": "string" + }, + "exp": { + "type": "string", + "format": "datetime", + "description": "expiration timestamp" + } + } + } + } +} + diff --git a/lexicons/at/nsid/cobalt/label/negateLabel.json b/lexicons/at/nsid/cobalt/label/negateLabel.json new file mode 100644 index 0000000..6b38e2b --- /dev/null +++ b/lexicons/at/nsid/cobalt/label/negateLabel.json @@ -0,0 +1,24 @@ +{ + "lexicon": 1, + "id": "at.nsid.cobalt.label.negateLabel", + "defs": { + "main": { + "type": "procedure", + "description": "Generates and persists a single new label, which negates (and overwrites) any previous label with the same (src, uri, cid, val).", + "input": { + "encoding": "application/json", + "schema": { + "type": "ref", + "ref": "at.nsid.cobalt.label.defs#labelRequest" + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "ref", + "ref": "com.atproto.label.def#label" + } + } + } + } +} diff --git a/lexicons/com/atproto/label/defs.json b/lexicons/com/atproto/label/defs.json new file mode 100644 index 0000000..095c7a6 --- /dev/null +++ b/lexicons/com/atproto/label/defs.json @@ -0,0 +1,189 @@ +{ + "defs": { + "label": { + "description": "Metadata tag on an atproto resource (eg, repo or record).", + "properties": { + "cid": { + "description": "Optionally, CID specifying the specific version of 'uri' resource this label applies to.", + "format": "cid", + "type": "string" + }, + "cts": { + "description": "Timestamp when this label was created.", + "format": "datetime", + "type": "string" + }, + "exp": { + "description": "Timestamp at which this label expires (no longer applies).", + "format": "datetime", + "type": "string" + }, + "neg": { + "description": "If true, this is a negation label, overwriting a previous label.", + "type": "boolean" + }, + "sig": { + "description": "Signature of dag-cbor encoded label.", + "type": "bytes" + }, + "src": { + "description": "DID of the actor who created this label.", + "format": "did", + "type": "string" + }, + "uri": { + "description": "AT URI of the record, repository (account), or other resource that this label applies to.", + "format": "uri", + "type": "string" + }, + "val": { + "description": "The short string name of the value or type of this label.", + "maxLength": 128, + "type": "string" + }, + "ver": { + "description": "The AT Protocol version of the label object.", + "type": "integer" + } + }, + "required": [ + "src", + "uri", + "val", + "cts" + ], + "type": "object" + }, + "labelValue": { + "knownValues": [ + "!hide", + "!warn", + "!no-unauthenticated", + "porn", + "sexual", + "nudity", + "graphic-media", + "bot" + ], + "type": "string" + }, + "labelValueDefinition": { + "description": "Declares a label value and its expected interpretations and behaviors.", + "properties": { + "adultOnly": { + "description": "Does the user need to have adult content enabled in order to configure this label?", + "type": "boolean" + }, + "blurs": { + "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" + ], + "type": "string" + }, + "defaultSetting": { + "default": "warn", + "description": "The default setting for this label.", + "knownValues": [ + "ignore", + "warn", + "hide" + ], + "type": "string" + }, + "identifier": { + "description": "The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).", + "maxGraphemes": 100, + "maxLength": 100, + "type": "string" + }, + "locales": { + "items": { + "ref": "#labelValueDefinitionStrings", + "type": "ref" + }, + "type": "array" + }, + "severity": { + "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" + ], + "type": "string" + } + }, + "required": [ + "identifier", + "severity", + "blurs", + "locales" + ], + "type": "object" + }, + "labelValueDefinitionStrings": { + "description": "Strings which describe the label in the UI, localized into a specific language.", + "properties": { + "description": { + "description": "A longer description of what the label means and why it might be applied.", + "maxGraphemes": 10000, + "maxLength": 100000, + "type": "string" + }, + "lang": { + "description": "The code of the language these strings are written in.", + "format": "language", + "type": "string" + }, + "name": { + "description": "A short human-readable name for the label.", + "maxGraphemes": 64, + "maxLength": 640, + "type": "string" + } + }, + "required": [ + "lang", + "name", + "description" + ], + "type": "object" + }, + "selfLabel": { + "description": "Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.", + "properties": { + "val": { + "description": "The short string name of the value or type of this label.", + "maxLength": 128, + "type": "string" + } + }, + "required": [ + "val" + ], + "type": "object" + }, + "selfLabels": { + "description": "Metadata tags on an atproto record, published by the author within the record.", + "properties": { + "values": { + "items": { + "ref": "#selfLabel", + "type": "ref" + }, + "maxLength": 10, + "type": "array" + } + }, + "required": [ + "values" + ], + "type": "object" + } + }, + "id": "com.atproto.label.defs", + "lexicon": 1 +} -- 2.51.2