chitose.com.atproto.label package#

Submodules#

chitose.com.atproto.label.defs module#

class chitose.com.atproto.label.defs.Label(src: str, uri: str, val: str, cts: str, ver: int | None = None, cid: str | None = None, neg: bool | None = None, exp: str | None = None, sig: Any | None = None)#

Bases: Object

Metadata tag on an atproto resource (eg, repo or record).

Parameters:
  • src – DID of the actor who created this label.

  • uri – AT URI of the record, repository (account), or other resource that this label applies to.

  • val – The short string name of the value or type of this label.

  • cts – Timestamp when this label was created.

  • ver – The AT Protocol version of the label object.

  • cid – Optionally, CID specifying the specific version of ‘uri’ resource this label applies to.

  • neg – If true, this is a negation label, overwriting a previous label.

  • exp – Timestamp at which this label expires (no longer applies).

  • sig – Signature of dag-cbor encoded label.

to_dict() dict[str, Any]#
class chitose.com.atproto.label.defs.LabelValueDefinition(identifier: str, severity: Literal['inform', 'alert', 'none'], blurs: Literal['content', 'media', 'none'], locales: list[LabelValueDefinitionStrings], default_setting: Literal['ignore', 'warn', 'hide'] | None = None, adult_only: bool | None = None)#

Bases: Object

Declares a label value and its expected interpretations and behaviors.

Parameters:
  • identifier – The value of the label being defined. Must only include lowercase ascii and the ‘-’ character ([a-z-]+).

  • severity – How should a client visually convey this label? ‘inform’ means neutral and informational; ‘alert’ means negative and warning; ‘none’ means show nothing.

  • blurs – 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.

  • default_setting – The default setting for this label.

  • adult_only – Does the user need to have adult content enabled in order to configure this label?

to_dict() dict[str, Any]#
class chitose.com.atproto.label.defs.LabelValueDefinitionStrings(lang: str, name: str, description: str)#

Bases: Object

Strings which describe the label in the UI, localized into a specific language.

Parameters:
  • lang – The code of the language these strings are written in.

  • name – A short human-readable name for the label.

  • description – A longer description of what the label means and why it might be applied.

to_dict() dict[str, Any]#
class chitose.com.atproto.label.defs.SelfLabel(val: str)#

Bases: Object

Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.

Parameters:

val – The short string name of the value or type of this label.

to_dict() dict[str, Any]#
class chitose.com.atproto.label.defs.SelfLabels(values: list[SelfLabel])#

Bases: Object

Metadata tags on an atproto record, published by the author within the record.

to_dict() dict[str, Any]#

chitose.com.atproto.label.query_labels module#

chitose.com.atproto.label.subscribe_labels module#

class chitose.com.atproto.label.subscribe_labels.Info(name: Literal['OutdatedCursor'], message: str | None = None)#

Bases: Object

to_dict() dict[str, Any]#
class chitose.com.atproto.label.subscribe_labels.Labels(seq: int, labels: list[Label])#

Bases: Object

to_dict() dict[str, Any]#

Module contents#

class chitose.com.atproto.label.Label_(call: Callable[[str, list[tuple[str, str | None | int | list[str]]], bytes | dict[str, Any] | None, dict[str, str]], bytes], subscribe: Callable[[str, list[tuple[str, str | None | int | list[str]]], Callable[[str | bytes], None]], None])#

Bases: object

We recommend calling methods in this class via the chitose.BskyAgent class instead of creating instances of this class directly.

query_labels(uri_patterns: list[str], sources: list[str] | None = None, limit: int | None = None, cursor: str | None = None) bytes#

Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth.

Parameters:
  • uri_patterns – 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 – Optional list of label sources (DIDs) to filter on.

subscribe_labels(handler: Callable[[str | bytes], None], cursor: int | None = None) None#

Subscribe to stream of labels (and negations). Public endpoint implemented by mod services. Uses same sequencing scheme as repo event stream.

Parameters:

cursor – The last known event seq number to backfill from.