Skip to content

Commit

Permalink
feat: add AdsCheckLink method
Browse files Browse the repository at this point in the history
  • Loading branch information
SevereCloud committed Nov 10, 2020
1 parent 6d77592 commit d8ee337
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
23 changes: 16 additions & 7 deletions api/ads.go
Expand Up @@ -15,16 +15,25 @@ import (
// return
// }

// TODO: AdsCheckLinkResponse struct.
// type AdsCheckLinkResponse struct{}
// AdsCheckLinkResponse struct.
type AdsCheckLinkResponse struct {
// link status
Status object.AdsLinkStatus `json:"status"`

// TODO: AdsCheckLink ...
// (if status = disallowed) — description of the reason
Description string `json:"description,omitempty"`

// (if the end link differs from original and status = allowed) — end link.
RedirectURL string `json:"redirect_url,omitempty"`
}

// AdsCheckLink allows to check the ad link.
//
// https://vk.com/dev/ads.checkLink
// func (vk *VK) AdsCheckLink(params Params) (response AdsCheckLinkResponse, err error) {
// err = vk.RequestUnmarshal("ads.checkLink", &response, params)
// return
// }
func (vk *VK) AdsCheckLink(params Params) (response AdsCheckLinkResponse, err error) {
err = vk.RequestUnmarshal("ads.checkLink", &response, params)
return
}

// TODO: AdsCreateAdsResponse struct.
// type AdsCreateAdsResponse struct{}
Expand Down
20 changes: 14 additions & 6 deletions object/ads.go
Expand Up @@ -119,12 +119,20 @@ type AdsFloodStats struct {
Refresh int `json:"refresh"` // Time to refresh in seconds
}

// AdsLinkStatus struct.
type AdsLinkStatus struct {
Description string `json:"description"` // Reject reason
RedirectURL string `json:"redirect_url"` // URL
Status string `json:"status"` // Link status
}
// AdsLinkStatus link status.
type AdsLinkStatus string

// Possible values.
const (
// allowed to use in ads.
AdsLinkAllowed AdsLinkStatus = "allowed"

// prohibited to use for this type of the object.
AdsLinkDisallowed AdsLinkStatus = "disallowed"

// checking, wait please.
AdsLinkInProgress AdsLinkStatus = "in_progress"
)

// AdsParagraphs struct.
type AdsParagraphs struct {
Expand Down

0 comments on commit d8ee337

Please sign in to comment.