Skip to content

Commit

Permalink
v3-asset type (#99)
Browse files Browse the repository at this point in the history
* targetframework now net8.0, packages upgraded

* updated gitignore to the toptotal standard, added launchSettings to help developers run the samples

* made AssetType obsolete and read it from the PropertyOptionsDictionary instead
  • Loading branch information
quirijnslings authored Sep 17, 2024
1 parent f3edc7a commit b87e130
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Bynder/Sample/MediaSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ private async Task RunMediaSampleAsync()
Console.WriteLine($"ID: {mediaInfo.Id}");
Console.WriteLine($"Name: {mediaInfo.Name}");
Console.WriteLine($"Brand Id: {mediaInfo.BrandId}");
Console.WriteLine($"Asset type: {string.Join(',', mediaInfo.PropertyAssetType)}");
if (mediaInfo.PropertyOptionsDictionary != null)
{
foreach (var propertyKey in mediaInfo.PropertyOptionsDictionary.Keys)
{
Console.Write($"Property option in dictionary: {propertyKey}: {mediaInfo.PropertyOptionsDictionary[propertyKey].ToString()}");
}
}


// Get the media download URL
Console.WriteLine("Enter the media ID to get the media download URL for: ");
Expand Down
12 changes: 11 additions & 1 deletion Bynder/Sdk/Model/Media.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Bynder.Sdk.Api.Converters;
using System;
using System.Linq;

namespace Bynder.Sdk.Model
{
Expand All @@ -23,7 +25,15 @@ public class Media
/// Property asset types assigned to media
/// </summary>
[JsonProperty("property_assettype")]
public IList<string> PropertyAssetType { get; set; }
[JsonIgnore]
[Obsolete("Use PropertyOptionsDictionary?[\"property_assettype\"] instead")]
public IList<string> PropertyAssetType
{
get
{
return PropertyOptionsDictionary?["property_assettype"].Values().Select(v => v.ToString()).ToList() ?? null;
}
}

/// <summary>
/// Active focus point in the original media item, defined
Expand Down

0 comments on commit b87e130

Please sign in to comment.