ApiMemberAttribute.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #nullable disable
  2. using System;
  3. namespace MediaBrowser.Model.Services
  4. {
  5. /// <summary>
  6. /// Identifies a single API endpoint.
  7. /// </summary>
  8. [AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
  9. public class ApiMemberAttribute : Attribute
  10. {
  11. /// <summary>
  12. /// Gets or sets verb to which applies attribute. By default applies to all verbs.
  13. /// </summary>
  14. public string Verb { get; set; }
  15. /// <summary>
  16. /// Gets or sets parameter type: It can be only one of the following: path, query, body, form, or header.
  17. /// </summary>
  18. public string ParameterType { get; set; }
  19. /// <summary>
  20. /// Gets or sets unique name for the parameter. Each name must be unique, even if they are associated with different paramType values.
  21. /// </summary>
  22. /// <remarks>
  23. /// <para>
  24. /// Other notes on the name field:
  25. /// If paramType is body, the name is used only for UI and codegeneration.
  26. /// If paramType is path, the name field must correspond to the associated path segment from the path field in the api object.
  27. /// If paramType is query, the name field corresponds to the query param name.
  28. /// </para>
  29. /// </remarks>
  30. public string Name { get; set; }
  31. /// <summary>
  32. /// Gets or sets the human-readable description for the parameter.
  33. /// </summary>
  34. public string Description { get; set; }
  35. /// <summary>
  36. /// For path, query, and header paramTypes, this field must be a primitive. For body, this can be a complex or container datatype.
  37. /// </summary>
  38. public string DataType { get; set; }
  39. /// <summary>
  40. /// For path, this is always true. Otherwise, this field tells the client whether or not the field must be supplied.
  41. /// </summary>
  42. public bool IsRequired { get; set; }
  43. /// <summary>
  44. /// For query params, this specifies that a comma-separated list of values can be passed to the API. For path and body types, this field cannot be true.
  45. /// </summary>
  46. public bool AllowMultiple { get; set; }
  47. /// <summary>
  48. /// Gets or sets route to which applies attribute, matches using StartsWith. By default applies to all routes.
  49. /// </summary>
  50. public string Route { get; set; }
  51. /// <summary>
  52. /// Whether to exclude this property from being included in the ModelSchema.
  53. /// </summary>
  54. public bool ExcludeInSchema { get; set; }
  55. }
  56. }