Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hydra model for default delivery channels #736

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/protagonist/DLCS.HydraModel/DefaultDeliveryChannel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Hydra;
using Hydra.Model;
using Newtonsoft.Json;

namespace DLCS.HydraModel;

[HydraClass(typeof(DefaultDeliveryChannelClass),
Description = "Assets that have not been assigned any delivery channels will use any matching " +
"default delivery channels configured in the customer or containing space.",
UriTemplate = "/customers/{0}/defaultDeliveryChannels/{1}, /customers/{0}/spaces/{1}/defaultDeliveryChannels/{2}")]
public class DefaultDeliveryChannel : DlcsResource
{
[RdfProperty(Description = "The name of the DLCS delivery channel this is based on.",
Range = Names.XmlSchema.String, ReadOnly = false, WriteOnly = false)]
[JsonProperty(Order = 11, PropertyName = "channel")]
public string? Channel { get; set; }

[HydraLink(Description = "The policy assigned to this default delivery channel.",
Range = "vocab:deliveryChannelPolicy", ReadOnly = false, WriteOnly = false)]
[JsonProperty(Order = 12, PropertyName = "policy")]
public string? Policy { get; set; }

[HydraLink(Description = "The asset media type matched by this default delivery channel.",
Range = Names.XmlSchema.String, ReadOnly = false, WriteOnly = false)]
[JsonProperty(Order = 12, PropertyName = "mediaType")]
public string? MediaType { get; set; }
}

public class DefaultDeliveryChannelClass: Class
{
string operationId = "_:defaultDeliveryChannel_";

public DefaultDeliveryChannelClass()
{
BootstrapViaReflection(typeof(DefaultDeliveryChannel));
}

public override void DefineOperations()
{
SupportedOperations = CommonOperations.GetStandardResourceOperations(
operationId, "Default Delivery Channel", Id,
"GET", "POST", "PUT", "DELETE");
}
}
Loading