@@ -8,6 +8,7 @@ namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop
88{
99 public static class TikTokShopClientExecutePromotionExtensions
1010 {
11+ #region Activity
1112 /// <summary>
1213 /// <para>异步调用 [POST] /promotion/{version}/activities 接口。</para>
1314 /// <para>
@@ -161,5 +162,54 @@ public static class TikTokShopClientExecutePromotionExtensions
161162
162163 return await client . SendFlurlRequesAsJsontAsync < Models . PromotionDeleteActivityProductsResponse > ( flurlReq , data : request , cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
163164 }
165+ #endregion
166+
167+ #region Coupon
168+ /// <summary>
169+ /// <para>异步调用 [POST] /promotion/{version}/coupons/search 接口。</para>
170+ /// <para>
171+ /// REF: <br/>
172+ /// <![CDATA[ https://partner.tiktokshop.com/docv2/page/6699dcdf115ebe02f841e4cd ]]>
173+ /// </para>
174+ /// </summary>
175+ /// <param name="client"></param>
176+ /// <param name="request"></param>
177+ /// <param name="cancellationToken"></param>
178+ /// <returns></returns>
179+ public static async Task < Models . PromotionSearchCouponsResponse > ExecutePromotionSearchCouponsAsync ( this TikTokShopClient client , Models . PromotionSearchCouponsRequest request , CancellationToken cancellationToken = default )
180+ {
181+ if ( client is null ) throw new ArgumentNullException ( nameof ( client ) ) ;
182+ if ( request is null ) throw new ArgumentNullException ( nameof ( request ) ) ;
183+
184+ IFlurlRequest flurlReq = client
185+ . CreateFlurlRequest ( request , HttpMethod . Post , "promotion" , request . ApiVersion , "coupons" , "search" )
186+ . SetQueryParam ( "page_size" , request . PageSize )
187+ . SetQueryParam ( "page_token" , request . PageToken ) ;
188+
189+ return await client . SendFlurlRequesAsJsontAsync < Models . PromotionSearchCouponsResponse > ( flurlReq , data : request , cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
190+ }
191+
192+ /// <summary>
193+ /// <para>异步调用 [GET] /promotion/{version}/coupons/{coupon_id} 接口。</para>
194+ /// <para>
195+ /// REF: <br/>
196+ /// <![CDATA[ https://partner.tiktokshop.com/docv2/page/6699dce0de15e502ed219e37 ]]>
197+ /// </para>
198+ /// </summary>
199+ /// <param name="client"></param>
200+ /// <param name="request"></param>
201+ /// <param name="cancellationToken"></param>
202+ /// <returns></returns>
203+ public static async Task < Models . PromotionGetCouponDetailResponse > ExecutePromotionGetCouponDetailAsync ( this TikTokShopClient client , Models . PromotionGetCouponDetailRequest request , CancellationToken cancellationToken = default )
204+ {
205+ if ( client is null ) throw new ArgumentNullException ( nameof ( client ) ) ;
206+ if ( request is null ) throw new ArgumentNullException ( nameof ( request ) ) ;
207+
208+ IFlurlRequest flurlReq = client
209+ . CreateFlurlRequest ( request , HttpMethod . Get , "promotion" , request . ApiVersion , "coupons" , request . CouponId ) ;
210+
211+ return await client . SendFlurlRequesAsJsontAsync < Models . PromotionGetCouponDetailResponse > ( flurlReq , data : request , cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
212+ }
213+ #endregion
164214 }
165215}
0 commit comments