Class ReadonlyAttachment

  • All Implemented Interfaces:
    org.json.JSONString

    public class ReadonlyAttachment
    extends Object
    implements org.json.JSONString
    Readonly message attachment meta-data.
    This does not actually contain the file but only meta-data useful to retrieve the actual attachment.
    • Constructor Detail

      • ReadonlyAttachment

        public ReadonlyAttachment​(@NotNull
                                  @NotNull String url,
                                  @NotNull
                                  @NotNull String proxyUrl,
                                  @NotNull
                                  @NotNull String fileName,
                                  int width,
                                  int height,
                                  int size,
                                  long id)
    • Method Detail

      • getUrl

        @NotNull
        public @NotNull String getUrl()
        The URL for this attachment
        Returns:
        The url
      • getProxyUrl

        @NotNull
        @JSONPropertyName("proxy_url")
        public @NotNull String getProxyUrl()
        The proxy url for this attachment, this is used by the client to generate previews of images.
        Returns:
        The proxy url
      • getFileName

        @NotNull
        @JSONPropertyName("filename")
        public @NotNull String getFileName()
        The name of this attachment
        Returns:
        The file name
      • getSize

        public int getSize()
        The approximated size of this embed in bytes
        Returns:
        The approximated size in bytes
      • getWidth

        public int getWidth()
        Width of the attachment, this is only relevant to images and videos
        Returns:
        Width of this image, or -1 if not an image or video
      • getHeight

        public int getHeight()
        Height of the attachment, this is only relevant to images and videos
        Returns:
        Height of this image, or -1 if not an image or video
      • getId

        public long getId()
        The id of this attachment
        Returns:
        The idi
      • toString

        public String toString()
        JSON representation of this attachment
        Overrides:
        toString in class Object
        Returns:
        The JSON representation
      • toJSONString

        public String toJSONString()
        Specified by:
        toJSONString in interface org.json.JSONString