Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

Commit

Permalink
Add INTERNAL MediaFile
Browse files Browse the repository at this point in the history
  • Loading branch information
pardahlman committed Apr 25, 2017
1 parent eee74a7 commit 3352895
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Akeneo/Common/EndpointResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Type, string> _typeToEndpointCache;

Expand Down Expand Up @@ -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}");
});
}
Expand Down
1 change: 1 addition & 0 deletions Akeneo/Common/Endpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
47 changes: 47 additions & 0 deletions Akeneo/Model/MediaFile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Akeneo.Model
{
internal class MediaFile : ModelBase
{
/// <summary>
/// The product to which the media file will be associated.
/// </summary>
public MediaProduct Product { get; set; }

/// <summary>
/// The binaries of the file
/// </summary>
public string File { get; set; }

public MediaFile()
{
Product = new MediaProduct();
}
}

internal class MediaProduct
{
/// <summary>
/// Product Identifier
/// </summary>
public string Identifier { get; set; }

/// <summary>
/// Attribute Code
/// </summary>
public string Attribute { get; set; }

/// <summary>
/// Channel Code
/// </summary>
public string Scope { get; set; }

/// <summary>
/// Locale Code
/// </summary>
public string Locale { get; set; }
}
}

0 comments on commit 3352895

Please sign in to comment.