Skip to content

Commit

Permalink
Merge branch 'release/v1.9.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Aug 1, 2024
2 parents 5d5d17d + f37f084 commit b544b5c
Show file tree
Hide file tree
Showing 23 changed files with 579 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,17 @@
- 创建应用 [ file.AdAppCreate(clt *core.SDKClient, accessToken string, req *file.AdAppCreateRequest) (*file.App, error) ]
- 修改应用 [ file.AdAppUpdate(clt *core.SDKClient, accessToken string, req *file.AdAppUpdateRequest) (*file.App, error) ]
- 获取应用列表 [ file.AdAppList(clt *core.SDKClient, accessToken string, req *file.AdAppListRequest) (*file.AdAppListResponse, error) ]
- 定向模版(新) (api/dsp/target)
- 查询定向模板 [ TemplateDetails(clt *core.SDKClient, accessToken string, req *target.TemplateDetailsRequest) (*target.TemplateDetailsResponse, error) ]
- 创建定向模板 [ TemplateCreate(clt *core.SDKClient, accessToken string, req *target.TemplateCreateRequest) (uint64, error) ]
- 更新定向模板 [ TemplateUpdate(clt *core.SDKClient, accessToken string, req *target.TemplateUpdateRequest) (uint64, error) ]
- 删除定向模板 [ TemplateDelete(clt *core.SDKClient, accessToken string, req *target.TemplateDeleteRequest) (uint64, error) ]
- 根据店铺名称查询商圈信息 [ OptionDistanceList(clt *core.SDKClient, accessToken string, req *target.OptionDistanceListRequest) (*target.OptionDistanceListResponse, error) ]
- 定向模板同步 [ TemplateUnitSync(clt *core.SDKClient, accessToken string, req *target.TemplateUnitSyncRequest) (*target.TemplateUnitSyncResponse, error) ]
- 模板同步失败查询 [ TemplateSyncHistory(clt *core.SDKClient, accessToken string, req *target.TemplateSyncHistoryRequest) (*target.TemplateSyncHistoryResponse, error) ]
- 查询模板关联的广告列表接口 [ TemplateRelatedUnitList(clt *core.SDKClient, accessToken string, req *target.TemplateRelatedUnitListRequest) (*target.TemplateRelatedUnitListResponse, error) ]
- 查询待升级模板列表 [ TemplateUpgradeList(clt *core.SDKClient, accessToken string, req *target.TemplateUpgradeListRequest) ([]target.TemplateUpgradeItem, error) ]
- 模板升级 [ TemplateUpgrade(clt *core.SDKClient, accessToken string, req *target.TemplateUpgradeRequest) (int64, error) ]
- 定向模版
- 创建定向模板 [ target.TemplateCreate(clt *core.SDKClient, accessToken string, req *target.TemplateCreateRequest) (*target.Template, error) ]
- 查询定向模板接口 [ target.TemplateList(clt *core.SDKClient, accessToken string, req *target.TemplateListRequest) (*target.TemplateListResponse, error) ]
Expand Down
2 changes: 2 additions & 0 deletions api/dsp/target/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package target 定向模板
package target
15 changes: 15 additions & 0 deletions api/dsp/target/option_distance_list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package target

import (
"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/dsp/target"
)

// OptionDistanceList 根据店铺名称查询商圈信息
func OptionDistanceList(clt *core.SDKClient, accessToken string, req *target.OptionDistanceListRequest) (*target.OptionDistanceListResponse, error) {
var resp target.OptionDistanceListResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
15 changes: 15 additions & 0 deletions api/dsp/target/template_create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package target

import (
"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/dsp/target"
)

// TemplateCreate 创建定向模板
func TemplateCreate(clt *core.SDKClient, accessToken string, req *target.TemplateCreateRequest) (uint64, error) {
var resp target.TemplateCreateResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
return 0, err
}
return resp.TemplateID, nil
}
15 changes: 15 additions & 0 deletions api/dsp/target/template_delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package target

import (
"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/dsp/target"
)

// TemplateDelete 删除定向模板
func TemplateDelete(clt *core.SDKClient, accessToken string, req *target.TemplateDeleteRequest) (uint64, error) {
var resp target.TemplateDeleteResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
return 0, err
}
return resp.TemplateID, nil
}
15 changes: 15 additions & 0 deletions api/dsp/target/template_details.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package target

import (
"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/dsp/target"
)

// TemplateDetails 查询定向模板
func TemplateDetails(clt *core.SDKClient, accessToken string, req *target.TemplateDetailsRequest) (*target.TemplateDetailsResponse, error) {
var resp target.TemplateDetailsResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
15 changes: 15 additions & 0 deletions api/dsp/target/template_related_unit_list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package target

import (
"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/dsp/target"
)

// TemplateRelatedUnitList 查询模板关联的广告列表接口
func TemplateRelatedUnitList(clt *core.SDKClient, accessToken string, req *target.TemplateRelatedUnitListRequest) (*target.TemplateRelatedUnitListResponse, error) {
var resp target.TemplateRelatedUnitListResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
15 changes: 15 additions & 0 deletions api/dsp/target/template_sync_history.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package target

import (
"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/dsp/target"
)

// TemplateSyncHistory 模板同步失败查询
func TemplateSyncHistory(clt *core.SDKClient, accessToken string, req *target.TemplateSyncHistoryRequest) (*target.TemplateSyncHistoryResponse, error) {
var resp target.TemplateSyncHistoryResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
15 changes: 15 additions & 0 deletions api/dsp/target/template_unit_sync.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package target

import (
"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/dsp/target"
)

// TemplateUnitSync 定向模板同步
func TemplateUnitSync(clt *core.SDKClient, accessToken string, req *target.TemplateUnitSyncRequest) (*target.TemplateUnitSyncResponse, error) {
var resp target.TemplateUnitSyncResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
15 changes: 15 additions & 0 deletions api/dsp/target/template_update.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package target

import (
"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/dsp/target"
)

// TemplateUpdate 更新定向模板
func TemplateUpdate(clt *core.SDKClient, accessToken string, req *target.TemplateUpdateRequest) (uint64, error) {
var resp target.TemplateUpdateResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
return 0, err
}
return resp.TemplateID, nil
}
15 changes: 15 additions & 0 deletions api/dsp/target/template_upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package target

import (
"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/dsp/target"
)

// TemplateUpgrade 模板升级
func TemplateUpgrade(clt *core.SDKClient, accessToken string, req *target.TemplateUpgradeRequest) (int64, error) {
var resp target.TemplateUpgradeResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
return 0, err
}
return resp.TemplateCount, nil
}
15 changes: 15 additions & 0 deletions api/dsp/target/template_upgrade_list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package target

import (
"github.com/bububa/kwai-marketing-api/core"
"github.com/bububa/kwai-marketing-api/model/dsp/target"
)

// TemplateUpgradeList 查询待升级模板列表
func TemplateUpgradeList(clt *core.SDKClient, accessToken string, req *target.TemplateUpgradeListRequest) ([]target.TemplateUpgradeItem, error) {
var resp []target.TemplateUpgradeItem
if err := clt.Post(accessToken, req, &resp); err != nil {
return nil, err
}
return resp, nil
}
2 changes: 2 additions & 0 deletions model/dsp/target/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package target 定向模板
package target
57 changes: 57 additions & 0 deletions model/dsp/target/option_distance_list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package target

import "github.com/bububa/kwai-marketing-api/model"

// OptionDistanceListRequest 根据店铺名称查询商圈信息 API Request
type OptionDistanceListRequest struct {
// ProvinceName 省份,城市二选一必填
ProvinceName string `json:"province_name,omitempty"`
// CityName 省份,城市二选一必填
CityName string `json:"city_name,omitempty"`
// DistrictName 街区,选填
DistrictName string `json:"district_name,omitempty"`
// LocationName 店铺名,必填
LocationName string `json:"location_name,omitempty"`
// Page 页数
Page int `json:"page,omitempty"`
// PageSize 页面大小
PageSize int `json:"page_size,omitempty"`
}

// Url implement GetRequest interface
func (r OptionDistanceListRequest) Url() string {
return "gw/dsp/target/option/distance_list"
}

// Encode implement PostRequest interface
func (r OptionDistanceListRequest) Encode() []byte {
return model.JSONMarshal(r)
}

// OptionDistanceListResponse 根据店铺名称查询商圈信息 API Response
type OptionDistanceListResponse struct {
// List 商圈信息列表
List []Distance `json:"list,omitempty"`
// CurrentPage 当前页数
CurrentPage int `json:"current_page,omitempty"`
// PageSize 页面大小
PageSize int `json:"page_size,omitempty"`
// NextPage 下一页页数
NextPage int `json:"next_page,omitempty"`
}

// Distance 商圈信息
type Distance struct {
// Address 地址
Address string `json:"address,omitempty"`
// Lat 经度
Lat string `json:"lat,omitempty"`
// Lng 纬度
Lng string `json:"lng,omitempty"`
// LocationName 店铺名称
LocationName string `json:"location_name,omitempty"`
// PoiID 唯一标识
PoiID string `json:"poi_id,omitempty"`
// Radius 半径(单位m)
Radius int64 `json:"radius,omitempty"`
}
32 changes: 32 additions & 0 deletions model/dsp/target/template_create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package target

import (
"github.com/bububa/kwai-marketing-api/model"
"github.com/bububa/kwai-marketing-api/model/dsp/unit"
)

// TemplateCreateRequest 创建定向模板 API Request
type TemplateCreateRequest struct {
// Target 定向信息
Target *unit.Target `json:"target,omitempty"`
// TemplateName 定向模板名称
TemplateName string `json:"template_name,omitempty"`
// AdvertiserID 广告主 ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
}

// Url implement GetRequest interface
func (r TemplateCreateRequest) Url() string {
return "gw/dsp/target/template/create"
}

// Encode implement GetRequest interface
func (r TemplateCreateRequest) Encode() []byte {
return model.JSONMarshal(r)
}

// TemplateCreateResponse 创建定向模板 API Response
type TemplateCreateResponse struct {
// TemplateID 模板ID
TemplateID uint64 `json:"template_id,omitempty"`
}
27 changes: 27 additions & 0 deletions model/dsp/target/template_delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package target

import (
"github.com/bububa/kwai-marketing-api/model"
)

// TemplateDeleteRequest 删除定向模板 API Request
type TemplateDeleteRequest struct {
// TemplateID 模板ID
TemplateID uint64 `json:"template_id,omitempty"`
}

// Url implement PostRequest interface
func (r TemplateDeleteRequest) Url() string {
return "gw/dsp/target/template/delete"
}

// Encode implement PostRequest interface
func (r TemplateDeleteRequest) Encode() []byte {
return model.JSONMarshal(r)
}

// TemplateDeleteResponse API Response
type TemplateDeleteResponse struct {
// TemplateID 模板ID
TemplateID uint64 `json:"template_id,omitempty"`
}
55 changes: 55 additions & 0 deletions model/dsp/target/template_details.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package target

import (
"github.com/bububa/kwai-marketing-api/model"
"github.com/bububa/kwai-marketing-api/model/dsp/unit"
)

// TemplateDetailsRequest 查询定向模板 API Request
type TemplateDetailsRequest struct {
// TemplateID 模板ID列表(默认ID和分页参数二选一必传)
TemplateID []uint64 `json:"template_id,omitempty"`
// AdvertiserID 广告主 ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// Page 请求的页码,默认为 1(page和page_size要么都传,要么都不传;都不传时需要传模板ID)
Page int `json:"page,omitempty"`
// PageSize 每页行数,默认 20
PageSize int `json:"page_size,omitempty"`
}

// Url implement GetRequest interface
func (r TemplateDetailsRequest) Url() string {
return "gw/dsp/target/template/details"
}

// Encode implement GetRequest interface
func (r TemplateDetailsRequest) Encode() []byte {
return model.JSONMarshal(r)
}

// TemplateDetailsResponse 查询定向模板 API Response
type TemplateDetailsResponse struct {
Details []Template `json:"details,omitempty"`
// TotalCount 总数
TotalCount int `json:"total_count,omitempty"`
// CurrentPage 当前页码, 第一页是1
CurrentPage int `json:"current_page"`
// PageSize 分页大小
PageSize int `json:"page_size"`
}

// Template 定向模板
type Template struct {
// Target 定向信息
Target *unit.Target `json:"target,omitempty"`
// TemplateName 定向模板名称
TemplateName string `json:"template_name,omitempty"`
// CreateTime 定向模板创建时间,"2019-06-11 15:17:25"
CreateTime string `json:"create_time,omitempty"`
// UpdateTime 定向模板最近修改时间
UpdateTime string `json:"update_time,omitempty"`
// TemplateID 定向模板 ID
TemplateID uint64 `json:"template_id,omitempty"`
// UnitCount 绑定unit个数
UnitCount int `json:"unit_count,omitempty"`
}
37 changes: 37 additions & 0 deletions model/dsp/target/template_related_unit_list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package target

import "github.com/bububa/kwai-marketing-api/model"

// TemplateRelatedUnitListRequest 查询模板关联的广告列表接口 API Request
type TemplateRelatedUnitListRequest struct {
// CurrentPage 当前页码
CurrentPage int `json:"current_page,omitempty"`
// PageSize 每页大小
PageSize int `json:"page_size,omitempty"`
// TaskID 任务ID
TaskID uint64 `json:"task_id,omitempty"`
// TemplateID 模板ID
TemplateID uint64 `json:"template_id,omitempty"`
}

// Url implement PostRequest interface
func (r TemplateRelatedUnitListRequest) Url() string {
return "gw/dsp/target/template/related_unit_list"
}

// Encode implement PostRequest interface
func (r TemplateRelatedUnitListRequest) Encode() []byte {
return model.JSONMarshal(r)
}

// TemplateRelatedUnitListResponse 查询模板关联的广告列表接口 API Response
type TemplateRelatedUnitListResponse struct {
// Details 模板同步列表
Details []TemplateSyncUnit `json:"details,omitempty"`
// CurrentPage 当前页码
CurrentPage int `json:"current_page,omitempty"`
// PageSize 每页大小
PageSize int `json:"page_size,omitempty"`
// TotalCount 总条数
TotalCount int `json:"total_count,omitempty"`
}
Loading

0 comments on commit b544b5c

Please sign in to comment.