diff --git a/README.md b/README.md index 3527c30..d3efdf9 100644 --- a/README.md +++ b/README.md @@ -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) ] diff --git a/api/dsp/target/doc.go b/api/dsp/target/doc.go new file mode 100644 index 0000000..e3de34d --- /dev/null +++ b/api/dsp/target/doc.go @@ -0,0 +1,2 @@ +// Package target 定向模板 +package target diff --git a/api/dsp/target/option_distance_list.go b/api/dsp/target/option_distance_list.go new file mode 100644 index 0000000..96b3e58 --- /dev/null +++ b/api/dsp/target/option_distance_list.go @@ -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 +} diff --git a/api/dsp/target/template_create.go b/api/dsp/target/template_create.go new file mode 100644 index 0000000..1901283 --- /dev/null +++ b/api/dsp/target/template_create.go @@ -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 +} diff --git a/api/dsp/target/template_delete.go b/api/dsp/target/template_delete.go new file mode 100644 index 0000000..cf1d85f --- /dev/null +++ b/api/dsp/target/template_delete.go @@ -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 +} diff --git a/api/dsp/target/template_details.go b/api/dsp/target/template_details.go new file mode 100644 index 0000000..949e3e8 --- /dev/null +++ b/api/dsp/target/template_details.go @@ -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 +} diff --git a/api/dsp/target/template_related_unit_list.go b/api/dsp/target/template_related_unit_list.go new file mode 100644 index 0000000..6c1f330 --- /dev/null +++ b/api/dsp/target/template_related_unit_list.go @@ -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 +} diff --git a/api/dsp/target/template_sync_history.go b/api/dsp/target/template_sync_history.go new file mode 100644 index 0000000..05157ad --- /dev/null +++ b/api/dsp/target/template_sync_history.go @@ -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 +} diff --git a/api/dsp/target/template_unit_sync.go b/api/dsp/target/template_unit_sync.go new file mode 100644 index 0000000..ba4085f --- /dev/null +++ b/api/dsp/target/template_unit_sync.go @@ -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 +} diff --git a/api/dsp/target/template_update.go b/api/dsp/target/template_update.go new file mode 100644 index 0000000..9380e90 --- /dev/null +++ b/api/dsp/target/template_update.go @@ -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 +} diff --git a/api/dsp/target/template_upgrade.go b/api/dsp/target/template_upgrade.go new file mode 100644 index 0000000..11c2fe5 --- /dev/null +++ b/api/dsp/target/template_upgrade.go @@ -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 +} diff --git a/api/dsp/target/template_upgrade_list.go b/api/dsp/target/template_upgrade_list.go new file mode 100644 index 0000000..c31b6f8 --- /dev/null +++ b/api/dsp/target/template_upgrade_list.go @@ -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 +} diff --git a/model/dsp/target/doc.go b/model/dsp/target/doc.go new file mode 100644 index 0000000..e3de34d --- /dev/null +++ b/model/dsp/target/doc.go @@ -0,0 +1,2 @@ +// Package target 定向模板 +package target diff --git a/model/dsp/target/option_distance_list.go b/model/dsp/target/option_distance_list.go new file mode 100644 index 0000000..3180772 --- /dev/null +++ b/model/dsp/target/option_distance_list.go @@ -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"` +} diff --git a/model/dsp/target/template_create.go b/model/dsp/target/template_create.go new file mode 100644 index 0000000..c6c5a75 --- /dev/null +++ b/model/dsp/target/template_create.go @@ -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"` +} diff --git a/model/dsp/target/template_delete.go b/model/dsp/target/template_delete.go new file mode 100644 index 0000000..02569e9 --- /dev/null +++ b/model/dsp/target/template_delete.go @@ -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"` +} diff --git a/model/dsp/target/template_details.go b/model/dsp/target/template_details.go new file mode 100644 index 0000000..de5b42a --- /dev/null +++ b/model/dsp/target/template_details.go @@ -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"` +} diff --git a/model/dsp/target/template_related_unit_list.go b/model/dsp/target/template_related_unit_list.go new file mode 100644 index 0000000..0ab83cc --- /dev/null +++ b/model/dsp/target/template_related_unit_list.go @@ -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"` +} diff --git a/model/dsp/target/template_sync_history.go b/model/dsp/target/template_sync_history.go new file mode 100644 index 0000000..f7aef6a --- /dev/null +++ b/model/dsp/target/template_sync_history.go @@ -0,0 +1,64 @@ +package target + +import "github.com/bububa/kwai-marketing-api/model" + +// TemplateSyncHistoryRequest 模板同步失败查询 API Request +type TemplateSyncHistoryRequest 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 TemplateSyncHistoryRequest) Url() string { + return "gw/dsp/target/template/sync_history" +} + +// Encode implement PostRequest interface +func (r TemplateSyncHistoryRequest) Encode() []byte { + return model.JSONMarshal(r) +} + +// TemplateSyncHistoryResponse 模板同步失败查询 API Response +type TemplateSyncHistoryResponse 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"` +} + +// TemplateSyncUnit 模板同步信息 +type TemplateSyncUnit struct { + // FailedMsg 同步失败详情信息 + FailedMsg string `json:"failed_msg,omitempty"` + // UnitViewStatusReason 广告组状态描述 + UnitViewStatusReason string `json:"unit_view_status_reason,omitempty"` + // CampaignName 计划名称 + CampaignName string `json:"campaign_name,omitempty"` + // UnitName 广告组名称 + UnitName string `json:"unit_name,omitempty"` + // CampaignID 计划ID + CampaignID uint64 `json:"campaign_id,omitempty"` + // TemplateID 模板ID + TemplateID uint64 `json:"template_id,omitempty"` + // UnitID 广告组ID + UnitID uint64 `json:"unit_id,omitempty"` + // AutoAdjust 计划是否开启自动调控 + AutoAdjust int `json:"auto_adjust,omitempty"` + // AutoBuild 计划是否开启自动基建 + AutoBuild int `json:"auto_build,omitempty"` + // AutoManage 计划是否开启智能投放 + AutoManage int `json:"auto_manage,omitempty"` + // UnitViewStatus 广告组状态 + // -1:不限,1:计划已暂停,3:计划超预算,6:余额不足,,11:审核中,12:审核未通过,14:已结束,15:已暂停,17:组超预算,19:未达投放时间,20:有效,22:不在投放时段 + UnitViewStatus int `json:"unit_view_status,omitempty"` +} diff --git a/model/dsp/target/template_unit_sync.go b/model/dsp/target/template_unit_sync.go new file mode 100644 index 0000000..fd85c76 --- /dev/null +++ b/model/dsp/target/template_unit_sync.go @@ -0,0 +1,43 @@ +package target + +import "github.com/bububa/kwai-marketing-api/model" + +// TemplateUnitSyncRequest 定向模板同步 API Request +type TemplateUnitSyncRequest struct { + // SyncUnitIDs 同步的广告组ID列表 + SyncUnitIDs []uint64 `json:"sync_unit_ids,omitempty"` + // SyncUnitType 1:同步定向模板关联的所有广告组,此时sync_unit_ids应该为空或者不传;2:同步到定向模板下指定的部分广告组,此时sync_unit_ids应该有值;3:同步到定向模板下的排除掉 sync_unit_ids 列表中的所有广告组。当 sync_unit_type = 2/3 时,对应的 sync_unit_ids 字段可从接口「/rest/openapi/gw/dsp/target/template/related_unit_list」获取相关联的广告组ID + SyncUnitType int `json:"sync_unit_type,omitempty"` + // TemplateID 模板ID + TemplateID uint64 `json:"template_id,omitempty"` +} + +// Url implement PostRequest interface +func (r TemplateUnitSyncRequest) Url() string { + return "gw/dsp/target/template/unit_sync" +} + +// Encode implement PostRequest interface +func (r TemplateUnitSyncRequest) Encode() []byte { + return model.JSONMarshal(r) +} + +// TemplateUnitSyncResponse 定向模板同步 API Response +type TemplateUnitSyncResponse struct { + // AsyncTask 是否是异步任务 + AsyncTask bool `json:"async_task,omitempty"` + // HasTask 是否存在同步任务 + // 仅当模板同步时同步到的广告组为空时,该字段为 true + HasTask bool `json:"has_task,omitempty"` + // TaskID 同步的任务ID + // 返回的 task_id 可根据接口 「/rest/openapi/gw/dsp/target/template/sync_history」查询相关的同步详情 + TaskID uint64 `json:"task_id,omitempty"` + // TemplateID 同步的模板ID + TemplateID uint64 `json:"template_id,omitempty"` + // UnitErrorCount 同步失败的广告组数量 + // 仅同步任务时会返回此字段 + UnitErrorCount int `json:"unit_error_count,omitempty"` + // UnitSuccessCount 同步成功的广告组数据 + // 仅同步任务时会返回此字段 + UnitSuccessCount int `json:"unit_success_count,omitempty"` +} diff --git a/model/dsp/target/template_update.go b/model/dsp/target/template_update.go new file mode 100644 index 0000000..511e2ad --- /dev/null +++ b/model/dsp/target/template_update.go @@ -0,0 +1,34 @@ +package target + +import ( + "github.com/bububa/kwai-marketing-api/model" + "github.com/bububa/kwai-marketing-api/model/dsp/unit" +) + +// TemplateUpdateRequest 更新定向模板 API Request +type TemplateUpdateRequest struct { + // Target 定向信息 + Target *unit.Target `json:"target,omitempty"` + // TemplateName 定向模板名称 + TemplateName string `json:"template_name,omitempty"` + // TemplateID 模板ID + TemplateID uint64 `json:"template_id,omitempty"` + // AdvertiserID 广告主 ID + AdvertiserID uint64 `json:"advertiser_id,omitempty"` +} + +// Url implement GetRequest interface +func (r TemplateUpdateRequest) Url() string { + return "gw/dsp/target/template/update" +} + +// Encode implement GetRequest interface +func (r TemplateUpdateRequest) Encode() []byte { + return model.JSONMarshal(r) +} + +// TemplateUpdateResponse 更新定向模板 API Response +type TemplateUpdateResponse struct { + // TemplateID 模板ID + TemplateID uint64 `json:"template_id,omitempty"` +} diff --git a/model/dsp/target/template_upgrade.go b/model/dsp/target/template_upgrade.go new file mode 100644 index 0000000..e55353a --- /dev/null +++ b/model/dsp/target/template_upgrade.go @@ -0,0 +1,26 @@ +package target + +import "github.com/bububa/kwai-marketing-api/model" + +// TemplateUpgradeRequest 模板升级 API Request +type TemplateUpgradeRequest struct { + // TemplateID 模板ID + // 模板ID不为空时会指定升级该模板,当模板ID为空时,会更新账户下所有需要升级的模板 + TemplateID uint64 `json:"template_id,omitempty"` +} + +// Url implement PostRequest interface +func (r TemplateUpgradeRequest) Url() string { + return "gw/dsp/target/template/upgrade" +} + +// Encode implement PostRequest interface +func (r TemplateUpgradeRequest) Encode() []byte { + return model.JSONMarshal(r) +} + +// TemplateUpgradeResponse 模板升级 API Response +type TemplateUpgradeResponse struct { + // TemplateCount 升级了的模板总数 + TemplateCount int64 `json:"template_count,omitempty"` +} diff --git a/model/dsp/target/template_upgrade_list.go b/model/dsp/target/template_upgrade_list.go new file mode 100644 index 0000000..59da47b --- /dev/null +++ b/model/dsp/target/template_upgrade_list.go @@ -0,0 +1,39 @@ +package target + +// TemplateUpgradeListRequest 查询待升级模板列表 +type TemplateUpgradeListRequest struct{} + +// Url implement PostRequest interface +func (r TemplateUpgradeListRequest) Url() string { + return "gw/dsp/target/template/upgrade_list" +} + +// Encode implement PostRequest interface +func (r TemplateUpgradeListRequest) Encode() []byte { + return nil +} + +// TemplateUpgradeItem 待升级模板 +type TemplateUpgradeItem struct { + // TargetChangeVO 模板升级详情 + TargetChangeVO *TargetChangeVO `json:"target_change_vo,omitempty"` + // TemplateName 模板名称 + TemplateName string `json:"template_name,omitempty"` + // TemplateID 模板ID + TemplateID uint64 `json:"template_id,omitempty"` + // UnitCount 关联的广告组数量 + UnitCount int64 `json:"unit_count,omitempty"` +} + +// TargetChangeVO 模板升级详情 +type TargetChangeVO struct { + // Celebrity 快手网红是否发生变更 + // true 表示快手网红之前有值被清空 + Celebrity bool `json:"celebrity,omitempty"` + // BehaviorInterest 行为意向是否发生变更 + // true 表示行为意向之前有值被清空 + BehaviorInterest bool `json:"behavior_interest,omitempty"` + // InteliExtendOption 智能定向是否发生变更 + // true 表示智能定向被打开 + InteliExtendOption bool `json:"inteli_extend_option,omitempty"` +}