
1package main
2
3import (
4 "bytes"
5 "demo/wxpay_utility"
6 "encoding/json"
7 "fmt"
8 "net/http"
9 "net/url"
10 "strings"
11 "time"
12)
13
14func main() {
15
16 config, err := wxpay_utility.CreateMchConfig(
17 "19xxxxxxxx",
18 "1DDE55AD98Exxxxxxxxxx",
19 "/path/to/apiclient_key.pem",
20 "PUB_KEY_ID_xxxxxxxxxxxxx",
21 "/path/to/wxp_pub.pem",
22 )
23 if err != nil {
24 fmt.Println(err)
25 return
26 }
27
28 request := &UseUserProductCouponRequest{
29 ProductCouponId: wxpay_utility.String("1000000013"),
30 StockId: wxpay_utility.String("1000000013001"),
31 CouponCode: wxpay_utility.String("Code_123456"),
32 Appid: wxpay_utility.String("wx233544546545989"),
33 Openid: wxpay_utility.String("oh-394z-6CGkNoJrsDLTTUKiAnp4"),
34 UseTime: wxpay_utility.Time(time.Now()),
35 OutRequestNo: wxpay_utility.String("MCHUSE202003101234"),
36 BrandId: wxpay_utility.String("120344"),
37 AssociatedOrderInfo: &UserProductCouponAssociatedOrderInfo{
38 TransactionId: wxpay_utility.String("4200000000123456789123456789"),
39 },
40 }
41
42 response, err := UseUserProductCoupon(config, request)
43 if err != nil {
44 fmt.Printf("请求失败: %+v\n", err)
45
46 return
47 }
48
49
50 fmt.Printf("请求成功: %+v\n", response)
51}
52
53func UseUserProductCoupon(config *wxpay_utility.MchConfig, request *UseUserProductCouponRequest) (response *UserProductCouponEntity, err error) {
54 const (
55 host = "https://api.mch.weixin.qq.com"
56 method = "POST"
57 path = "/v3/marketing/partner/product-coupon/users/{openid}/coupons/{coupon_code}/use"
58 )
59
60 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path))
61 if err != nil {
62 return nil, err
63 }
64 reqUrl.Path = strings.Replace(reqUrl.Path, "{coupon_code}", url.PathEscape(*request.CouponCode), -1)
65 reqUrl.Path = strings.Replace(reqUrl.Path, "{openid}", url.PathEscape(*request.Openid), -1)
66 reqBody, err := json.Marshal(request)
67 if err != nil {
68 return nil, err
69 }
70 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody))
71 if err != nil {
72 return nil, err
73 }
74 httpRequest.Header.Set("Accept", "application/json")
75 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId())
76 httpRequest.Header.Set("Content-Type", "application/json")
77 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody)
78 if err != nil {
79 return nil, err
80 }
81 httpRequest.Header.Set("Authorization", authorization)
82
83 client := &http.Client{}
84 httpResponse, err := client.Do(httpRequest)
85 if err != nil {
86 return nil, err
87 }
88 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse)
89 if err != nil {
90 return nil, err
91 }
92 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 {
93
94 err = wxpay_utility.ValidateResponse(
95 config.WechatPayPublicKeyId(),
96 config.WechatPayPublicKey(),
97 &httpResponse.Header,
98 respBody,
99 )
100 if err != nil {
101 return nil, err
102 }
103 response := &UserProductCouponEntity{}
104 if err := json.Unmarshal(respBody, response); err != nil {
105 return nil, err
106 }
107
108 return response, nil
109 } else {
110 return nil, wxpay_utility.NewApiException(
111 httpResponse.StatusCode,
112 httpResponse.Header,
113 respBody,
114 )
115 }
116}
117
118type UseUserProductCouponRequest struct {
119 ProductCouponId *string `json:"product_coupon_id,omitempty"`
120 StockId *string `json:"stock_id,omitempty"`
121 CouponCode *string `json:"coupon_code,omitempty"`
122 Appid *string `json:"appid,omitempty"`
123 Openid *string `json:"openid,omitempty"`
124 UseTime *time.Time `json:"use_time,omitempty"`
125 OutRequestNo *string `json:"out_request_no,omitempty"`
126 BrandId *string `json:"brand_id,omitempty"`
127 StoreId *string `json:"store_id,omitempty"`
128 AssociatedOrderInfo *UserProductCouponAssociatedOrderInfo `json:"associated_order_info,omitempty"`
129 AssociatedPayScoreOrderInfo *UserProductCouponAssociatedPayScoreOrderInfo `json:"associated_pay_score_order_info,omitempty"`
130 SavedAmount *int64 `json:"saved_amount,omitempty"`
131}
132
133func (o *UseUserProductCouponRequest) MarshalJSON() ([]byte, error) {
134 type Alias UseUserProductCouponRequest
135 a := &struct {
136 CouponCode *string `json:"coupon_code,omitempty"`
137 Openid *string `json:"openid,omitempty"`
138 *Alias
139 }{
140
141 CouponCode: nil,
142 Openid: nil,
143 Alias: (*Alias)(o),
144 }
145 return json.Marshal(a)
146}
147
148type UserProductCouponEntity struct {
149 CouponCode *string `json:"coupon_code,omitempty"`
150 CouponState *UserProductCouponState `json:"coupon_state,omitempty"`
151 ValidBeginTime *time.Time `json:"valid_begin_time,omitempty"`
152 ValidEndTime *time.Time `json:"valid_end_time,omitempty"`
153 ReceiveTime *string `json:"receive_time,omitempty"`
154 SendRequestNo *string `json:"send_request_no,omitempty"`
155 SendChannel *UserProductCouponSendChannel `json:"send_channel,omitempty"`
156 ConfirmRequestNo *string `json:"confirm_request_no,omitempty"`
157 ConfirmTime *time.Time `json:"confirm_time,omitempty"`
158 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
159 DeactivateTime *string `json:"deactivate_time,omitempty"`
160 DeactivateReason *string `json:"deactivate_reason,omitempty"`
161 SingleUsageDetail *CouponUsageDetail `json:"single_usage_detail,omitempty"`
162 ProgressiveBundleUsageDetail *CouponUsageDetail `json:"progressive_bundle_usage_detail,omitempty"`
163 UserProductCouponBundleInfo *UserProductCouponBundleInfo `json:"user_product_coupon_bundle_info,omitempty"`
164 ProductCoupon *ProductCouponEntity `json:"product_coupon,omitempty"`
165 Stock *StockEntity `json:"stock,omitempty"`
166 Attach *string `json:"attach,omitempty"`
167 ChannelCustomInfo *string `json:"channel_custom_info,omitempty"`
168 CouponTagInfo *CouponTagInfo `json:"coupon_tag_info,omitempty"`
169 BrandId *string `json:"brand_id,omitempty"`
170}
171
172type UserProductCouponAssociatedOrderInfo struct {
173 TransactionId *string `json:"transaction_id,omitempty"`
174 OutTradeNo *string `json:"out_trade_no,omitempty"`
175 Mchid *string `json:"mchid,omitempty"`
176 SubMchid *string `json:"sub_mchid,omitempty"`
177}
178
179type UserProductCouponAssociatedPayScoreOrderInfo struct {
180 OrderId *string `json:"order_id,omitempty"`
181 OutOrderNo *string `json:"out_order_no,omitempty"`
182 Mchid *string `json:"mchid,omitempty"`
183 SubMchid *string `json:"sub_mchid,omitempty"`
184}
185
186type UserProductCouponState string
187
188func (e UserProductCouponState) Ptr() *UserProductCouponState {
189 return &e
190}
191
192const (
193 USERPRODUCTCOUPONSTATE_CONFIRMING UserProductCouponState = "CONFIRMING"
194 USERPRODUCTCOUPONSTATE_PENDING UserProductCouponState = "PENDING"
195 USERPRODUCTCOUPONSTATE_EFFECTIVE UserProductCouponState = "EFFECTIVE"
196 USERPRODUCTCOUPONSTATE_USED UserProductCouponState = "USED"
197 USERPRODUCTCOUPONSTATE_EXPIRED UserProductCouponState = "EXPIRED"
198 USERPRODUCTCOUPONSTATE_DELETED UserProductCouponState = "DELETED"
199 USERPRODUCTCOUPONSTATE_DEACTIVATED UserProductCouponState = "DEACTIVATED"
200)
201
202type UserProductCouponSendChannel string
203
204func (e UserProductCouponSendChannel) Ptr() *UserProductCouponSendChannel {
205 return &e
206}
207
208const (
209 USERPRODUCTCOUPONSENDCHANNEL_BRAND_MANAGE UserProductCouponSendChannel = "BRAND_MANAGE"
210 USERPRODUCTCOUPONSENDCHANNEL_API UserProductCouponSendChannel = "API"
211 USERPRODUCTCOUPONSENDCHANNEL_RECEIVE_COMPONENT UserProductCouponSendChannel = "RECEIVE_COMPONENT"
212)
213
214type CouponUsageDetail struct {
215 UseRequestNo *string `json:"use_request_no,omitempty"`
216 UseTime *time.Time `json:"use_time,omitempty"`
217 ReturnRequestNo *string `json:"return_request_no,omitempty"`
218 ReturnTime *time.Time `json:"return_time,omitempty"`
219 AssociatedOrderInfo *UserProductCouponAssociatedOrderInfo `json:"associated_order_info,omitempty"`
220 AssociatedPayScoreOrderInfo *UserProductCouponAssociatedPayScoreOrderInfo `json:"associated_pay_score_order_info,omitempty"`
221 SavedAmount *int64 `json:"saved_amount,omitempty"`
222}
223
224type UserProductCouponBundleInfo struct {
225 UserCouponBundleId *string `json:"user_coupon_bundle_id,omitempty"`
226 UserCouponBundleIndex *int64 `json:"user_coupon_bundle_index,omitempty"`
227 TotalCount *int64 `json:"total_count,omitempty"`
228 UsedCount *int64 `json:"used_count,omitempty"`
229}
230
231type ProductCouponEntity struct {
232 ProductCouponId *string `json:"product_coupon_id,omitempty"`
233 Scope *ProductCouponScope `json:"scope,omitempty"`
234 Type *ProductCouponType `json:"type,omitempty"`
235 UsageMode *UsageMode `json:"usage_mode,omitempty"`
236 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"`
237 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"`
238 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"`
239 OutProductNo *string `json:"out_product_no,omitempty"`
240 State *ProductCouponState `json:"state,omitempty"`
241 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
242 DeactivateTime *string `json:"deactivate_time,omitempty"`
243 DeactivateReason *string `json:"deactivate_reason,omitempty"`
244 BrandId *string `json:"brand_id,omitempty"`
245}
246
247type StockEntity struct {
248 ProductCouponId *string `json:"product_coupon_id,omitempty"`
249 StockId *string `json:"stock_id,omitempty"`
250 Remark *string `json:"remark,omitempty"`
251 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
252 CouponCodeCountInfo *CouponCodeCountInfo `json:"coupon_code_count_info,omitempty"`
253 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
254 SingleUsageRule *SingleUsageRule `json:"single_usage_rule,omitempty"`
255 ProgressiveBundleUsageRule *StockUsageRule `json:"progressive_bundle_usage_rule,omitempty"`
256 StockBundleInfo *StockBundleInfo `json:"stock_bundle_info,omitempty"`
257 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
258 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
259 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
260 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
261 SentCountInfo *StockSentCountInfo `json:"sent_count_info,omitempty"`
262 State *StockState `json:"state,omitempty"`
263 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
264 DeactivateTime *time.Time `json:"deactivate_time,omitempty"`
265 DeactivateReason *string `json:"deactivate_reason,omitempty"`
266 BrandId *string `json:"brand_id,omitempty"`
267}
268
269type CouponTagInfo struct {
270 CouponTagList []UserProductCouponTag `json:"coupon_tag_list,omitempty"`
271 MemberTagInfo *MemberTagInfo `json:"member_tag_info,omitempty"`
272}
273
274type ProductCouponScope string
275
276func (e ProductCouponScope) Ptr() *ProductCouponScope {
277 return &e
278}
279
280const (
281 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL"
282 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE"
283)
284
285type ProductCouponType string
286
287func (e ProductCouponType) Ptr() *ProductCouponType {
288 return &e
289}
290
291const (
292 PRODUCTCOUPONTYPE_NORMAL ProductCouponType = "NORMAL"
293 PRODUCTCOUPONTYPE_DISCOUNT ProductCouponType = "DISCOUNT"
294 PRODUCTCOUPONTYPE_EXCHANGE ProductCouponType = "EXCHANGE"
295)
296
297type UsageMode string
298
299func (e UsageMode) Ptr() *UsageMode {
300 return &e
301}
302
303const (
304 USAGEMODE_SINGLE UsageMode = "SINGLE"
305 USAGEMODE_PROGRESSIVE_BUNDLE UsageMode = "PROGRESSIVE_BUNDLE"
306)
307
308type SingleUsageInfo struct {
309 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
310 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
311}
312
313type ProgressiveBundleUsageInfo struct {
314 Count *int64 `json:"count,omitempty"`
315 IntervalDays *int64 `json:"interval_days,omitempty"`
316}
317
318type ProductCouponDisplayInfo struct {
319 Name *string `json:"name,omitempty"`
320 ImageUrl *string `json:"image_url,omitempty"`
321 BackgroundUrl *string `json:"background_url,omitempty"`
322 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"`
323 OriginalPrice *int64 `json:"original_price,omitempty"`
324 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"`
325}
326
327type ProductCouponState string
328
329func (e ProductCouponState) Ptr() *ProductCouponState {
330 return &e
331}
332
333const (
334 PRODUCTCOUPONSTATE_AUDITING ProductCouponState = "AUDITING"
335 PRODUCTCOUPONSTATE_EFFECTIVE ProductCouponState = "EFFECTIVE"
336 PRODUCTCOUPONSTATE_DEACTIVATED ProductCouponState = "DEACTIVATED"
337)
338
339type CouponCodeMode string
340
341func (e CouponCodeMode) Ptr() *CouponCodeMode {
342 return &e
343}
344
345const (
346 COUPONCODEMODE_WECHATPAY CouponCodeMode = "WECHATPAY"
347 COUPONCODEMODE_UPLOAD CouponCodeMode = "UPLOAD"
348 COUPONCODEMODE_API_ASSIGN CouponCodeMode = "API_ASSIGN"
349)
350
351type CouponCodeCountInfo struct {
352 TotalCount *int64 `json:"total_count,omitempty"`
353 AvailableCount *int64 `json:"available_count,omitempty"`
354}
355
356type StockSendRule struct {
357 MaxCount *int64 `json:"max_count,omitempty"`
358 MaxCountPerDay *int64 `json:"max_count_per_day,omitempty"`
359 MaxCountPerUser *int64 `json:"max_count_per_user,omitempty"`
360}
361
362type SingleUsageRule struct {
363 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
364 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
365 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
366 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
367}
368
369type StockUsageRule struct {
370 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
371 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
372 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
373 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
374}
375
376type StockBundleInfo struct {
377 StockBundleId *string `json:"stock_bundle_id,omitempty"`
378 StockBundleIndex *int64 `json:"stock_bundle_index,omitempty"`
379}
380
381type UsageRuleDisplayInfo struct {
382 CouponUsageMethodList []CouponUsageMethod `json:"coupon_usage_method_list,omitempty"`
383 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
384 MiniProgramPath *string `json:"mini_program_path,omitempty"`
385 AppPath *string `json:"app_path,omitempty"`
386 UsageDescription *string `json:"usage_description,omitempty"`
387 CouponAvailableStoreInfo *CouponAvailableStoreInfo `json:"coupon_available_store_info,omitempty"`
388 AppJumpType *AppJumpType `json:"app_jump_type,omitempty"`
389 PasscodeLink *string `json:"passcode_link,omitempty"`
390}
391
392type CouponDisplayInfo struct {
393 CodeDisplayMode *CouponCodeDisplayMode `json:"code_display_mode,omitempty"`
394 BackgroundColor *string `json:"background_color,omitempty"`
395 EntranceMiniProgram *EntranceMiniProgram `json:"entrance_mini_program,omitempty"`
396 EntranceOfficialAccount *EntranceOfficialAccount `json:"entrance_official_account,omitempty"`
397 EntranceFinder *EntranceFinder `json:"entrance_finder,omitempty"`
398}
399
400type NotifyConfig struct {
401 NotifyAppid *string `json:"notify_appid,omitempty"`
402}
403
404type StockStoreScope string
405
406func (e StockStoreScope) Ptr() *StockStoreScope {
407 return &e
408}
409
410const (
411 STOCKSTORESCOPE_NONE StockStoreScope = "NONE"
412 STOCKSTORESCOPE_ALL StockStoreScope = "ALL"
413 STOCKSTORESCOPE_SPECIFIC StockStoreScope = "SPECIFIC"
414)
415
416type StockSentCountInfo struct {
417 TotalCount *int64 `json:"total_count,omitempty"`
418 TodayCount *int64 `json:"today_count,omitempty"`
419}
420
421type StockState string
422
423func (e StockState) Ptr() *StockState {
424 return &e
425}
426
427const (
428 STOCKSTATE_AUDITING StockState = "AUDITING"
429 STOCKSTATE_SENDING StockState = "SENDING"
430 STOCKSTATE_PAUSED StockState = "PAUSED"
431 STOCKSTATE_STOPPED StockState = "STOPPED"
432 STOCKSTATE_DEACTIVATED StockState = "DEACTIVATED"
433)
434
435type UserProductCouponTag string
436
437func (e UserProductCouponTag) Ptr() *UserProductCouponTag {
438 return &e
439}
440
441const (
442 USERPRODUCTCOUPONTAG_MEMBER UserProductCouponTag = "MEMBER"
443)
444
445type MemberTagInfo struct {
446 MemberCardId *string `json:"member_card_id,omitempty"`
447}
448
449type NormalCouponUsageRule struct {
450 Threshold *int64 `json:"threshold,omitempty"`
451 DiscountAmount *int64 `json:"discount_amount,omitempty"`
452}
453
454type DiscountCouponUsageRule struct {
455 Threshold *int64 `json:"threshold,omitempty"`
456 PercentOff *int64 `json:"percent_off,omitempty"`
457}
458
459type ComboPackage struct {
460 Name *string `json:"name,omitempty"`
461 PickCount *int64 `json:"pick_count,omitempty"`
462 ChoiceList []ComboPackageChoice `json:"choice_list,omitempty"`
463}
464
465type CouponAvailablePeriod struct {
466 AvailableBeginTime *string `json:"available_begin_time,omitempty"`
467 AvailableEndTime *string `json:"available_end_time,omitempty"`
468 AvailableDays *int64 `json:"available_days,omitempty"`
469 WaitDaysAfterReceive *int64 `json:"wait_days_after_receive,omitempty"`
470 WeeklyAvailablePeriod *FixedWeekPeriod `json:"weekly_available_period,omitempty"`
471 IrregularAvailablePeriodList []TimePeriod `json:"irregular_available_period_list,omitempty"`
472}
473
474type ExchangeCouponUsageRule struct {
475 Threshold *int64 `json:"threshold,omitempty"`
476 ExchangePrice *int64 `json:"exchange_price,omitempty"`
477}
478
479type CouponUsageMethod string
480
481func (e CouponUsageMethod) Ptr() *CouponUsageMethod {
482 return &e
483}
484
485const (
486 COUPONUSAGEMETHOD_OFFLINE CouponUsageMethod = "OFFLINE"
487 COUPONUSAGEMETHOD_MINI_PROGRAM CouponUsageMethod = "MINI_PROGRAM"
488 COUPONUSAGEMETHOD_APP CouponUsageMethod = "APP"
489 COUPONUSAGEMETHOD_PAYMENT_CODE CouponUsageMethod = "PAYMENT_CODE"
490)
491
492type CouponAvailableStoreInfo struct {
493 Description *string `json:"description,omitempty"`
494 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
495 MiniProgramPath *string `json:"mini_program_path,omitempty"`
496}
497
498type AppJumpType string
499
500func (e AppJumpType) Ptr() *AppJumpType {
501 return &e
502}
503
504const (
505 APPJUMPTYPE_H5 AppJumpType = "H5"
506 APPJUMPTYPE_PASSCODE_LINK AppJumpType = "PASSCODE_LINK"
507)
508
509type CouponCodeDisplayMode string
510
511func (e CouponCodeDisplayMode) Ptr() *CouponCodeDisplayMode {
512 return &e
513}
514
515const (
516 COUPONCODEDISPLAYMODE_INVISIBLE CouponCodeDisplayMode = "INVISIBLE"
517 COUPONCODEDISPLAYMODE_BARCODE CouponCodeDisplayMode = "BARCODE"
518 COUPONCODEDISPLAYMODE_QRCODE CouponCodeDisplayMode = "QRCODE"
519)
520
521type EntranceMiniProgram struct {
522 Appid *string `json:"appid,omitempty"`
523 Path *string `json:"path,omitempty"`
524 EntranceWording *string `json:"entrance_wording,omitempty"`
525 GuidanceWording *string `json:"guidance_wording,omitempty"`
526}
527
528type EntranceOfficialAccount struct {
529 Appid *string `json:"appid,omitempty"`
530}
531
532type EntranceFinder struct {
533 FinderId *string `json:"finder_id,omitempty"`
534 FinderVideoId *string `json:"finder_video_id,omitempty"`
535 FinderVideoCoverImageUrl *string `json:"finder_video_cover_image_url,omitempty"`
536}
537
538type ComboPackageChoice struct {
539 Name *string `json:"name,omitempty"`
540 Price *int64 `json:"price,omitempty"`
541 Count *int64 `json:"count,omitempty"`
542 ImageUrl *string `json:"image_url,omitempty"`
543 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
544 MiniProgramPath *string `json:"mini_program_path,omitempty"`
545}
546
547type FixedWeekPeriod struct {
548 DayList []WeekEnum `json:"day_list,omitempty"`
549 DayPeriodList []PeriodOfTheDay `json:"day_period_list,omitempty"`
550}
551
552type TimePeriod struct {
553 BeginTime *string `json:"begin_time,omitempty"`
554 EndTime *string `json:"end_time,omitempty"`
555}
556
557type WeekEnum string
558
559func (e WeekEnum) Ptr() *WeekEnum {
560 return &e
561}
562
563const (
564 WEEKENUM_MONDAY WeekEnum = "MONDAY"
565 WEEKENUM_TUESDAY WeekEnum = "TUESDAY"
566 WEEKENUM_WEDNESDAY WeekEnum = "WEDNESDAY"
567 WEEKENUM_THURSDAY WeekEnum = "THURSDAY"
568 WEEKENUM_FRIDAY WeekEnum = "FRIDAY"
569 WEEKENUM_SATURDAY WeekEnum = "SATURDAY"
570 WEEKENUM_SUNDAY WeekEnum = "SUNDAY"
571)
572
573type PeriodOfTheDay struct {
574 BeginTime *int64 `json:"begin_time,omitempty"`
575 EndTime *int64 `json:"end_time,omitempty"`
576}
577