cattle_grid.model¶
cattle_grid.model ¶
ActivityMessage ¶
Bases: WithActor
Message that contains an Activity. Activity is used as the name for the ‘data object’ being exchanged, as is common in the Fediverse
Parameters:
Name | Type | Description | Default |
---|---|---|---|
actor
|
str
|
actor_id of the actor that received the message |
required |
data
|
Dict[str, Any]
|
The activity |
required |
Source code in cattle_grid/model/__init__.py
FetchMessage ¶
SharedInboxMessage ¶
Bases: BaseModel
Message that contains an Activity. In difference to the ActivityMessage this message does not have an actor, and thus its recipients will be determined by cattle_grid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Dict[str, Any]
|
Activity |
required |
Source code in cattle_grid/model/__init__.py
account ¶
Objects used for the account exchange
ActorInformation ¶
CreateActorRequest ¶
Bases: BaseModel
Request to create an actor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
Base url for the actor, the actor URI will be of the form |
required |
name
|
str | None
|
Internal name of the actor |
None
|
preferred_username
|
str | None
|
Add a preferred username. This name will be used in acct:username@domain and supplied to webfinger. Here domain is determine from baseUrl. |
None
|
profile
|
Dict[str, Any]
|
New profile object for the actor. |
{}
|
automatically_accept_followers
|
bool | None
|
Enables setting actors to automatically accept follow requests |
None
|
Source code in cattle_grid/model/account.py
ErrorMessage ¶
Bases: BaseModel
Message to send an exception
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
list[str]
|
The exception |
required |
routing_key
|
str
|
The routing key of the message that caused the error |
required |
Source code in cattle_grid/model/account.py
EventInformation ¶
Bases: WithActor
, WithTransformedData
Send on outgoing or incoming events
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict[str, Any]
|
The data that was exchanged. We note that this data was processed by the transformers. |
required |
actor
|
str
|
actor_id of the actor that received the message |
required |
event_type
|
EventType
|
Type of event incoming means that the contained data was not generated on the actors behalf. outgoing means that the data is being send out by the actor. |
required |
Source code in cattle_grid/model/account.py
FetchMessage ¶
FetchResponse ¶
Bases: WithActor
Result of a a fetch request
Parameters:
Name | Type | Description | Default |
---|---|---|---|
actor
|
str
|
actor_id of the actor that received the message |
required |
uri
|
str
|
The resource that was requested |
required |
data
|
dict | None
|
The data returned for the object |
required |
Source code in cattle_grid/model/account.py
InformationResponse ¶
Bases: BaseModel
Response for the information request
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account_name
|
str
|
Name of the account |
required |
actors
|
List[ActorInformation]
|
Actors of the account on the server |
required |
base_urls
|
List[str]
|
The base urls of the server |
required |
backend
|
NameAndVersion
|
Name and version of the backend |
required |
protocol
|
NameAndVersion
|
Name and version of the protocol being used |
required |
method_information
|
List[MethodInformationModel]
|
Built-in mutable sequence. If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified. |
<dynamic>
|
Source code in cattle_grid/model/account.py
NameAndVersion ¶
common ¶
WithActor ¶
WithTransformedData ¶
Bases: BaseModel
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict[str, Any]
|
The data that was exchanged. We note that this data was processed by the transformers. |
required |
Source code in cattle_grid/model/common.py
exchange ¶
DeleteActorMessage ¶
TransformedActivityMessage ¶
Bases: WithActor
, WithTransformedData
Transformed activity message
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict[str, Any]
|
The data that was exchanged. We note that this data was processed by the transformers. |
required |
actor
|
str
|
actor_id of the actor that received the message |
required |
Source code in cattle_grid/model/exchange.py
UpdateActorMessage ¶
Bases: WithActor
Allows one to update the actor object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
actor
|
str
|
actor_id of the actor that received the message |
required |
profile
|
Dict[str, Any] | None
|
New profile object for the actor. The fields. |
None
|
autoFollow
|
bool | None
|
Enables setting actors to automatically accept follow requests |
None
|
actions
|
List[Annotated[Union[UpdateIdentifierAction, UpdatePropertyValueAction, UpdateUrlAction, RenameActorAction], FieldInfo]]
|
Actions to be taken when updating the profile |
<dynamic>
|
Source code in cattle_grid/model/exchange.py
exchange_update_actor ¶
RenameActorAction ¶
UpdateActionType ¶
Bases: StrEnum
Available actions for updating the actor
Source code in cattle_grid/model/exchange_update_actor.py
add_identifier
class-attribute
instance-attribute
¶
add_identifier = auto()
Adds a new identifier. The identifier is assumed to already exist.
create_identifier
class-attribute
instance-attribute
¶
create_identifier = auto()
Creates a new identifier. Must be on a domain controlled by cattle_grid and enabled in the account
remove_identifier
class-attribute
instance-attribute
¶
remove_identifier = auto()
Removes an identifier
remove_property_value
class-attribute
instance-attribute
¶
remove_property_value = auto()
Removes a property value
remove_url
class-attribute
instance-attribute
¶
remove_url = auto()
Removes an url from the actor profile
UpdateIdentifierAction ¶
Bases: BaseModel
Used to update an identifier of the actor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action
|
Literal[<UpdateActionType.add_identifier: 'add_identifier'>, <UpdateActionType.create_identifier: 'create_identifier'>, <UpdateActionType.update_identifier: 'update_identifier'>]
|
|
required |
identifier
|
str
|
The identifier |
required |
primary
|
bool
|
Set the identifier as the primary one, if the identifier corresponds to an acct-uri this will update the primary identifier |
False
|
Source code in cattle_grid/model/exchange_update_actor.py
UpdatePropertyValueAction ¶
Bases: BaseModel
Update a property value of the actor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action
|
Literal[<UpdateActionType.update_property_value: 'update_property_value'>, <UpdateActionType.remove_property_value: 'remove_property_value'>]
|
|
required |
key
|
str
|
The key of the property value to be created, updated, or deleted |
required |
value
|
str | None
|
The value of the property value |
None
|
Source code in cattle_grid/model/exchange_update_actor.py
UpdateUrlAction ¶
Bases: BaseModel
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action
|
Literal[<UpdateActionType.add_url: 'add_url'>, <UpdateActionType.remove_url: 'remove_url'>]
|
|
required |
url
|
str
|
The url to add |
required |
media_type
|
str | None
|
The media type for the url |
None
|
rel
|
str | None
|
The relation to use |
None
|
Source code in cattle_grid/model/exchange_update_actor.py
extension ¶
AddMethodInformationMessage ¶
Bases: BaseModel
Message to add method information through the exchange
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method_information
|
list[MethodInformationModel]
|
List of method information |
required |
Source code in cattle_grid/model/extension.py
MethodInformationModel ¶
Bases: BaseModel
cattle_grid allows to define methods on the exchange through extensions. This class contains a description of them
Parameters:
Name | Type | Description | Default |
---|---|---|---|
routing_key
|
str
|
Name of the method |
required |
module
|
str
|
Module the extension was imported from. This is cattle_grid for build-in methods |
required |
description
|
str | None
|
Description of the method |
None
|
replies
|
bool
|
Indicates whether the method will reply on |
False
|
Source code in cattle_grid/model/extension.py
lookup ¶
LookupMethod
module-attribute
¶
Alias for the Lookup Method
Lookup ¶
Bases: BaseModel
Lookup of something from the Fediverse
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uri
|
str
|
The uri being looked up |
required |
actor
|
str
|
The actor performing the lookup |
required |
result
|
dict | None
|
The result of the lookup, None if no result yet, the result will be returned once the lookup is finished |
None
|
Source code in cattle_grid/model/lookup.py
messages ¶
CreateActorMessage ¶
Bases: BaseModel
Parameters:
Name | Type | Description | Default |
---|---|---|---|
baseUrl
|
str
|
base url used to create the user on. Can contain a path |
required |
preferredUsername
|
str | None
|
Add a preferred username. This name will be used in acct:username@domain and supplied to webfinger. Here domain is determine from baseUrl. |
None
|
profile
|
Dict[str, Any]
|
New profile object for the actor. The fields. |
{}
|
autoFollow
|
bool
|
Enables setting actors to automatically accept follow requests |
False
|