Documentation
¶
Overview ¶
Package api implements the Mixpanel API
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a client to the Mixpanel API
type Config ¶
type Config struct {
// Scheme is the URI scheme for the Mixpanel server.
Scheme string
// Address is URI of mixpanel server.
Address string
// Key is the API key for mixpanel access.
Key string
// Secret is the API secret for mixpanel access.
Secret string
// HttpClient is the client to use. Default will be used if not provided.
HttpClient *http.Client
}
Config is used to configure the creation of a client
func DefaultConfig ¶
DefaultConfig returns a default configuration for the client
type EngageResponse ¶
type QueryOptions ¶
type QueryOptions struct {
// Key is the API key for mixpanel access.
Key string `json:"api_key"`
// Secret is the API key for mixpanel access.
Secret string `json:"api_secret"`
// Expire is the UTC time in seconds;
// used to expire an API request.
Expire string `json:"expire"`
// Sig is the auth signature for the method call, more documentation here
// https://mixpanel.com/docs/api-documentation/data-export-api#auth-implementation .
Sig string `json:"sig"`
// FromDate sets the start date for export API. json/csv
FromDate string `json:"from_date"`
// ToDate sets the start date for export API.
ToDate string `json:"to_date"`
// Format describes the response format. json/csv
Format string `json:"format"`
// Event only exports data for this event.
Event string `json:"event"`
// SessionID used to maintain session in engage API
SessionID string `json:"session_id"`
// Page is page number to get results
Page string `json:"page"`
}
QueryOptions describe the various options required for different requests the `json` struct tag value, decides name used in HTTP request
func DefaultExportQueryOptions ¶
func DefaultExportQueryOptions(config *Config) *QueryOptions
func DefaultQueryOptions ¶
func DefaultQueryOptions(config *Config) *QueryOptions
func MergeQueryOptions ¶
func MergeQueryOptions(a, b *QueryOptions) *QueryOptions
func (*QueryOptions) AddSig ¶
func (q *QueryOptions) AddSig()
Adds sig to QueryOptions args = all query parameters going to be sent out with the request (e.g. api_key, unit, interval, expire, format, etc.) excluding sig. args_sorted = sort_args_alphabetically_by_key(args) args_concat = join(args_sorted) Output: api_key=ed0b8ff6cc3fbb37a521b40019915f18event=["pages"] expire=1248499222format=jsoninterval=24unit=hour sig = md5(args_concat + api_secret)
Click to show internal directories.
Click to hide internal directories.