2013-09-11 09:33:47 +03:00
|
|
|
using System;
|
|
|
|
using NzbDrone.Api.REST;
|
|
|
|
using NzbDrone.Core.Datastore.Events;
|
|
|
|
|
|
|
|
namespace NzbDrone.Api
|
|
|
|
{
|
|
|
|
public class ResourceChangeMessage<TResource> where TResource : RestResource
|
|
|
|
{
|
|
|
|
public TResource Resource { get; private set; }
|
|
|
|
public ModelAction Action { get; private set; }
|
|
|
|
|
|
|
|
public ResourceChangeMessage(ModelAction action)
|
|
|
|
{
|
2013-10-02 08:20:30 +03:00
|
|
|
if (action != ModelAction.Deleted && action != ModelAction.Sync)
|
2013-09-11 09:33:47 +03:00
|
|
|
{
|
|
|
|
throw new InvalidOperationException("Resource message without a resource needs to have Delete or Sync as action");
|
|
|
|
}
|
|
|
|
|
|
|
|
Action = action;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ResourceChangeMessage(TResource resource, ModelAction action)
|
|
|
|
{
|
|
|
|
Resource = resource;
|
|
|
|
Action = action;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|