-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
268 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
namespace Cronofy | ||
{ | ||
using Newtonsoft.Json; | ||
|
||
/// <summary> | ||
/// Class for the deserialization of an attachment summary | ||
/// response. | ||
/// </summary> | ||
public sealed class Attachment | ||
{ | ||
/// <summary> | ||
/// Gets or sets the attachment ID. | ||
/// </summary> | ||
/// <value> | ||
/// The ID of the attachment. | ||
/// </value> | ||
[JsonProperty("attachment_id")] | ||
public string AttachmentId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the file name for the attachment. | ||
/// </summary> | ||
/// <value> | ||
/// The file name for the attachment. | ||
/// </value> | ||
[JsonProperty("file_name")] | ||
public string FileName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the MIME content type for the attachment. | ||
/// </summary> | ||
/// <value> | ||
/// The MIME content type for the attachment. | ||
/// </value> | ||
[JsonProperty("content_type")] | ||
public string ContentType { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the MD5 hash of the attachment content. | ||
/// </summary> | ||
/// <value> | ||
/// The MD5 hash of the attachment content. | ||
/// </value> | ||
[JsonProperty("md5")] | ||
public string MD5 { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) | ||
{ | ||
return false; | ||
} | ||
|
||
if (ReferenceEquals(this, obj)) | ||
{ | ||
return true; | ||
} | ||
|
||
return obj is Attachment && this.Equals((Attachment)obj); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override int GetHashCode() | ||
{ | ||
return this.AttachmentId.GetHashCode(); | ||
} | ||
|
||
/// <summary> | ||
/// Determines whether the specified <see cref="Cronofy.Attachment"/> | ||
/// is equal to the current <see cref="Cronofy.Attachment"/>. | ||
/// </summary> | ||
/// <param name="other"> | ||
/// The <see cref="Cronofy.Attachment"/> to compare with the current | ||
/// <see cref="Cronofy.Attachment"/>. | ||
/// </param> | ||
/// <returns> | ||
/// <c>true</c> if the specified <see cref="Cronofy.Attachment"/> is | ||
/// equal to the current <see cref="Cronofy.Attachment"/>; otherwise, | ||
/// <c>false</c>. | ||
/// </returns> | ||
public bool Equals(Attachment other) | ||
{ | ||
return this.AttachmentId == other.AttachmentId && this.FileName == other.FileName | ||
&& this.ContentType == other.ContentType && this.MD5 == other.MD5; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override string ToString() | ||
{ | ||
return string.Format( | ||
"<{0} AttachmentId={1}, FileName={2}>", | ||
this.GetType(), | ||
this.AttachmentId, | ||
this.FileName); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
namespace Cronofy.Requests | ||
{ | ||
using Newtonsoft.Json; | ||
using System.Collections.Generic; | ||
|
||
/// <summary> | ||
/// Class for the serialization of a create attachment request. | ||
/// </summary> | ||
public sealed class CreateAttachmentRequest | ||
{ | ||
/// <summary> | ||
/// Gets or sets the file name for the attachment. | ||
/// </summary> | ||
/// <value> | ||
/// The file name for the attachment. | ||
/// </value> | ||
[JsonProperty("file_name")] | ||
public string FileName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the MIME content type for the attachment. | ||
/// </summary> | ||
/// <value> | ||
/// The MIME content type for the attachment. | ||
/// </value> | ||
[JsonProperty("content_type")] | ||
public string ContentType { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the Base64-encoded content of the attachment. | ||
/// </summary> | ||
/// <value> | ||
/// The Base64-encoded content of the attachment. | ||
/// </value> | ||
[JsonProperty("base64_content")] | ||
public string Base64Content { get; set; } | ||
|
||
/// <summary> | ||
/// Class for the serialization of attachment subscriptions. | ||
/// </summary> | ||
public sealed class RequestSubscription | ||
{ | ||
/// <summary> | ||
/// Gets or sets the type of the subscription. | ||
/// </summary> | ||
/// <value> | ||
/// The type of the subscription. | ||
/// </value> | ||
[JsonProperty("type")] | ||
public string Type { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the destination URI Cronofy will call when the subscription is triggered. | ||
/// </summary> | ||
/// <value> | ||
/// The destination URI Cronofy will call when the subscription is triggered. | ||
/// </value> | ||
[JsonProperty("uri")] | ||
public string Uri { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the interactions subscribed to. | ||
/// </summary> | ||
/// <value> | ||
/// The interactions subscribed to. | ||
/// </value> | ||
[JsonProperty("interactions")] | ||
public IEnumerable<Interaction> Interactions { get; set; } | ||
|
||
/// <summary> | ||
/// Class for the serialization of event subscription interactions. | ||
/// </summary> | ||
public sealed class Interaction | ||
{ | ||
/// <summary> | ||
/// Gets or sets the type of the interaction. | ||
/// </summary> | ||
/// <value> | ||
/// The type of the interaction. | ||
/// </value> | ||
[JsonProperty("type")] | ||
public string Type { get; set; } | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
namespace Cronofy.Responses | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
|
||
/// <summary> | ||
/// Class for the deserialization of an availability response. | ||
/// </summary> | ||
internal sealed class AttachmentResponse | ||
{ | ||
/// <summary> | ||
/// Gets or sets the available periods of the response. | ||
/// </summary> | ||
/// <value> | ||
/// The available periods of the response. | ||
/// </value> | ||
[JsonProperty("attachment")] | ||
public AttachmentSummary Attachment { get; set; } | ||
|
||
internal sealed class AttachmentSummary | ||
{ | ||
[JsonProperty("attachment_id")] | ||
public string AttachmentId { get; set; } | ||
|
||
[JsonProperty("file_name")] | ||
public string FileName { get; set; } | ||
|
||
[JsonProperty("content_type")] | ||
public string ContentType { get; set; } | ||
|
||
[JsonProperty("md5")] | ||
public string MD5 { get; set; } | ||
} | ||
|
||
public Attachment ToAttachment() | ||
{ | ||
return new Attachment | ||
{ | ||
AttachmentId = this.Attachment.AttachmentId, | ||
FileName = this.Attachment.FileName, | ||
ContentType = this.Attachment.ContentType, | ||
MD5 = this.Attachment.MD5, | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters