amazon_advertising

package module
v0.0.0-...-b0c8af5 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 12 Imported by: 0

README

A package for Amazon Advertising API

Installing

go get -u github.com/gzp233/amazon_advertising

This will retrieve the library.

example

package main

import (
	"fmt"

	"github.com/gzp233/amazon_advertising"
)

func main() {
	c, err := amazon_advertising.NewClient(amazon_advertising.ClientOption{
		Region:       "NA",
		ClientId:     "amzn1.application-oa2-client.xxxxxxxxxx",
		ClientSecret: "xxxxxxxxxxxxxxxx",
		RefreshToken: "Atzr|cxxxxxxxxxxxxxxxxxxxxxxxxxx",
	})
	if err != nil {
		fmt.Println(err)
	}

	c.SetProfileId(12345678901111)
	c.SetDebug(true)
	r, err := c.SpListAdGroupsEx()
	if err != nil {
		fmt.Println(err)
	}
	if r != nil {
		fmt.Printf("%s %d", r.Body, r.StatusCode)
	}
}

Documentation

Overview

base client

list Portfolios

profile api

Sponsored products api

Index

Constants

View Source
const (
	MAX_RETRIES = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Debug     bool
	Option    ClientOption
	Endpoint  string
	ProfileId int64
}

请求客户端

func NewClient

func NewClient(option ClientOption) (*Client, error)

func (*Client) DownloadReportData

func (c *Client) DownloadReportData(reportId string) (*Response, error)

func (*Client) GetProfiles

func (c *Client) GetProfiles() (*Response, error)

func (*Client) GetReport

func (c *Client) GetReport(reportId string) (*Response, error)

func (*Client) HttpGet

func (c *Client) HttpGet(url string, query ...interface{}) (*Response, error)

func (*Client) HttpPost

func (c *Client) HttpPost(url string, params interface{}) (*Response, error)

func (*Client) ListPortfoliosEx

func (c *Client) ListPortfoliosEx(query ...interface{}) (*Response, error)

func (*Client) RefreshToken

func (c *Client) RefreshToken() error

获取accessToken

func (*Client) SbListAdGroups

func (c *Client) SbListAdGroups(query ...interface{}) (*Response, error)

func (*Client) SbListBrands

func (c *Client) SbListBrands(query ...interface{}) (*Response, error)

func (*Client) SbListCampaigns

func (c *Client) SbListCampaigns(query ...interface{}) (*Response, error)

func (*Client) SbListDrafts

func (c *Client) SbListDrafts(query ...interface{}) (*Response, error)

func (*Client) SbListKeywords

func (c *Client) SbListKeywords(query ...interface{}) (*Response, error)

func (*Client) SbListNegativeKeywords

func (c *Client) SbListNegativeKeywords(query ...interface{}) (*Response, error)

func (*Client) SbListNegativeProductTargets

func (c *Client) SbListNegativeProductTargets(json interface{}) (*Response, error)

func (*Client) SbListProductTargets

func (c *Client) SbListProductTargets(json interface{}) (*Response, error)

func (*Client) SbRequestReport

func (c *Client) SbRequestReport(recordType, params interface{}) (*Response, error)

func (*Client) SdListAdGroupsEx

func (c *Client) SdListAdGroupsEx(query ...interface{}) (*Response, error)

func (*Client) SdListCampaignsEx

func (c *Client) SdListCampaignsEx(query ...interface{}) (*Response, error)

func (*Client) SdListNegativeTargetsEx

func (c *Client) SdListNegativeTargetsEx(query ...interface{}) (*Response, error)

func (*Client) SdListProductAdsEx

func (c *Client) SdListProductAdsEx(query ...interface{}) (*Response, error)

func (*Client) SdListTargetsEx

func (c *Client) SdListTargetsEx(query ...interface{}) (*Response, error)

func (*Client) SdRequestReport

func (c *Client) SdRequestReport(recordType, params interface{}) (*Response, error)

func (*Client) SetDebug

func (c *Client) SetDebug(mode bool)

func (*Client) SetProfileId

func (c *Client) SetProfileId(profileId int64)

func (*Client) SpListAdGroupsEx

func (c *Client) SpListAdGroupsEx(query ...interface{}) (*Response, error)

func (*Client) SpListBiddableKeywordsEx

func (c *Client) SpListBiddableKeywordsEx(query ...interface{}) (*Response, error)

func (*Client) SpListCampaignNegativeKeywordsEx

func (c *Client) SpListCampaignNegativeKeywordsEx(query ...interface{}) (*Response, error)

func (*Client) SpListCampaignsEx

func (c *Client) SpListCampaignsEx(query ...interface{}) (*Response, error)

func (*Client) SpListNegativeKeywordsEx

func (c *Client) SpListNegativeKeywordsEx(query ...interface{}) (*Response, error)

func (*Client) SpListNegativeTargetingClausesEx

func (c *Client) SpListNegativeTargetingClausesEx(query ...interface{}) (*Response, error)

func (*Client) SpListProductAdsEx

func (c *Client) SpListProductAdsEx(query ...interface{}) (*Response, error)

func (*Client) SpListTargetingClausesEx

func (c *Client) SpListTargetingClausesEx(query ...interface{}) (*Response, error)

func (*Client) SpRequestAsinReport

func (c *Client) SpRequestAsinReport(params interface{}) (*Response, error)

func (*Client) SpRequestReport

func (c *Client) SpRequestReport(recordType, params interface{}) (*Response, error)

type ClientOption

type ClientOption struct {
	Region       string
	ClientId     string
	ClientSecret string
	RefreshToken string
	AccessToken  string
}

type Response

type Response struct {
	StatusCode int
	Body       string
	Header     http.Header
}

Jump to

Keyboard shortcuts

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