-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
346 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package dmp | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dmp" | ||
) | ||
|
||
// PopulationAccountsPush 人群包跨账户推送 | ||
func PopulationAccountsPush(clt *core.SDKClient, accessToken string, req *dmp.PopulationAccountsPushRequest) (*dmp.PopulationAccountsPushResponse, error) { | ||
var resp dmp.PopulationAccountsPushResponse | ||
err := clt.Post(accessToken, req, &resp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &resp, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dmp | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dmp" | ||
) | ||
|
||
// PopulationDelete 人群包删除接口 | ||
func PopulationDelete(clt *core.SDKClient, accessToken string, req *dmp.PopulationDeleteRequest) error { | ||
return clt.Post(accessToken, req, nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package dmp | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dmp" | ||
) | ||
|
||
// PopulationList 人群列表查询接口 | ||
func PopulationList(clt *core.SDKClient, accessToken string, req *dmp.PopulationListRequest) ([]dmp.Population, error) { | ||
var resp []dmp.Population | ||
err := clt.Get(accessToken, req, &resp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return resp, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dmp | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dmp" | ||
) | ||
|
||
// PopulationPush 人群包上线接口 | ||
func PopulationPush(clt *core.SDKClient, accessToken string, req *dmp.PopulationPushRequest) error { | ||
return clt.Post(accessToken, req, nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package dmp | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dmp" | ||
) | ||
|
||
// PopulationUpdate 人群包更新接口 | ||
func PopulationUpdate(clt *core.SDKClient, accessToken string, req *dmp.PopulationUpdateRequest) (*dmp.Population, error) { | ||
var resp dmp.Population | ||
err := clt.Upload(accessToken, req, &resp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &resp, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package dmp | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dmp" | ||
) | ||
|
||
// PopulationUpload 人群包上传接口 | ||
func PopulationUpload(clt *core.SDKClient, accessToken string, req *dmp.PopulationUploadRequest) (*dmp.Population, error) { | ||
var resp dmp.Population | ||
err := clt.Upload(accessToken, req, &resp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &resp, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Package dmp DMP人群管理相关API models | ||
package dmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package dmp | ||
|
||
// Population 人群包 | ||
type Population struct { | ||
// OrientationID 人群包ID | ||
OrientationID int64 `json:"orientation_id,omitempty"` | ||
// OrientationName 人群包名称 | ||
OrientationName string `json:"orientation_name,omitempty"` | ||
// Type 人群数据类型; 1:IMEI;2:IDFA;3:IMEI_MD5;4:IDFA_MD5;5:手机号-MD5;7:OAID;8:OAID_MD5 | ||
Type int `json:"type,omitempty"` | ||
// PopulationType 人群包类型; 1, "上传人群";2, "广告人群";3, "主题专区";4, "逻辑规则";5, "人群扩展";6, "平台定制";7, "定制付费";8, "网红粉丝类别";9, "内容付费行为";10, "移动应用安装";11, "快手使用活跃度";12, "行业分类";13, "商业兴趣";14, "固化标签";15, "行业偏好";16, "第三方标签";17, "产品关键词";19, "应用渗透率";22, "指定网红";23, "行业分类"(同12) | ||
PopulationType int `json:"population_type,omitempty"` | ||
// RecordSize 上传数量 | ||
RecordSize int64 `json:"record_size,omitempty"` | ||
// MatchSize 匹配数量 | ||
MatchSize int64 `json:"match_size,omitempty"` | ||
// CoverNum 覆盖人群; 返回值固定为0 | ||
CoverNum int64 `json:"cover_num,omitempty"` | ||
// Status 人群包状态; 0, "计算中";1, "已生效";2, "已删除";3, "上线中";4, "已上线";5, "计算失败";6, "上线失败";7, "已失效" | ||
Status int `json:"status,omitempty"` | ||
// CreateTime 创建时间; 格式:13位毫秒级时间戳 | ||
CreateTime int64 `json:"create_time,omitempty"` | ||
// ThirdPlatformCode 付费人群包-第3方平台code | ||
ThirdPlatformCode int `json:"third_platform_code,omitempty"` | ||
// ThirdPlatformName 付费人群包第三方供应商名称 | ||
ThirdPlatformName string `json:"third_platform_name,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package dmp | ||
|
||
import "encoding/json" | ||
|
||
// PopulationAccountsPushRequest 人群包跨账户推送 APIRequest | ||
type PopulationAccountsPushRequest struct { | ||
// AdvertiserID 广告主 ID | ||
AdvertiserID int64 `json:"advertiser_id,omitempty"` | ||
// OrientationID 人群包ID | ||
OrientationID int64 `json:"orientation_id,omitempty"` | ||
// DestAccountIDs 要推送的账户ids | ||
DestAccountIDs []int64 `json:"dest_account_ids,omitempty"` | ||
} | ||
|
||
// Url implement PostRequest interface | ||
func (r PopulationAccountsPushRequest) Url() string { | ||
return "v1/dmp/population/accounts/push" | ||
} | ||
|
||
// Encode implement PostRequest interface | ||
func (r PopulationAccountsPushRequest) Encode() []byte { | ||
ret, _ := json.Marshal(r) | ||
return ret | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dmp | ||
|
||
// PopulationAccountsPushResponse 人群包跨账户推送 APIResponse | ||
type PopulationAccountsPushResponse struct { | ||
// Success 推送成功的account_ids | ||
Success []int64 `json:"success,omitempty"` | ||
// Fail 推送失败的account_ids | ||
Fail []int64 `json:"fail,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package dmp | ||
|
||
import "encoding/json" | ||
|
||
// PopulationDeleteRequest 人群包删除接口APIRequest | ||
type PopulationDeleteRequest struct { | ||
// AdvertiserID 广告主 ID | ||
AdvertiserID int64 `json:"advertiser_id,omitempty"` | ||
// OrientationID 人群包ID | ||
OrientationID int64 `json:"orientation_id,omitempty"` | ||
} | ||
|
||
// Url implement PostRequest interface | ||
func (r PopulationDeleteRequest) Url() string { | ||
return "v1/dmp/population/delete" | ||
} | ||
|
||
// Encode implement PostRequest interface | ||
func (r PopulationDeleteRequest) Encode() []byte { | ||
ret, _ := json.Marshal(r) | ||
return ret | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package dmp | ||
|
||
import ( | ||
"net/url" | ||
"strconv" | ||
) | ||
|
||
// PopulationListRequest 人群列表查询接口 API Request | ||
type PopulationListRequest struct { | ||
// AdvertiserID 广告主ID | ||
AdvertiserID int64 `json:"advertiser_id,omitempty"` | ||
// Status 人群包状态; 0, "计算中";1, "已生效";2, "已删除";3, "推送中";4, "已推送";5, "计算失败";6, "推送失败" ;7, "已失效" | ||
Status *int `json:"status,omitempty"` | ||
// Page 页码,默认 1 | ||
Page int `json:"page,omitempty"` | ||
// PageSize 页数,默认 20 | ||
PageSize int `json:"page_size,omitempty"` | ||
} | ||
|
||
// Url implement GetRequest interface | ||
func (r PopulationListRequest) Url() string { | ||
return "v2/dmp/population/list" | ||
} | ||
|
||
// Encode implement GetRequest interface | ||
func (r PopulationListRequest) Encode() string { | ||
values := &url.Values{} | ||
values.Set("advertiser_id", strconv.FormatInt(r.AdvertiserID, 10)) | ||
if r.Status != nil { | ||
values.Set("status", strconv.Itoa(*r.Status)) | ||
} | ||
if r.Page > 0 { | ||
values.Set("page", strconv.Itoa(r.Page)) | ||
} | ||
if r.PageSize > 0 { | ||
values.Set("page_size", strconv.Itoa(r.PageSize)) | ||
} | ||
return values.Encode() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package dmp | ||
|
||
import "encoding/json" | ||
|
||
// PopulationPushRequest 人群包上线接口APIRequest | ||
type PopulationPushRequest struct { | ||
// AdvertiserID 广告主 ID | ||
AdvertiserID int64 `json:"advertiser_id,omitempty"` | ||
// OrientationID 人群包 ID; 只有 status 为 1 或 6 的人群包可上线,最多支持 4 个人群包状态同时为“上线中”, | ||
OrientationID int64 `json:"orientation_id,omitempty"` | ||
} | ||
|
||
// Url implement PostRequest interface | ||
func (r PopulationPushRequest) Url() string { | ||
return "v1/dmp/population/push" | ||
} | ||
|
||
// Encode implement PostRequest interface | ||
func (r PopulationPushRequest) Encode() []byte { | ||
ret, _ := json.Marshal(r) | ||
return ret | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package dmp | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/kwai-marketing-api/model" | ||
) | ||
|
||
// PopulationUpdateRequest 人群包更新接口 | ||
type PopulationUpdateRequest struct { | ||
// AdvertiserID 广告主ID | ||
AdvertiserID int64 `json:"advertiser_id,omitempty"` | ||
// Type 人群数据类型; 1:IMEI;2:IDFA;3:IMEI_MD5;4:IDFA_MD5;5:手机号-MD5;7:OAID;8:OAID_MD5 | ||
Type int `json:"type,omitempty"` | ||
// OrientationID 人群包id | ||
OrientationID int64 `json:"orientation_id,omitempty"` | ||
// OperationType 修改操作类型; 1:APPEND(增量更新)3:DELETE(缩量更新) | ||
OperationType int `json:"operation_type,omitempty"` | ||
// File 请求的文件; 最大支持500MB | ||
File *model.UploadField `json:"file,omitempty"` | ||
} | ||
|
||
// Url implement UploadRequest interface | ||
func (r PopulationUpdateRequest) Url() string { | ||
return "v1/dmp/population/update" | ||
} | ||
|
||
// Encode implement UploadRequest interface | ||
func (r PopulationUpdateRequest) Encode() []model.UploadField { | ||
fileName := r.File.Value | ||
if fileName == "" { | ||
fileName = "file" | ||
} | ||
return []model.UploadField{ | ||
{ | ||
Key: "advertiser_id", | ||
Value: strconv.FormatInt(r.AdvertiserID, 10), | ||
}, | ||
{ | ||
Key: "type", | ||
Value: strconv.Itoa(r.Type), | ||
}, | ||
{ | ||
Key: "orientation_id", | ||
Value: strconv.FormatInt(r.OrientationID, 10), | ||
}, | ||
{ | ||
Key: "operation_type", | ||
Value: strconv.Itoa(r.OperationType), | ||
}, | ||
{ | ||
Key: "file", | ||
Value: fileName, | ||
Reader: r.File.Reader, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package dmp | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/kwai-marketing-api/model" | ||
) | ||
|
||
// PopulationUploadRequest 人群包上传接口 | ||
type PopulationUploadRequest struct { | ||
// AdvertiserID 广告主ID | ||
AdvertiserID int64 `json:"advertiser_id,omitempty"` | ||
// Type 人群数据类型; 1:IMEI;2:IDFA;3:IMEI_MD5;4:IDFA_MD5;5:手机号-MD5;7:OAID;8:OAID_MD5 | ||
Type int `json:"type,omitempty"` | ||
// OrientationName 人群包名称; 不能大于20个字符,人群包名称不得重复 | ||
OrientationName string `json:"orientation_name,omitempty"` | ||
// File 请求的文件; 最大支持500MB | ||
File *model.UploadField `json:"file,omitempty"` | ||
} | ||
|
||
// Url implement UploadRequest interface | ||
func (r PopulationUploadRequest) Url() string { | ||
return "v1/dmp/population/upload" | ||
} | ||
|
||
// Encode implement UploadRequest interface | ||
func (r PopulationUploadRequest) Encode() []model.UploadField { | ||
fileName := r.File.Value | ||
if fileName == "" { | ||
fileName = "file" | ||
} | ||
return []model.UploadField{ | ||
{ | ||
Key: "advertiser_id", | ||
Value: strconv.FormatInt(r.AdvertiserID, 10), | ||
}, | ||
{ | ||
Key: "type", | ||
Value: strconv.Itoa(r.Type), | ||
}, | ||
{ | ||
Key: "orientation_name", | ||
Value: r.OrientationName, | ||
}, | ||
{ | ||
Key: "file", | ||
Value: fileName, | ||
Reader: r.File.Reader, | ||
}, | ||
} | ||
} |