Skip to content

Commit

Permalink
Added example for expires_at
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Jan 10, 2020
1 parent 0732661 commit 78d1864
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ type Campaign struct {
Clicks uint64 `json:"clicks,omitempty"`
Currency string `json:"currency,omitempty"`
Description string `json:"description,omitempty"`
ExpiresAt string `json:"expires_at,omitempty"`
FundingAddress string `json:"funding_address,omitempty"`
Goals []*Goal `json:"goals,omitempty"`
ID uint64 `json:"id,omitempty"`
Expand Down
12 changes: 7 additions & 5 deletions examples/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"math/rand"
"os"
"time"

"github.com/tonicpow/go-tonicpow"
)
Expand Down Expand Up @@ -200,6 +201,7 @@ func main() {
//
// Example: Create a campaign
//
expiresAt := time.Now().UTC().Add(500 * time.Hour) // Optional expiration date
campaign := &tonicpow.Campaign{
AdvertiserProfileID: advertiser.ID,
Currency: "USD",
Expand All @@ -208,6 +210,7 @@ func main() {
PayPerClickRate: 0.01,
TargetURL: "https://offers.tonicpow.com",
Title: "TonicPow Offers",
ExpiresAt: expiresAt.String(),
}
if campaign, err = createCampaign(campaign, userSessionToken); err != nil {
os.Exit(1)
Expand Down Expand Up @@ -327,14 +330,13 @@ func main() {

log.Printf("got conversion: %d", conversion.ID)

/*if newConversion, err = TonicPowAPI.CreateConversionByUserID(1, 1, "", 0); err != nil {
if newConversion, err = TonicPowAPI.CreateConversionByUserID(1, 1, "", 0); err != nil {
os.Exit(1)
}*/
}

/*if newConversion, err = TonicPowAPI.CreateConversionByUserID(1, 1, "", 1); err != nil {
os.Exit(1)
}*/
log.Printf("new conversion: %d", newConversion.ID)

log.Println("examples complete!")
}

//
Expand Down

0 comments on commit 78d1864

Please sign in to comment.