ApiMemberAttribute.cs 2.5 KB

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