Skip to content

Commit

Permalink
Documentation and warnings resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
CronofyMatt committed Aug 13, 2024
1 parent b9c41a8 commit cff074d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 12 deletions.
12 changes: 12 additions & 0 deletions src/Cronofy/ICronofyOAuthClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,18 @@ public interface ICronofyOAuthClient
/// </exception>
IAuthorizationUrlBuilder GetEnterpriseConnectAuthorizationUrlBuilder(string redirectUri);

/// <summary>
/// Creates a new attachment that can be added to an event as part of an upsert operation.
/// </summary>
/// <param name="createAttachmentRequest">
/// The details of the attachment to be created.
/// </param>
/// <returns>
/// The created attachment.
/// </returns>
/// <exception cref="System.ArgumentException">
/// Thrown if <paramref name="createAttachmentRequest"/> is null or empty.
/// </exception>
Attachment CreateAttachment(CreateAttachmentRequest createAttachmentRequest);
}
}
2 changes: 1 addition & 1 deletion src/Cronofy/Requests/CreateAttachmentRequest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Cronofy.Requests
{
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json;

/// <summary>
/// Class for the serialization of a create attachment request.
Expand Down
53 changes: 42 additions & 11 deletions src/Cronofy/Responses/AttachmentResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,61 @@ internal sealed class AttachmentResponse
[JsonProperty("attachment")]
public AttachmentSummary Attachment { get; set; }

/// <summary>
/// Converts the response into an attachment.
/// </summary>
/// <returns>The response as an attachment.</returns>
public Attachment ToAttachment()
{
return new Attachment
{
AttachmentId = this.Attachment.AttachmentId,
FileName = this.Attachment.FileName,
ContentType = this.Attachment.ContentType,
MD5 = this.Attachment.MD5,
};
}

/// <summary>
/// Class for the serialization of attachment summary.
/// </summary>
internal sealed class AttachmentSummary
{
/// <summary>
/// Gets or sets the id of the attachment.
/// </summary>
/// <value>
/// The id of the attachment.
/// </value>
[JsonProperty("attachment_id")]
public string AttachmentId { get; set; }

/// <summary>
/// Gets or sets the name of the attachment file.
/// </summary>
/// <value>
/// The name of the attachment file.
/// </value>
[JsonProperty("file_name")]
public string FileName { get; set; }

/// <summary>
/// Gets or sets the MIME content type of the attachment.
/// </summary>
/// <value>
/// The MIME content type of the attachment.
/// </value>
[JsonProperty("content_type")]
public string ContentType { get; set; }

/// <summary>
/// Gets or sets the MD5 hash of the attachment file content.
/// </summary>
/// <value>
/// The MD5 hash of the attachment file content.
/// </value>
[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,
};
}
}
}

0 comments on commit cff074d

Please sign in to comment.