Add attachment type "video"
This commit is contained in:
parent
f14e762ee3
commit
3a584f52b5
3 changed files with 24 additions and 0 deletions
|
@ -609,6 +609,23 @@ components:
|
|||
description: Ethereum wallet address.
|
||||
type: string
|
||||
example: '0xd8da6bf...'
|
||||
Attachment:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
description: The ID of the attachment in the database.
|
||||
type: string
|
||||
format: uuid
|
||||
type:
|
||||
description: The type of the attachment.
|
||||
type: string
|
||||
enum:
|
||||
- unknown
|
||||
- image
|
||||
- video
|
||||
url:
|
||||
description: The location of the original full-size attachment.
|
||||
type: string
|
||||
Instance:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -743,6 +760,9 @@ components:
|
|||
visibility:
|
||||
description: Visibility of this post.
|
||||
$ref: '#/components/schemas/Visibility'
|
||||
media_attachments:
|
||||
description: Media that is attached to this post.
|
||||
$ref: '#/components/schemas/Attachment'
|
||||
mentions:
|
||||
description: Mentions of users within the post.
|
||||
type: array
|
||||
|
|
|
@ -31,6 +31,7 @@ impl Attachment {
|
|||
let attachment_type_mastodon = match attachment_type {
|
||||
AttachmentType::Unknown => "unknown",
|
||||
AttachmentType::Image => "image",
|
||||
AttachmentType::Video => "video",
|
||||
};
|
||||
let attachment_url = get_file_url(instance_url, &db_object.file_name);
|
||||
Self {
|
||||
|
|
|
@ -17,6 +17,7 @@ pub struct DbMediaAttachment {
|
|||
pub enum AttachmentType {
|
||||
Unknown,
|
||||
Image,
|
||||
Video,
|
||||
}
|
||||
|
||||
impl AttachmentType {
|
||||
|
@ -25,6 +26,8 @@ impl AttachmentType {
|
|||
Some(media_type) => {
|
||||
if media_type.starts_with("image/") {
|
||||
Self::Image
|
||||
} else if media_type.starts_with("video/") {
|
||||
Self::Video
|
||||
} else {
|
||||
Self::Unknown
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue