123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- // Copyright 2021 Tencent Inc. All rights reserved.
- //
- // 营销加价购对外API
- //
- // 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。
- //
- // API version: 1.4.0
- // Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT.
- package retailstore
- import (
- "context"
- "fmt"
- nethttp "net/http"
- neturl "net/url"
- "strings"
- "github.com/wechatpay-apiv3/wechatpay-go/core"
- "github.com/wechatpay-apiv3/wechatpay-go/core/consts"
- "github.com/wechatpay-apiv3/wechatpay-go/services"
- )
- type ActivityApiService services.Service
- // ApplyActivity 门店报名品牌加价购活动
- //
- // 接口介绍:该接口为服务商替门店报名品牌加价购活动专用接口。
- // 使用对象:指定服务商。
- func (a *ActivityApiService) ApplyActivity(ctx context.Context, req ApplyActivityRequest) (resp *ApplyActivityResponse, result *core.APIResult, err error) {
- var (
- localVarHTTPMethod = nethttp.MethodPost
- localVarPostBody interface{}
- localVarQueryParams neturl.Values
- localVarHeaderParams = nethttp.Header{}
- )
- // Make sure Path Params are properly set
- if req.ActivityId == nil {
- return nil, nil, fmt.Errorf("field `ActivityId` is required and must be specified in ApplyActivityRequest")
- }
- localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/activity/{activity_id}/apply"
- // Build Path with Path Params
- localVarPath = strings.Replace(localVarPath, "{"+"activity_id"+"}", neturl.PathEscape(core.ParameterToString(*req.ActivityId, "")), -1)
- // Make sure All Required Params are properly set
- // Setup Body Params
- localVarPostBody = &ApplyActivityBody{
- CallerMerchantId: req.CallerMerchantId,
- ApplyInfos: req.ApplyInfos,
- }
- // Determine the Content-Type Header
- localVarHTTPContentTypes := []string{"application/json"}
- // Setup Content-Type
- localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
- // Perform Http Request
- result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
- if err != nil {
- return nil, result, err
- }
- // Extract ApplyActivityResponse from Http Response
- resp = new(ApplyActivityResponse)
- err = core.UnMarshalResponse(result.Response, resp)
- if err != nil {
- return nil, result, err
- }
- return resp, result, nil
- }
- // ListActsByArea 按区域查询品牌加价购活动
- //
- // 接口介绍:该接口为服务商查询门店报名的品牌加价购活动的专用接口。
- // 使用对象:指定服务商。
- func (a *ActivityApiService) ListActsByArea(ctx context.Context, req ListActsByAreaRequest) (resp *ListActsByAreaResponse, result *core.APIResult, err error) {
- var (
- localVarHTTPMethod = nethttp.MethodGet
- localVarPostBody interface{}
- localVarQueryParams neturl.Values
- localVarHeaderParams = nethttp.Header{}
- )
- localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/activities"
- // Make sure All Required Params are properly set
- if req.CityId == nil {
- return nil, nil, fmt.Errorf("field `CityId` is required and must be specified in ListActsByAreaRequest")
- }
- if req.Offset == nil {
- return nil, nil, fmt.Errorf("field `Offset` is required and must be specified in ListActsByAreaRequest")
- }
- if req.Limit == nil {
- return nil, nil, fmt.Errorf("field `Limit` is required and must be specified in ListActsByAreaRequest")
- }
- // Setup Query Params
- localVarQueryParams = neturl.Values{}
- localVarQueryParams.Add("city_id", core.ParameterToString(*req.CityId, ""))
- localVarQueryParams.Add("offset", core.ParameterToString(*req.Offset, ""))
- localVarQueryParams.Add("limit", core.ParameterToString(*req.Limit, ""))
- // Determine the Content-Type Header
- localVarHTTPContentTypes := []string{}
- // Setup Content-Type
- localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
- // Perform Http Request
- result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
- if err != nil {
- return nil, result, err
- }
- // Extract ListActsByAreaResponse from Http Response
- resp = new(ListActsByAreaResponse)
- err = core.UnMarshalResponse(result.Response, resp)
- if err != nil {
- return nil, result, err
- }
- return resp, result, nil
- }
|