Skip to content

Commit

Permalink
Merge branch 'release/v1.6.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Jan 31, 2024
2 parents a0580c1 + c2399a1 commit 9594f3d
Show file tree
Hide file tree
Showing 27 changed files with 374 additions and 82 deletions.
15 changes: 15 additions & 0 deletions api/file/ad_video_delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package file

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

// AdVideoDelete 批量删除视频
func AdVideoDelete(clt *core.SDKClient, accessToken string, req *file.AdVideoDeleteRequest) ([]string, error) {
var ret file.AdVideoDeleteResponse
if err := clt.Post(accessToken, req, &ret); err != nil {
return nil, err
}
return ret.PhotoIDs, nil
}
15 changes: 15 additions & 0 deletions api/file/ad_video_share_new.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package file

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

// AdVideoShareNew 视频库-推送视频(新版)
func AdVideoShareNew(clt *core.SDKClient, accessToken string, req *file.AdVideoShareNewRequest) (*file.AdVideoShareNewResponse, error) {
var resp file.AdVideoShareNewResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
8 changes: 6 additions & 2 deletions api/file/ad_video_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import (
)

// AdVideoUpdate 视频库-批量更新视频功能
func AdVideoUpdate(clt *core.SDKClient, accessToken string, req *file.AdVideoUpdateRequest) error {
return clt.Post(accessToken, req, nil)
func AdVideoUpdate(clt *core.SDKClient, accessToken string, req *file.AdVideoUpdateRequest) ([]string, error) {
var ret file.AdVideoUpdateResponse
if err := clt.Post(accessToken, req, &ret); err != nil {
return nil, err
}
return ret.PhotoIDs, nil
}
15 changes: 15 additions & 0 deletions api/file/pic_share.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package file

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

// PicShare 图片库推送
func PicShare(clt *core.SDKClient, accessToken string, req *file.PicShareRequest) ([]file.PicShareResult, error) {
var resp file.PicShareResponse
if err := clt.Post(accessToken, req, &resp); err != nil {
return nil, err
}
return resp.Details, nil
}
15 changes: 15 additions & 0 deletions api/file/upload_atlas_photo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package file

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

// UploadAtlasPhoto 上传图文视频
func UploadAtlasPhoto(clt *core.SDKClient, accessToken string, req *file.UploadAtlasPhotoRequest) (string, error) {
var ret file.UploadAtlasPhotoResponse
if err := clt.Post(accessToken, req, &ret); err != nil {
return "", err
}
return ret.PhotoID, nil
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package file

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

// AdImageListRequest 查询图片接口list接口API Request
Expand All @@ -12,6 +12,13 @@ type AdImageListRequest struct {
StartDate string `json:"start_date,omitempty"`
// EndDate 结束时间
EndDate string `json:"end_date,omitempty"`
// PicTypes 图片类型
// 0-默认,5-竖版,6-横版,12-开屏。不填,则获取所有类型图片
PicTypes []int `json:"pic_types,omitempty"`
// ImageToken 图片 token
ImageToken string `json:"image_token,omitempty"`
// ImageTokens 图片 tokens
ImageTokens []string `json:"image_tokens,omitempty"`
// Page 请求的页码数
Page int `json:"page,omitempty"`
// PageSize 每页行数
Expand All @@ -25,6 +32,13 @@ func (r AdImageListRequest) Url() string {

// Encode implement GetRequest interface
func (r AdImageListRequest) Encode() []byte {
ret, _ := json.Marshal(r)
return ret
return model.JSONMarshal(r)
}

// AdImageListResponse 查询图片接口list接口 API Response
type AdImageListResponse struct {
// TotalCount 图片总数
TotalCount int `json:"total_count,omitempty"`
// Details 详情
Details []Image `json:"details,omitempty"`
}
9 changes: 0 additions & 9 deletions model/file/ad_image_list_response.go

This file was deleted.

File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions model/file/ad_video_delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package file

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

// AdVideoDeleteRequest 批量删除视频 API Request
type AdVideoDeleteRequest struct {
// AdvertiserID 广告主 id
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// PhotoIDs 视频 ids,不超过 100 个
PhotoIDs []string `json:"photo_ids,omitempty"`
}

// Url implement PostRequest interface
func (r AdVideoDeleteRequest) Url() string {
return "gw/dsp/file/ad/video/delete"
}

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

// AdVideoDeleteResponse 批量删除视频 API Response
type AdVideoDeleteResponse struct {
// PhotoIDs 视频 ids
PhotoIDs []string `json:"photo_ids,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package file

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

// AdVideoGetRequest 获取视频信息get接口 API Request
type AdVideoGetRequest struct {
Expand All @@ -17,6 +19,5 @@ func (r AdVideoGetRequest) Url() string {

// Encode implement PostRequest interface
func (r AdVideoGetRequest) Encode() []byte {
ret, _ := json.Marshal(r)
return ret
return model.JSONMarshal(r)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package file

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

// AdVideoListRequest 查询视频接口list接口API Request
type AdVideoListRequest struct {
Expand All @@ -18,6 +20,10 @@ type AdVideoListRequest struct {
Page int `json:"page,omitempty"`
// PageSize 每页行数
PageSize int `json:"page_size,omitempty"`
// OuterLoopNative 是否查询原生视频:0=查询非原生视频;1=查询原生视频。
OuterLoopNative *int `json:"outer_loop_native,omitempty"`
// PhotoUserID 视频所属的userId,仅针对原生视频生效,且查询原生视频时必须传递,且仅当视频来源为“本地上传”与“快手客户端(个人主页)”生效。
PhotoUserID uint64 `json:"photo_user_id,omitempty"`
}

// Url implement PostRequest interface
Expand All @@ -27,6 +33,13 @@ func (r AdVideoListRequest) Url() string {

// Encode implement PostRequest interface
func (r AdVideoListRequest) Encode() []byte {
ret, _ := json.Marshal(r)
return ret
return model.JSONMarshal(r)
}

// AdVideoListResponse 查询视频接口list接口 API Response
type AdVideoListResponse struct {
// TotalCount 图片总数
TotalCount int `json:"total_count,omitempty"`
// Details 详情
Details []Video `json:"details,omitempty"`
}
9 changes: 0 additions & 9 deletions model/file/ad_video_list_response.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
package file

import "encoding/json"

// AdVideoRelateCreativesRequest 视频关联创意数查询
type AdVideoRelateCreativesRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// PhotoIDs 视频id; 最大20个,可以动态配置
PhotoIds []string `json:"photo_ids,omitempty"`
}

// Url implement PostRequest interface
func (r AdVideoRelateCreativesRequest) Url() string {
return "v1/file/ad/video/relate/creatives"
}

// Encode implement PostRequest interface3
func (r AdVideoRelateCreativesRequest) Encode() []byte {
ret, _ := json.Marshal(r)
return ret
}

// AdVideoRelateCreativesResponse 视频关联创意数查询 API Response
type AdVideoRelateCreativesResponse struct {
// RelatedCreatives 与视频相关联的创意的信息; 关联创意数=审核中+投放中的创意,仅包含自定义创意,程序化创意数量暂未计入
Expand All @@ -14,6 +35,10 @@ type AdVideoRelatedCreatives struct {
Creatives []AdVideoRelatedCreative `json:"creatives,omitempty"`
// CreativeCount 与此视频id关联的创意总数
CreativeCount int64 `json:"creative_count,omitempty"`
// AdvancedCreativeIDs 与此视频 id 关联的程序化创意ID
AdvancedCreativeIDs []uint64 `json:"advanced_creative_ids,omitempty"`
// AdvancedCreativeCount 与此视频 id 关联的程序化创意数量
AdvancedCreativeCount int64 `json:"advanced_creative_count,omitempty"`
}

// AdVideoRelatedCreative
Expand Down
22 changes: 0 additions & 22 deletions model/file/ad_video_relate_creatives_request.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package file

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

// AdVideoShareRequest 视频库-推送视频 API Request
type AdVideoShareRequest struct {
Expand All @@ -19,6 +21,21 @@ func (r AdVideoShareRequest) Url() string {

// Encode implement PostRequest interface
func (r AdVideoShareRequest) Encode() []byte {
ret, _ := json.Marshal(r)
return ret
return model.JSONMarshal(r)
}

// AdVideoShareResponse 视频库-推送视频 API Response
type AdVideoShareResponse struct {
// Details Response details
Details []AdVideoShareDetail `json:"details,omitempty"`
}

// AdVideoShareDetail 视频库-推送视频 API Response Detail
type AdVideoShareDetail struct {
// AdvertiserID 账号ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// PhotoID 分享生成新的photoId
PhotoID string `json:"photo_id,omitempty"`
// OriginalPhotoID 原始photoId
OriginalPhotoID string `json:"original_photo_id,omitempty"`
}
55 changes: 55 additions & 0 deletions model/file/ad_video_share_new.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package file

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

// AdVideoShareNewRequest 视频库-推送视频(新版) API Request
type AdVideoShareNewRequest struct {
// AdvertiserID 广告主 id
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// PhotoIDs 视频 ids,不超过 10 个
PhotoIDs []string `json:"photo_ids,omitempty"`
// AccountIDs 目标推送账户
AccountIDs []uint64 `json:"account_ids,omitempty"`
// ShareAccountType 分享账户类型:-1:暂未支持的账户类型;1. 同主体同代理商账户;2. 同主体下账户(需加白使用);3. 内部账户;4. 同代理商下账户
ShareAccountType int `json:"share_account_type,omitempty"`
}

// Url implement PostRequest interface
func (r AdVideoShareNewRequest) Url() string {
return "gw/dsp/v1/file/ad/video/share/new"
}

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

// AdVideoShareNewResponse 视频库-推送视频(新版) API Response
type AdVideoShareNewResponse struct {
// ShareStatus 视频推送状态:-1=全部失败,0=表示部分失败,1=全部成功
ShareStatus int `json:"share_status,omitempty"`
// SharePhotoExists 被推送视频是否已存在于被推送账户的视频库中,true = 已存在;false = 不存在
SharePhotoExists bool `json:"share_photo_exists,omitempty"`
// NotSupportedInternalPhoto 被推送账户是否是内部账户,true = 是,发;false = 不是
NotSupportedInternalPhoto bool `json:"not_supported_internal_photo,omitempty"`
// MismatchedAccountList 在“同主体同代理商”的基础上,本次新增“同主体账户”,“内部账户”等两种可推送账户类型,如果被推送账户不满足条件,将于此列表返回
MismatchedAccountList []uint64 `json:"mismatched_account_list,omitempty"`
// NeedToTryList 因各种原因导致推送失败,需要重试的推送记录
NeedToTryList []PhotoShareResult `json:"need_to_try_list,omitempty"`
// ShareSuccessList 视频推送成功结果网关参数
ShareSuccessList []PhotoShareResult `json:"share_success_list,omitempty"`
}

// PhotoShareResult
type PhotoShareResult struct {
// AccountID 账号ID
AccountID uint64 `json:"account_id,omitempty"`
// PhotoID 分享生成新的photoId
PhotoID string `json:"photo_id,omitempty"`
// OriginalPhotoID 被推送视频ID
OriginalPhotoID string `json:"original_photo_id,omitempty"`
// ShareResult 推送结果
ShareResult string `json:"share_result,omitempty"`
}
17 changes: 0 additions & 17 deletions model/file/ad_video_share_response.go

This file was deleted.

Loading

0 comments on commit 9594f3d

Please sign in to comment.