ad_api

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 10 Imported by: 0

README

ad_api

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v1.0.2

type Client struct {
	Credentials
	AccessToken     string
	ProfileId       int64
	AutoAccessToken bool
}

func NewClient added in v1.0.2

func NewClient(cre Credentials) *Client

func (*Client) CreateSbCampaigns added in v1.0.3

func (c *Client) CreateSbCampaigns(r ...RequestOption) *Response

func (*Client) CreateSbKeywords added in v1.0.3

func (c *Client) CreateSbKeywords(r ...RequestOption) *Response

func (*Client) CreateSbTargets added in v1.0.3

func (c *Client) CreateSbTargets(r ...RequestOption) *Response

func (*Client) CreateSdAdGroups added in v1.0.3

func (c *Client) CreateSdAdGroups(r ...RequestOption) *Response

func (*Client) CreateSdCampaigns added in v1.0.3

func (c *Client) CreateSdCampaigns(r ...RequestOption) *Response

func (*Client) CreateSdTargets added in v1.0.3

func (c *Client) CreateSdTargets(r ...RequestOption) *Response

func (*Client) CreateSpAdGroups added in v1.0.2

func (c *Client) CreateSpAdGroups(r ...RequestOption) *Response

func (*Client) CreateSpCampaigns added in v1.0.2

func (c *Client) CreateSpCampaigns(r ...RequestOption) *Response

func (*Client) CreateSpKeywords added in v1.0.2

func (c *Client) CreateSpKeywords(r ...RequestOption) *Response

func (*Client) CreateSpTargets added in v1.0.2

func (c *Client) CreateSpTargets(r ...RequestOption) *Response

func (*Client) DeleteSbCampaignById added in v1.0.3

func (c *Client) DeleteSbCampaignById(campaignId int) *Response

func (*Client) DeleteSbKeywordById added in v1.0.3

func (c *Client) DeleteSbKeywordById(keywordId int) *Response

func (*Client) DeleteSbTargetById added in v1.0.3

func (c *Client) DeleteSbTargetById(targetId int) *Response

func (*Client) DeleteSpAdGroupById added in v1.0.2

func (c *Client) DeleteSpAdGroupById(adGroupId int) *Response

func (*Client) DeleteSpCampaignById added in v1.0.2

func (c *Client) DeleteSpCampaignById(campaignId int) *Response

func (*Client) DoRequest added in v1.0.2

func (c *Client) DoRequest(preReq PrepareRequest, options ...RequestOption) *Response

func (*Client) GetNewAccessToken added in v1.0.2

func (c *Client) GetNewAccessToken() (res TokenResponse, err error)
func (c *Credential) GetGrantUrl() (string, error) {
	hostUrl := c.getHostUrl()
	fmt.Println("aaa")
	return fmt.Sprintf("%s?client_id=%s&scope=%s&response_type=%s&redirect_uri=%s", hostUrl, c.ClientId, c.Scope, c.ResponseType, c.RedirectUri), nil
}
func (c *Credential) GetRefreshToken() (res response.Token, err error) {
	//data := map[string]string{
	//	"grant_type":    "authorization_code",
	//	"code":          code,
	//	"redirect_uri":  c.RedirectUri,
	//	"client_id":     c.ClientId,
	//	"client_secret": c.ClientSecret,
	//}
	//dataStr, err := json.Marshal(data)
	//if err != nil {
	//	return res, errors.New("failed to convert json")
	//}
	//tokenUrl := c.getTokenUrl()
	//req, err := http.Post(tokenUrl)
	return res, nil
}

func (*Client) GetPortfolios added in v1.0.2

func (c *Client) GetPortfolios(r ...RequestOption) *Response

func (*Client) GetSbAdGroupById added in v1.0.3

func (c *Client) GetSbAdGroupById(adGroupId int) *Response

func (*Client) GetSbAdGroups added in v1.0.3

func (c *Client) GetSbAdGroups(r ...RequestOption) *Response

func (*Client) GetSbBidRecommendations added in v1.0.3

func (c *Client) GetSbBidRecommendations(r ...RequestOption) *Response

