Documentation ¶
Overview ¶
Package appmetrica privides bindings to Yandex AppMetrica HTTP API.
Index ¶
- Variables
- func NewError(code int, message string) error
- type Application
- type Applications
- type Client
- func (c *Client) Close() error
- func (c *Client) CreateApplication(name, tz string) (*Application, error)
- func (c *Client) DeleteApplication(id int) error
- func (c *Client) GetApplication(id int) (*Application, error)
- func (c *Client) ImportEvent(event ImportEvent) error
- func (c *Client) ImportEvents(reader io.Reader) error
- func (c *Client) ListApplications() ([]Application, error)
- func (c *Client) ModifyApplication(id int, name, tz string) (*Application, error)
- func (c *Client) SetAPIKey(token string)
- func (c *Client) SetPostAPIKey(token string)
- type ConnectionType
- type Error
- type EventIdentifierType
- type EventImporter
- func (e *EventImporter) Import(events ...*ImportEvent)
- func (e *EventImporter) ImportMany(events []*ImportEvent)
- func (e *EventImporter) ImportOne(event *ImportEvent)
- func (e *EventImporter) Read(buffer []byte) (int, error)
- func (e *EventImporter) Reset()
- func (e *EventImporter) SetEventIdentifierType(kind EventIdentifierType)
- func (e *EventImporter) SetHeader(header ...string)
- type EventImporterState
- type ImportEvent
- type Response
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = errors.New(prefix + "not implemented")
Functions ¶
Types ¶
type Application ¶
type Application struct { APIKey128 string `json:"api_key128,omitempty"` CreateDate string `json:"create_date,omitempty"` GDPRAgreementAccepted bool `json:"gdpr_agreement_accepted,omitempty"` HideAddress bool `json:"hide_address,omitempty"` ID uint64 `json:"id,omitempty"` Label string `json:"label,omitempty"` LabelID uint64 `json:"label_id,omitempty"` Name string `json:"name,omitempty"` OwnerLogin string `json:"owner_login,omitempty"` Permission string `json:"permission,omitempty"` PermissionDate string `json:"permission_date,omitempty"` Status string `json:"status,omitempty"` TimeZoneName string `json:"time_zone_name,omitempty"` TimeZoneOffset int `json:"time_zone_offset,omitempty"` UID uint64 `json:"uid,omitempty"` UseUniversalLinks bool `json:"use_universal_links,omitempty"` }
type Applications ¶
type Applications []Application
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client binds HTTP API to simple function calls.
func (*Client) CreateApplication ¶
func (c *Client) CreateApplication(name, tz string) (*Application, error)
ModifyApplication добавляет приложение в AppMetrica.
func (*Client) DeleteApplication ¶
DeleteApplication удаляет приложение.
func (*Client) GetApplication ¶
func (c *Client) GetApplication(id int) (*Application, error)
GetApplication возвращает информацию об указанном приложении.
func (*Client) ImportEvent ¶
func (c *Client) ImportEvent(event ImportEvent) error
ImportEvent загружает информацию о событии.
func (*Client) ImportEvents ¶
ImportEvents загружает информацию о событиях. Функция в качестве аргумента принимает интерфейс Reader. Предполагается, что пользователь самостоятельно подготовил тело запроса в формате CSV, как того требует спецификация AppMetrica API. Задачу может упростить реализация интерфейса Reader тип EventImporter, который фильтрует и форматирует список событий.
func (*Client) ListApplications ¶
func (c *Client) ListApplications() ([]Application, error)
ListApplications возвращает информацию о приложениях, доступных пользователю.
func (*Client) ModifyApplication ¶
func (c *Client) ModifyApplication(id int, name, tz string) (*Application, error)
ModifyApplication изменяет настройки приложения.
func (*Client) SetPostAPIKey ¶
type ConnectionType ¶
type ConnectionType int
const ( CT_Unknown ConnectionType = iota CT_WiFi CT_Cell )
type EventIdentifierType ¶
type EventIdentifierType int
EventIdentifierType encodes identifier which could be used in event import.
const ( DeviceID EventIdentifierType = iota ProfileID )
type EventImporter ¶
type EventImporter struct {
// contains filtered or unexported fields
}
EventImporter
func NewEventImporter ¶
func NewEventImporter(kind EventIdentifierType, header ...string) *EventImporter
NewEventImporter creates new instance of EventImporter. Developer has to specify type of user identifer which is either DeviceID or ProfileID and optional list of attribution columns. The list of mandatory columns should not to be specified since EventImporter adds them automatically. Mandatory columns are ApplicationID, either ProfileID or DeviceId, EventName, and EventTimestamp.
func (*EventImporter) Import ¶
func (e *EventImporter) Import(events ...*ImportEvent)
func (*EventImporter) ImportMany ¶
func (e *EventImporter) ImportMany(events []*ImportEvent)
func (*EventImporter) ImportOne ¶
func (e *EventImporter) ImportOne(event *ImportEvent)
func (*EventImporter) Reset ¶
func (e *EventImporter) Reset()
func (*EventImporter) SetEventIdentifierType ¶
func (e *EventImporter) SetEventIdentifierType(kind EventIdentifierType)
func (*EventImporter) SetHeader ¶
func (e *EventImporter) SetHeader(header ...string)
type EventImporterState ¶
type EventImporterState int
EventImporterState codes inner state of reader in event importer.
const ( Initial EventImporterState = iota HeaderWriting EventWriting EndOfEvents )
type ImportEvent ¶
type ImportEvent struct { ApplicationID int `json:"application_id"` ProfileID string `json:"profile_id"` DeviceID uint64 `json:"appmetrica_device_id"` SessionType string `json:"session_type,omitempty"` IFA string `json:"ios_ifa,omitempty"` IFV string `json:"ios_ifv,omitempty"` GoogleAID string `json:"google_aid,omitempty"` WindowsAID string `json:"windows_aid,omitempty"` OSName string `json:"os_name,omitempty"` OSVersion string `json:"os_version,omitempty"` DeviceManufacturer string `json:"device_manufacturer,omitempty"` DeviceModel string `json:"device_model,omitempty"` DeviceType string `json:"device_type,omitempty"` DeviceLocale string `json:"device_locale,omitempty"` AppVersionName string `json:"app_version_name,omitempty"` AppPackageName string `json:"app_package_name,omitempty"` EventName string `json:"event_name"` EventJSON interface{} `json:"event_json,omitempty"` EventTimestamp int64 `json:"event_timestamp"` ConnectionType string `json:"connection_type,omitempty"` OperatorName string `json:"operator_name,omitempty"` MCC int `json:"mcc,omitempty"` MNC int `json:"mnc,omitempty"` DeviceIPv6 string `json:"device_ipv6,omitempty"` }
type Response ¶
type Response struct { Application *Application `json:"application,omitempty"` Applications []Application `json:"applications,omitempty"` Errors []Error `json:"errors,omitempty"` ErrorCode int `json:"code,omitempty"` ErrorMessage string `json:"message,omitempty"` }