direct_sdk

package module
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 18 Imported by: 0

README

direct-sdk

Documentation

Index

Constants

View Source
const (
	LIVE    environment = "api.direct.yandex.com"
	SANDBOX environment = "api-sandbox.direct.yandex.com"
)

Variables

View Source
var ErrAuthorisationPending = responseError{
	Err: "authorization_pending",
	Msg: "User has not yet authorized your application",
}

Functions

This section is empty.

Types

type App

type App struct {
	ID     string
	Secret string
}

type AuthByCode

type AuthByCode struct {
	DeviceCode      string `json:"device_code"`
	ExpiresIn       int    `json:"expires_in"`
	Interval        int    `json:"interval"`
	UserCode        string `json:"user_code"`
	VerificationURL string `json:"verification_url"`
}

type Client

type Client struct {
	Tr    *http.Client
	Login string
	Token *string
	App   *App
	// contains filtered or unexported fields
}

func NewClient

func NewClient(tr *http.Client, login string, token *string, app *App, sandbox bool, logger *zerolog.Logger) *Client

func (*Client) Authorise

func (c *Client) Authorise(message chan<- string) error

func (*Client) GetAccessCode

func (c *Client) GetAccessCode() (auth AuthByCode, err error)

func (*Client) GetCampaigns added in v1.3.3

func (c *Client) GetCampaigns(ctx context.Context, dateRange statistics.DateRange) ([]string, error)

func (*Client) GetFiles

func (c *Client) GetFiles(ctx context.Context, dir string, params statistics.ReportDefinition) ([]string, error)

func (*Client) GetReport

func (c *Client) GetReport(ctx context.Context, prefixTitleRequest, dir string, typeReport statistics.ReportType, fields []string, filter []statistics.Filter, dateRange statistics.DateRange) ([]string, error)

func (*Client) GetTokenByCode

func (c *Client) GetTokenByCode(code AuthByCode) (token Token, err error)

func (*Client) GetYclidStat added in v1.3.2

func (c *Client) GetYclidStat(ctx context.Context, yclids []string) ([]anti_fraud.Row, error)

type Payload

type Payload struct {
	Method string `json:"method"`
	Params struct {
		Ads []struct {
			AdGroupID int `json:"AdGroupId"`
			TextAd    struct {
				Text   string `json:"Text"`
				Title  string `json:"Title"`
				Href   string `json:"Href,omitempty"`
				Mobile string `json:"Mobile"`
			} `json:"TextAd"`
		} `json:"Ads"`
	} `json:"params"`
}

type Request

type Request struct {
	Params statistics.ReportDefinition `json:"params"`
}

type Response

type Response struct {
	Error struct {
		ErrorDetail string `json:"error_detail"`
		RequestID   string `json:"request_id"`
		ErrorCode   string `json:"error_code"`
		ErrorString string `json:"error_string"`
	} `json:"error"`
}

type Token

type Token struct {
	TokenType    string `json:"token_type"`
	AccessToken  string `json:"access_token"`
	ExpiresIn    int64  `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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