Documentation
¶
Index ¶
Constants ¶
const (
// BaseURL is the base URL for Yandex.Metrika API requests.
APIBaseURL = "https://api.appmetrica.yandex.ru"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { Code int `json:"code"` // Code is the error code. Message string `json:"message"` // Message is a human-readable error message. Reasons []struct { ErrorType string `json:"error_type"` // ErrorType specifies the type of error. Message string `json:"message"` // Message is a more detailed error message. Location string `json:"location"` // Location specifies where the error occurred. } `json:"errors"` // Reasons is a list of error details. }
APIError API error object. Source: https://yandex.ru/dev/metrika/doc/api2/management/concept/errors.html#errors__resp
type AppService ¶
type AppService struct {
// contains filtered or unexported fields
}
func (*AppService) Get ¶
func (s *AppService) Get(counter int) (*AppsResponse, error)
func (*AppService) GetWithContext ¶
func (s *AppService) GetWithContext(ctx context.Context, counter int) (*AppsResponse, error)
type AppsResponse ¶
type AppsResponse struct {
Data []AppsResponseEntry `json:"applications"` // Data is a list of goal entries.
}
GoalsResponse represents a response containing a list of goals from the Yandex.Metrika API.
func (*AppsResponse) Batch ¶
func (r *AppsResponse) Batch() (service.MessageBatch, error)
Batch creates a service.MessageBatch from the GoalsResponse.
type AppsResponseEntry ¶
type AppsResponseEntry struct { Id uint64 `json:"id"` // Id is the unique identifier of the goal. Name string `json:"name"` // Name is the name of the goal. Label string `json:"label"` // Label is name of the folder where the application is located in the web interface. }
GoalsResponseEntry represents a single goal entry in a GoalsResponse.
type Client ¶
type Client struct { App *AppService StatTable *StatTableService // contains filtered or unexported fields }
Client is a wrapper around req.Client for interacting with the Yandex.AppMetrika API. It provides methods for creating and sending API requests, handling errors, and managing authentication.
type StatTableQuery ¶
type StatTableQuery struct { IDs []int `json:"ids" url:"ids,comma"` // IDs is a list of counter IDs. Date1 string `json:"date1,omitempty" url:"date1,omitempty"` // Date1 is the start date of the data range. Date2 string `json:"date2,omitempty" url:"date2,omitempty"` // Date2 is the end date of the data range. Dimensions []string `json:"dimensions,omitempty" url:"dimensions,comma,omitempty"` // Dimensions is a list of dimensions for data breakdown. Metrics []string `json:"metrics,omitempty" url:"metrics,comma,omitempty"` // Metrics is a list of metrics to be fetched. Sort []string `json:"sort,omitempty" url:"sort,comma,omitempty"` // Sort is a list of fields to sort the data by. Limit int `json:"limit,omitempty" url:"limit,omitempty"` // Limit is the maximum number of rows to return. Offset int `json:"offset,omitempty" url:"offset,omitempty"` // Offset is the offset of the first row to return. Filters string `json:"filters,omitempty" url:"filters,omitempty"` // Filters is a filter string to apply to the data. Accuracy string `json:"accuracy,omitempty" url:"accuracy,omitempty"` // Accuracy is a sample size for the report. Lang string `json:"lang,omitempty" url:"lang,omitempty"` // Lang is the language for the response. Preset string `json:"preset,omitempty" url:"preset,omitempty"` // Preset is the preset used for the query. Timezone string `json:"timezone,omitempty" url:"timezone,omitempty"` // Timezone is the timezone to use for the data. DirectLogins []string `json:"direct_client_logins,omitempty" url:"direct_client_logins,comma,omitempty"` // DirectLogins is a list of direct client logins. }
StatTableQuery represents a query for fetching data from Yandex.Metrika API stat tables.
type StatTableResponse ¶
type StatTableResponse struct { Query *StatTableQuery `json:"query"` // Query contains the query parameters used to fetch this data. Data []StatTableResponseEntry `json:"data"` // Data contains the actual data returned by the query. TotalRows int `json:"total_rows"` // TotalRows is the total number of rows matching the query. }
StatTableResponse represents the response from a stat table query.
func (*StatTableResponse) Batch ¶
func (r *StatTableResponse) Batch() (service.MessageBatch, error)
Batch creates a service.MessageBatch from the StatTableResponse.
type StatTableResponseEntry ¶
type StatTableResponseEntry struct { Dimensions []struct { Name string `json:"name"` // Name is the name of the dimension. Id string `json:"id,omitempty"` // Id is the optional ID of the dimension. } `json:"dimensions"` // Dimensions is a list of dimensions for this row. Metrics []float64 `json:"metrics"` // Metrics is a list of metrics for this row. }
StatTableResponseEntry represents a single row in the stat table data.
type StatTableService ¶
type StatTableService struct {
// contains filtered or unexported fields
}
func (*StatTableService) Get ¶
func (s *StatTableService) Get(q *StatTableQuery) (*StatTableResponse, error)
func (*StatTableService) GetWithContext ¶
func (s *StatTableService) GetWithContext(ctx context.Context, q *StatTableQuery) (*StatTableResponse, error)