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,11 +56,38 @@
} }
] ]
}, },
"media_attachments": [], "media_attachments": [{
"mentions": [], "id": "22345792",
"tags": [], "type": "image",
"emojis": [], "url": "https://files.mastodon.social/media_attachments/files/022/345/792/original/57859aede991da25.jpeg",
"card": { "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": [],
"tags": [],
"emojis": [],
"card": {
"url": "https://www.theguardian.com/money/2019/dec/07/i-lost-my-193000-inheritance-with-one-wrong-digit-on-my-sort-code", "url": "https://www.theguardian.com/money/2019/dec/07/i-lost-my-193000-inheritance-with-one-wrong-digit-on-my-sort-code",
"title": "I lost my £193,000 inheritance with one wrong digit on my sort code", "title": "I lost my £193,000 inheritance with one wrong digit on my sort code",
"description": "When Peter Teichs money went to another Barclays customer, the bank offered £25 as a token gesture", "description": "When Peter Teichs money went to another Barclays customer, the bank offered £25 as a token gesture",
@ -74,6 +101,6 @@
"height": 0, "height": 0,
"image": null, "image": null,
"embed_url": "" "embed_url": ""
}, },
"poll": null "poll": null
} }