func (*Client) GetSbCampaignById added in v1.0.3

func (c *Client) GetSbCampaignById(campaignId int) *Response

func (*Client) GetSbCampaigns added in v1.0.3

func (c *Client) GetSbCampaigns(r ...RequestOption) *Response

func (*Client) GetSbKeywordById added in v1.0.3

func (c *Client) GetSbKeywordById(keywordId int) *Response

func (*Client) GetSbKeywords added in v1.0.3

func (c *Client) GetSbKeywords(r ...RequestOption) *Response

func (*Client) GetSbTargetById added in v1.0.3

func (c *Client) GetSbTargetById(targetId int) *Response

func (*Client) GetSbTargets added in v1.0.3

func (c *Client) GetSbTargets(r ...RequestOption) *Response

func (*Client) GetSdAdGroupById added in v1.0.3

func (c *Client) GetSdAdGroupById(adGroupId int) *Response

func (*Client) GetSdAdGroupExtendedById added in v1.0.3

func (c *Client) GetSdAdGroupExtendedById(adGroupId int) *Response

func (*Client) GetSdAdGroups added in v1.0.3

func (c *Client) GetSdAdGroups(r ...RequestOption) *Response

func (*Client) GetSdAdGroupsExtended added in v1.0.3

func (c *Client) GetSdAdGroupsExtended(r ...RequestOption) *Response

func (*Client) GetSdCampaignById added in v1.0.3

func (c *Client) GetSdCampaignById(campaignId int) *Response

func (*Client) GetSdCampaignExtendedById added in v1.0.3

func (c *Client) GetSdCampaignExtendedById(campaignId int) *Response

func (*Client) GetSdCampaigns added in v1.0.3

func (c *Client) GetSdCampaigns(r ...RequestOption) *Response

func (*Client) GetSdCampaignsExtended added in v1.0.3

func (c *Client) GetSdCampaignsExtended(r ...RequestOption) *Response

func (*Client) GetSdTargetById added in v1.0.3

func (c *Client) GetSdTargetById(targetId int) *Response

func (*Client) GetSdTargetExtendedById added in v1.0.3

func (c *Client) GetSdTargetExtendedById(targetId int) *Response

func (*Client) GetSdTargets added in v1.0.3

func (c *Client) GetSdTargets(r ...RequestOption) *Response

func (*Client) GetSdTargetsBidRecommendations added in v1.0.3

func (c *Client) GetSdTargetsBidRecommendations(r ...RequestOption) *Response

func (*Client) GetSdTargetsExtended added in v1.0.3

func (c *Client) GetSdTargetsExtended(r ...RequestOption) *Response

func (*Client) GetSpAdGroupById added in v1.0.2

func (c *Client) GetSpAdGroupById(adGroupId int) *Response

func (*Client) GetSpAdGroupExtendedById added in v1.0.2

func (c *Client) GetSpAdGroupExtendedById(adGroupId int) *Response

func (*Client) GetSpAdGroups added in v1.0.2

func (c *Client) GetSpAdGroups(r ...RequestOption) *Response

func (*Client) GetSpAdGroupsExtended added in v1.0.2

func (c *Client) GetSpAdGroupsExtended(r ...RequestOption) *Response

func (*Client) GetSpBidRecommendationByAdGroupId added in v1.0.2

func (c *Client) GetSpBidRecommendationByAdGroupId(adGroupId int) *Response

func (*Client) GetSpBidRecommendationByKeywordId added in v1.0.2

func (c *Client) GetSpBidRecommendationByKeywordId(keywordId int) *Response

func (*Client) GetSpCampaignById added in v1.0.2

func (c *Client) GetSpCampaignById(campaignId int) *Response

func (*Client) GetSpCampaignExtendedById added in v1.0.2

func (c *Client) GetSpCampaignExtendedById(campaignId int) *Response

func (*Client) GetSpCampaigns added in v1.0.2

func (c *Client) GetSpCampaigns(r ...RequestOption) *Response

func (*Client) GetSpCampaignsExtended added in v1.0.2

func (c *Client) GetSpCampaignsExtended(r ...RequestOption) *Response

