diff --git a/Akeneo/Common/EndpointResolver.cs b/Akeneo/Common/EndpointResolver.cs index 3ffe28c..1059c55 100644 --- a/Akeneo/Common/EndpointResolver.cs +++ b/Akeneo/Common/EndpointResolver.cs @@ -13,6 +13,7 @@ public class EndpointResolver private static readonly Type Family = typeof(Family); private static readonly Type Category = typeof(Category); private static readonly Type Product = typeof(Product); + private static readonly Type MediaFile = typeof(MediaFile); private readonly ConcurrentDictionary _typeToEndpointCache; @@ -106,6 +107,10 @@ protected virtual string GetResourceEndpoint(Type modelType) { return Endpoints.Attributes; } + if (MediaFile.GetTypeInfo().IsAssignableFrom(type)) + { + return Endpoints.MediaFiles; + } throw new NotSupportedException($"Unable to find API endpoint for type {modelType.FullName}"); }); } diff --git a/Akeneo/Common/Endpoints.cs b/Akeneo/Common/Endpoints.cs index 26f4299..e49a831 100644 --- a/Akeneo/Common/Endpoints.cs +++ b/Akeneo/Common/Endpoints.cs @@ -7,5 +7,6 @@ public class Endpoints public const string Categories = "api/rest/v1/categories"; public const string Attributes = "api/rest/v1/attributes"; public const string Families = "api/rest/v1/families"; + public const string MediaFiles = "api/rest/v1/media-files"; } } diff --git a/Akeneo/Model/MediaFile.cs b/Akeneo/Model/MediaFile.cs new file mode 100644 index 0000000..cab9d4f --- /dev/null +++ b/Akeneo/Model/MediaFile.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Akeneo.Model +{ + internal class MediaFile : ModelBase + { + /// + /// The product to which the media file will be associated. + /// + public MediaProduct Product { get; set; } + + /// + /// The binaries of the file + /// + public string File { get; set; } + + public MediaFile() + { + Product = new MediaProduct(); + } + } + + internal class MediaProduct + { + /// + /// Product Identifier + /// + public string Identifier { get; set; } + + /// + /// Attribute Code + /// + public string Attribute { get; set; } + + /// + /// Channel Code + /// + public string Scope { get; set; } + + /// + /// Locale Code + /// + public string Locale { get; set; } + } +}