You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Attachment.cs 2.6 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System.Text.Json.Serialization;
  2. namespace Discord.Net.Models
  3. {
  4. /// <summary>
  5. /// Represents an attachment object.
  6. /// </summary>
  7. public record Attachment
  8. {
  9. /// <summary>
  10. /// Creates a <see cref="Attachment"/> with the provided parameters.
  11. /// </summary>
  12. /// <param name="id">Attachment id.</param>
  13. /// <param name="filename">Name of file attached.</param>
  14. /// <param name="contentType">The attachment's media type.</param>
  15. /// <param name="size">Size of file in bytes.</param>
  16. /// <param name="url">Source url of file.</param>
  17. /// <param name="proxyUrl">A proxied url of file.</param>
  18. /// <param name="height">Height of file (if image).</param>
  19. /// <param name="width">Width of file (if image).</param>
  20. [JsonConstructor]
  21. public Attachment(Snowflake id, string filename, Optional<string> contentType, int size, string url, string proxyUrl, Optional<int?> height, Optional<int?> width)
  22. {
  23. Id = id;
  24. Filename = filename;
  25. ContentType = contentType;
  26. Size = size;
  27. Url = url;
  28. ProxyUrl = proxyUrl;
  29. Height = height;
  30. Width = width;
  31. }
  32. /// <summary>
  33. /// Attachment id.
  34. /// </summary>
  35. [JsonPropertyName("id")]
  36. public Snowflake Id { get; }
  37. /// <summary>
  38. /// Name of file attached.
  39. /// </summary>
  40. [JsonPropertyName("filename")]
  41. public string Filename { get; }
  42. /// <summary>
  43. /// The attachment's media type.
  44. /// </summary>
  45. [JsonPropertyName("content_type")]
  46. public Optional<string> ContentType { get; }
  47. /// <summary>
  48. /// Size of file in bytes.
  49. /// </summary>
  50. [JsonPropertyName("size")]
  51. public int Size { get; }
  52. /// <summary>
  53. /// Source url of file.
  54. /// </summary>
  55. [JsonPropertyName("url")]
  56. public string Url { get; }
  57. /// <summary>
  58. /// A proxied url of file.
  59. /// </summary>
  60. [JsonPropertyName("proxy_url")]
  61. public string ProxyUrl { get; }
  62. /// <summary>
  63. /// Height of file (if image).
  64. /// </summary>
  65. [JsonPropertyName("height")]
  66. public Optional<int?> Height { get; }
  67. /// <summary>
  68. /// Width of file (if image).
  69. /// </summary>
  70. [JsonPropertyName("width")]
  71. public Optional<int?> Width { get; }
  72. }
  73. }

No Description