Skip to content

Commit

Permalink
update targetUrl requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
rohenaz committed Jun 23, 2022
1 parent 7890c8a commit 82673d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion campaigns.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ func (c *Client) CreateCampaign(campaign *Campaign) (*StandardResponse, error) {
return nil, fmt.Errorf("missing required attribute: %s", fieldTitle)
} else if len(campaign.Description) == 0 {
return nil, fmt.Errorf("missing required attribute: %s", fieldDescription)
} else if len(campaign.TargetURL) == 0 {
} else if len(campaign.TargetType) == 0 {
return nil, fmt.Errorf("missing required attribute: %s", fieldTargetType)
} else if campaign.TargetType == "url" && len(campaign.TargetURL) == 0 {
return nil, fmt.Errorf("missing required attribute: %s", fieldTargetURL)
} else if campaign.TargetType == "hosted" && len(campaign.TargetData) == 0 {
return nil, fmt.Errorf("missing required attribute: %s", fieldTargetData)
}

// Fire the Request
Expand Down
11 changes: 7 additions & 4 deletions definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ const (
fieldSortBy = "sort_by"
fieldSortOrder = "sort_order"
fieldTargetURL = "target_url"
fieldTitle = "title"
fieldTwitterID = "twitter_id"
fieldUserID = "user_id"
fieldVisitorSessionGUID = "tncpw_session"
fieldTargetData = "target_data"
fieldTargetType = "target_type"

fieldTitle = "title"
fieldTwitterID = "twitter_id"
fieldUserID = "user_id"
fieldVisitorSessionGUID = "tncpw_session"

// Model names (used for Request endpoints)
modelAdvertiser string = "advertisers"
Expand Down

0 comments on commit 82673d7

Please sign in to comment.