2020-05-05 19:19:16 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-02 20:38:50 +00:00
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
2020-05-05 19:19:16 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.ApiSpec.Schemas.Attachment do
|
|
|
|
alias OpenApiSpex.Schema
|
|
|
|
|
|
|
|
require OpenApiSpex
|
|
|
|
|
|
|
|
OpenApiSpex.schema(%{
|
|
|
|
title: "Attachment",
|
|
|
|
description: "Represents a file or media attachment that can be added to a status.",
|
|
|
|
type: :object,
|
2023-12-27 23:15:32 +00:00
|
|
|
required: [:id, :url, :preview_url],
|
2020-05-05 19:19:16 +00:00
|
|
|
properties: %{
|
2020-05-14 08:50:12 +00:00
|
|
|
id: %Schema{type: :string, description: "The ID of the attachment in the database."},
|
2020-05-05 19:19:16 +00:00
|
|
|
url: %Schema{
|
|
|
|
type: :string,
|
|
|
|
format: :uri,
|
|
|
|
description: "The location of the original full-size attachment"
|
|
|
|
},
|
|
|
|
remote_url: %Schema{
|
|
|
|
type: :string,
|
|
|
|
format: :uri,
|
|
|
|
description:
|
|
|
|
"The location of the full-size original attachment on the remote website. String (URL), or null if the attachment is local",
|
|
|
|
nullable: true
|
|
|
|
},
|
|
|
|
preview_url: %Schema{
|
|
|
|
type: :string,
|
|
|
|
format: :uri,
|
|
|
|
description: "The location of a scaled-down preview of the attachment"
|
|
|
|
},
|
|
|
|
text_url: %Schema{
|
|
|
|
type: :string,
|
|
|
|
format: :uri,
|
|
|
|
description: "A shorter URL for the attachment"
|
|
|
|
},
|
|
|
|
description: %Schema{
|
|
|
|
type: :string,
|
|
|
|
nullable: true,
|
|
|
|
description:
|
|
|
|
"Alternate text that describes what is in the media attachment, to be used for the visually impaired or when media attachments do not load"
|
|
|
|
},
|
|
|
|
type: %Schema{
|
|
|
|
type: :string,
|
|
|
|
enum: ["image", "video", "audio", "unknown"],
|
|
|
|
description: "The type of the attachment"
|
|
|
|
},
|
|
|
|
pleroma: %Schema{
|
|
|
|
type: :object,
|
|
|
|
properties: %{
|
2023-03-09 09:35:57 +00:00
|
|
|
mime_type: %Schema{type: :string, description: "mime type of the attachment"},
|
|
|
|
name: %Schema{
|
|
|
|
type: :string,
|
|
|
|
description: "Name of the attachment, typically the filename"
|
|
|
|
}
|
2020-05-05 19:19:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
example: %{
|
|
|
|
id: "1638338801",
|
|
|
|
type: "image",
|
|
|
|
url: "someurl",
|
|
|
|
remote_url: "someurl",
|
|
|
|
preview_url: "someurl",
|
|
|
|
text_url: "someurl",
|
|
|
|
description: nil,
|
|
|
|
pleroma: %{mime_type: "image/png"}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|