bovine.types
ServerSentEvent
dataclass
A server sent event as defined in
Event Source Interface
<https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events>
_.
This is used by the event_source function
of the BovineClient.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
str
|
|
required |
event
|
str | None
|
|
None
|
id
|
str | None
|
|
None
|
retry
|
int | None
|
|
None
|
Source code in bovine/bovine/types/__init__.py
encode
encode() -> bytes
Encodes the server sent event as bytes to send to the client.
Source code in bovine/bovine/types/__init__.py
parse
staticmethod
parse(raw: bytes)
parse_utf8
staticmethod
parse_utf8(raw: str)
Parses utf-8 encoded string to ServerSentEvent
Source code in bovine/bovine/types/__init__.py
Visibility
Bases: Enum
Defines the visiblity of an object. Currently only used for Actor, where endpoints are hidden from anyone by the owner.
Source code in bovine/bovine/types/__init__.py
jrd
JrdData
Bases: BaseModel
See RFC 6415
>>> JrdData(subject="acct:actor@test.example").model_dump(exclude_none=True)
{'subject': 'acct:actor@test.example'}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subject
|
str | None
|
|
None
|
expires
|
datetime | None
|
expiration date time |
None
|
aliases
|
List[str] | None
|
value a string array containing the values of each element in order |
None
|
properties
|
Dict[str, Any] | None
|
value an object with each element included as a name/value pair with the value of the type attribute as name, and element value included as a string value. |
None
|
links
|
List[JrdLink] | None
|
a single name/value pair with the name ‘links’, and value an array with each element included as an object |
None
|
Source code in bovine/bovine/types/jrd.py
JrdLink
Bases: BaseModel
See RFC 7033.
>>> JrdLink(rel="self", href="http://test.example/actor").model_dump(exclude_none=True)
{'rel': 'self', 'href': 'http://test.example/actor'}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rel
|
str | None
|
rel |
None
|
type
|
str | None
|
|
None
|
href
|
str | None
|
when used with the ‘href’ attribute, conveys a link relation between the host described by the document and a common target URI |
None
|
titles
|
Dict[str, Any] | None
|
titles |
None
|
properties
|
Dict[str, Any] | None
|
properties |
None
|
template
|
str | None
|
template attribute conveys a relation whose context is an individual resource within the host-meta document scope, |
None
|
Source code in bovine/bovine/types/jrd.py
nodeinfo
NodeInfo
Bases: BaseModel
NodeInfo schema version 2.0.
Usage:
>>> NodeInfo(software={"name": "bovine", "version": "0.0.1"}).model_dump()
{'version': '2.0',
'software': {'name': 'bovine', 'version': '0.0.1'},
'protocols': [<Protocol.activitypub: 'activitypub'>],
'services': {'inbound': [],
'outbound': []},
'openRegistrations': False,
'usage': {'users':
{'total': 0, 'activeHalfyear': 0, 'activeMonth': 0},
'localPosts': 0,
'localComments': 0},
'metadata': {}}
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version
|
str
|
The schema version, must be 2.0. |
'2.0'
|
software
|
Software
|
Metadata about server software in use. |
required |
protocols
|
List[Protocol]
|
The protocols supported on this server. |
[<Protocol.activitypub: 'activitypub'>]
|
services
|
Services
|
The third party sites this server can connect to via their application API. |
Services(inbound=[], outbound=[])
|
openRegistrations
|
bool
|
Whether this server allows open self-registration. |
False
|
usage
|
Usage
|
Usage statistics for this server. |
<dynamic>
|
metadata
|
Dict[str, Any]
|
Free form key value pairs for software specific values. Clients should not rely on any specific key present. |
{}
|
Source code in bovine/bovine/types/nodeinfo.py
Services
Bases: BaseModel
The third party sites this server can connect to via their application API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inbound
|
List[InboundEnum]
|
The third party sites this server can retrieve messages from for combined display with regular traffic. |
required |
outbound
|
List[OutboundEnum]
|
The third party sites this server can publish messages to on the behalf of a user. |
required |
Source code in bovine/bovine/types/nodeinfo.py
Software
Bases: BaseModel
Metadata about server software in use.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The canonical name of this server software. |
required |
version
|
str
|
The version of this server software. |
required |
Source code in bovine/bovine/types/nodeinfo.py
Usage
Bases: BaseModel
Usage statistics for this server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
users
|
Users
|
statistics about the users of this server. |
<dynamic>
|
localPosts
|
int
|
The amount of posts that were made by users that are registered on this server. |
0
|
localComments
|
int
|
The amount of comments that were made by users that are registered on this server. |
0
|
Source code in bovine/bovine/types/nodeinfo.py
Users
Bases: BaseModel
statistics about the users of this server.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
total
|
int
|
The total amount of on this server registered users. |
0
|
activeHalfyear
|
int
|
The amount of users that signed in at least once in the last 180 days. |
0
|
activeMonth
|
int
|
The amount of users that signed in at least once in the last 30 days. |
0
|