diff --git a/Bynder/Sample/UploadSample.cs b/Bynder/Sample/UploadSample.cs index 21a054a..7e1da81 100644 --- a/Bynder/Sample/UploadSample.cs +++ b/Bynder/Sample/UploadSample.cs @@ -78,6 +78,12 @@ private async Task RunUploadSampleAsync() query.Description = description; } + + query.MetapropertyOptions = new Dictionary>() + { + { "a", [ "b" ]} + }; + FileStream fileStream = null; if (passAsStream) { diff --git a/Bynder/Sdk/Query/Asset/MediaQuery.cs b/Bynder/Sdk/Query/Asset/MediaQuery.cs index 09b0869..0c6d87c 100644 --- a/Bynder/Sdk/Query/Asset/MediaQuery.cs +++ b/Bynder/Sdk/Query/Asset/MediaQuery.cs @@ -84,7 +84,7 @@ public class MediaQuery /// - If the metaproperty is of type text, the values refer to the text itself /// /// - [ApiField("property_", Converter = typeof(MetapropertyOptionsConverter))] + [ApiField("property_", Converter = typeof(MetapropertyOptionsConverter), OmitSeparator = true)] public IDictionary> MetaProperties { get; set; } } diff --git a/Bynder/Sdk/Query/Decoder/ApiField.cs b/Bynder/Sdk/Query/Decoder/ApiField.cs index d9e8ae1..b23424a 100644 --- a/Bynder/Sdk/Query/Decoder/ApiField.cs +++ b/Bynder/Sdk/Query/Decoder/ApiField.cs @@ -1,4 +1,4 @@ -// Copyright (c) Bynder. All rights reserved. +// Copyright (c) Bynder. All rights reserved. // Licensed under the MIT License. See LICENSE file in the project root for full license information. using System; @@ -30,5 +30,10 @@ public ApiField(string name) /// Name of the property in the API documentation. /// public string ApiName { get; private set; } + + /// + /// Indicates whether or not the separator (usually a dot) must be omitted when converting + /// + public bool OmitSeparator { get; set; } } } diff --git a/Bynder/Sdk/Query/Decoder/QueryDecoder.cs b/Bynder/Sdk/Query/Decoder/QueryDecoder.cs index 7a2a022..5bf54cf 100644 --- a/Bynder/Sdk/Query/Decoder/QueryDecoder.cs +++ b/Bynder/Sdk/Query/Decoder/QueryDecoder.cs @@ -68,9 +68,10 @@ private void ConvertProperty(PropertyInfo propertyInfo, object query, IDictionar else if (Activator.CreateInstance(apiField.Converter) is ITypeToDictionaryConverter dictConverter && dictConverter.CanConvert(propertyInfo.PropertyType)) { + var separator = apiField.OmitSeparator ? string.Empty : "."; foreach (var item in dictConverter.Convert(value)) { - AddParam(parameters, $"{apiField.ApiName}{item.Key}", item.Value); + AddParam(parameters, $"{apiField.ApiName}{separator}{item.Key}", item.Value); } } }