Documentation
¶
Index ¶
- Constants
- type APIError
- type APIVersion
- type BaseResponse
- type BaseResponseWithData
- type Client
- func (c *Client) SetAuthToken(authToken string)
- func (c *Client) SetBaseUrl(baseUrl string)
- func (c *Client) VideoGet(ctx context.Context, request *VideoAdGetRequest) (respData *VideoGetResponseData, err error)
- func (c *Client) VideoNameUpdate(ctx context.Context, request *UpdateVideoNameRequest) (respData *UpdateVideoNameData, err error)
- func (c *Client) VideoSearch(ctx context.Context, request *VideoAdSearchRequest) (respData *VideoAdSearchResponseData, err error)
- func (c *Client) VideoThumbnailsSuggested(ctx context.Context, request *SuggestedVideoThumbnailsRequest) (respData *SuggestedVideoThumbnailsData, err error)
- func (c *Client) VideoUpload(ctx context.Context, request *VideoAdRequest) (respData []*VideoData, err error)
- type ClientConfig
- type ErrorResponse
- type PageInfo
- type RequestError
- type SuggestedThumbnail
- type SuggestedVideoThumbnailsData
- type SuggestedVideoThumbnailsRequest
- type UpdateVideoNameData
- type UpdateVideoNameRequest
- type UploadType_
- type VideoAdGetRequest
- type VideoAdRequest
- type VideoAdSearchRequest
- type VideoAdSearchResponseData
- type VideoData
- type VideoGetFilter
- type VideoGetResponseData
Constants ¶
View Source
const ( BaseAPIURL = "https://business-api.tiktok.com/open_api" BaseSandboxAPIURL = "https://sandbox-ads.tiktok.com/open_api" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { Code any `json:"code,omitempty"` Message string `json:"message"` Param *string `json:"param,omitempty"` Type string `json:"type"` HTTPStatusCode int `json:"-"` }
APIError provides error information returned by the TikTok Business API.
type APIVersion ¶
type APIVersion string
const ( APIVersion12 APIVersion = "v1.2" APIVersion13 APIVersion = "v1.3" )
type BaseResponse ¶
type BaseResponse struct { // Code is the return code Code int `json:"code"` // Message is the return message Message string `json:"message"` // RequestID is the request log ID, uniquely identifies a request RequestID string `json:"request_id,omitempty"` }
BaseResponse contains shared API response data fields
func (BaseResponse) IsError ¶
func (r BaseResponse) IsError() bool
IsError implement Response interface
type BaseResponseWithData ¶
type BaseResponseWithData struct { BaseResponse Data json.RawMessage `json:"data,omitempty"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client sdk client
func NewClientWithConfig ¶
func NewClientWithConfig(config ClientConfig) *Client
NewClientWithConfig creates new Tiktok Business API for specified config.
func (*Client) SetAuthToken ¶
set authentication token.
func (*Client) VideoGet ¶
func (c *Client) VideoGet(ctx context.Context, request *VideoAdGetRequest) ( respData *VideoGetResponseData, err error, )
VideoGet: get info about videos
func (*Client) VideoNameUpdate ¶
func (c *Client) VideoNameUpdate(ctx context.Context, request *UpdateVideoNameRequest) ( respData *UpdateVideoNameData, err error, )
VideoNameUpdate: update the name of a video
func (*Client) VideoSearch ¶
func (c *Client) VideoSearch(ctx context.Context, request *VideoAdSearchRequest) ( respData *VideoAdSearchResponseData, err error, )
VideoSearch: search for videos
func (*Client) VideoThumbnailsSuggested ¶
func (c *Client) VideoThumbnailsSuggested(ctx context.Context, request *SuggestedVideoThumbnailsRequest) ( respData *SuggestedVideoThumbnailsData, err error, )
VideoThumbnailsSuggested: get suggested thumbnails for a video
func (*Client) VideoUpload ¶
func (c *Client) VideoUpload(ctx context.Context, request *VideoAdRequest) ( respData []*VideoData, err error, )
VideoUpload: upload a video
type ClientConfig ¶
type ClientConfig struct { AuthToken string BaseURL string APIVersion APIVersion HTTPClient *http.Client // contains filtered or unexported fields }
ClientConfig is a configuration of a client.
func DefaultConfig ¶
func DefaultConfig(appID, secret string) ClientConfig
func (ClientConfig) String ¶
func (ClientConfig) String() string
type ErrorResponse ¶
type ErrorResponse struct {
Error *APIError `json:"error,omitempty"`
}
type PageInfo ¶
type PageInfo struct { // Page is the current page number. Page int `json:"page,omitempty"` // PageSize is the number of items per page. PageSize int `json:"page_size,omitempty"` // TotalNumber is the total number of items. TotalNumber int64 `json:"total_number,omitempty"` // TotalPage is the total number of pages. TotalPage int `json:"total_page,omitempty"` }
PageInfo contains general pagination data.
type RequestError ¶
RequestError provides informations about generic request errors.
func (*RequestError) Error ¶
func (e *RequestError) Error() string
type SuggestedThumbnail ¶
type SuggestedThumbnail struct { // Image width.. Width int `json:"width,omitempty"` // Image height. Height int `json:"height,omitempty"` // Image ID. ID string `json:"id,omitempty"` // Picture preview address, valid for an hour and needs to be re-acquired after expiration. URL string `json:"url,omitempty"` }
type SuggestedVideoThumbnailsData ¶
type SuggestedVideoThumbnailsData struct { // A list of image information.. List []SuggestedThumbnail `json:"list,omitempty"` }
type SuggestedVideoThumbnailsRequest ¶
type SuggestedVideoThumbnailsRequest struct { // Advertiser ID AdvertiserID string `json:"advertiser_id,omitempty"` // Video id VideoID string `json:"video_id,omitempty"` // Number of cover candidates you want to get. Range: 1-10. Default value: 10 . PosterNumber int `json:"poster_number,omitempty"` }
type UpdateVideoNameData ¶
type UpdateVideoNameData struct {
// Returned data
VideoData interface{} `json:"data,omitempty"`
}
type UpdateVideoNameRequest ¶
type UploadType_ ¶
type UploadType_ string
Upload method
const ( UPLOAD_BY_FILE UploadType_ = "UPLOAD_BY_FILE" UPLOAD_BY_URL UploadType_ = "UPLOAD_BY_URL" UPLOAD_BY_FILE_ID UploadType_ = "UPLOAD_BY_FILE_ID" UPLOAD_BY_VIDEO_ID UploadType_ = "UPLOAD_BY_VIDEO_ID" )
type VideoAdGetRequest ¶
type VideoAdRequest ¶
type VideoAdRequest struct { // Advertiser ID AdvertiserID string `json:"advertiser_id,omitempty"` // Video name. FileName string `json:"file_name,omitempty"` // Image upload method. UploadType UploadType_ `json:"upload_type,omitempty"` // Video file. // VideoFile *UploadField `json:"video_file,omitempty"` // Video MD5 (used for server verification).; Required when upload_type is UPLOAD_BY_FILE VideoSignature string `json:"video_signature,omitempty"` // Video URL address; Required when upload_type is UPLOAD_BY_URL VideoURL string `json:"video_url,omitempty"` // Id of the file that you want to upload; Required when upload_type is UPLOAD_BY_FILE_ID FileId string `json:"file_id,omitempty"` // Video id; Required when upload_type is UPLOAD_BY_VIDEO_ID VideoID string `json:"video_id,omitempty"` // The video is third party or not IsThirdParty bool `json:"is_third_party,omitempty"` // Whether to automatically detect an issue in your video FlawDetect bool `json:"flaw_detect,omitempty"` // Whether to automatically fix the detected issue. AutoFixEnabled bool `json:"auto_fix_enabled,omitempty"` // Whether to automatically upload the fixed video to your creative library. AutoBindEnabled bool `json:"auto_bind_enabled,omitempty"` }
type VideoAdSearchRequest ¶
type VideoAdSearchRequest struct { // Advertiser ID AdvertiserID string `json:"advertiser_id,omitempty"` // Filters on the data. Filtering *VideoGetFilter `json:"filtering,omitempty"` // Current page number. Default value: 1 Page int `json:"page,omitempty"` // Page size. Default value: 20. Value range: 1-100 PageSize int `json:"page_size,omitempty"` }
type VideoData ¶
type VideoData struct { // Temporary URL for video cover, valid for six hours and needs to be re-acquired after expiration VideoCoverURL string `json:"video_cover_url,omitempty"` // Video format. Format string `json:"format,omitempty"` // Video preview link, valid for six hours and needs to be re-acquired after expiration. PreviewUrl string `json:"preview_url,omitempty"` // The expiration time of the video preview link, in the format of YYYY-MM-DD HH:MM:SS (UTC+0) PreviewUrlExpireTime string `json:"preview_url_expire_time,omitempty"` // Video name. FileName string `json:"file_name,omitempty"` // Video name. Displayable bool `json:"displayable,omitempty"` // Video height. Height int `json:"height,omitempty"` // Video width. Width int `json:"width,omitempty"` // Bit rate in bps BitRate int64 `json:"bit_rate,omitempty"` // Creation time. UTC time. Format: 2020-06-10T07:39:14Z. CreateTime string `json:"create_time,omitempty"` // Modification time. UTC time. Format: 2020-06-10T07:39:14Z. ModifyTime string `json:"modify_time,omitempty"` // Video file MD5. Signature string `json:"signature,omitempty"` // Video duration, in seconds. Duration float64 `json:"duration,omitempty"` // Video ID, can be used to create ad in ad delivery. VideoID string `json:"video_id,omitempty"` // Video size, in bytes. Size uint64 `json:"size,omitempty"` // Material ID MaterialID string `json:"material_id,omitempty"` // Available placements AllowedPlacements []string `json:"allowed_placements,omitempty"` // Whether the video is downloadable AllowDownload bool `json:"allow_download,omitempty"` // Fix task ID FixTaskId string `json:"fix_task_id,omitempty"` // Video issue types FlawTypes string `json:"flaw_types,omitempty"` }
type VideoGetFilter ¶
type VideoGetFilter struct { // Video height. Height int `json:"height,omitempty"` // Video aspect ratio Ratio []float64 `json:"ratio,omitempty"` // A list of video IDs. At most 100 IDs can be included in the list. VideoIDs []string `json:"video_ids,omitempty"` // A list of material IDs. At most 100 IDs can be included in the list. MaterialIDs []string `json:"material_ids,omitempty"` // Video width. Width int `json:"width,omitempty"` // Video name. Displayable bool `json:"displayable,omitempty"` }
type VideoGetResponseData ¶
type VideoGetResponseData struct { // List contains the list of videos. List []VideoData `json:"list,omitempty"` }
Click to show internal directories.
Click to hide internal directories.