Skip to content

Commit e9bac5d

Browse files
committed
Finish the example usage of the attachments feature
1 parent 20c4ae5 commit e9bac5d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Cronofy.Example/Program.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public static void Main(string[] args)
4242
var client = new CronofyAccountClient(accessToken);
4343

4444
FetchAndPrintCalendars(client);
45+
FetchAndPrintEvents(client);
4546

4647
const string EventId = "CronofyExample";
4748

@@ -191,9 +192,12 @@ private static void AttachmentsExample()
191192

192193
var attachment = oaClient.CreateAttachment(new Requests.CreateAttachmentRequest
193194
{
194-
FileName = "example.txt",
195-
ContentType = "text/plain",
196-
Base64Content = Convert.ToBase64String(attachmentContent),
195+
Attachment = new Requests.CreateAttachmentRequest.AttachmentSummary
196+
{
197+
FileName = "example.txt",
198+
ContentType = "text/plain",
199+
Base64Content = Convert.ToBase64String(attachmentContent),
200+
},
197201
});
198202

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

256260
Console.WriteLine();
261+
}
257262

263+
/// <summary>
264+
/// Fetches a list of all of the users events and prints a summary to the console.
265+
/// </summary>
266+
/// <param name="client">Account client to use to read the list of events.</param>
267+
private static void FetchAndPrintEvents(CronofyAccountClient client)
268+
{
258269
Console.WriteLine("Fetching events...");
259270
var events = client.GetEvents();
260271

0 commit comments

Comments
 (0)