-
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
25 changed files
with
1,009 additions
and
123 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,15 @@ | ||
package dpa | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dsp/dpa" | ||
) | ||
|
||
// CategoryList 获取商品库类目树 | ||
func CategoryList(clt *core.SDKClient, accessToken string, req *dpa.CategoryListRequest) (*dpa.CategoryListResponse, error) { | ||
var resp dpa.CategoryListResponse | ||
if err := clt.Post(accessToken, req, &resp); 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,15 @@ | ||
package dpa | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dsp/dpa" | ||
) | ||
|
||
// CreativeTemplateList 获取SDPA创意视频模板 | ||
func CreativeTemplateList(clt *core.SDKClient, accessToken string, req *dpa.CreativeTemplateListRequest) (*dpa.CreativeTemplateListResponse, error) { | ||
var resp dpa.CreativeTemplateListResponse | ||
if err := clt.Post(accessToken, req, &resp); 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,15 @@ | ||
package dpa | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dsp/dpa" | ||
) | ||
|
||
// CreativeVideoGenerate 批量模板合成SDPA创意视频 | ||
func CreativeVideoGenerate(clt *core.SDKClient, accessToken string, req *dpa.CreativeVideoGenerateRequest) ([]dpa.GenerateVideoResult, error) { | ||
var resp dpa.CreativeVideoGenerateResponse | ||
if err := clt.Post(accessToken, req, &resp); err != nil { | ||
return nil, err | ||
} | ||
return resp.VideoInfos, 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,15 @@ | ||
package dpa | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dsp/dpa" | ||
) | ||
|
||
// ProductBatchCreate 创建商品 | ||
func ProductBatchCreate(clt *core.SDKClient, accessToken string, req *dpa.ProductBatchCreateRequest) ([]dpa.ProductUpdateResult, error) { | ||
var resp dpa.ProductBatchUpdateResponse | ||
if err := clt.Post(accessToken, req, &resp); err != nil { | ||
return nil, err | ||
} | ||
return resp.ProductEditResponses, 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,15 @@ | ||
package dpa | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dsp/dpa" | ||
) | ||
|
||
// ProductBatchUpdate 更新商品 | ||
func ProductBatchUpdate(clt *core.SDKClient, accessToken string, req *dpa.ProductBatchUpdateRequest) ([]dpa.ProductUpdateResult, error) { | ||
var resp dpa.ProductBatchUpdateResponse | ||
if err := clt.Post(accessToken, req, &resp); err != nil { | ||
return nil, err | ||
} | ||
return resp.ProductEditResponses, 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,15 @@ | ||
package dpa | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dsp/dpa" | ||
) | ||
|
||
// ProductCursorQuery 获取商品列表(游标) | ||
func ProductCursorQuery(clt *core.SDKClient, accessToken string, req *dpa.ProductCursorQueryRequest) (*dpa.ProductCursorQueryResponse, error) { | ||
var resp dpa.ProductCursorQueryResponse | ||
if err := clt.Post(accessToken, req, &resp); 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 dpa | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dsp/dpa" | ||
) | ||
|
||
// SecretCidLink CID服务商投放SDPA接口 | ||
func SecretCidLink(clt *core.SDKClient, accessToken string, req *dpa.SecretCidLinkRequest) 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,15 @@ | ||
package dpa | ||
|
||
import ( | ||
"github.com/bububa/kwai-marketing-api/core" | ||
"github.com/bububa/kwai-marketing-api/model/dsp/dpa" | ||
) | ||
|
||
// TemplateList 查询 DPA 模板信息 | ||
func TemplateList(clt *core.SDKClient, accessToken string, req *dpa.TemplateListRequest) (*dpa.TemplateListResponse, error) { | ||
var resp dpa.TemplateListResponse | ||
if err := clt.Post(accessToken, req, &resp); 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,37 @@ | ||
package dpa | ||
|
||
import "github.com/bububa/kwai-marketing-api/model" | ||
|
||
// CategoryListRequest 获取商品库类目树 API Request | ||
type CategoryListRequest struct { | ||
// AdvertiserID 广告主账号ID | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// LibraryID 商品库ID | ||
LibraryID uint64 `json:"library_id,omitempty"` | ||
} | ||
|
||
// Url implements PostRequest interface | ||
func (r CategoryListRequest) Url() string { | ||
return "gw/dsp/v1/dpa/category/list" | ||
} | ||
|
||
// Encode implements PostRequest interface | ||
func (r CategoryListRequest) Encode() []byte { | ||
return model.JSONMarshal(r) | ||
} | ||
|
||
// CategoryListResponse 获取商品库类目树 API Response | ||
type CategoryListResponse struct { | ||
// Details 类目信息列表 | ||
Details []Category `json:"details,omitempty"` | ||
} | ||
|
||
// Category 类目信息 | ||
type Category struct { | ||
// Label 类目名称 | ||
Label string `json:"label,omitempty"` | ||
// Children 子类目 | ||
Children []Category `json:"children,omitempty"` | ||
// Value 类目ID | ||
Value uint64 `json:"value,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,54 @@ | ||
package dpa | ||
|
||
import "github.com/bububa/kwai-marketing-api/model" | ||
|
||
// CreativeTemplateListRequest 获取SDPA创意视频模板 API Request | ||
type CreativeTemplateListRequest struct { | ||
// PageInfo 分页信息 | ||
PageInfo *model.PageInfo `json:"page_info,omitempty"` | ||
// OuterID 商品外部ID | ||
// 填写则返回"canSelect" | ||
OuterID string `json:"outer_id,omitempty"` | ||
// AdvertiserID 广告主账号ID | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// LibraryID 商品库ID | ||
LibraryID uint64 `json:"library_id,omitempty"` | ||
// ProductID 商品ID | ||
// 填写则返回"canSelect",优先于"outer_id"生效 | ||
ProductID uint64 `json:"product_id,omitempty"` | ||
} | ||
|
||
// Url implements PostRequest interface | ||
func (r CreativeTemplateListRequest) Url() string { | ||
return "gw/dsp/v1/dpa/creative/template/list" | ||
} | ||
|
||
// Encode implements PostRequest interface | ||
func (r CreativeTemplateListRequest) Encode() []byte { | ||
return model.JSONMarshal(r) | ||
} | ||
|
||
// CreativeTemplateListResponse 获取SDPA创意视频模板 API Response | ||
type CreativeTemplateListResponse struct { | ||
// PageInfo 分页信息 | ||
PageInfo *model.PageInfo `json:"page_info,omitempty"` | ||
// TemplateList 创意模板列表 | ||
TemplateList []CreativeTemplate `json:"template_list,omitempty"` | ||
} | ||
|
||
// CreativeTemplate 创意模板 | ||
type CreativeTemplate struct { | ||
// Image 封面图URL | ||
Image string `json:"image,omitempty"` | ||
// DemoURL 样例视频URL | ||
DemoURL string `json:"demo_url,omitempty"` | ||
// TemplateID 模板ID | ||
TemplateID uint64 `json:"template_id,omitempty"` | ||
// PackageID 配置包ID | ||
PackageID uint64 `json:"package_id,omitempty"` | ||
// TemplateType 模板类型 | ||
// 1-图片模板, 2-视频模板, 3-图片视频模板 | ||
TemplateType int `json:"template_type,omitempty"` | ||
// CanSelect 是否可选 | ||
CanSelect bool `json:"can_select,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,68 @@ | ||
package dpa | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/bububa/kwai-marketing-api/model" | ||
) | ||
|
||
// CreativeVideoGenerateRequest 批量模板合成SDPA创意视频 API Request | ||
type CreativeVideoGenerateRequest struct { | ||
// OuterID 商品外部ID | ||
OuterID string `json:"outer_id,omitempty"` | ||
// Templates 视频模板信息 | ||
Templates []CreativeTemplate `json:"templates,omitempty"` | ||
// AdvertiserID 广告主账号ID | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// LibraryID 商品库ID | ||
LibraryID uint64 `json:"library_id,omitempty"` | ||
// ProductID 商品ID | ||
// 优先于"outer_id"生效 | ||
ProductID uint64 `json:"product_id,omitempty"` | ||
} | ||
|
||
// Url implements PostRequest interface | ||
func (r CreativeVideoGenerateRequest) Url() string { | ||
return "gw/dsp/v1/dpa/creative/video/generate" | ||
} | ||
|
||
// Encode implements PostRequest interface | ||
func (r CreativeVideoGenerateRequest) Encode() []byte { | ||
return model.JSONMarshal(r) | ||
} | ||
|
||
// CreativeVideoGenerateResponse 批量模板合成SDPA创意视频 API Response | ||
type CreativeVideoGenerateResponse struct { | ||
// VideoInfos 视频信息列表 | ||
VideoInfos []GenerateVideoResult `json:"video_infos,omitempty"` | ||
} | ||
|
||
// GenerateVideoResult 合成视频信息 | ||
type GenerateVideoResult struct { | ||
// OuterID 商品第三方ID | ||
OuterID string `json:"outer_id,omitempty"` | ||
// ProductName 商品名称 | ||
ProductName string `json:"product_name,omitempty"` | ||
// VideoURL 视频URL | ||
VideoURL string `json:"video_url,omitempty"` | ||
// Code 失败状态码 | ||
Code string `json:"code,omitempty"` | ||
// Message 失败信息 | ||
Message string `json:"message,omitempty"` | ||
// PhotoID Photo ID | ||
PhotoID uint64 `json:"photo_id,omitempty"` | ||
// TemplateID 模板ID | ||
TemplateID uint64 `json:"template_id,omitempty"` | ||
// ProductID 商品ID | ||
ProductID uint64 `json:"product_id,omitempty"` | ||
} | ||
|
||
// IsError check generated video is failed | ||
func (r GenerateVideoResult) IsError() bool { | ||
return r.Code != "" | ||
} | ||
|
||
// Error implements error interface | ||
func (r GenerateVideoResult) Error() string { | ||
return fmt.Sprintf("code:%s, msg:%s", r.Code, r.Message) | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.