go-adzerk

module
v0.0.0-...-3d9ab22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2017 License: MIT

README

go-adzerk

go-adzerk is a Go client library for accessing Adzerk's Native Ads API.

GoDoc Build Status Coverage Status

Usage

import "github.com/Wattpad/go-adzerk/adzerk"

Constructing a new Adzerk client:

client := adzerk.NewClient(nil)

Constructing the HTTP request can look something like the following:

placements := []adzerk.Placement{
	{
		DivName:   "div1",
		AdTypes:   []int{4, 5},
		SiteID:    123,
		ZoneIDs:   []int{456},
		NetworkID: 789,
	},
}

httpRequest, err := client.NewRequest(adzerk.RequestData{
	IP:               "10.123.123.123",
	UserID:           "ad39231daeb043f2a9610414f08394b5",
	BlockedCreatives: []int{123, 456},
	Keywords:         []string{"foo", "bar", "baz"},
	Placements:       placements,
})

if err != nil {
	// Handle non-nil error
}

Performing the request:

var v map[string]interface{}
httpResponse, err = client.Do(ctx, httpRequest, &v)

Modifying the URL which the client will hit – for example, when creating mock service tests:

client.URL = "http://mockserveraddress.com"

License

This library is distributed under the MIT-style license found in the LICENSE file.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL