From cff074dc53a8420ed3518db845810a9c174ba1e6 Mon Sep 17 00:00:00 2001 From: Matthew Wade Date: Tue, 13 Aug 2024 08:36:35 +0100 Subject: [PATCH] Documentation and warnings resolution --- src/Cronofy/ICronofyOAuthClient.cs | 12 +++++ .../Requests/CreateAttachmentRequest.cs | 2 +- src/Cronofy/Responses/AttachmentResponse.cs | 53 +++++++++++++++---- 3 files changed, 55 insertions(+), 12 deletions(-) diff --git a/src/Cronofy/ICronofyOAuthClient.cs b/src/Cronofy/ICronofyOAuthClient.cs index 19e70e8..ad32ec5 100644 --- a/src/Cronofy/ICronofyOAuthClient.cs +++ b/src/Cronofy/ICronofyOAuthClient.cs @@ -397,6 +397,18 @@ public interface ICronofyOAuthClient /// IAuthorizationUrlBuilder GetEnterpriseConnectAuthorizationUrlBuilder(string redirectUri); + /// + /// Creates a new attachment that can be added to an event as part of an upsert operation. + /// + /// + /// The details of the attachment to be created. + /// + /// + /// The created attachment. + /// + /// + /// Thrown if is null or empty. + /// Attachment CreateAttachment(CreateAttachmentRequest createAttachmentRequest); } } diff --git a/src/Cronofy/Requests/CreateAttachmentRequest.cs b/src/Cronofy/Requests/CreateAttachmentRequest.cs index ec94077..05fdcd9 100644 --- a/src/Cronofy/Requests/CreateAttachmentRequest.cs +++ b/src/Cronofy/Requests/CreateAttachmentRequest.cs @@ -1,7 +1,7 @@ namespace Cronofy.Requests { - using Newtonsoft.Json; using System.Collections.Generic; + using Newtonsoft.Json; /// /// Class for the serialization of a create attachment request. diff --git a/src/Cronofy/Responses/AttachmentResponse.cs b/src/Cronofy/Responses/AttachmentResponse.cs index ad9d41c..7a762fd 100644 --- a/src/Cronofy/Responses/AttachmentResponse.cs +++ b/src/Cronofy/Responses/AttachmentResponse.cs @@ -19,30 +19,61 @@ internal sealed class AttachmentResponse [JsonProperty("attachment")] public AttachmentSummary Attachment { get; set; } + /// + /// Converts the response into an attachment. + /// + /// The response as an attachment. + public Attachment ToAttachment() + { + return new Attachment + { + AttachmentId = this.Attachment.AttachmentId, + FileName = this.Attachment.FileName, + ContentType = this.Attachment.ContentType, + MD5 = this.Attachment.MD5, + }; + } + + /// + /// Class for the serialization of attachment summary. + /// internal sealed class AttachmentSummary { + /// + /// Gets or sets the id of the attachment. + /// + /// + /// The id of the attachment. + /// [JsonProperty("attachment_id")] public string AttachmentId { get; set; } + /// + /// Gets or sets the name of the attachment file. + /// + /// + /// The name of the attachment file. + /// [JsonProperty("file_name")] public string FileName { get; set; } + /// + /// Gets or sets the MIME content type of the attachment. + /// + /// + /// The MIME content type of the attachment. + /// [JsonProperty("content_type")] public string ContentType { get; set; } + /// + /// Gets or sets the MD5 hash of the attachment file content. + /// + /// + /// The MD5 hash of the attachment file content. + /// [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, - }; - } } }