http_fetcher

package
v0.0.0-...-ea31b78 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpFetcher

type HttpFetcher struct {
	Endpoint string

	Categories map[string]map[string]stored_requests.Category
	// contains filtered or unexported fields
}

func NewFetcher

func NewFetcher(client *http.Client, endpoint string) *HttpFetcher

NewFetcher returns a Fetcher which uses the Client to pull data from the endpoint.

This file expects the endpoint to satisfy the following API:

GET {endpoint}?request-ids=["req1","req2"]&imp-ids=["imp1","imp2","imp3"]

This endpoint should return a payload like:

{
  "requests": {
    "req1": { ... stored data for req1 ... },
    "req2": { ... stored data for req2 ... },
  },
  "imps": {
    "imp1": { ... stored data for imp1 ... },
    "imp2": { ... stored data for imp2 ... },
    "imp3": null // If imp3 is not found
  }
}

func (*HttpFetcher) FetchCategories

func (fetcher *HttpFetcher) FetchCategories(ctx context.Context, primaryAdServer, publisherId, iabCategory string) (string, error)

func (*HttpFetcher) FetchRequests

func (fetcher *HttpFetcher) FetchRequests(ctx context.Context, requestIDs []string, impIDs []string) (requestData map[string]json.RawMessage, impData map[string]json.RawMessage, errs []error)

Jump to

Keyboard shortcuts

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