Request.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. using Microsoft.AspNetCore.Mvc;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.Reflection;
  4. namespace goods.Models.Coupang
  5. {
  6. /*
  7. * 쿠팡파트너스 API
  8. * 골드박스
  9. * https://api-gateway.coupang.com/v2/providers/affiliate_open_api/apis/openapi/v1/products​/goldbox
  10. *
  11. * 카테고리 별 베스트 상품
  12. * https://api-gateway.coupang.com/v2/providers/affiliate_open_api/apis/openapi/v1/products/bestcategories/{categoryID}
  13. *
  14. * 쿠팡PL 상품
  15. * https://api-gateway.coupang.com/v2/providers/affiliate_open_api/apis/openapi/v1/products/coupangPL/{brandID}
  16. *
  17. * 쿠팡 검색
  18. * https://api-gateway.coupang.com/v2/providers/affiliate_open_api/apis/openapi/v1/products/search
  19. */
  20. // 검색요청 변수
  21. public class Request
  22. {
  23. // 쿠팡 카테고리
  24. public enum Categories
  25. {
  26. [Display(Name = "여성패션")]
  27. WomenFashion = 1001,
  28. [Display(Name = "남성패션")]
  29. MenFashion = 1002,
  30. [Display(Name = "뷰티")]
  31. Beauty = 1010,
  32. [Display(Name = "출산/유아동")]
  33. BabyAndKids = 1011,
  34. [Display(Name = "식품")]
  35. Food = 1012,
  36. [Display(Name = "주방용품")]
  37. KitchenSupplies = 1013,
  38. [Display(Name = "생활용품")]
  39. HouseholdItems = 1014,
  40. [Display(Name = "홈인테리어")]
  41. HomeInterior = 1015,
  42. [Display(Name = "가전디지털")]
  43. ElectronicsAndDigital = 1016,
  44. [Display(Name = "스포츠/레저")]
  45. SportsAndLeisure = 1017,
  46. [Display(Name = "자동차용품")]
  47. AutomotiveSupplies = 1018,
  48. [Display(Name = "도서/음반/DVD")]
  49. BooksMusicDVDs = 1019,
  50. [Display(Name = "완구/취미")]
  51. ToysAndHobbies = 1020,
  52. [Display(Name = "문구/오피스")]
  53. StationeryAndOffice = 1021,
  54. [Display(Name = "헬스/건강식품")]
  55. HealthAndSupplements = 1024,
  56. [Display(Name = "국내여행")]
  57. DomesticTravel = 1025,
  58. [Display(Name = "해외여행")]
  59. OverseasTravel = 1026,
  60. [Display(Name = "반려동물용품")]
  61. PetSupplies = 1029,
  62. [Display(Name = "유아동패션")]
  63. KidsFashion = 1030
  64. }
  65. // 쿠팡PL 브랜드
  66. public enum Brand
  67. {
  68. [Display(Name = "탐사")]
  69. Tamsa = 1001,
  70. [Display(Name = "코멧")]
  71. Comet = 1002,
  72. [Display(Name = "Gomgom")]
  73. Gomgom = 1003,
  74. [Display(Name = "줌")]
  75. Zoom = 1004,
  76. [Display(Name = "곰곰")]
  77. GomgomKorean = 1006,
  78. [Display(Name = "꼬리별")]
  79. Kkoribyul = 1007,
  80. [Display(Name = "베이스알파에센셜")]
  81. BaseAlphaEssential = 1008,
  82. [Display(Name = "비타할로")]
  83. VitaHalo = 1010,
  84. [Display(Name = "비지엔젤")]
  85. BeeZNgel = 1011
  86. }
  87. public Categories? Category { get; set; } = null;
  88. public Brand? BrandID { get; set; } = null;
  89. // 검색어
  90. public string? Keyword { get; set; } = null;
  91. }
  92. public static class EnumExtensions
  93. {
  94. public static string GetDisplayName(this Enum enumValue)
  95. {
  96. var enumType = enumValue.GetType();
  97. var member = enumType.GetMember(enumValue.ToString());
  98. // DisplayAttribute 읽기
  99. var attribute = member[0].GetCustomAttribute<DisplayAttribute>();
  100. // Name 속성 반환 (없을 경우 기본값 설정)
  101. return attribute?.Name ?? enumValue.ToString();
  102. }
  103. }
  104. }