insights

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*algoliaInsights.APIClient
}

Client wraps the default Insights API client so that we can declare methods on it

func NewClient

func NewClient(appID, apiKey string, region algoliaInsights.Region) (*Client, error)

NewClient instantiates a new Insights API client

func (*Client) GetEvents added in v1.7.0

func (c *Client) GetEvents(startDate, endDate time.Time, limit int) (*EventsRes, error)

GetEvents retrieves a number of events from the Algolia Insights API.

type Event

type Event struct {
	EventType string    `json:"eventType"`
	EventName string    `json:"eventName"`
	Index     string    `json:"index"`
	UserToken string    `json:"userToken"`
	Timestamp Timestamp `json:"timestamp"`
	ObjectIDs []string  `json:"objectIDs,omitempty"`
	Positions []int     `json:"positions,omitempty"`
	QueryID   string    `json:"queryID,omitempty"`
	Filters   []string  `json:"filters,omitempty"`
}

TODO: Replace this with a type from the API.

type EventWrapper

type EventWrapper struct {
	Event     Event    `json:"event"`
	RequestID string   `json:"requestID"`
	Status    int      `json:"status"`
	Errors    []string `json:"errors"`
	Headers   map[string][]string
}

type EventsRes

type EventsRes struct {
	Events []EventWrapper `json:"events"`
}

type Timestamp

type Timestamp struct {
	time.Time
}

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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