Skip to content

Commit

Permalink
added test for datePublished to ModifyMediaSample
Browse files Browse the repository at this point in the history
  • Loading branch information
quirijnslings committed Sep 9, 2024
1 parent 99140e2 commit 1a11165
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions Bynder/Sample/ModifyMediaSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,38 @@ private async Task RunModifyMediaSampleAsync()
var mediaInfo = await assetService.GetMediaInfoAsync(mediaInformationQuery);
Console.WriteLine($"ID: {mediaInfo.Id}");
Console.WriteLine($"Name: {mediaInfo.Name}");


// datePublished
Console.WriteLine($"---\r\nTest with datePublished");
Console.WriteLine($"datePublished is currently set to: {mediaInfo.DatePublished}");
Console.WriteLine("New value (use ISO8601 format: yyyy-mm-ddThh:mm:ssZ, or n = now, or leave empty to erase): ");
var cmd = Console.ReadLine();
var query = new ModifyMediaQuery(mediaId);
if (cmd.ToLower().StartsWith("n"))
{
query.PublishedDate = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ssZ");
}
else if (string.IsNullOrEmpty(cmd))
{
query.PublishedDate = "";
}
else
{
query.PublishedDate = cmd;
}
await assetService.ModifyMediaAsync(query);
Console.WriteLine("The asset has been modified. It takes a few seconds for changes come through. Hit enter when you want to retrieve the asset again.");
Console.ReadLine();
mediaInfo = await assetService.GetMediaInfoAsync(mediaInformationQuery);
Console.WriteLine($"datePublished is now set to: {mediaInfo.DatePublished}");

// isArchived (boolean)
Console.WriteLine($"---\r\nTest with boolean value (isArchived)");
Console.WriteLine($"isArchived is currently set to: {mediaInfo.IsArchived}");
Console.WriteLine("New value (t=true, f=false, n=not set): ");
var cmd = Console.ReadLine();
var query = new ModifyMediaQuery(mediaId);
cmd = Console.ReadLine();
query = new ModifyMediaQuery(mediaId);
if (cmd.ToLower().StartsWith("t"))
{
query.Archive = true;
Expand All @@ -71,8 +98,6 @@ private async Task RunModifyMediaSampleAsync()
await assetService.ModifyMediaAsync(query);
Console.WriteLine("The asset has been modified. It takes a few seconds for changes come through. Hit enter when you want to retrieve the asset again.");
Console.ReadLine();


mediaInfo = await assetService.GetMediaInfoAsync(mediaInformationQuery);
Console.WriteLine($"isArchived is now set to: {mediaInfo.IsArchived}");

Expand Down

0 comments on commit 1a11165

Please sign in to comment.