| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using Microsoft.AspNetCore.Mvc;
- using System.ComponentModel.DataAnnotations;
- using System.Reflection;
- namespace goods.Models.Coupang
- {
- /*
- * 쿠팡파트너스 API
- * 골드박스
- * https://api-gateway.coupang.com/v2/providers/affiliate_open_api/apis/openapi/v1/products/goldbox
- *
- * 카테고리 별 베스트 상품
- * https://api-gateway.coupang.com/v2/providers/affiliate_open_api/apis/openapi/v1/products/bestcategories/{categoryID}
- *
- * 쿠팡PL 상품
- * https://api-gateway.coupang.com/v2/providers/affiliate_open_api/apis/openapi/v1/products/coupangPL/{brandID}
- *
- * 쿠팡 검색
- * https://api-gateway.coupang.com/v2/providers/affiliate_open_api/apis/openapi/v1/products/search
- */
- // 검색요청 변수
- public class Request
- {
- // 쿠팡 카테고리
- public enum Categories
- {
- [Display(Name = "여성패션")]
- WomenFashion = 1001,
- [Display(Name = "남성패션")]
- MenFashion = 1002,
- [Display(Name = "뷰티")]
- Beauty = 1010,
- [Display(Name = "출산/유아동")]
- BabyAndKids = 1011,
- [Display(Name = "식품")]
- Food = 1012,
- [Display(Name = "주방용품")]
- KitchenSupplies = 1013,
- [Display(Name = "생활용품")]
- HouseholdItems = 1014,
- [Display(Name = "홈인테리어")]
- HomeInterior = 1015,
- [Display(Name = "가전디지털")]
- ElectronicsAndDigital = 1016,
- [Display(Name = "스포츠/레저")]
- SportsAndLeisure = 1017,
- [Display(Name = "자동차용품")]
- AutomotiveSupplies = 1018,
- [Display(Name = "도서/음반/DVD")]
- BooksMusicDVDs = 1019,
- [Display(Name = "완구/취미")]
- ToysAndHobbies = 1020,
- [Display(Name = "문구/오피스")]
- StationeryAndOffice = 1021,
- [Display(Name = "헬스/건강식품")]
- HealthAndSupplements = 1024,
- [Display(Name = "국내여행")]
- DomesticTravel = 1025,
- [Display(Name = "해외여행")]
- OverseasTravel = 1026,
- [Display(Name = "반려동물용품")]
- PetSupplies = 1029,
- [Display(Name = "유아동패션")]
- KidsFashion = 1030
- }
- // 쿠팡PL 브랜드
- public enum Brand
- {
- [Display(Name = "탐사")]
- Tamsa = 1001,
- [Display(Name = "코멧")]
- Comet = 1002,
- [Display(Name = "Gomgom")]
- Gomgom = 1003,
- [Display(Name = "줌")]
- Zoom = 1004,
- [Display(Name = "곰곰")]
- GomgomKorean = 1006,
- [Display(Name = "꼬리별")]
- Kkoribyul = 1007,
- [Display(Name = "베이스알파에센셜")]
- BaseAlphaEssential = 1008,
- [Display(Name = "비타할로")]
- VitaHalo = 1010,
- [Display(Name = "비지엔젤")]
- BeeZNgel = 1011
- }
- public Categories? Category { get; set; } = null;
- public Brand? BrandID { get; set; } = null;
- // 검색어
- public string? Keyword { get; set; } = null;
- }
- public static class EnumExtensions
- {
- public static string GetDisplayName(this Enum enumValue)
- {
- var enumType = enumValue.GetType();
- var member = enumType.GetMember(enumValue.ToString());
- // DisplayAttribute 읽기
- var attribute = member[0].GetCustomAttribute<DisplayAttribute>();
- // Name 속성 반환 (없을 경우 기본값 설정)
- return attribute?.Name ?? enumValue.ToString();
- }
- }
- }
|