Skip to content

Commit

Permalink
Finish the example usage of the attachments feature
Browse files Browse the repository at this point in the history
  • Loading branch information
CronofyMatt committed Aug 13, 2024
1 parent 20c4ae5 commit e9bac5d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Cronofy.Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public static void Main(string[] args)
var client = new CronofyAccountClient(accessToken);

FetchAndPrintCalendars(client);
FetchAndPrintEvents(client);

const string EventId = "CronofyExample";

Expand Down Expand Up @@ -191,9 +192,12 @@ private static void AttachmentsExample()

var attachment = oaClient.CreateAttachment(new Requests.CreateAttachmentRequest
{
FileName = "example.txt",
ContentType = "text/plain",
Base64Content = Convert.ToBase64String(attachmentContent),
Attachment = new Requests.CreateAttachmentRequest.AttachmentSummary
{
FileName = "example.txt",
ContentType = "text/plain",
Base64Content = Convert.ToBase64String(attachmentContent),
},
});

Console.WriteLine("Attachment created");
Expand Down Expand Up @@ -254,7 +258,14 @@ private static void FetchAndPrintCalendars(CronofyAccountClient client)
}

Console.WriteLine();
}

/// <summary>
/// Fetches a list of all of the users events and prints a summary to the console.
/// </summary>
/// <param name="client">Account client to use to read the list of events.</param>
private static void FetchAndPrintEvents(CronofyAccountClient client)
{
Console.WriteLine("Fetching events...");
var events = client.GetEvents();

Expand Down

0 comments on commit e9bac5d

Please sign in to comment.