|
| 1 | +namespace Cronofy |
| 2 | +{ |
| 3 | + using Newtonsoft.Json; |
| 4 | + |
| 5 | + /// <summary> |
| 6 | + /// Class for the deserialization of an attachment summary |
| 7 | + /// response. |
| 8 | + /// </summary> |
| 9 | + public sealed class Attachment |
| 10 | + { |
| 11 | + /// <summary> |
| 12 | + /// Gets or sets the attachment ID. |
| 13 | + /// </summary> |
| 14 | + /// <value> |
| 15 | + /// The ID of the attachment. |
| 16 | + /// </value> |
| 17 | + [JsonProperty("attachment_id")] |
| 18 | + public string AttachmentId { get; set; } |
| 19 | + |
| 20 | + /// <summary> |
| 21 | + /// Gets or sets the file name for the attachment. |
| 22 | + /// </summary> |
| 23 | + /// <value> |
| 24 | + /// The file name for the attachment. |
| 25 | + /// </value> |
| 26 | + [JsonProperty("file_name")] |
| 27 | + public string FileName { get; set; } |
| 28 | + |
| 29 | + /// <summary> |
| 30 | + /// Gets or sets the MIME content type for the attachment. |
| 31 | + /// </summary> |
| 32 | + /// <value> |
| 33 | + /// The MIME content type for the attachment. |
| 34 | + /// </value> |
| 35 | + [JsonProperty("content_type")] |
| 36 | + public string ContentType { get; set; } |
| 37 | + |
| 38 | + /// <summary> |
| 39 | + /// Gets or sets the MD5 hash of the attachment content. |
| 40 | + /// </summary> |
| 41 | + /// <value> |
| 42 | + /// The MD5 hash of the attachment content. |
| 43 | + /// </value> |
| 44 | + [JsonProperty("md5")] |
| 45 | + public string MD5 { get; set; } |
| 46 | + |
| 47 | + /// <inheritdoc/> |
| 48 | + public override bool Equals(object obj) |
| 49 | + { |
| 50 | + if (ReferenceEquals(null, obj)) |
| 51 | + { |
| 52 | + return false; |
| 53 | + } |
| 54 | + |
| 55 | + if (ReferenceEquals(this, obj)) |
| 56 | + { |
| 57 | + return true; |
| 58 | + } |
| 59 | + |
| 60 | + return obj is Attachment && this.Equals((Attachment)obj); |
| 61 | + } |
| 62 | + |
| 63 | + /// <inheritdoc/> |
| 64 | + public override int GetHashCode() |
| 65 | + { |
| 66 | + return this.AttachmentId.GetHashCode(); |
| 67 | + } |
| 68 | + |
| 69 | + /// <summary> |
| 70 | + /// Determines whether the specified <see cref="Cronofy.Attachment"/> |
| 71 | + /// is equal to the current <see cref="Cronofy.Attachment"/>. |
| 72 | + /// </summary> |
| 73 | + /// <param name="other"> |
| 74 | + /// The <see cref="Cronofy.Attachment"/> to compare with the current |
| 75 | + /// <see cref="Cronofy.Attachment"/>. |
| 76 | + /// </param> |
| 77 | + /// <returns> |
| 78 | + /// <c>true</c> if the specified <see cref="Cronofy.Attachment"/> is |
| 79 | + /// equal to the current <see cref="Cronofy.Attachment"/>; otherwise, |
| 80 | + /// <c>false</c>. |
| 81 | + /// </returns> |
| 82 | + public bool Equals(Attachment other) |
| 83 | + { |
| 84 | + return this.AttachmentId == other.AttachmentId && this.FileName == other.FileName |
| 85 | + && this.ContentType == other.ContentType && this.MD5 == other.MD5; |
| 86 | + } |
| 87 | + |
| 88 | + /// <inheritdoc/> |
| 89 | + public override string ToString() |
| 90 | + { |
| 91 | + return string.Format( |
| 92 | + "<{0} AttachmentId={1}, FileName={2}>", |
| 93 | + this.GetType(), |
| 94 | + this.AttachmentId, |
| 95 | + this.FileName); |
| 96 | + } |
| 97 | + } |
| 98 | +} |
0 commit comments