QuickConnectResultDto.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. namespace MediaBrowser.Model.QuickConnect
  3. {
  4. /// <summary>
  5. /// Stores the non-sensitive results of an incoming quick connect request.
  6. /// </summary>
  7. public class QuickConnectResultDto
  8. {
  9. /// <summary>
  10. /// Gets a value indicating whether this request is authorized.
  11. /// </summary>
  12. public bool Authenticated { get; private set; }
  13. /// <summary>
  14. /// Gets the user facing code used so the user can quickly differentiate this request from others.
  15. /// </summary>
  16. public string? Code { get; private set; }
  17. /// <summary>
  18. /// Gets the public value used to uniquely identify this request. Can only be used to authorize the request.
  19. /// </summary>
  20. public string? Lookup { get; private set; }
  21. /// <summary>
  22. /// Gets the device friendly name.
  23. /// </summary>
  24. public string? FriendlyName { get; private set; }
  25. /// <summary>
  26. /// Gets the DateTime that this request was created.
  27. /// </summary>
  28. public DateTime? DateAdded { get; private set; }
  29. /// <summary>
  30. /// Cast an internal quick connect result to a DTO by removing all sensitive properties.
  31. /// </summary>
  32. /// <param name="result">QuickConnectResult object to cast</param>
  33. public static implicit operator QuickConnectResultDto(QuickConnectResult result)
  34. {
  35. QuickConnectResultDto resultDto = new QuickConnectResultDto
  36. {
  37. Authenticated = result.Authenticated,
  38. Code = result.Code,
  39. FriendlyName = result.FriendlyName,
  40. DateAdded = result.DateAdded,
  41. Lookup = result.Lookup
  42. };
  43. return resultDto;
  44. }
  45. }
  46. }