Added media attachments model for statuses
Build and Release / run-terraform (push) Successful in 42s Details

This commit is contained in:
jfm 2024-05-02 09:00:14 +02:00
parent af9ac0c773
commit e52a6fd178
4 changed files with 80 additions and 26 deletions

BIN
.coverage

Binary file not shown.

View File

@ -0,0 +1,26 @@
from pydantic import BaseModel, Field
class MetaData(BaseModel):
width: int
height: int
size: str
aspect: float
class MetaCoordinates(BaseModel):
x: float
y: float
class Meta(BaseModel):
original: MetaData
small: MetaData
focus: MetaCoordinates
class MediaAttachment(BaseModel):
media_id: str = Field(alias="id")
media_type: str = Field(alias="type")
url: str
preview_url: str
text_url: str
meta: Meta
description: str
blurhash: str

View File

@ -4,6 +4,7 @@ from pydantic import BaseModel, Field
from mastodon.model.application import Application from mastodon.model.application import Application
from mastodon.model.account import Account from mastodon.model.account import Account
from mastodon.model.card import Card from mastodon.model.card import Card
from mastodon.model.media import MediaAttachment
from mastodon.model.poll import Poll from mastodon.model.poll import Poll
@ -29,7 +30,7 @@ class Status(BaseModel):
reblog: Optional["Status"] reblog: Optional["Status"]
# application: Optional[Application] # application: Optional[Application]
account: Account account: Account
media_attachments: List media_attachments: List[MediaAttachment]
mentions: List mentions: List
tags: List tags: List
emojis: List emojis: List

View File

@ -56,7 +56,34 @@
} }
] ]
}, },
"media_attachments": [], "media_attachments": [{
"id": "22345792",
"type": "image",
"url": "https://files.mastodon.social/media_attachments/files/022/345/792/original/57859aede991da25.jpeg",
"preview_url": "https://files.mastodon.social/media_attachments/files/022/345/792/small/57859aede991da25.jpeg",
"remote_url": null,
"text_url": "https://mastodon.social/media/2N4uvkuUtPVrkZGysms",
"meta": {
"original": {
"width": 640,
"height": 480,
"size": "640x480",
"aspect": 1.3333333333333333
},
"small": {
"width": 461,
"height": 346,
"size": "461x346",
"aspect": 1.3323699421965318
},
"focus": {
"x": -0.27,
"y": 0.51
}
},
"description": "test media description",
"blurhash": "UFBWY:8_0Jxv4mx]t8t64.%M-:IUWGWAt6M}"
}],
"mentions": [], "mentions": [],
"tags": [], "tags": [],
"emojis": [], "emojis": [],