logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

attachment.ex (2118B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.ApiSpec.Schemas.Attachment do
  5. alias OpenApiSpex.Schema
  6. require OpenApiSpex
  7. OpenApiSpex.schema(%{
  8. title: "Attachment",
  9. description: "Represents a file or media attachment that can be added to a status.",
  10. type: :object,
  11. required: [:id, :url, :preview_url],
  12. properties: %{
  13. id: %Schema{type: :string, description: "The ID of the attachment in the database."},
  14. url: %Schema{
  15. type: :string,
  16. format: :uri,
  17. description: "The location of the original full-size attachment"
  18. },
  19. remote_url: %Schema{
  20. type: :string,
  21. format: :uri,
  22. description:
  23. "The location of the full-size original attachment on the remote website. String (URL), or null if the attachment is local",
  24. nullable: true
  25. },
  26. preview_url: %Schema{
  27. type: :string,
  28. format: :uri,
  29. description: "The location of a scaled-down preview of the attachment"
  30. },
  31. text_url: %Schema{
  32. type: :string,
  33. format: :uri,
  34. description: "A shorter URL for the attachment"
  35. },
  36. description: %Schema{
  37. type: :string,
  38. nullable: true,
  39. description:
  40. "Alternate text that describes what is in the media attachment, to be used for the visually impaired or when media attachments do not load"
  41. },
  42. type: %Schema{
  43. type: :string,
  44. enum: ["image", "video", "audio", "unknown"],
  45. description: "The type of the attachment"
  46. },
  47. pleroma: %Schema{
  48. type: :object,
  49. properties: %{
  50. mime_type: %Schema{type: :string, description: "mime type of the attachment"}
  51. }
  52. }
  53. },
  54. example: %{
  55. id: "1638338801",
  56. type: "image",
  57. url: "someurl",
  58. remote_url: "someurl",
  59. preview_url: "someurl",
  60. text_url: "someurl",
  61. description: nil,
  62. pleroma: %{mime_type: "image/png"}
  63. }
  64. })
  65. end