2017-08-11 10:04:59 -04:00
|
|
|
|
using Bit.Core.Enums;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Models.Api
|
|
|
|
|
|
{
|
|
|
|
|
|
public class PushSendRequestModel : IValidatableObject
|
|
|
|
|
|
{
|
|
|
|
|
|
public string UserId { get; set; }
|
|
|
|
|
|
public string OrganizationId { get; set; }
|
2019-03-19 00:39:03 -04:00
|
|
|
|
public string DeviceId { get; set; }
|
2017-08-11 10:04:59 -04:00
|
|
|
|
public string Identifier { get; set; }
|
|
|
|
|
|
[Required]
|
|
|
|
|
|
public PushType? Type { get; set; }
|
|
|
|
|
|
[Required]
|
|
|
|
|
|
public object Payload { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(string.IsNullOrWhiteSpace(UserId) && string.IsNullOrWhiteSpace(OrganizationId))
|
|
|
|
|
|
{
|
|
|
|
|
|
yield return new ValidationResult($"{nameof(UserId)} or {nameof(OrganizationId)} is required.");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|