func (*Client) GetSpKeywordById added in v1.0.2

func (c *Client) GetSpKeywordById(keywordId int) *Response

func (*Client) GetSpKeywordExtendedById added in v1.0.2

func (c *Client) GetSpKeywordExtendedById(keywordId int) *Response

func (*Client) GetSpKeywords added in v1.0.2

func (c *Client) GetSpKeywords(r ...RequestOption) *Response

func (*Client) GetSpKeywordsBidRecommendations added in v1.0.2

func (c *Client) GetSpKeywordsBidRecommendations(r ...RequestOption) *Response

func (*Client) GetSpKeywordsExtended added in v1.0.2

func (c *Client) GetSpKeywordsExtended(r ...RequestOption) *Response

func (*Client) GetSpTargets added in v1.0.2

func (c *Client) GetSpTargets(r ...RequestOption) *Response

func (*Client) GetSpTargetsBidRecommendations added in v1.0.2

func (c *Client) GetSpTargetsBidRecommendations(r ...RequestOption) *Response

func (*Client) GetSpTargetsById added in v1.0.2

func (c *Client) GetSpTargetsById(targetId int) *Response

func (*Client) GetSpTargetsExtended added in v1.0.2

func (c *Client) GetSpTargetsExtended(r ...RequestOption) *Response

func (*Client) GetSpTargetsExtendedById added in v1.0.2

func (c *Client) GetSpTargetsExtendedById(targetId int) *Response

func (*Client) UpdateSbCampaigns added in v1.0.3

func (c *Client) UpdateSbCampaigns(r ...RequestOption) *Response

func (*Client) UpdateSbKeywords added in v1.0.3

func (c *Client) UpdateSbKeywords(r ...RequestOption) *Response

func (*Client) UpdateSbTargets added in v1.0.3

func (c *Client) UpdateSbTargets(r ...RequestOption) *Response

func (*Client) UpdateSdAdGroups added in v1.0.3

func (c *Client) UpdateSdAdGroups(r ...RequestOption) *Response

func (*Client) UpdateSdCampaigns added in v1.0.3

func (c *Client) UpdateSdCampaigns(r ...RequestOption) *Response

func (*Client) UpdateSdTargets added in v1.0.3

func (c *Client) UpdateSdTargets(r ...RequestOption) *Response

func (*Client) UpdateSpAdGroups added in v1.0.2

func (c *Client) UpdateSpAdGroups(r ...RequestOption) *Response

func (*Client) UpdateSpCampaigns added in v1.0.2

func (c *Client) UpdateSpCampaigns(r ...RequestOption) *Response

func (*Client) UpdateSpKeywords added in v1.0.2

func (c *Client) UpdateSpKeywords(r ...RequestOption) *Response

func (*Client) UpdateSpTargets added in v1.0.2

func (c *Client) UpdateSpTargets(r ...RequestOption) *Response

type Credentials added in v1.0.2

type Credentials struct {
	ClientId     string
	ClientSecret string
	Region       string
	RefreshToken string
}

type PortfoliosResponse added in v1.0.2

type PortfoliosResponse struct {
	PortfolioId int    `json:"portfolioId"`
	Name        string `json:"name"`
	InBudget    bool   `json:"inBudget"`
	State       string `json:"state"`
}

type PrepareRequest added in v1.0.2

type PrepareRequest struct {
	Method      string
	UriPath     string
	ContentType string
}

type Request added in v1.0.2

type Request struct {
	Queries map[string]string
	Body    io.Reader
}

func NewRequest added in v1.0.2

func NewRequest(options ...RequestOption) *Request

type RequestOption added in v1.0.2

type RequestOption func(*Request)

func WithBody added in v1.0.2

func WithBody(body io.Reader) RequestOption

func WithQueries added in v1.0.2

func WithQueries(queries map[string]string) RequestOption

type Response added in v1.0.2

type Response struct {
	StatusCode int
	Payload    []byte
	Error      error
}

type TokenResponse added in v1.0.2

type TokenResponse struct {
	RefreshToken string `json:"refresh_token"`
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
}

Jump to

Keyboard shortcuts

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