chunkifyanalytics

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Chunkify Analytics Go API Library

This is the API client for the Chunkify Analytics server. For automatic playback tracking in a browser, use @chunkify/player-analytics.

Go Reference

The Chunkify Analytics Go library provides convenient access to the Chunkify Analytics REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/chunkifydev/chunkify-analytics-go" // imported as chunkifyanalytics
)

Or to pin the version:

go get -u 'github.com/chunkifydev/chunkify-analytics-go@v0.9.0'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/chunkifydev/chunkify-analytics-go"
	"github.com/chunkifydev/chunkify-analytics-go/option"
)

func main() {
	client := chunkifyanalytics.NewClient(
		option.WithSecretKey("My Secret Key"), // defaults to os.LookupEnv("CHUNKIFY_ANALYTICS_SECRET_KEY")
	)
	metricsResponse, err := client.Summary.Get(context.TODO(), chunkifyanalytics.SummaryGetParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", metricsResponse)
}

Request fields

The chunkifyanalytics library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `api:"required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, chunkifyanalytics.String(string), chunkifyanalytics.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := chunkifyanalytics.ExampleParams{
	ID:   "id_xxx",                        // required property
	Name: chunkifyanalytics.String("..."), // optional property

	Point: chunkifyanalytics.Point{
		X: 0,                        // required field will serialize as 0
		Y: chunkifyanalytics.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: chunkifyanalytics.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[chunkifyanalytics.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := chunkifyanalytics.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Summary.Get(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.Events.ListAutoPaging(context.TODO(), chunkifyanalytics.EventListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	storedEvent := iter.Current()
	fmt.Printf("%+v\n", storedEvent)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.Events.List(context.TODO(), chunkifyanalytics.EventListParams{})
for page != nil {
	for _, event := range page.Events {
		fmt.Printf("%+v\n", event)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *chunkifyanalytics.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Summary.Get(context.TODO(), chunkifyanalytics.SummaryGetParams{})
if err != nil {
	var apierr *chunkifyanalytics.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v1/summary": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Summary.Get(
	ctx,
	chunkifyanalytics.SummaryGetParams{},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper chunkifyanalytics.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := chunkifyanalytics.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Summary.Get(
	context.TODO(),
	chunkifyanalytics.SummaryGetParams{},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
metricsResponse, err := client.Summary.Get(
	context.TODO(),
	chunkifyanalytics.SummaryGetParams{},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", metricsResponse)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: chunkifyanalytics.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := chunkifyanalytics.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

View Source
const BrowserContextDeviceTypeDesktop = shared.BrowserContextDeviceTypeDesktop

Equals "desktop"

View Source
const BrowserContextDeviceTypeMobile = shared.BrowserContextDeviceTypeMobile

Equals "mobile"

View Source
const BrowserContextDeviceTypeTablet = shared.BrowserContextDeviceTypeTablet

Equals "tablet"

View Source
const BrowserContextDeviceTypeUnknown = shared.BrowserContextDeviceTypeUnknown

Equals "unknown"

View Source
const EventContextContinentAf = shared.EventContextContinentAf

Equals "AF"

View Source
const EventContextContinentAn = shared.EventContextContinentAn

Equals "AN"

View Source
const EventContextContinentAs = shared.EventContextContinentAs

Equals "AS"

View Source
const EventContextContinentEu = shared.EventContextContinentEu

Equals "EU"

View Source
const EventContextContinentNa = shared.EventContextContinentNa

Equals "NA"

View Source
const EventContextContinentOc = shared.EventContextContinentOc

Equals "OC"

View Source
const EventContextContinentSa = shared.EventContextContinentSa

Equals "SA"

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (CHUNKIFY_ANALYTICS_PUBLIC_KEY, CHUNKIFY_ANALYTICS_SECRET_KEY, CHUNKIFY_ANALYTICS_ADMIN_KEY, CHUNKIFY_ANALYTICS_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type AdminKeyRotateParams

type AdminKeyRotateParams struct {
	ProjectID string `path:"project_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type AdminKeyService

type AdminKeyService struct {
	Options []option.RequestOption
}

Project origins and keys.

AdminKeyService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAdminKeyService method instead.

func NewAdminKeyService

func NewAdminKeyService(opts ...option.RequestOption) (r AdminKeyService)

NewAdminKeyService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AdminKeyService) List

func (r *AdminKeyService) List(ctx context.Context, projectID string, opts ...option.RequestOption) (res *ProjectKeys, err error)

List key IDs, names and permissions by project ID using CHUNKIFY_ADMIN_KEY. No project credential is required. Key values are never returned. Intended for a trusted backend that verifies project ownership.

func (*AdminKeyService) Rotate

func (r *AdminKeyService) Rotate(ctx context.Context, keyID string, body AdminKeyRotateParams, opts ...option.RequestOption) (res *RotatedProjectKey, err error)

Replace one existing public or secret key using CHUNKIFY_ADMIN_KEY, even when the project secret was lost. The old value stops working immediately. Key ID, type and read-only access are preserved; other keys are unchanged. Save the returned replacement. Intended for a trusted backend that verifies project ownership.

type AdminNewProjectParams

type AdminNewProjectParams struct {
	// Project display name.
	Name string `json:"name" api:"required"`
	// Retention by server receipt time, in seconds. 0 disables expiration; null
	// inherits the installation default. Omission also inherits the default.
	RetentionSeconds param.Opt[int64] `json:"retention_seconds,omitzero"`
	// Additional project origins. Shared TOML origins are always included.
	AllowedOrigins []string `json:"allowed_origins,omitzero"`
	// contains filtered or unexported fields
}

func (AdminNewProjectParams) MarshalJSON

func (r AdminNewProjectParams) MarshalJSON() (data []byte, err error)

func (*AdminNewProjectParams) UnmarshalJSON

func (r *AdminNewProjectParams) UnmarshalJSON(data []byte) error

type AdminService

type AdminService struct {
	Options []option.RequestOption
	// Project origins and keys.
	Keys AdminKeyService
}

Project origins and keys.

AdminService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAdminService method instead.

func NewAdminService

func NewAdminService(opts ...option.RequestOption) (r AdminService)

NewAdminService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AdminService) NewProject

func (r *AdminService) NewProject(ctx context.Context, body AdminNewProjectParams, opts ...option.RequestOption) (res *CreatedProject, err error)

Generate a project ID and initial keys, optionally setting retention. Requires the installation admin key. The project and its retention are active before success is returned.

type AnalyticsEventUnion

type AnalyticsEventUnion struct {
	ConnectorName            string  `json:"connector_name"`
	ConnectorVersion         string  `json:"connector_version"`
	DeliveryHostname         string  `json:"delivery_hostname"`
	DeliveryRequestCount     float64 `json:"delivery_request_count"`
	DeliveryThroughputBps    float64 `json:"delivery_throughput_bps"`
	DeliveryTransferredBytes float64 `json:"delivery_transferred_bytes"`
	DroppedVideoFrames       float64 `json:"dropped_video_frames"`
	Environment              string  `json:"environment"`
	ErrorCategory            string  `json:"error_category"`
	// This field is a union of [ViewStartedErrorCodeUnion],
	// [ViewSnapshotErrorCodeUnion], [PlaybackErrorErrorCodeUnion],
	// [ViewEndedErrorCodeUnion], [PlaybackStateChangedErrorCodeUnion],
	// [RenditionChangedErrorCodeUnion], [SeekCompletedErrorCodeUnion],
	// [SubtitleChangedErrorCodeUnion], [PlaybackRateChangedErrorCodeUnion]
	ErrorCode            AnalyticsEventUnionErrorCode `json:"error_code"`
	ErrorFatal           bool                         `json:"error_fatal"`
	ErrorPlayheadSeconds float64                      `json:"error_playhead_seconds"`
	EventID              string                       `json:"event_id"`
	// Any of "chunkify.video.view_started", "chunkify.video.view_snapshot",
	// "chunkify.video.playback_error", "chunkify.video.view_ended",
	// "chunkify.video.playback_state_changed", "chunkify.video.rendition_changed",
	// "chunkify.video.seek_completed", "chunkify.video.subtitle_changed",
	// "chunkify.video.playback_rate_changed".
	EventName                   string                        `json:"event_name"`
	FirstVideoFrameTimeMs       float64                       `json:"first_video_frame_time_ms"`
	FurthestProgressRatio       float64                       `json:"furthest_progress_ratio"`
	MaximumPlayheadSeconds      float64                       `json:"maximum_playhead_seconds"`
	MediaDurationSeconds        float64                       `json:"media_duration_seconds"`
	MediaHeightPx               float64                       `json:"media_height_px"`
	MediaWidthPx                float64                       `json:"media_width_px"`
	OccurredAt                  time.Time                     `json:"occurred_at"`
	PlayerHeightPx              float64                       `json:"player_height_px"`
	PlayerName                  string                        `json:"player_name"`
	PlayerVersion               string                        `json:"player_version"`
	PlayerWidthPx               float64                       `json:"player_width_px"`
	PlayingTimeMs               float64                       `json:"playing_time_ms"`
	Reason                      string                        `json:"reason"`
	RebufferCount               float64                       `json:"rebuffer_count"`
	RebufferDurationMs          float64                       `json:"rebuffer_duration_ms"`
	RebufferRatio               float64                       `json:"rebuffer_ratio"`
	RenditionPlayingTime        []shared.RenditionPlayingTime `json:"rendition_playing_time"`
	RenditionSwitchCount        float64                       `json:"rendition_switch_count"`
	SchemaVersion               float64                       `json:"schema_version"`
	SDKName                     string                        `json:"sdk_name"`
	SDKVersion                  string                        `json:"sdk_version"`
	SeekCount                   float64                       `json:"seek_count"`
	SeekDurationMs              float64                       `json:"seek_duration_ms"`
	SelectedRenditionBitrateBps float64                       `json:"selected_rendition_bitrate_bps"`
	SelectedRenditionCodec      string                        `json:"selected_rendition_codec"`
	SelectedRenditionHeight     float64                       `json:"selected_rendition_height"`
	SelectedRenditionWidth      float64                       `json:"selected_rendition_width"`
	Sequence                    int64                         `json:"sequence"`
	StartupOutcome              string                        `json:"startup_outcome"`
	StartupTimeMs               float64                       `json:"startup_time_ms"`
	TotalVideoFrames            float64                       `json:"total_video_frames"`
	VideoID                     string                        `json:"video_id"`
	ViewID                      string                        `json:"view_id"`
	ViewerID                    string                        `json:"viewer_id"`
	// This field is from variant [ViewStarted].
	BrowserContext shared.BrowserContext `json:"browser_context"`
	// This field is from variant [ViewStarted].
	Custom                  shared.CustomDimensions          `json:"custom"`
	PlaybackRate            float64                          `json:"playback_rate"`
	PlaybackRatePlayingTime []shared.PlaybackRatePlayingTime `json:"playback_rate_playing_time"`
	PlayedRanges            []shared.PlayedRange             `json:"played_ranges"`
	PlayheadSeconds         float64                          `json:"playhead_seconds"`
	SubtitleLanguage        string                           `json:"subtitle_language"`
	SubtitlePlayingTime     []shared.SubtitlePlayingTime     `json:"subtitle_playing_time"`
	UserID                  string                           `json:"user_id"`
	VideoTitle              string                           `json:"video_title"`
	VisibilityState         string                           `json:"visibility_state"`
	// This field is from variant [PlaybackStateChanged].
	FromState PlaybackStateChangedFromState `json:"from_state"`
	// This field is from variant [PlaybackStateChanged].
	PreviousStateDurationMs float64 `json:"previous_state_duration_ms"`
	// This field is from variant [PlaybackStateChanged].
	ToState PlaybackStateChangedToState `json:"to_state"`
	// This field is from variant [RenditionChanged].
	PreviousRenditionBitrateBps float64 `json:"previous_rendition_bitrate_bps"`
	// This field is from variant [RenditionChanged].
	PreviousRenditionCodec string `json:"previous_rendition_codec"`
	// This field is from variant [RenditionChanged].
	PreviousRenditionFrameRate float64 `json:"previous_rendition_frame_rate"`
	// This field is from variant [RenditionChanged].
	PreviousRenditionHeight float64 `json:"previous_rendition_height"`
	// This field is from variant [RenditionChanged].
	PreviousRenditionWidth float64 `json:"previous_rendition_width"`
	// This field is from variant [RenditionChanged].
	SelectedRenditionFrameRate float64 `json:"selected_rendition_frame_rate"`
	// This field is from variant [SeekCompleted].
	FromPlayheadSeconds float64 `json:"from_playhead_seconds"`
	// This field is from variant [SeekCompleted].
	LastSeekedAt time.Time `json:"last_seeked_at"`
	// This field is from variant [SeekCompleted].
	PlaybackResumedAt time.Time `json:"playback_resumed_at"`
	// This field is from variant [SeekCompleted].
	SeekInteractionDurationMs float64 `json:"seek_interaction_duration_ms"`
	// This field is from variant [SeekCompleted].
	SeekOutcome SeekCompletedSeekOutcome `json:"seek_outcome"`
	// This field is from variant [SeekCompleted].
	SeekResumeWaitMs float64 `json:"seek_resume_wait_ms"`
	// This field is from variant [SeekCompleted].
	SeekStartedAt time.Time `json:"seek_started_at"`
	// This field is from variant [SeekCompleted].
	StateAfterSeek SeekCompletedStateAfterSeek `json:"state_after_seek"`
	// This field is from variant [SeekCompleted].
	StateBeforeSeek SeekCompletedStateBeforeSeek `json:"state_before_seek"`
	// This field is from variant [SeekCompleted].
	ToPlayheadSeconds float64 `json:"to_playhead_seconds"`
	// This field is from variant [SubtitleChanged].
	PreviousSubtitleLanguage string `json:"previous_subtitle_language"`
	// This field is from variant [PlaybackRateChanged].
	PreviousPlaybackRate float64 `json:"previous_playback_rate"`
	JSON                 struct {
		ConnectorName               respjson.Field
		ConnectorVersion            respjson.Field
		DeliveryHostname            respjson.Field
		DeliveryRequestCount        respjson.Field
		DeliveryThroughputBps       respjson.Field
		DeliveryTransferredBytes    respjson.Field
		DroppedVideoFrames          respjson.Field
		Environment                 respjson.Field
		ErrorCategory               respjson.Field
		ErrorCode                   respjson.Field
		ErrorFatal                  respjson.Field
		ErrorPlayheadSeconds        respjson.Field
		EventID                     respjson.Field
		EventName                   respjson.Field
		FirstVideoFrameTimeMs       respjson.Field
		FurthestProgressRatio       respjson.Field
		MaximumPlayheadSeconds      respjson.Field
		MediaDurationSeconds        respjson.Field
		MediaHeightPx               respjson.Field
		MediaWidthPx                respjson.Field
		OccurredAt                  respjson.Field
		PlayerHeightPx              respjson.Field
		PlayerName                  respjson.Field
		PlayerVersion               respjson.Field
		PlayerWidthPx               respjson.Field
		PlayingTimeMs               respjson.Field
		Reason                      respjson.Field
		RebufferCount               respjson.Field
		RebufferDurationMs          respjson.Field
		RebufferRatio               respjson.Field
		RenditionPlayingTime        respjson.Field
		RenditionSwitchCount        respjson.Field
		SchemaVersion               respjson.Field
		SDKName                     respjson.Field
		SDKVersion                  respjson.Field
		SeekCount                   respjson.Field
		SeekDurationMs              respjson.Field
		SelectedRenditionBitrateBps respjson.Field
		SelectedRenditionCodec      respjson.Field
		SelectedRenditionHeight     respjson.Field
		SelectedRenditionWidth      respjson.Field
		Sequence                    respjson.Field
		StartupOutcome              respjson.Field
		StartupTimeMs               respjson.Field
		TotalVideoFrames            respjson.Field
		VideoID                     respjson.Field
		ViewID                      respjson.Field
		ViewerID                    respjson.Field
		BrowserContext              respjson.Field
		Custom                      respjson.Field
		PlaybackRate                respjson.Field
		PlaybackRatePlayingTime     respjson.Field
		PlayedRanges                respjson.Field
		PlayheadSeconds             respjson.Field
		SubtitleLanguage            respjson.Field
		SubtitlePlayingTime         respjson.Field
		UserID                      respjson.Field
		VideoTitle                  respjson.Field
		VisibilityState             respjson.Field
		FromState                   respjson.Field
		PreviousStateDurationMs     respjson.Field
		ToState                     respjson.Field
		PreviousRenditionBitrateBps respjson.Field
		PreviousRenditionCodec      respjson.Field
		PreviousRenditionFrameRate  respjson.Field
		PreviousRenditionHeight     respjson.Field
		PreviousRenditionWidth      respjson.Field
		SelectedRenditionFrameRate  respjson.Field
		FromPlayheadSeconds         respjson.Field
		LastSeekedAt                respjson.Field
		PlaybackResumedAt           respjson.Field
		SeekInteractionDurationMs   respjson.Field
		SeekOutcome                 respjson.Field
		SeekResumeWaitMs            respjson.Field
		SeekStartedAt               respjson.Field
		StateAfterSeek              respjson.Field
		StateBeforeSeek             respjson.Field
		ToPlayheadSeconds           respjson.Field
		PreviousSubtitleLanguage    respjson.Field
		PreviousPlaybackRate        respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AnalyticsEventUnion contains all possible properties and values from ViewStarted, ViewSnapshot, PlaybackError, ViewEnded, PlaybackStateChanged, RenditionChanged, SeekCompleted, SubtitleChanged, PlaybackRateChanged.

Use the AnalyticsEventUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (AnalyticsEventUnion) AsAny

func (u AnalyticsEventUnion) AsAny() anyAnalyticsEvent

Use the following switch statement to find the correct variant

switch variant := AnalyticsEventUnion.AsAny().(type) {
case chunkifyanalytics.ViewStarted:
case chunkifyanalytics.ViewSnapshot:
case chunkifyanalytics.PlaybackError:
case chunkifyanalytics.ViewEnded:
case chunkifyanalytics.PlaybackStateChanged:
case chunkifyanalytics.RenditionChanged:
case chunkifyanalytics.SeekCompleted:
case chunkifyanalytics.SubtitleChanged:
case chunkifyanalytics.PlaybackRateChanged:
default:
  fmt.Errorf("no variant present")
}

func (AnalyticsEventUnion) AsPlaybackError

func (u AnalyticsEventUnion) AsPlaybackError() (v PlaybackError)

func (AnalyticsEventUnion) AsPlaybackRateChanged

func (u AnalyticsEventUnion) AsPlaybackRateChanged() (v PlaybackRateChanged)

func (AnalyticsEventUnion) AsPlaybackStateChanged

func (u AnalyticsEventUnion) AsPlaybackStateChanged() (v PlaybackStateChanged)

func (AnalyticsEventUnion) AsRenditionChanged

func (u AnalyticsEventUnion) AsRenditionChanged() (v RenditionChanged)

func (AnalyticsEventUnion) AsSeekCompleted

func (u AnalyticsEventUnion) AsSeekCompleted() (v SeekCompleted)

func (AnalyticsEventUnion) AsSubtitleChanged

func (u AnalyticsEventUnion) AsSubtitleChanged() (v SubtitleChanged)

func (AnalyticsEventUnion) AsViewEnded

func (u AnalyticsEventUnion) AsViewEnded() (v ViewEnded)

func (AnalyticsEventUnion) AsViewSnapshot

func (u AnalyticsEventUnion) AsViewSnapshot() (v ViewSnapshot)

func (AnalyticsEventUnion) AsViewStarted

func (u AnalyticsEventUnion) AsViewStarted() (v ViewStarted)

func (AnalyticsEventUnion) RawJSON

func (u AnalyticsEventUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (AnalyticsEventUnion) ToParam

ToParam converts this AnalyticsEventUnion to a AnalyticsEventUnionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with AnalyticsEventUnionParam.Overrides()

func (*AnalyticsEventUnion) UnmarshalJSON

func (r *AnalyticsEventUnion) UnmarshalJSON(data []byte) error

type AnalyticsEventUnionErrorCode

type AnalyticsEventUnionErrorCode struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AnalyticsEventUnionErrorCode is an implicit subunion of AnalyticsEventUnion. AnalyticsEventUnionErrorCode provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the AnalyticsEventUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (*AnalyticsEventUnionErrorCode) UnmarshalJSON

func (r *AnalyticsEventUnionErrorCode) UnmarshalJSON(data []byte) error

type AnalyticsEventUnionParam

type AnalyticsEventUnionParam struct {
	OfViewStarted          *ViewStartedParam          `json:",omitzero,inline"`
	OfViewSnapshot         *ViewSnapshotParam         `json:",omitzero,inline"`
	OfPlaybackError        *PlaybackErrorParam        `json:",omitzero,inline"`
	OfViewEnded            *ViewEndedParam            `json:",omitzero,inline"`
	OfPlaybackStateChanged *PlaybackStateChangedParam `json:",omitzero,inline"`
	OfRenditionChanged     *RenditionChangedParam     `json:",omitzero,inline"`
	OfSeekCompleted        *SeekCompletedParam        `json:",omitzero,inline"`
	OfSubtitleChanged      *SubtitleChangedParam      `json:",omitzero,inline"`
	OfPlaybackRateChanged  *PlaybackRateChangedParam  `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (AnalyticsEventUnionParam) GetBrowserContext

func (u AnalyticsEventUnionParam) GetBrowserContext() *shared.BrowserContextParam

Returns a pointer to the underlying variant's BrowserContext property, if present.

func (AnalyticsEventUnionParam) GetConnectorName

func (u AnalyticsEventUnionParam) GetConnectorName() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetConnectorVersion

func (u AnalyticsEventUnionParam) GetConnectorVersion() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetCustom

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetDeliveryHostname

func (u AnalyticsEventUnionParam) GetDeliveryHostname() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetDeliveryRequestCount

func (u AnalyticsEventUnionParam) GetDeliveryRequestCount() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetDeliveryThroughputBps

func (u AnalyticsEventUnionParam) GetDeliveryThroughputBps() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetDeliveryTransferredBytes

func (u AnalyticsEventUnionParam) GetDeliveryTransferredBytes() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetDroppedVideoFrames

func (u AnalyticsEventUnionParam) GetDroppedVideoFrames() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetEnvironment

func (u AnalyticsEventUnionParam) GetEnvironment() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetErrorCategory

func (u AnalyticsEventUnionParam) GetErrorCategory() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetErrorCode

func (u AnalyticsEventUnionParam) GetErrorCode() (res analyticsEventUnionParamErrorCode)

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

func (AnalyticsEventUnionParam) GetErrorFatal

func (u AnalyticsEventUnionParam) GetErrorFatal() *bool

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetErrorPlayheadSeconds

func (u AnalyticsEventUnionParam) GetErrorPlayheadSeconds() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetEventID

func (u AnalyticsEventUnionParam) GetEventID() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetEventName

func (u AnalyticsEventUnionParam) GetEventName() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetFirstVideoFrameTimeMs

func (u AnalyticsEventUnionParam) GetFirstVideoFrameTimeMs() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetFromPlayheadSeconds

func (u AnalyticsEventUnionParam) GetFromPlayheadSeconds() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetFromState

func (u AnalyticsEventUnionParam) GetFromState() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetFurthestProgressRatio

func (u AnalyticsEventUnionParam) GetFurthestProgressRatio() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetLastSeekedAt

func (u AnalyticsEventUnionParam) GetLastSeekedAt() *time.Time

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetMaximumPlayheadSeconds

func (u AnalyticsEventUnionParam) GetMaximumPlayheadSeconds() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetMediaDurationSeconds

func (u AnalyticsEventUnionParam) GetMediaDurationSeconds() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetMediaHeightPx

func (u AnalyticsEventUnionParam) GetMediaHeightPx() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetMediaWidthPx

func (u AnalyticsEventUnionParam) GetMediaWidthPx() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetOccurredAt

func (u AnalyticsEventUnionParam) GetOccurredAt() *time.Time

Returns a pointer to the underlying variant's OccurredAt property, if present.

func (AnalyticsEventUnionParam) GetPlaybackRate

func (u AnalyticsEventUnionParam) GetPlaybackRate() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPlaybackRatePlayingTime

func (u AnalyticsEventUnionParam) GetPlaybackRatePlayingTime() []shared.PlaybackRatePlayingTimeParam

Returns a pointer to the underlying variant's PlaybackRatePlayingTime property, if present.

func (AnalyticsEventUnionParam) GetPlaybackResumedAt

func (u AnalyticsEventUnionParam) GetPlaybackResumedAt() *time.Time

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPlayedRanges

func (u AnalyticsEventUnionParam) GetPlayedRanges() []shared.PlayedRangeParam

Returns a pointer to the underlying variant's PlayedRanges property, if present.

func (AnalyticsEventUnionParam) GetPlayerHeightPx

func (u AnalyticsEventUnionParam) GetPlayerHeightPx() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPlayerName

func (u AnalyticsEventUnionParam) GetPlayerName() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPlayerVersion

func (u AnalyticsEventUnionParam) GetPlayerVersion() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPlayerWidthPx

func (u AnalyticsEventUnionParam) GetPlayerWidthPx() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPlayheadSeconds

func (u AnalyticsEventUnionParam) GetPlayheadSeconds() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPlayingTimeMs

func (u AnalyticsEventUnionParam) GetPlayingTimeMs() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPreviousPlaybackRate

func (u AnalyticsEventUnionParam) GetPreviousPlaybackRate() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPreviousRenditionBitrateBps

func (u AnalyticsEventUnionParam) GetPreviousRenditionBitrateBps() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPreviousRenditionCodec

func (u AnalyticsEventUnionParam) GetPreviousRenditionCodec() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPreviousRenditionFrameRate

func (u AnalyticsEventUnionParam) GetPreviousRenditionFrameRate() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPreviousRenditionHeight

func (u AnalyticsEventUnionParam) GetPreviousRenditionHeight() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPreviousRenditionWidth

func (u AnalyticsEventUnionParam) GetPreviousRenditionWidth() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPreviousStateDurationMs

func (u AnalyticsEventUnionParam) GetPreviousStateDurationMs() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetPreviousSubtitleLanguage

func (u AnalyticsEventUnionParam) GetPreviousSubtitleLanguage() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetReason

func (u AnalyticsEventUnionParam) GetReason() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetRebufferCount

func (u AnalyticsEventUnionParam) GetRebufferCount() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetRebufferDurationMs

func (u AnalyticsEventUnionParam) GetRebufferDurationMs() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetRebufferRatio

func (u AnalyticsEventUnionParam) GetRebufferRatio() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetRenditionPlayingTime

func (u AnalyticsEventUnionParam) GetRenditionPlayingTime() []shared.RenditionPlayingTimeParam

Returns a pointer to the underlying variant's RenditionPlayingTime property, if present.

func (AnalyticsEventUnionParam) GetRenditionSwitchCount

func (u AnalyticsEventUnionParam) GetRenditionSwitchCount() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSDKName

func (u AnalyticsEventUnionParam) GetSDKName() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSDKVersion

func (u AnalyticsEventUnionParam) GetSDKVersion() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSchemaVersion

func (u AnalyticsEventUnionParam) GetSchemaVersion() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSeekCount

func (u AnalyticsEventUnionParam) GetSeekCount() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSeekDurationMs

func (u AnalyticsEventUnionParam) GetSeekDurationMs() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSeekInteractionDurationMs

func (u AnalyticsEventUnionParam) GetSeekInteractionDurationMs() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSeekOutcome

func (u AnalyticsEventUnionParam) GetSeekOutcome() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSeekResumeWaitMs

func (u AnalyticsEventUnionParam) GetSeekResumeWaitMs() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSeekStartedAt

func (u AnalyticsEventUnionParam) GetSeekStartedAt() *time.Time

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSelectedRenditionBitrateBps

func (u AnalyticsEventUnionParam) GetSelectedRenditionBitrateBps() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSelectedRenditionCodec

func (u AnalyticsEventUnionParam) GetSelectedRenditionCodec() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSelectedRenditionFrameRate

func (u AnalyticsEventUnionParam) GetSelectedRenditionFrameRate() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSelectedRenditionHeight

func (u AnalyticsEventUnionParam) GetSelectedRenditionHeight() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSelectedRenditionWidth

func (u AnalyticsEventUnionParam) GetSelectedRenditionWidth() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSequence

func (u AnalyticsEventUnionParam) GetSequence() *int64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetStartupOutcome

func (u AnalyticsEventUnionParam) GetStartupOutcome() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetStartupTimeMs

func (u AnalyticsEventUnionParam) GetStartupTimeMs() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetStateAfterSeek

func (u AnalyticsEventUnionParam) GetStateAfterSeek() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetStateBeforeSeek

func (u AnalyticsEventUnionParam) GetStateBeforeSeek() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSubtitleLanguage

func (u AnalyticsEventUnionParam) GetSubtitleLanguage() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetSubtitlePlayingTime

func (u AnalyticsEventUnionParam) GetSubtitlePlayingTime() []shared.SubtitlePlayingTimeParam

Returns a pointer to the underlying variant's SubtitlePlayingTime property, if present.

func (AnalyticsEventUnionParam) GetToPlayheadSeconds

func (u AnalyticsEventUnionParam) GetToPlayheadSeconds() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetToState

func (u AnalyticsEventUnionParam) GetToState() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetTotalVideoFrames

func (u AnalyticsEventUnionParam) GetTotalVideoFrames() *float64

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetUserID

func (u AnalyticsEventUnionParam) GetUserID() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetVideoID

func (u AnalyticsEventUnionParam) GetVideoID() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetVideoTitle

func (u AnalyticsEventUnionParam) GetVideoTitle() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetViewID

func (u AnalyticsEventUnionParam) GetViewID() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetViewerID

func (u AnalyticsEventUnionParam) GetViewerID() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) GetVisibilityState

func (u AnalyticsEventUnionParam) GetVisibilityState() *string

Returns a pointer to the underlying variant's property, if present.

func (AnalyticsEventUnionParam) MarshalJSON

func (u AnalyticsEventUnionParam) MarshalJSON() ([]byte, error)

func (*AnalyticsEventUnionParam) UnmarshalJSON

func (u *AnalyticsEventUnionParam) UnmarshalJSON(data []byte) error

type BrowserContext

type BrowserContext = shared.BrowserContext

Browser and device information. The Chunkify player sends every field, with null for unavailable measurements. Other integrations may omit any field except schema_version. Extra properties are preserved.

This is an alias to an internal type.

type BrowserContextDeviceType

type BrowserContextDeviceType = shared.BrowserContextDeviceType

This is an alias to an internal type.

type BrowserContextParam

type BrowserContextParam = shared.BrowserContextParam

Browser and device information. The Chunkify player sends every field, with null for unavailable measurements. Other integrations may omit any field except schema_version. Extra properties are preserved.

This is an alias to an internal type.

type Client

type Client struct {
	Options []option.RequestOption
	// Health and private ingestion status.
	Health HealthService
	Events EventService
	// Private retained-event and view-cohort queries.
	Summary SummaryService
	// Private retained-event and view-cohort queries.
	Videos VideoService
	// Private retained-event and view-cohort queries.
	Timeseries TimeseryService
	// Private retained-event and view-cohort queries.
	Quality QualityService
	// Private retained-event and view-cohort queries.
	Engagement EngagementService
	// Project origins and keys.
	Project ProjectService
	// Project origins and keys.
	Admin AdminService
	// Private retained-event and view-cohort queries.
	Views ViewService
	// Private retained-event and view-cohort queries.
	Errors ErrorService
	// Private retained-event and view-cohort queries.
	Dimensions DimensionService
	Exports    ExportService
	// Private retained-event and view-cohort queries.
	Retention RetentionService
	// Private retained-event and view-cohort queries.
	Renditions RenditionService
	// Private retained-event and view-cohort queries.
	Subtitles SubtitleService
	// Private retained-event and view-cohort queries.
	PlaybackRates PlaybackRateService
}

Client creates a struct with services and top level methods that help with interacting with the Chunkify Analytics API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (CHUNKIFY_ANALYTICS_PUBLIC_KEY, CHUNKIFY_ANALYTICS_SECRET_KEY, CHUNKIFY_ANALYTICS_ADMIN_KEY, CHUNKIFY_ANALYTICS_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type CreatedProject

type CreatedProject struct {
	// Effective retention in seconds after resolving the installation default. 0
	// disables expiration.
	EffectiveRetentionSeconds int64 `json:"effective_retention_seconds" api:"required"`
	// Project display name.
	Name      string `json:"name" api:"required"`
	ProjectID string `json:"project_id" api:"required" format:"uuid"`
	// Public key for sending events.
	PublicKey       string `json:"public_key" api:"required"`
	RestartRequired bool   `json:"restart_required" api:"required"`
	// Retention by server receipt time, in seconds. 0 disables expiration; null
	// inherits the installation default.
	RetentionSeconds int64 `json:"retention_seconds" api:"required"`
	// Secret key for this project. Save it now; it is returned once.
	SecretKey string `json:"secret_key" api:"required"`
	Warning   string `json:"warning"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EffectiveRetentionSeconds respjson.Field
		Name                      respjson.Field
		ProjectID                 respjson.Field
		PublicKey                 respjson.Field
		RestartRequired           respjson.Field
		RetentionSeconds          respjson.Field
		SecretKey                 respjson.Field
		Warning                   respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CreatedProject) RawJSON

func (r CreatedProject) RawJSON() string

Returns the unmodified JSON received from the API

func (*CreatedProject) UnmarshalJSON

func (r *CreatedProject) UnmarshalJSON(data []byte) error

type CreatedProjectKey

type CreatedProjectKey struct {
	// New key value. Save it now; it is returned once.
	Key   string `json:"key" api:"required"`
	KeyID string `json:"key_id" api:"required"`
	// Any of "public", "secret".
	Permission CreatedProjectKeyPermission `json:"permission" api:"required"`
	ProjectID  string                      `json:"project_id" api:"required"`
	// True for a private key limited to analytics reads through HTTP and MCP. Public
	// keys always report false. Rotation preserves this setting.
	ReadOnly        bool   `json:"read_only" api:"required"`
	RestartRequired bool   `json:"restart_required" api:"required"`
	Warning         string `json:"warning"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Key             respjson.Field
		KeyID           respjson.Field
		Permission      respjson.Field
		ProjectID       respjson.Field
		ReadOnly        respjson.Field
		RestartRequired respjson.Field
		Warning         respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A newly created key. Save the key value now; later key listings contain only metadata.

func (CreatedProjectKey) RawJSON

func (r CreatedProjectKey) RawJSON() string

Returns the unmodified JSON received from the API

func (*CreatedProjectKey) UnmarshalJSON

func (r *CreatedProjectKey) UnmarshalJSON(data []byte) error

type CreatedProjectKeyPermission

type CreatedProjectKeyPermission string
const (
	CreatedProjectKeyPermissionPublic CreatedProjectKeyPermission = "public"
	CreatedProjectKeyPermissionSecret CreatedProjectKeyPermission = "secret"
)

type CustomDimensionUnion

type CustomDimensionUnion = shared.CustomDimensionUnion

This is an alias to an internal type.

type CustomDimensionUnionParam

type CustomDimensionUnionParam = shared.CustomDimensionUnionParam

This is an alias to an internal type.

type CustomDimensions

type CustomDimensions = shared.CustomDimensions

Integrator-defined dimensions set once when the view starts: at most 10 keys of 1 to 40 characters a-z, 0-9 and \_, each with text of 1 to 256 characters, a number or a boolean. Reports compare values as text, exactly and case-sensitively: numbers as their JSON text (5, 5.5; send whole numbers without a decimal part, as JavaScript does), booleans as true or false. Only view_started accepts custom. Never put personal data here; use user_id for user identity.

This is an alias to an internal type.

type CustomDimensionsParam

type CustomDimensionsParam = shared.CustomDimensionsParam

Integrator-defined dimensions set once when the view starts: at most 10 keys of 1 to 40 characters a-z, 0-9 and \_, each with text of 1 to 256 characters, a number or a boolean. Reports compare values as text, exactly and case-sensitively: numbers as their JSON text (5, 5.5; send whole numbers without a decimal part, as JavaScript does), booleans as true or false. Only view_started accepts custom. Never put personal data here; use user_id for user identity.

This is an alias to an internal type.

type DeletedProject

type DeletedProject struct {
	Deleted         bool   `json:"deleted" api:"required"`
	ProjectID       string `json:"project_id" api:"required"`
	RestartRequired bool   `json:"restart_required" api:"required"`
	Warning         string `json:"warning"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Deleted         respjson.Field
		ProjectID       respjson.Field
		RestartRequired respjson.Field
		Warning         respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (DeletedProject) RawJSON

func (r DeletedProject) RawJSON() string

Returns the unmodified JSON received from the API

func (*DeletedProject) UnmarshalJSON

func (r *DeletedProject) UnmarshalJSON(data []byte) error

type DimensionListValuesParams

type DimensionListValuesParams struct {
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Use next_cursor from the previous page. Keep the same filters, sort_by and
	// order. Video cursors from earlier versions are invalid; start a new pagination
	// sequence after upgrading.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent DimensionListValuesParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType DimensionListValuesParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (DimensionListValuesParams) URLQuery

func (r DimensionListValuesParams) URLQuery() (v url.Values, err error)

URLQuery serializes DimensionListValuesParams's query parameters as `url.Values`.

type DimensionListValuesParamsContinent

type DimensionListValuesParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	DimensionListValuesParamsContinentAf DimensionListValuesParamsContinent = "AF"
	DimensionListValuesParamsContinentAn DimensionListValuesParamsContinent = "AN"
	DimensionListValuesParamsContinentAs DimensionListValuesParamsContinent = "AS"
	DimensionListValuesParamsContinentEu DimensionListValuesParamsContinent = "EU"
	DimensionListValuesParamsContinentNa DimensionListValuesParamsContinent = "NA"
	DimensionListValuesParamsContinentOc DimensionListValuesParamsContinent = "OC"
	DimensionListValuesParamsContinentSa DimensionListValuesParamsContinent = "SA"
)

type DimensionListValuesParamsDeviceType

type DimensionListValuesParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	DimensionListValuesParamsDeviceTypeDesktop DimensionListValuesParamsDeviceType = "desktop"
	DimensionListValuesParamsDeviceTypeMobile  DimensionListValuesParamsDeviceType = "mobile"
	DimensionListValuesParamsDeviceTypeTablet  DimensionListValuesParamsDeviceType = "tablet"
	DimensionListValuesParamsDeviceTypeUnknown DimensionListValuesParamsDeviceType = "unknown"
)

type DimensionListValuesParamsDimension

type DimensionListValuesParamsDimension string
const (
	DimensionListValuesParamsDimensionBrowserName      DimensionListValuesParamsDimension = "browser_name"
	DimensionListValuesParamsDimensionOsName           DimensionListValuesParamsDimension = "os_name"
	DimensionListValuesParamsDimensionDeviceType       DimensionListValuesParamsDimension = "device_type"
	DimensionListValuesParamsDimensionVideoID          DimensionListValuesParamsDimension = "video_id"
	DimensionListValuesParamsDimensionViewerID         DimensionListValuesParamsDimension = "viewer_id"
	DimensionListValuesParamsDimensionUserID           DimensionListValuesParamsDimension = "user_id"
	DimensionListValuesParamsDimensionVideoTitle       DimensionListValuesParamsDimension = "video_title"
	DimensionListValuesParamsDimensionContinent        DimensionListValuesParamsDimension = "continent"
	DimensionListValuesParamsDimensionCountry          DimensionListValuesParamsDimension = "country"
	DimensionListValuesParamsDimensionCity             DimensionListValuesParamsDimension = "city"
	DimensionListValuesParamsDimensionPageOrigin       DimensionListValuesParamsDimension = "page_origin"
	DimensionListValuesParamsDimensionPagePath         DimensionListValuesParamsDimension = "page_path"
	DimensionListValuesParamsDimensionSubtitleLanguage DimensionListValuesParamsDimension = "subtitle_language"
	DimensionListValuesParamsDimensionPlaybackRate     DimensionListValuesParamsDimension = "playback_rate"
	DimensionListValuesParamsDimensionCustomKeys       DimensionListValuesParamsDimension = "custom_keys"
)

type DimensionService

type DimensionService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

DimensionService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewDimensionService method instead.

func NewDimensionService

func NewDimensionService(opts ...option.RequestOption) (r DimensionService)

NewDimensionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*DimensionService) ListValues

Values and view counts come from the first retained view starts, after applying the same cohort filters as summary. Values sort by views descending, then value ascending with null first for ties; missing context is separate from the literal unknown. Cursors bind the dimension, filters, project and ingestion watermark.

func (*DimensionService) ListValuesAutoPaging

Values and view counts come from the first retained view starts, after applying the same cohort filters as summary. Values sort by views descending, then value ascending with null first for ties; missing context is separate from the literal unknown. Cursors bind the dimension, filters, project and ingestion watermark.

type DimensionValues

type DimensionValues struct {
	// One custom dimension's values, such as custom.plan.
	Dimension  DimensionValuesDimension `json:"dimension" api:"required"`
	NextCursor string                   `json:"next_cursor" api:"required"`
	Values     []DimensionValuesValue   `json:"values" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Dimension   respjson.Field
		NextCursor  respjson.Field
		Values      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (DimensionValues) RawJSON

func (r DimensionValues) RawJSON() string

Returns the unmodified JSON received from the API

func (*DimensionValues) UnmarshalJSON

func (r *DimensionValues) UnmarshalJSON(data []byte) error

type DimensionValuesDimension

type DimensionValuesDimension string
const (
	DimensionValuesDimensionBrowserName      DimensionValuesDimension = "browser_name"
	DimensionValuesDimensionOsName           DimensionValuesDimension = "os_name"
	DimensionValuesDimensionDeviceType       DimensionValuesDimension = "device_type"
	DimensionValuesDimensionVideoID          DimensionValuesDimension = "video_id"
	DimensionValuesDimensionViewerID         DimensionValuesDimension = "viewer_id"
	DimensionValuesDimensionUserID           DimensionValuesDimension = "user_id"
	DimensionValuesDimensionVideoTitle       DimensionValuesDimension = "video_title"
	DimensionValuesDimensionContinent        DimensionValuesDimension = "continent"
	DimensionValuesDimensionCountry          DimensionValuesDimension = "country"
	DimensionValuesDimensionCity             DimensionValuesDimension = "city"
	DimensionValuesDimensionPageOrigin       DimensionValuesDimension = "page_origin"
	DimensionValuesDimensionPagePath         DimensionValuesDimension = "page_path"
	DimensionValuesDimensionSubtitleLanguage DimensionValuesDimension = "subtitle_language"
	DimensionValuesDimensionPlaybackRate     DimensionValuesDimension = "playback_rate"
	DimensionValuesDimensionCustomKeys       DimensionValuesDimension = "custom_keys"
)

type DimensionValuesValue

type DimensionValuesValue struct {
	Value string `json:"value" api:"required"`
	Views int64  `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Value       respjson.Field
		Views       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (DimensionValuesValue) RawJSON

func (r DimensionValuesValue) RawJSON() string

Returns the unmodified JSON received from the API

func (*DimensionValuesValue) UnmarshalJSON

func (r *DimensionValuesValue) UnmarshalJSON(data []byte) error

type Engagement

type Engagement struct {
	// Total playing time divided by all selected attempts. Null with no views; zero
	// when views exist with no measured time.
	AveragePlayingTimeMs float64 `json:"average_playing_time_ms" api:"required"`
	// Furthest progress on the selected final event or latest snapshot. Only views
	// with a positive known media duration and a progress ratio in [0,1] are samples.
	// Each milestone ratio uses sample_views. Seeking can count; this is not watched
	// coverage or audience retention.
	ProgressReached shared.ProgressReached `json:"progress_reached" api:"required"`
	// Reached-end views divided by all selected attempts. Null without views. Multiply
	// by 100 for percent. Does not imply the whole video was watched.
	ReachedEndRatio float64 `json:"reached_end_ratio" api:"required"`
	// Views whose winning final event has reason=ended. Counts each selected view at
	// most once.
	ReachedEndViews int64 `json:"reached_end_views" api:"required"`
	// Cumulative playing time summed once per selected view, as in summary.
	TotalPlayingTimeMs float64 `json:"total_playing_time_ms" api:"required"`
	// Selected playback attempts with a retained start, including failed, ongoing and
	// start-only attempts.
	Views int64 `json:"views" api:"required"`
	// Playing time in milliseconds from one selected final event or latest snapshot
	// per view. Measured zero is included; missing measurements are excluded.
	// Percentiles use linear interpolation and are null without samples. This sample
	// denominator differs from average_playing_time_ms, which uses all attempts.
	WatchTimeMs shared.WatchTimeDistribution `json:"watch_time_ms" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AveragePlayingTimeMs respjson.Field
		ProgressReached      respjson.Field
		ReachedEndRatio      respjson.Field
		ReachedEndViews      respjson.Field
		TotalPlayingTimeMs   respjson.Field
		Views                respjson.Field
		WatchTimeMs          respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Observed watch time and end-of-media for the same start cohort as summary. Missing delivery can undercount both.

func (Engagement) RawJSON

func (r Engagement) RawJSON() string

Returns the unmodified JSON received from the API

func (*Engagement) UnmarshalJSON

func (r *Engagement) UnmarshalJSON(data []byte) error

type EngagementBreakdownPage

type EngagementBreakdownPage struct {
	// A custom dimension key, such as custom.plan.
	GroupBy    EngagementBreakdownPageGroupBy `json:"group_by" api:"required"`
	Groups     []EngagementBreakdownPageGroup `json:"groups" api:"required"`
	NextCursor string                         `json:"next_cursor" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GroupBy     respjson.Field
		Groups      respjson.Field
		NextCursor  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EngagementBreakdownPage) RawJSON

func (r EngagementBreakdownPage) RawJSON() string

Returns the unmodified JSON received from the API

func (*EngagementBreakdownPage) UnmarshalJSON

func (r *EngagementBreakdownPage) UnmarshalJSON(data []byte) error

type EngagementBreakdownPageGroup

type EngagementBreakdownPageGroup struct {
	// Observed watch time and end-of-media for the same start cohort as summary.
	// Missing delivery can undercount both.
	Data  Engagement `json:"data" api:"required"`
	Value string     `json:"value" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EngagementBreakdownPageGroup) RawJSON

Returns the unmodified JSON received from the API

func (*EngagementBreakdownPageGroup) UnmarshalJSON

func (r *EngagementBreakdownPageGroup) UnmarshalJSON(data []byte) error

type EngagementBreakdownPageGroupBy

type EngagementBreakdownPageGroupBy string
const (
	EngagementBreakdownPageGroupByBrowserName      EngagementBreakdownPageGroupBy = "browser_name"
	EngagementBreakdownPageGroupByOsName           EngagementBreakdownPageGroupBy = "os_name"
	EngagementBreakdownPageGroupByDeviceType       EngagementBreakdownPageGroupBy = "device_type"
	EngagementBreakdownPageGroupByContinent        EngagementBreakdownPageGroupBy = "continent"
	EngagementBreakdownPageGroupByCountry          EngagementBreakdownPageGroupBy = "country"
	EngagementBreakdownPageGroupByCity             EngagementBreakdownPageGroupBy = "city"
	EngagementBreakdownPageGroupByPageOrigin       EngagementBreakdownPageGroupBy = "page_origin"
	EngagementBreakdownPageGroupByPagePath         EngagementBreakdownPageGroupBy = "page_path"
	EngagementBreakdownPageGroupBySubtitleLanguage EngagementBreakdownPageGroupBy = "subtitle_language"
	EngagementBreakdownPageGroupByPlaybackRate     EngagementBreakdownPageGroupBy = "playback_rate"
	EngagementBreakdownPageGroupByVideoTitle       EngagementBreakdownPageGroupBy = "video_title"
	EngagementBreakdownPageGroupByUserID           EngagementBreakdownPageGroupBy = "user_id"
)

type EngagementGetParams

type EngagementGetParams struct {
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Use next_cursor from the previous page. Keep the same filters, sort_by and
	// order. Video cursors from earlier versions are invalid; start a new pagination
	// sequence after upgrading.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent EngagementGetParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType EngagementGetParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// Optional on summary, quality and engagement. Group views by this field on their
	// first retained start. Missing, null and nonstring context forms a null group;
	// the literal device type unknown stays separate. Groups sort by views descending,
	// then value ascending with null first for ties. Pagination is available only with
	// group_by. Location uses the first retained start too. City groups use the stored
	// name; filter by country to avoid combining names shared by different countries.
	// Page groups use the first retained start even if playback continues after
	// navigation. Filter by page_origin when grouping page_path to distinguish
	// identical paths on different sites. video_title groups by the title on each
	// view's first retained start, so a renamed video counts each view under the title
	// it started with. user_id groups by the user ID on each view's first retained
	// start. Use custom.<key>, such as custom.plan, to group by a custom dimension;
	// views without the key form the null group.
	GroupBy EngagementGetParamsGroupBy `query:"group_by,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EngagementGetParams) URLQuery

func (r EngagementGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes EngagementGetParams's query parameters as `url.Values`.

type EngagementGetParamsContinent

type EngagementGetParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	EngagementGetParamsContinentAf EngagementGetParamsContinent = "AF"
	EngagementGetParamsContinentAn EngagementGetParamsContinent = "AN"
	EngagementGetParamsContinentAs EngagementGetParamsContinent = "AS"
	EngagementGetParamsContinentEu EngagementGetParamsContinent = "EU"
	EngagementGetParamsContinentNa EngagementGetParamsContinent = "NA"
	EngagementGetParamsContinentOc EngagementGetParamsContinent = "OC"
	EngagementGetParamsContinentSa EngagementGetParamsContinent = "SA"
)

type EngagementGetParamsDeviceType

type EngagementGetParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	EngagementGetParamsDeviceTypeDesktop EngagementGetParamsDeviceType = "desktop"
	EngagementGetParamsDeviceTypeMobile  EngagementGetParamsDeviceType = "mobile"
	EngagementGetParamsDeviceTypeTablet  EngagementGetParamsDeviceType = "tablet"
	EngagementGetParamsDeviceTypeUnknown EngagementGetParamsDeviceType = "unknown"
)

type EngagementGetParamsGroupBy

type EngagementGetParamsGroupBy string

Optional on summary, quality and engagement. Group views by this field on their first retained start. Missing, null and nonstring context forms a null group; the literal device type unknown stays separate. Groups sort by views descending, then value ascending with null first for ties. Pagination is available only with group_by. Location uses the first retained start too. City groups use the stored name; filter by country to avoid combining names shared by different countries. Page groups use the first retained start even if playback continues after navigation. Filter by page_origin when grouping page_path to distinguish identical paths on different sites. video_title groups by the title on each view's first retained start, so a renamed video counts each view under the title it started with. user_id groups by the user ID on each view's first retained start. Use custom.<key>, such as custom.plan, to group by a custom dimension; views without the key form the null group.

const (
	EngagementGetParamsGroupByBrowserName      EngagementGetParamsGroupBy = "browser_name"
	EngagementGetParamsGroupByOsName           EngagementGetParamsGroupBy = "os_name"
	EngagementGetParamsGroupByDeviceType       EngagementGetParamsGroupBy = "device_type"
	EngagementGetParamsGroupByContinent        EngagementGetParamsGroupBy = "continent"
	EngagementGetParamsGroupByCountry          EngagementGetParamsGroupBy = "country"
	EngagementGetParamsGroupByCity             EngagementGetParamsGroupBy = "city"
	EngagementGetParamsGroupByPageOrigin       EngagementGetParamsGroupBy = "page_origin"
	EngagementGetParamsGroupByPagePath         EngagementGetParamsGroupBy = "page_path"
	EngagementGetParamsGroupBySubtitleLanguage EngagementGetParamsGroupBy = "subtitle_language"
	EngagementGetParamsGroupByPlaybackRate     EngagementGetParamsGroupBy = "playback_rate"
	EngagementGetParamsGroupByVideoTitle       EngagementGetParamsGroupBy = "video_title"
	EngagementGetParamsGroupByUserID           EngagementGetParamsGroupBy = "user_id"
)

type EngagementResponseUnion

type EngagementResponseUnion struct {
	// This field is from variant [Engagement].
	AveragePlayingTimeMs float64 `json:"average_playing_time_ms"`
	// This field is from variant [Engagement].
	ProgressReached shared.ProgressReached `json:"progress_reached"`
	// This field is from variant [Engagement].
	ReachedEndRatio float64 `json:"reached_end_ratio"`
	// This field is from variant [Engagement].
	ReachedEndViews int64 `json:"reached_end_views"`
	// This field is from variant [Engagement].
	TotalPlayingTimeMs float64 `json:"total_playing_time_ms"`
	// This field is from variant [Engagement].
	Views int64 `json:"views"`
	// This field is from variant [Engagement].
	WatchTimeMs shared.WatchTimeDistribution `json:"watch_time_ms"`
	// This field is from variant [EngagementBreakdownPage].
	GroupBy EngagementBreakdownPageGroupBy `json:"group_by"`
	// This field is from variant [EngagementBreakdownPage].
	Groups []EngagementBreakdownPageGroup `json:"groups"`
	// This field is from variant [EngagementBreakdownPage].
	NextCursor string `json:"next_cursor"`
	JSON       struct {
		AveragePlayingTimeMs respjson.Field
		ProgressReached      respjson.Field
		ReachedEndRatio      respjson.Field
		ReachedEndViews      respjson.Field
		TotalPlayingTimeMs   respjson.Field
		Views                respjson.Field
		WatchTimeMs          respjson.Field
		GroupBy              respjson.Field
		Groups               respjson.Field
		NextCursor           respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EngagementResponseUnion contains all possible properties and values from Engagement, EngagementBreakdownPage.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (EngagementResponseUnion) AsEngagement

func (u EngagementResponseUnion) AsEngagement() (v Engagement)

func (EngagementResponseUnion) AsEngagementBreakdownPage

func (u EngagementResponseUnion) AsEngagementBreakdownPage() (v EngagementBreakdownPage)

func (EngagementResponseUnion) RawJSON

func (u EngagementResponseUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*EngagementResponseUnion) UnmarshalJSON

func (r *EngagementResponseUnion) UnmarshalJSON(data []byte) error

type EngagementService

type EngagementService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

EngagementService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEngagementService method instead.

func NewEngagementService

func NewEngagementService(opts ...option.RequestOption) (r EngagementService)

NewEngagementService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EngagementService) Get

Get average watch time per attempt and the observed reached-end rate. Reaching the end does not prove the whole video was watched. Optionally group the full filtered view-start cohort with group_by=browser_name, os_name, device_type, continent, country or city. Without group_by the totals response is unchanged. With group_by, return paginated groups sorted by views descending. Equal view counts sort by value ascending, null first. Context comes from the first retained start; missing, null and nonstring values form a null group. Keep group_by and filters unchanged with each cursor. Unique viewers must not be summed across groups. Includes furthest-progress milestones and measured watch-time distribution. Progress can include seeking and is not retention.

type EngagementTimeseries

type EngagementTimeseries struct {
	Buckets []EngagementTimeseriesBucket `json:"buckets" api:"required"`
	// Inclusive query bound normalized to UTC milliseconds.
	From time.Time `json:"from" api:"required" format:"date-time"`
	// Any of "hour", "day".
	Interval EngagementTimeseriesInterval `json:"interval" api:"required"`
	Kind     constant.Engagement          `json:"kind" default:"engagement"`
	Timezone constant.Utc                 `json:"timezone" default:"UTC"`
	// Exclusive query bound normalized to UTC milliseconds.
	To time.Time `json:"to" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Buckets     respjson.Field
		From        respjson.Field
		Interval    respjson.Field
		Kind        respjson.Field
		Timezone    respjson.Field
		To          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EngagementTimeseries) RawJSON

func (r EngagementTimeseries) RawJSON() string

Returns the unmodified JSON received from the API

func (*EngagementTimeseries) UnmarshalJSON

func (r *EngagementTimeseries) UnmarshalJSON(data []byte) error

type EngagementTimeseriesBucket

type EngagementTimeseriesBucket struct {
	// Total playing time divided by all selected attempts. Null with no views; zero
	// when views exist with no measured time.
	AveragePlayingTimeMs float64   `json:"average_playing_time_ms" api:"required"`
	BucketStart          time.Time `json:"bucket_start" api:"required" format:"date-time"`
	// Furthest progress on the selected final event or latest snapshot. Only views
	// with a positive known media duration and a progress ratio in [0,1] are samples.
	// Each milestone ratio uses sample_views. Seeking can count; this is not watched
	// coverage or audience retention.
	ProgressReached shared.ProgressReached `json:"progress_reached" api:"required"`
	// Reached-end views divided by all selected attempts. Null without views. Multiply
	// by 100 for percent. Does not imply the whole video was watched.
	ReachedEndRatio float64 `json:"reached_end_ratio" api:"required"`
	// Views whose winning final event has reason=ended. Counts each selected view at
	// most once.
	ReachedEndViews int64 `json:"reached_end_views" api:"required"`
	// Cumulative playing time summed once per selected view, as in summary.
	TotalPlayingTimeMs float64 `json:"total_playing_time_ms" api:"required"`
	// Selected playback attempts with a retained start, including failed, ongoing and
	// start-only attempts.
	Views int64 `json:"views" api:"required"`
	// Playing time in milliseconds from one selected final event or latest snapshot
	// per view. Measured zero is included; missing measurements are excluded.
	// Percentiles use linear interpolation and are null without samples. This sample
	// denominator differs from average_playing_time_ms, which uses all attempts.
	WatchTimeMs shared.WatchTimeDistribution `json:"watch_time_ms" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AveragePlayingTimeMs respjson.Field
		BucketStart          respjson.Field
		ProgressReached      respjson.Field
		ReachedEndRatio      respjson.Field
		ReachedEndViews      respjson.Field
		TotalPlayingTimeMs   respjson.Field
		Views                respjson.Field
		WatchTimeMs          respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Observed watch time and end-of-media for the same start cohort as summary. Missing delivery can undercount both.

func (EngagementTimeseriesBucket) RawJSON

func (r EngagementTimeseriesBucket) RawJSON() string

Returns the unmodified JSON received from the API

func (*EngagementTimeseriesBucket) UnmarshalJSON

func (r *EngagementTimeseriesBucket) UnmarshalJSON(data []byte) error

type EngagementTimeseriesInterval

type EngagementTimeseriesInterval string
const (
	EngagementTimeseriesIntervalHour EngagementTimeseriesInterval = "hour"
	EngagementTimeseriesIntervalDay  EngagementTimeseriesInterval = "day"
)

type Error

type Error = apierror.Error

type ErrorGroup

type ErrorGroup struct {
	AffectedViews int64                    `json:"affected_views" api:"required"`
	ErrorCode     ErrorGroupErrorCodeUnion `json:"error_code" api:"required"`
	ErrorEvents   int64                    `json:"error_events" api:"required"`
	Fatal         bool                     `json:"fatal" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AffectedViews respjson.Field
		ErrorCode     respjson.Field
		ErrorEvents   respjson.Field
		Fatal         respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ErrorGroup) RawJSON

func (r ErrorGroup) RawJSON() string

Returns the unmodified JSON received from the API

func (*ErrorGroup) UnmarshalJSON

func (r *ErrorGroup) UnmarshalJSON(data []byte) error

type ErrorGroupErrorCodeUnion

type ErrorGroupErrorCodeUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ErrorGroupErrorCodeUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (ErrorGroupErrorCodeUnion) AsFloat

func (u ErrorGroupErrorCodeUnion) AsFloat() (v float64)

func (ErrorGroupErrorCodeUnion) AsString

func (u ErrorGroupErrorCodeUnion) AsString() (v string)

func (ErrorGroupErrorCodeUnion) RawJSON

func (u ErrorGroupErrorCodeUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ErrorGroupErrorCodeUnion) UnmarshalJSON

func (r *ErrorGroupErrorCodeUnion) UnmarshalJSON(data []byte) error

type ErrorListParams

type ErrorListParams struct {
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Use next_cursor from the previous page. Keep the same filters, sort_by and
	// order. Video cursors from earlier versions are invalid; start a new pagination
	// sequence after upgrading.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent ErrorListParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType ErrorListParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ErrorListParams) URLQuery

func (r ErrorListParams) URLQuery() (v url.Values, err error)

URLQuery serializes ErrorListParams's query parameters as `url.Values`.

type ErrorListParamsContinent

type ErrorListParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	ErrorListParamsContinentAf ErrorListParamsContinent = "AF"
	ErrorListParamsContinentAn ErrorListParamsContinent = "AN"
	ErrorListParamsContinentAs ErrorListParamsContinent = "AS"
	ErrorListParamsContinentEu ErrorListParamsContinent = "EU"
	ErrorListParamsContinentNa ErrorListParamsContinent = "NA"
	ErrorListParamsContinentOc ErrorListParamsContinent = "OC"
	ErrorListParamsContinentSa ErrorListParamsContinent = "SA"
)

type ErrorListParamsDeviceType

type ErrorListParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	ErrorListParamsDeviceTypeDesktop ErrorListParamsDeviceType = "desktop"
	ErrorListParamsDeviceTypeMobile  ErrorListParamsDeviceType = "mobile"
	ErrorListParamsDeviceTypeTablet  ErrorListParamsDeviceType = "tablet"
	ErrorListParamsDeviceTypeUnknown ErrorListParamsDeviceType = "unknown"
)

type ErrorPage

type ErrorPage struct {
	Errors     []ErrorGroup `json:"errors" api:"required"`
	NextCursor string       `json:"next_cursor" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Errors      respjson.Field
		NextCursor  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ErrorPage) RawJSON

func (r ErrorPage) RawJSON() string

Returns the unmodified JSON received from the API

func (*ErrorPage) UnmarshalJSON

func (r *ErrorPage) UnmarshalJSON(data []byte) error

type ErrorService

type ErrorService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

ErrorService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewErrorService method instead.

func NewErrorService

func NewErrorService(opts ...option.RequestOption) (r ErrorService)

NewErrorService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ErrorService) List

Filters select first retained starts. Error events from the selected view identity contribute even after to. Group by exact JSON error_code and fatal status, distinguishing numeric codes from text and missing from false. Sort by affected_views descending, then canonical JSON code and fatal status ascending for ties. error_events counts distinct event IDs per group, affected_views counts distinct view IDs. Groups are not additive across codes. Cursors exclude later arrivals.

func (*ErrorService) ListAutoPaging

Filters select first retained starts. Error events from the selected view identity contribute even after to. Group by exact JSON error_code and fatal status, distinguishing numeric codes from text and missing from false. Sort by affected_views descending, then canonical JSON code and fatal status ascending for ties. error_events counts distinct event IDs per group, affected_views counts distinct view IDs. Groups are not additive across codes. Cursors exclude later arrivals.

type EventContext

type EventContext = shared.EventContext

Browser context and locally derived continent/country/city. Request IP addresses are never added to events or stored context.

This is an alias to an internal type.

type EventContextBrowserNameUnion

type EventContextBrowserNameUnion = shared.EventContextBrowserNameUnion

Copied from browser_context.browser_name when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextBrowserVersionUnion

type EventContextBrowserVersionUnion = shared.EventContextBrowserVersionUnion

Copied from browser_context.browser_version when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextContinent

type EventContextContinent = shared.EventContextContinent

Continent code from the local City MMDB lookup: Africa, Antarctica, Asia, Europe, North America, Oceania or South America. Null when unknown.

This is an alias to an internal type.

type EventContextDeviceFamilyUnion

type EventContextDeviceFamilyUnion = shared.EventContextDeviceFamilyUnion

Copied from browser_context.device_family when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextDeviceTypeUnion

type EventContextDeviceTypeUnion = shared.EventContextDeviceTypeUnion

Copied from browser_context.device_type when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextLanguagePrefixUnion

type EventContextLanguagePrefixUnion = shared.EventContextLanguagePrefixUnion

Copied from browser_context.language_prefix when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextLanguageUnion

type EventContextLanguageUnion = shared.EventContextLanguageUnion

Copied from browser_context.language when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextOsNameUnion

type EventContextOsNameUnion = shared.EventContextOsNameUnion

Copied from browser_context.os_name when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextOsVersionUnion

type EventContextOsVersionUnion = shared.EventContextOsVersionUnion

Copied from browser_context.os_version when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextPixelRatioUnion

type EventContextPixelRatioUnion = shared.EventContextPixelRatioUnion

Copied from browser_context.pixel_ratio when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextScreenHeightPxUnion

type EventContextScreenHeightPxUnion = shared.EventContextScreenHeightPxUnion

Copied from browser_context.screen_height_px when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextScreenWidthPxUnion

type EventContextScreenWidthPxUnion = shared.EventContextScreenWidthPxUnion

Copied from browser_context.screen_width_px when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextTimezoneOffsetMinutesUnion

type EventContextTimezoneOffsetMinutesUnion = shared.EventContextTimezoneOffsetMinutesUnion

Copied from browser_context.timezone_offset_minutes when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextTimezoneUnion

type EventContextTimezoneUnion = shared.EventContextTimezoneUnion

Copied from browser_context.timezone when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextUserAgentUnion

type EventContextUserAgentUnion = shared.EventContextUserAgentUnion

Copied from browser_context.user_agent when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextViewportHeightPxUnion

type EventContextViewportHeightPxUnion = shared.EventContextViewportHeightPxUnion

Copied from browser_context.viewport_height_px when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventContextViewportWidthPxUnion

type EventContextViewportWidthPxUnion = shared.EventContextViewportWidthPxUnion

Copied from browser_context.viewport_width_px when primitive. See BrowserContext for the SDK type; the collector currently accepts any primitive here.

This is an alias to an internal type.

type EventIngestParams

type EventIngestParams struct {
	// A schema version 1 playback event. Extra properties are preserved.
	Event  AnalyticsEventUnionParam
	Origin param.Opt[string] `header:"Origin,omitzero" json:"-"`
	// Any of "identity".
	ContentEncoding EventIngestParamsContentEncoding `header:"Content-Encoding,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EventIngestParams) MarshalJSON

func (r EventIngestParams) MarshalJSON() (data []byte, err error)

func (*EventIngestParams) UnmarshalJSON

func (r *EventIngestParams) UnmarshalJSON(data []byte) error

type EventIngestParamsContentEncoding

type EventIngestParamsContentEncoding string
const (
	EventIngestParamsContentEncodingIdentity EventIngestParamsContentEncoding = "identity"
)

type EventIngestResponseUnion

type EventIngestResponseUnion struct {
	Accepted  bool `json:"accepted"`
	Duplicate bool `json:"duplicate"`
	JSON      struct {
		Accepted  respjson.Field
		Duplicate respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventIngestResponseUnion contains all possible properties and values from NativeCreated, NativeDuplicate.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (EventIngestResponseUnion) AsNativeCreated

func (u EventIngestResponseUnion) AsNativeCreated() (v NativeCreated)

func (EventIngestResponseUnion) AsNativeDuplicate

func (u EventIngestResponseUnion) AsNativeDuplicate() (v NativeDuplicate)

func (EventIngestResponseUnion) RawJSON

func (u EventIngestResponseUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventIngestResponseUnion) UnmarshalJSON

func (r *EventIngestResponseUnion) UnmarshalJSON(data []byte) error

type EventListParams

type EventListParams struct {
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Use next_cursor from the previous page. Keep the same filters, sort_by and
	// order. Video cursors from earlier versions are invalid; start a new pagination
	// sequence after upgrading.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent EventListParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType EventListParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// Raw-event queries only. Summaries and videos reject this parameter.
	//
	// Any of "chunkify.video.view_started", "chunkify.video.view_snapshot",
	// "chunkify.video.playback_error", "chunkify.video.view_ended",
	// "chunkify.video.playback_state_changed", "chunkify.video.rendition_changed",
	// "chunkify.video.seek_completed", "chunkify.video.subtitle_changed",
	// "chunkify.video.playback_rate_changed".
	EventName EventListParamsEventName `query:"event_name,omitzero" json:"-"`
	// Sort direction. Events and videos default to asc; views default to desc. Events
	// sort by ingestion sequence. Videos and views sort by sort_by with missing values
	// last. View ties use view_id in the requested direction; video metric ties use
	// video_id ascending.
	//
	// Any of "asc", "desc".
	Order EventListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (EventListParams) URLQuery

func (r EventListParams) URLQuery() (v url.Values, err error)

URLQuery serializes EventListParams's query parameters as `url.Values`.

type EventListParamsContinent

type EventListParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	EventListParamsContinentAf EventListParamsContinent = "AF"
	EventListParamsContinentAn EventListParamsContinent = "AN"
	EventListParamsContinentAs EventListParamsContinent = "AS"
	EventListParamsContinentEu EventListParamsContinent = "EU"
	EventListParamsContinentNa EventListParamsContinent = "NA"
	EventListParamsContinentOc EventListParamsContinent = "OC"
	EventListParamsContinentSa EventListParamsContinent = "SA"
)

type EventListParamsDeviceType

type EventListParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	EventListParamsDeviceTypeDesktop EventListParamsDeviceType = "desktop"
	EventListParamsDeviceTypeMobile  EventListParamsDeviceType = "mobile"
	EventListParamsDeviceTypeTablet  EventListParamsDeviceType = "tablet"
	EventListParamsDeviceTypeUnknown EventListParamsDeviceType = "unknown"
)

type EventListParamsEventName

type EventListParamsEventName string

Raw-event queries only. Summaries and videos reject this parameter.

const (
	EventListParamsEventNameChunkifyVideoViewStarted          EventListParamsEventName = "chunkify.video.view_started"
	EventListParamsEventNameChunkifyVideoViewSnapshot         EventListParamsEventName = "chunkify.video.view_snapshot"
	EventListParamsEventNameChunkifyVideoPlaybackError        EventListParamsEventName = "chunkify.video.playback_error"
	EventListParamsEventNameChunkifyVideoViewEnded            EventListParamsEventName = "chunkify.video.view_ended"
	EventListParamsEventNameChunkifyVideoPlaybackStateChanged EventListParamsEventName = "chunkify.video.playback_state_changed"
	EventListParamsEventNameChunkifyVideoRenditionChanged     EventListParamsEventName = "chunkify.video.rendition_changed"
	EventListParamsEventNameChunkifyVideoSeekCompleted        EventListParamsEventName = "chunkify.video.seek_completed"
	EventListParamsEventNameChunkifyVideoSubtitleChanged      EventListParamsEventName = "chunkify.video.subtitle_changed"
	EventListParamsEventNameChunkifyVideoPlaybackRateChanged  EventListParamsEventName = "chunkify.video.playback_rate_changed"
)

type EventListParamsOrder

type EventListParamsOrder string

Sort direction. Events and videos default to asc; views default to desc. Events sort by ingestion sequence. Videos and views sort by sort_by with missing values last. View ties use view_id in the requested direction; video metric ties use video_id ascending.

const (
	EventListParamsOrderAsc  EventListParamsOrder = "asc"
	EventListParamsOrderDesc EventListParamsOrder = "desc"
)

type EventPage

type EventPage struct {
	Events     []StoredEvent `json:"events" api:"required"`
	NextCursor string        `json:"next_cursor" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Events      respjson.Field
		NextCursor  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventPage) RawJSON

func (r EventPage) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventPage) UnmarshalJSON

func (r *EventPage) UnmarshalJSON(data []byte) error

type EventService

type EventService struct {
	Options []option.RequestOption
}

EventService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEventService method instead.

func NewEventService

func NewEventService(opts ...option.RequestOption) (r EventService)

NewEventService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EventService) Ingest

Send one playback event using a public key. Success confirms storage completed.

Configure the client with a public ingestion key for this method. The SDK sends the event you supply; it does not collect playback events automatically. For automatic browser player tracking, use `@chunkify/player-analytics`.

func (*EventService) List

List project events with filters and pagination. Use order=desc for the newest events.

func (*EventService) ListAutoPaging

List project events with filters and pagination. Use order=desc for the newest events.

type Export

type Export struct {
	ContentType constant.TextCsv `json:"content_type" default:"text/csv"`
	DownloadURL string           `json:"download_url" api:"required" format:"uri"`
	ExpiresAt   time.Time        `json:"expires_at" api:"required" format:"date-time"`
	Filename    string           `json:"filename" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContentType respjson.Field
		DownloadURL respjson.Field
		ExpiresAt   respjson.Field
		Filename    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Export) RawJSON

func (r Export) RawJSON() string

Returns the unmodified JSON received from the API

func (*Export) UnmarshalJSON

func (r *Export) UnmarshalJSON(data []byte) error

type ExportColumns

type ExportColumns struct {
	// Available CSV column names in default output order.
	Columns []string `json:"columns" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Columns     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ExportColumns) RawJSON

func (r ExportColumns) RawJSON() string

Returns the unmodified JSON received from the API

func (*ExportColumns) UnmarshalJSON

func (r *ExportColumns) UnmarshalJSON(data []byte) error

type ExportListColumnsParams

type ExportListColumnsParams struct {
	// Report whose CSV columns to list.
	//
	// Any of "summary", "quality", "engagement", "timeseries", "videos", "events",
	// "views", "errors", "dimensions", "renditions", "subtitles", "playback_rates",
	// "retention".
	Resource ExportListColumnsParamsResource `query:"resource,omitzero" api:"required" json:"-"`
	// Optional on summary, quality and engagement. Group views by this field on their
	// first retained start. Missing, null and nonstring context forms a null group;
	// the literal device type unknown stays separate. Groups sort by views descending,
	// then value ascending with null first for ties. Pagination is available only with
	// group_by. Location uses the first retained start too. City groups use the stored
	// name; filter by country to avoid combining names shared by different countries.
	// Page groups use the first retained start even if playback continues after
	// navigation. Filter by page_origin when grouping page_path to distinguish
	// identical paths on different sites. video_title groups by the title on each
	// view's first retained start, so a renamed video counts each view under the title
	// it started with. user_id groups by the user ID on each view's first retained
	// start. Use custom.<key>, such as custom.plan, to group by a custom dimension;
	// views without the key form the null group.
	GroupBy ExportListColumnsParamsGroupBy `query:"group_by,omitzero" json:"-"`
	// Metric set for every time bucket. Uses the same calculations and sample counts
	// as the corresponding totals route.
	//
	// Any of "summary", "quality", "engagement".
	Kind ExportListColumnsParamsKind `query:"kind,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ExportListColumnsParams) URLQuery

func (r ExportListColumnsParams) URLQuery() (v url.Values, err error)

URLQuery serializes ExportListColumnsParams's query parameters as `url.Values`.

type ExportListColumnsParamsGroupBy

type ExportListColumnsParamsGroupBy string

Optional on summary, quality and engagement. Group views by this field on their first retained start. Missing, null and nonstring context forms a null group; the literal device type unknown stays separate. Groups sort by views descending, then value ascending with null first for ties. Pagination is available only with group_by. Location uses the first retained start too. City groups use the stored name; filter by country to avoid combining names shared by different countries. Page groups use the first retained start even if playback continues after navigation. Filter by page_origin when grouping page_path to distinguish identical paths on different sites. video_title groups by the title on each view's first retained start, so a renamed video counts each view under the title it started with. user_id groups by the user ID on each view's first retained start. Use custom.<key>, such as custom.plan, to group by a custom dimension; views without the key form the null group.

const (
	ExportListColumnsParamsGroupByBrowserName      ExportListColumnsParamsGroupBy = "browser_name"
	ExportListColumnsParamsGroupByOsName           ExportListColumnsParamsGroupBy = "os_name"
	ExportListColumnsParamsGroupByDeviceType       ExportListColumnsParamsGroupBy = "device_type"
	ExportListColumnsParamsGroupByContinent        ExportListColumnsParamsGroupBy = "continent"
	ExportListColumnsParamsGroupByCountry          ExportListColumnsParamsGroupBy = "country"
	ExportListColumnsParamsGroupByCity             ExportListColumnsParamsGroupBy = "city"
	ExportListColumnsParamsGroupByPageOrigin       ExportListColumnsParamsGroupBy = "page_origin"
	ExportListColumnsParamsGroupByPagePath         ExportListColumnsParamsGroupBy = "page_path"
	ExportListColumnsParamsGroupBySubtitleLanguage ExportListColumnsParamsGroupBy = "subtitle_language"
	ExportListColumnsParamsGroupByPlaybackRate     ExportListColumnsParamsGroupBy = "playback_rate"
	ExportListColumnsParamsGroupByVideoTitle       ExportListColumnsParamsGroupBy = "video_title"
	ExportListColumnsParamsGroupByUserID           ExportListColumnsParamsGroupBy = "user_id"
)

type ExportListColumnsParamsKind

type ExportListColumnsParamsKind string

Metric set for every time bucket. Uses the same calculations and sample counts as the corresponding totals route.

const (
	ExportListColumnsParamsKindSummary    ExportListColumnsParamsKind = "summary"
	ExportListColumnsParamsKindQuality    ExportListColumnsParamsKind = "quality"
	ExportListColumnsParamsKindEngagement ExportListColumnsParamsKind = "engagement"
)

type ExportListColumnsParamsResource

type ExportListColumnsParamsResource string

Report whose CSV columns to list.

const (
	ExportListColumnsParamsResourceSummary       ExportListColumnsParamsResource = "summary"
	ExportListColumnsParamsResourceQuality       ExportListColumnsParamsResource = "quality"
	ExportListColumnsParamsResourceEngagement    ExportListColumnsParamsResource = "engagement"
	ExportListColumnsParamsResourceTimeseries    ExportListColumnsParamsResource = "timeseries"
	ExportListColumnsParamsResourceVideos        ExportListColumnsParamsResource = "videos"
	ExportListColumnsParamsResourceEvents        ExportListColumnsParamsResource = "events"
	ExportListColumnsParamsResourceViews         ExportListColumnsParamsResource = "views"
	ExportListColumnsParamsResourceErrors        ExportListColumnsParamsResource = "errors"
	ExportListColumnsParamsResourceDimensions    ExportListColumnsParamsResource = "dimensions"
	ExportListColumnsParamsResourceRenditions    ExportListColumnsParamsResource = "renditions"
	ExportListColumnsParamsResourceSubtitles     ExportListColumnsParamsResource = "subtitles"
	ExportListColumnsParamsResourcePlaybackRates ExportListColumnsParamsResource = "playback_rates"
	ExportListColumnsParamsResourceRetention     ExportListColumnsParamsResource = "retention"
)

type ExportNewParams

type ExportNewParams struct {
	// Any of "summary", "quality", "engagement", "timeseries", "videos", "events",
	// "views", "errors", "dimensions", "renditions", "subtitles", "playback_rates",
	// "retention".
	Resource ExportNewParamsResource `json:"resource,omitzero" api:"required"`
	// CSV column names in output order. Omit for all columns. Get the available names
	// from GET /v1/exports using the same resource, kind and group_by. Unknown names,
	// duplicates and empty selections are rejected.
	Columns []string         `json:"columns,omitzero"`
	Query   ExportQueryParam `json:"query,omitzero"`
	// contains filtered or unexported fields
}

func (ExportNewParams) MarshalJSON

func (r ExportNewParams) MarshalJSON() (data []byte, err error)

func (*ExportNewParams) UnmarshalJSON

func (r *ExportNewParams) UnmarshalJSON(data []byte) error

type ExportNewParamsResource

type ExportNewParamsResource string
const (
	ExportNewParamsResourceSummary       ExportNewParamsResource = "summary"
	ExportNewParamsResourceQuality       ExportNewParamsResource = "quality"
	ExportNewParamsResourceEngagement    ExportNewParamsResource = "engagement"
	ExportNewParamsResourceTimeseries    ExportNewParamsResource = "timeseries"
	ExportNewParamsResourceVideos        ExportNewParamsResource = "videos"
	ExportNewParamsResourceEvents        ExportNewParamsResource = "events"
	ExportNewParamsResourceViews         ExportNewParamsResource = "views"
	ExportNewParamsResourceErrors        ExportNewParamsResource = "errors"
	ExportNewParamsResourceDimensions    ExportNewParamsResource = "dimensions"
	ExportNewParamsResourceRenditions    ExportNewParamsResource = "renditions"
	ExportNewParamsResourceSubtitles     ExportNewParamsResource = "subtitles"
	ExportNewParamsResourcePlaybackRates ExportNewParamsResource = "playback_rates"
	ExportNewParamsResourceRetention     ExportNewParamsResource = "retention"
)

type ExportQueryContinent

type ExportQueryContinent string
const (
	ExportQueryContinentAf ExportQueryContinent = "AF"
	ExportQueryContinentAn ExportQueryContinent = "AN"
	ExportQueryContinentAs ExportQueryContinent = "AS"
	ExportQueryContinentEu ExportQueryContinent = "EU"
	ExportQueryContinentNa ExportQueryContinent = "NA"
	ExportQueryContinentOc ExportQueryContinent = "OC"
	ExportQueryContinentSa ExportQueryContinent = "SA"
)

type ExportQueryDeviceType

type ExportQueryDeviceType string
const (
	ExportQueryDeviceTypeDesktop ExportQueryDeviceType = "desktop"
	ExportQueryDeviceTypeMobile  ExportQueryDeviceType = "mobile"
	ExportQueryDeviceTypeTablet  ExportQueryDeviceType = "tablet"
	ExportQueryDeviceTypeUnknown ExportQueryDeviceType = "unknown"
)

type ExportQueryDimension

type ExportQueryDimension string
const (
	ExportQueryDimensionBrowserName      ExportQueryDimension = "browser_name"
	ExportQueryDimensionOsName           ExportQueryDimension = "os_name"
	ExportQueryDimensionDeviceType       ExportQueryDimension = "device_type"
	ExportQueryDimensionVideoID          ExportQueryDimension = "video_id"
	ExportQueryDimensionViewerID         ExportQueryDimension = "viewer_id"
	ExportQueryDimensionUserID           ExportQueryDimension = "user_id"
	ExportQueryDimensionVideoTitle       ExportQueryDimension = "video_title"
	ExportQueryDimensionContinent        ExportQueryDimension = "continent"
	ExportQueryDimensionCountry          ExportQueryDimension = "country"
	ExportQueryDimensionCity             ExportQueryDimension = "city"
	ExportQueryDimensionPageOrigin       ExportQueryDimension = "page_origin"
	ExportQueryDimensionPagePath         ExportQueryDimension = "page_path"
	ExportQueryDimensionSubtitleLanguage ExportQueryDimension = "subtitle_language"
	ExportQueryDimensionPlaybackRate     ExportQueryDimension = "playback_rate"
	ExportQueryDimensionCustomKeys       ExportQueryDimension = "custom_keys"
)

type ExportQueryEventName

type ExportQueryEventName string
const (
	ExportQueryEventNameChunkifyVideoViewStarted          ExportQueryEventName = "chunkify.video.view_started"
	ExportQueryEventNameChunkifyVideoViewSnapshot         ExportQueryEventName = "chunkify.video.view_snapshot"
	ExportQueryEventNameChunkifyVideoPlaybackError        ExportQueryEventName = "chunkify.video.playback_error"
	ExportQueryEventNameChunkifyVideoViewEnded            ExportQueryEventName = "chunkify.video.view_ended"
	ExportQueryEventNameChunkifyVideoPlaybackStateChanged ExportQueryEventName = "chunkify.video.playback_state_changed"
	ExportQueryEventNameChunkifyVideoRenditionChanged     ExportQueryEventName = "chunkify.video.rendition_changed"
	ExportQueryEventNameChunkifyVideoSeekCompleted        ExportQueryEventName = "chunkify.video.seek_completed"
	ExportQueryEventNameChunkifyVideoSubtitleChanged      ExportQueryEventName = "chunkify.video.subtitle_changed"
	ExportQueryEventNameChunkifyVideoPlaybackRateChanged  ExportQueryEventName = "chunkify.video.playback_rate_changed"
)

type ExportQueryGroupBy

type ExportQueryGroupBy string
const (
	ExportQueryGroupByBrowserName      ExportQueryGroupBy = "browser_name"
	ExportQueryGroupByOsName           ExportQueryGroupBy = "os_name"
	ExportQueryGroupByDeviceType       ExportQueryGroupBy = "device_type"
	ExportQueryGroupByContinent        ExportQueryGroupBy = "continent"
	ExportQueryGroupByCountry          ExportQueryGroupBy = "country"
	ExportQueryGroupByCity             ExportQueryGroupBy = "city"
	ExportQueryGroupByPageOrigin       ExportQueryGroupBy = "page_origin"
	ExportQueryGroupByPagePath         ExportQueryGroupBy = "page_path"
	ExportQueryGroupBySubtitleLanguage ExportQueryGroupBy = "subtitle_language"
	ExportQueryGroupByPlaybackRate     ExportQueryGroupBy = "playback_rate"
	ExportQueryGroupByVideoTitle       ExportQueryGroupBy = "video_title"
	ExportQueryGroupByUserID           ExportQueryGroupBy = "user_id"
)

type ExportQueryInterval

type ExportQueryInterval string
const (
	ExportQueryIntervalHour ExportQueryInterval = "hour"
	ExportQueryIntervalDay  ExportQueryInterval = "day"
)

type ExportQueryKind

type ExportQueryKind string
const (
	ExportQueryKindSummary    ExportQueryKind = "summary"
	ExportQueryKindQuality    ExportQueryKind = "quality"
	ExportQueryKindEngagement ExportQueryKind = "engagement"
)

type ExportQueryOrder

type ExportQueryOrder string
const (
	ExportQueryOrderAsc  ExportQueryOrder = "asc"
	ExportQueryOrderDesc ExportQueryOrder = "desc"
)

type ExportQueryParam

type ExportQueryParam struct {
	BrowserName   param.Opt[string]    `json:"browser_name,omitzero"`
	City          param.Opt[string]    `json:"city,omitzero"`
	Country       param.Opt[string]    `json:"country,omitzero"`
	From          param.Opt[time.Time] `json:"from,omitzero" format:"date-time"`
	HasFatalError param.Opt[bool]      `json:"has_fatal_error,omitzero"`
	OsName        param.Opt[string]    `json:"os_name,omitzero"`
	// Exact, case-sensitive page_origin from the first retained view start, or each
	// event for raw-event exports.
	PageOrigin param.Opt[string] `json:"page_origin,omitzero"`
	// Exact, case-sensitive page_path from the first retained view start, or each
	// event for raw-event exports.
	PagePath         param.Opt[string]    `json:"page_path,omitzero"`
	PlaybackRate     param.Opt[string]    `json:"playback_rate,omitzero"`
	SubtitleLanguage param.Opt[string]    `json:"subtitle_language,omitzero"`
	To               param.Opt[time.Time] `json:"to,omitzero" format:"date-time"`
	UserID           param.Opt[string]    `json:"user_id,omitzero"`
	VideoID          param.Opt[string]    `json:"video_id,omitzero"`
	VideoTitle       param.Opt[string]    `json:"video_title,omitzero"`
	ViewID           param.Opt[string]    `json:"view_id,omitzero"`
	ViewerID         param.Opt[string]    `json:"viewer_id,omitzero"`
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent ExportQueryContinent `json:"continent,omitzero"`
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType ExportQueryDeviceType `json:"device_type,omitzero"`
	// One custom dimension's values, such as custom.plan.
	Dimension ExportQueryDimension `json:"dimension,omitzero"`
	// Any of "chunkify.video.view_started", "chunkify.video.view_snapshot",
	// "chunkify.video.playback_error", "chunkify.video.view_ended",
	// "chunkify.video.playback_state_changed", "chunkify.video.rendition_changed",
	// "chunkify.video.seek_completed", "chunkify.video.subtitle_changed",
	// "chunkify.video.playback_rate_changed".
	EventName ExportQueryEventName `json:"event_name,omitzero"`
	// A custom dimension key, such as custom.plan.
	GroupBy ExportQueryGroupBy `json:"group_by,omitzero"`
	// Any of "hour", "day".
	Interval ExportQueryInterval `json:"interval,omitzero"`
	// Any of "summary", "quality", "engagement".
	Kind ExportQueryKind `json:"kind,omitzero"`
	// Any of "asc", "desc".
	Order ExportQueryOrder `json:"order,omitzero"`
	// Videos or views only. Use a sort field supported by the selected resource.
	// Defaults to video_id for videos and started_at for views.
	//
	// Any of "video_id", "views", "unique_viewers", "total_playing_time_ms",
	// "playback_score", "started_at", "view_id", "device_type", "playing_time_ms",
	// "startup_time_ms", "rebuffer_duration_ms".
	SortBy ExportQuerySortBy `json:"sort_by,omitzero"`
	// contains filtered or unexported fields
}

func (ExportQueryParam) MarshalJSON

func (r ExportQueryParam) MarshalJSON() (data []byte, err error)

func (*ExportQueryParam) UnmarshalJSON

func (r *ExportQueryParam) UnmarshalJSON(data []byte) error

type ExportQuerySortBy

type ExportQuerySortBy string

Videos or views only. Use a sort field supported by the selected resource. Defaults to video_id for videos and started_at for views.

const (
	ExportQuerySortByVideoID            ExportQuerySortBy = "video_id"
	ExportQuerySortByViews              ExportQuerySortBy = "views"
	ExportQuerySortByUniqueViewers      ExportQuerySortBy = "unique_viewers"
	ExportQuerySortByTotalPlayingTimeMs ExportQuerySortBy = "total_playing_time_ms"
	ExportQuerySortByPlaybackScore      ExportQuerySortBy = "playback_score"
	ExportQuerySortByStartedAt          ExportQuerySortBy = "started_at"
	ExportQuerySortByViewID             ExportQuerySortBy = "view_id"
	ExportQuerySortByDeviceType         ExportQuerySortBy = "device_type"
	ExportQuerySortByPlayingTimeMs      ExportQuerySortBy = "playing_time_ms"
	ExportQuerySortByStartupTimeMs      ExportQuerySortBy = "startup_time_ms"
	ExportQuerySortByRebufferDurationMs ExportQuerySortBy = "rebuffer_duration_ms"
)

type ExportService

type ExportService struct {
	Options []option.RequestOption
}

ExportService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewExportService method instead.

func NewExportService

func NewExportService(opts ...option.RequestOption) (r ExportService)

NewExportService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ExportService) Download

func (r *ExportService) Download(ctx context.Context, token string, opts ...option.RequestOption) (res *string, err error)

The token authorizes only its saved project and query. Requires no Authorization header and accepts no query parameters. Generate CSV on demand from one read snapshot on a dedicated connection; stream with bounded application buffers and backpressure. Dataset is selected when the link is opened. Rows are not capped by query pagination. Nested metric columns use slash-separated paths. Events have documented scalar columns and flat context.\* columns. Custom attributes, nested arrays and historical OTLP payloads are excluded. CSV cells never contain JSON objects or arrays. Nulls are empty cells; spreadsheet-formula strings are prefixed with an apostrophe. Interrupted or failed downloads terminate the stream; retry the full download. No files are retained. Defaults: 2 download starts/minute per project with burst capacity 2, one active CSV generation per project and four server-wide. Limits are shared across keys and links. Excess requests receive 429 with Retry-After instead of queueing. Override limits in config.toml [rate_limits]. Link expiry is checked before starting, not during an active download. S3 retention/deletion can remove source objects during a download.

The download URL contains the credential needed for this request. Treat it as a secret until it expires. You can call this method without configuring an API key on the client.

func (*ExportService) ListColumns

func (r *ExportService) ListColumns(ctx context.Context, query ExportListColumnsParams, opts ...option.RequestOption) (res *ExportColumns, err error)

Discover column names before creating an export. Requires a project private key; read-only keys are allowed. kind applies only to timeseries. group_by applies to summary, quality and engagement. Date ranges and filters do not change the columns.

func (*ExportService) New

func (r *ExportService) New(ctx context.Context, body ExportNewParams, opts ...option.RequestOption) (res *Export, err error)

Create a scoped 256-bit random download token for all matching rows. Requires a project private key; read-only keys are allowed. The link expires after 30 minutes and is invalidated by issuer-key rotation/revocation, project deletion or collector restart. No CSV is generated or retained at creation. limit/cursor are rejected. Existing query endpoints continue returning JSON. Event CSV files contain documented scalar event fields and flat context.\* columns. Custom attributes, nested arrays and historical OTLP payloads are excluded. CSV cells never contain JSON objects or arrays; use GET /v1/events for original payloads.

type Health

type Health struct {
	Status constant.Ok `json:"status" default:"ok"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Health) RawJSON

func (r Health) RawJSON() string

Returns the unmodified JSON received from the API

func (*Health) UnmarshalJSON

func (r *Health) UnmarshalJSON(data []byte) error

type HealthService

type HealthService struct {
	Options []option.RequestOption
}

Health and private ingestion status.

HealthService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewHealthService method instead.

func NewHealthService

func NewHealthService(opts ...option.RequestOption) (r HealthService)

NewHealthService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*HealthService) Get

func (r *HealthService) Get(ctx context.Context, opts ...option.RequestOption) (res *Health, err error)

Check whether the service is ready.

No API key is required. This checks collector readiness and does not return project analytics.

type MetricCountRatio

type MetricCountRatio = shared.MetricCountRatio

View count and fraction of its documented denominator. The ratio is null when that denominator is zero.

This is an alias to an internal type.

type Metrics

type Metrics struct {
	TotalPlayingTimeMs float64 `json:"total_playing_time_ms" api:"required"`
	UniqueViewers      int64   `json:"unique_viewers" api:"required"`
	Views              int64   `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		TotalPlayingTimeMs respjson.Field
		UniqueViewers      respjson.Field
		Views              respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Metrics) RawJSON

func (r Metrics) RawJSON() string

Returns the unmodified JSON received from the API

func (*Metrics) UnmarshalJSON

func (r *Metrics) UnmarshalJSON(data []byte) error

type MetricsBreakdownPage

type MetricsBreakdownPage struct {
	// A custom dimension key, such as custom.plan.
	GroupBy    MetricsBreakdownPageGroupBy `json:"group_by" api:"required"`
	Groups     []MetricsBreakdownPageGroup `json:"groups" api:"required"`
	NextCursor string                      `json:"next_cursor" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GroupBy     respjson.Field
		Groups      respjson.Field
		NextCursor  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MetricsBreakdownPage) RawJSON

func (r MetricsBreakdownPage) RawJSON() string

Returns the unmodified JSON received from the API

func (*MetricsBreakdownPage) UnmarshalJSON

func (r *MetricsBreakdownPage) UnmarshalJSON(data []byte) error

type MetricsBreakdownPageGroup

type MetricsBreakdownPageGroup struct {
	Data  Metrics `json:"data" api:"required"`
	Value string  `json:"value" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MetricsBreakdownPageGroup) RawJSON

func (r MetricsBreakdownPageGroup) RawJSON() string

Returns the unmodified JSON received from the API

func (*MetricsBreakdownPageGroup) UnmarshalJSON

func (r *MetricsBreakdownPageGroup) UnmarshalJSON(data []byte) error

type MetricsBreakdownPageGroupBy

type MetricsBreakdownPageGroupBy string
const (
	MetricsBreakdownPageGroupByBrowserName      MetricsBreakdownPageGroupBy = "browser_name"
	MetricsBreakdownPageGroupByOsName           MetricsBreakdownPageGroupBy = "os_name"
	MetricsBreakdownPageGroupByDeviceType       MetricsBreakdownPageGroupBy = "device_type"
	MetricsBreakdownPageGroupByContinent        MetricsBreakdownPageGroupBy = "continent"
	MetricsBreakdownPageGroupByCountry          MetricsBreakdownPageGroupBy = "country"
	MetricsBreakdownPageGroupByCity             MetricsBreakdownPageGroupBy = "city"
	MetricsBreakdownPageGroupByPageOrigin       MetricsBreakdownPageGroupBy = "page_origin"
	MetricsBreakdownPageGroupByPagePath         MetricsBreakdownPageGroupBy = "page_path"
	MetricsBreakdownPageGroupBySubtitleLanguage MetricsBreakdownPageGroupBy = "subtitle_language"
	MetricsBreakdownPageGroupByPlaybackRate     MetricsBreakdownPageGroupBy = "playback_rate"
	MetricsBreakdownPageGroupByVideoTitle       MetricsBreakdownPageGroupBy = "video_title"
	MetricsBreakdownPageGroupByUserID           MetricsBreakdownPageGroupBy = "user_id"
)

type MetricsResponseUnion

type MetricsResponseUnion struct {
	// This field is from variant [Metrics].
	TotalPlayingTimeMs float64 `json:"total_playing_time_ms"`
	// This field is from variant [Metrics].
	UniqueViewers int64 `json:"unique_viewers"`
	// This field is from variant [Metrics].
	Views int64 `json:"views"`
	// This field is from variant [MetricsBreakdownPage].
	GroupBy MetricsBreakdownPageGroupBy `json:"group_by"`
	// This field is from variant [MetricsBreakdownPage].
	Groups []MetricsBreakdownPageGroup `json:"groups"`
	// This field is from variant [MetricsBreakdownPage].
	NextCursor string `json:"next_cursor"`
	JSON       struct {
		TotalPlayingTimeMs respjson.Field
		UniqueViewers      respjson.Field
		Views              respjson.Field
		GroupBy            respjson.Field
		Groups             respjson.Field
		NextCursor         respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

MetricsResponseUnion contains all possible properties and values from Metrics, MetricsBreakdownPage.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (MetricsResponseUnion) AsMetrics

func (u MetricsResponseUnion) AsMetrics() (v Metrics)

func (MetricsResponseUnion) AsMetricsBreakdownPage

func (u MetricsResponseUnion) AsMetricsBreakdownPage() (v MetricsBreakdownPage)

func (MetricsResponseUnion) RawJSON

func (u MetricsResponseUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*MetricsResponseUnion) UnmarshalJSON

func (r *MetricsResponseUnion) UnmarshalJSON(data []byte) error

type NativeCreated

type NativeCreated struct {
	Accepted  bool `json:"accepted" api:"required"`
	Duplicate bool `json:"duplicate" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accepted    respjson.Field
		Duplicate   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NativeCreated) RawJSON

func (r NativeCreated) RawJSON() string

Returns the unmodified JSON received from the API

func (*NativeCreated) UnmarshalJSON

func (r *NativeCreated) UnmarshalJSON(data []byte) error

type NativeDuplicate

type NativeDuplicate struct {
	Accepted  bool `json:"accepted" api:"required"`
	Duplicate bool `json:"duplicate" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accepted    respjson.Field
		Duplicate   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NativeDuplicate) RawJSON

func (r NativeDuplicate) RawJSON() string

Returns the unmodified JSON received from the API

func (*NativeDuplicate) UnmarshalJSON

func (r *NativeDuplicate) UnmarshalJSON(data []byte) error

type OtlpAnyValue

type OtlpAnyValue = shared.OtlpAnyValue

Standard OTLP AnyValue in a preserved resource, scope or body. This collector does not decode these fields into the event.

This is an alias to an internal type.

type OtlpAnyValueArrayValue

type OtlpAnyValueArrayValue = shared.OtlpAnyValueArrayValue

This is an alias to an internal type.

type OtlpAnyValueIntValueUnion

type OtlpAnyValueIntValueUnion = shared.OtlpAnyValueIntValueUnion

Signed int64. Strings avoid JavaScript precision loss.

This is an alias to an internal type.

type OtlpAnyValueKvlistValue

type OtlpAnyValueKvlistValue = shared.OtlpAnyValueKvlistValue

This is an alias to an internal type.

type OtlpAttribute

type OtlpAttribute = shared.OtlpAttribute

An absent or null key decodes to the empty string; duplicate decoded keys reject the request. An absent value decodes to null.

This is an alias to an internal type.

type OtlpAttributeValueObject

type OtlpAttributeValueObject = shared.OtlpAttributeValueObject

This is an alias to an internal type.

type OtlpAttributeValueObject2

type OtlpAttributeValueObject2 = shared.OtlpAttributeValueObject2

This is an alias to an internal type.

type OtlpAttributeValueObject3

type OtlpAttributeValueObject3 = shared.OtlpAttributeValueObject3

This is an alias to an internal type.

type OtlpAttributeValueObject4

type OtlpAttributeValueObject4 = shared.OtlpAttributeValueObject4

This is an alias to an internal type.

type OtlpAttributeValueObject5

type OtlpAttributeValueObject5 = shared.OtlpAttributeValueObject5

This is an alias to an internal type.

type OtlpAttributeValueObject6

type OtlpAttributeValueObject6 = shared.OtlpAttributeValueObject6

This is an alias to an internal type.

type OtlpAttributeValueObject7

type OtlpAttributeValueObject7 = shared.OtlpAttributeValueObject7

This is an alias to an internal type.

type OtlpAttributeValueUnion

type OtlpAttributeValueUnion = shared.OtlpAttributeValueUnion

A typed log attribute. At most one value field can be set. Binary values are unsupported.

This is an alias to an internal type.

type OtlpContextAttribute

type OtlpContextAttribute = shared.OtlpContextAttribute

This is an alias to an internal type.

type OtlpLogRecord

type OtlpLogRecord = shared.OtlpLogRecord

A playback event in log attributes. Duplicate attributes and invalid event fields reject the request.

This is an alias to an internal type.

type OtlpResource

type OtlpResource = shared.OtlpResource

This is an alias to an internal type.

type OtlpScope

type OtlpScope = shared.OtlpScope

This is an alias to an internal type.

type PlaybackError

type PlaybackError struct {
	ConnectorName            string  `json:"connector_name" api:"required"`
	ConnectorVersion         string  `json:"connector_version" api:"required"`
	DeliveryHostname         string  `json:"delivery_hostname" api:"required"`
	DeliveryRequestCount     float64 `json:"delivery_request_count" api:"required"`
	DeliveryThroughputBps    float64 `json:"delivery_throughput_bps" api:"required"`
	DeliveryTransferredBytes float64 `json:"delivery_transferred_bytes" api:"required"`
	DroppedVideoFrames       float64 `json:"dropped_video_frames" api:"required"`
	Environment              string  `json:"environment" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory          PlaybackErrorErrorCategory          `json:"error_category" api:"required"`
	ErrorCode              PlaybackErrorErrorCodeUnion         `json:"error_code" api:"required"`
	ErrorFatal             bool                                `json:"error_fatal" api:"required"`
	ErrorPlayheadSeconds   float64                             `json:"error_playhead_seconds" api:"required"`
	EventID                string                              `json:"event_id" api:"required" format:"uuid"`
	EventName              constant.ChunkifyVideoPlaybackError `json:"event_name" default:"chunkify.video.playback_error"`
	FirstVideoFrameTimeMs  float64                             `json:"first_video_frame_time_ms" api:"required"`
	FurthestProgressRatio  float64                             `json:"furthest_progress_ratio" api:"required"`
	MaximumPlayheadSeconds float64                             `json:"maximum_playhead_seconds" api:"required"`
	MediaDurationSeconds   float64                             `json:"media_duration_seconds" api:"required"`
	MediaHeightPx          float64                             `json:"media_height_px" api:"required"`
	MediaWidthPx           float64                             `json:"media_width_px" api:"required"`
	OccurredAt             time.Time                           `json:"occurred_at" api:"required" format:"date-time"`
	PlayerHeightPx         float64                             `json:"player_height_px" api:"required"`
	PlayerName             string                              `json:"player_name" api:"required"`
	PlayerVersion          string                              `json:"player_version" api:"required"`
	PlayerWidthPx          float64                             `json:"player_width_px" api:"required"`
	PlayingTimeMs          float64                             `json:"playing_time_ms" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason               PlaybackErrorReason           `json:"reason" api:"required"`
	RebufferCount        float64                       `json:"rebuffer_count" api:"required"`
	RebufferDurationMs   float64                       `json:"rebuffer_duration_ms" api:"required"`
	RebufferRatio        float64                       `json:"rebuffer_ratio" api:"required"`
	RenditionPlayingTime []shared.RenditionPlayingTime `json:"rendition_playing_time" api:"required"`
	RenditionSwitchCount float64                       `json:"rendition_switch_count" api:"required"`
	SchemaVersion        float64                       `json:"schema_version" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName                     string  `json:"sdk_name" api:"required"`
	SDKVersion                  string  `json:"sdk_version" api:"required"`
	SeekCount                   float64 `json:"seek_count" api:"required"`
	SeekDurationMs              float64 `json:"seek_duration_ms" api:"required"`
	SelectedRenditionBitrateBps float64 `json:"selected_rendition_bitrate_bps" api:"required"`
	SelectedRenditionCodec      string  `json:"selected_rendition_codec" api:"required"`
	SelectedRenditionHeight     float64 `json:"selected_rendition_height" api:"required"`
	SelectedRenditionWidth      float64 `json:"selected_rendition_width" api:"required"`
	Sequence                    int64   `json:"sequence" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome   PlaybackErrorStartupOutcome `json:"startup_outcome" api:"required"`
	StartupTimeMs    float64                     `json:"startup_time_ms" api:"required"`
	TotalVideoFrames float64                     `json:"total_video_frames" api:"required"`
	VideoID          string                      `json:"video_id" api:"required"`
	ViewID           string                      `json:"view_id" api:"required" format:"uuid"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID string `json:"viewer_id" api:"required"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContext `json:"browser_context" api:"nullable"`
	// Current playback rate, rounded to two decimals, such as 1, 1.5 or 2; from 0.01
	// to 16. Optional.
	PlaybackRate float64 `json:"playback_rate" api:"nullable"`
	// Cumulative playing time per playback rate for this attempt. At most 32 entries.
	// Optional.
	PlaybackRatePlayingTime []shared.PlaybackRatePlayingTime `json:"playback_rate_playing_time" api:"nullable"`
	// Cumulative played media ranges for this attempt, sorted and merged without
	// overlaps. Seeking, pauses and buffering are excluded. Missing or null means
	// unavailable; an empty array means measured but no section played. Replaying a
	// section does not add another range.
	PlayedRanges []shared.PlayedRange `json:"played_ranges" api:"nullable"`
	// Current media position at this event, not the maximum reached.
	PlayheadSeconds float64 `json:"playhead_seconds" api:"nullable"`
	// Language tag (BCP 47) of the showing subtitles or captions track; und when the
	// track declares no language; null when subtitles are off. Optional.
	SubtitleLanguage string `json:"subtitle_language" api:"nullable"`
	// Cumulative playing time per subtitle language for this attempt, null language
	// meaning subtitles off. At most 32 entries. Optional.
	SubtitlePlayingTime []shared.SubtitlePlayingTime `json:"subtitle_playing_time" api:"nullable"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID string `json:"user_id" api:"nullable"`
	// Optional human-readable video title for reports.
	VideoTitle string `json:"video_title" api:"nullable"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState PlaybackErrorVisibilityState `json:"visibility_state" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorName               respjson.Field
		ConnectorVersion            respjson.Field
		DeliveryHostname            respjson.Field
		DeliveryRequestCount        respjson.Field
		DeliveryThroughputBps       respjson.Field
		DeliveryTransferredBytes    respjson.Field
		DroppedVideoFrames          respjson.Field
		Environment                 respjson.Field
		ErrorCategory               respjson.Field
		ErrorCode                   respjson.Field
		ErrorFatal                  respjson.Field
		ErrorPlayheadSeconds        respjson.Field
		EventID                     respjson.Field
		EventName                   respjson.Field
		FirstVideoFrameTimeMs       respjson.Field
		FurthestProgressRatio       respjson.Field
		MaximumPlayheadSeconds      respjson.Field
		MediaDurationSeconds        respjson.Field
		MediaHeightPx               respjson.Field
		MediaWidthPx                respjson.Field
		OccurredAt                  respjson.Field
		PlayerHeightPx              respjson.Field
		PlayerName                  respjson.Field
		PlayerVersion               respjson.Field
		PlayerWidthPx               respjson.Field
		PlayingTimeMs               respjson.Field
		Reason                      respjson.Field
		RebufferCount               respjson.Field
		RebufferDurationMs          respjson.Field
		RebufferRatio               respjson.Field
		RenditionPlayingTime        respjson.Field
		RenditionSwitchCount        respjson.Field
		SchemaVersion               respjson.Field
		SDKName                     respjson.Field
		SDKVersion                  respjson.Field
		SeekCount                   respjson.Field
		SeekDurationMs              respjson.Field
		SelectedRenditionBitrateBps respjson.Field
		SelectedRenditionCodec      respjson.Field
		SelectedRenditionHeight     respjson.Field
		SelectedRenditionWidth      respjson.Field
		Sequence                    respjson.Field
		StartupOutcome              respjson.Field
		StartupTimeMs               respjson.Field
		TotalVideoFrames            respjson.Field
		VideoID                     respjson.Field
		ViewID                      respjson.Field
		ViewerID                    respjson.Field
		BrowserContext              respjson.Field
		PlaybackRate                respjson.Field
		PlaybackRatePlayingTime     respjson.Field
		PlayedRanges                respjson.Field
		PlayheadSeconds             respjson.Field
		SubtitleLanguage            respjson.Field
		SubtitlePlayingTime         respjson.Field
		UserID                      respjson.Field
		VideoTitle                  respjson.Field
		VisibilityState             respjson.Field
		ExtraFields                 map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlaybackError) RawJSON

func (r PlaybackError) RawJSON() string

Returns the unmodified JSON received from the API

func (PlaybackError) ToParam

func (r PlaybackError) ToParam() PlaybackErrorParam

ToParam converts this PlaybackError to a PlaybackErrorParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with PlaybackErrorParam.Overrides()

func (*PlaybackError) UnmarshalJSON

func (r *PlaybackError) UnmarshalJSON(data []byte) error

type PlaybackErrorErrorCategory

type PlaybackErrorErrorCategory string
const (
	PlaybackErrorErrorCategoryAborted     PlaybackErrorErrorCategory = "aborted"
	PlaybackErrorErrorCategoryNetwork     PlaybackErrorErrorCategory = "network"
	PlaybackErrorErrorCategoryDecode      PlaybackErrorErrorCategory = "decode"
	PlaybackErrorErrorCategoryUnsupported PlaybackErrorErrorCategory = "unsupported"
	PlaybackErrorErrorCategoryUnknown     PlaybackErrorErrorCategory = "unknown"
)

type PlaybackErrorErrorCodeUnion

type PlaybackErrorErrorCodeUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

PlaybackErrorErrorCodeUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (PlaybackErrorErrorCodeUnion) AsFloat

func (u PlaybackErrorErrorCodeUnion) AsFloat() (v float64)

func (PlaybackErrorErrorCodeUnion) AsString

func (u PlaybackErrorErrorCodeUnion) AsString() (v string)

func (PlaybackErrorErrorCodeUnion) RawJSON

func (u PlaybackErrorErrorCodeUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*PlaybackErrorErrorCodeUnion) UnmarshalJSON

func (r *PlaybackErrorErrorCodeUnion) UnmarshalJSON(data []byte) error

type PlaybackErrorErrorCodeUnionParam

type PlaybackErrorErrorCodeUnionParam struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (PlaybackErrorErrorCodeUnionParam) MarshalJSON

func (u PlaybackErrorErrorCodeUnionParam) MarshalJSON() ([]byte, error)

func (*PlaybackErrorErrorCodeUnionParam) UnmarshalJSON

func (u *PlaybackErrorErrorCodeUnionParam) UnmarshalJSON(data []byte) error

type PlaybackErrorParam

type PlaybackErrorParam struct {
	ConnectorVersion         param.Opt[string]  `json:"connector_version,omitzero" api:"required"`
	DeliveryHostname         param.Opt[string]  `json:"delivery_hostname,omitzero" api:"required"`
	DeliveryRequestCount     param.Opt[float64] `json:"delivery_request_count,omitzero" api:"required"`
	DeliveryThroughputBps    param.Opt[float64] `json:"delivery_throughput_bps,omitzero" api:"required"`
	DeliveryTransferredBytes param.Opt[float64] `json:"delivery_transferred_bytes,omitzero" api:"required"`
	DroppedVideoFrames       param.Opt[float64] `json:"dropped_video_frames,omitzero" api:"required"`
	Environment              param.Opt[string]  `json:"environment,omitzero" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory         param.Opt[PlaybackErrorErrorCategory] `json:"error_category,omitzero" api:"required"`
	ErrorFatal            param.Opt[bool]                       `json:"error_fatal,omitzero" api:"required"`
	ErrorPlayheadSeconds  param.Opt[float64]                    `json:"error_playhead_seconds,omitzero" api:"required"`
	FirstVideoFrameTimeMs param.Opt[float64]                    `json:"first_video_frame_time_ms,omitzero" api:"required"`
	FurthestProgressRatio param.Opt[float64]                    `json:"furthest_progress_ratio,omitzero" api:"required"`
	MediaDurationSeconds  param.Opt[float64]                    `json:"media_duration_seconds,omitzero" api:"required"`
	MediaHeightPx         param.Opt[float64]                    `json:"media_height_px,omitzero" api:"required"`
	MediaWidthPx          param.Opt[float64]                    `json:"media_width_px,omitzero" api:"required"`
	PlayerHeightPx        param.Opt[float64]                    `json:"player_height_px,omitzero" api:"required"`
	PlayerName            param.Opt[string]                     `json:"player_name,omitzero" api:"required"`
	PlayerVersion         param.Opt[string]                     `json:"player_version,omitzero" api:"required"`
	PlayerWidthPx         param.Opt[float64]                    `json:"player_width_px,omitzero" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason                      param.Opt[PlaybackErrorReason] `json:"reason,omitzero" api:"required"`
	RebufferRatio               param.Opt[float64]             `json:"rebuffer_ratio,omitzero" api:"required"`
	RenditionSwitchCount        param.Opt[float64]             `json:"rendition_switch_count,omitzero" api:"required"`
	SelectedRenditionBitrateBps param.Opt[float64]             `json:"selected_rendition_bitrate_bps,omitzero" api:"required"`
	SelectedRenditionCodec      param.Opt[string]              `json:"selected_rendition_codec,omitzero" api:"required"`
	SelectedRenditionHeight     param.Opt[float64]             `json:"selected_rendition_height,omitzero" api:"required"`
	SelectedRenditionWidth      param.Opt[float64]             `json:"selected_rendition_width,omitzero" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome   param.Opt[PlaybackErrorStartupOutcome] `json:"startup_outcome,omitzero" api:"required"`
	StartupTimeMs    param.Opt[float64]                     `json:"startup_time_ms,omitzero" api:"required"`
	TotalVideoFrames param.Opt[float64]                     `json:"total_video_frames,omitzero" api:"required"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID               param.Opt[string]                  `json:"viewer_id,omitzero" api:"required"`
	ErrorCode              PlaybackErrorErrorCodeUnionParam   `json:"error_code,omitzero" api:"required"`
	RenditionPlayingTime   []shared.RenditionPlayingTimeParam `json:"rendition_playing_time,omitzero" api:"required"`
	ConnectorName          string                             `json:"connector_name" api:"required"`
	EventID                string                             `json:"event_id" api:"required" format:"uuid"`
	MaximumPlayheadSeconds float64                            `json:"maximum_playhead_seconds" api:"required"`
	OccurredAt             time.Time                          `json:"occurred_at" api:"required" format:"date-time"`
	PlayingTimeMs          float64                            `json:"playing_time_ms" api:"required"`
	RebufferCount          float64                            `json:"rebuffer_count" api:"required"`
	RebufferDurationMs     float64                            `json:"rebuffer_duration_ms" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName        string  `json:"sdk_name" api:"required"`
	SDKVersion     string  `json:"sdk_version" api:"required"`
	SeekCount      float64 `json:"seek_count" api:"required"`
	SeekDurationMs float64 `json:"seek_duration_ms" api:"required"`
	Sequence       int64   `json:"sequence" api:"required"`
	VideoID        string  `json:"video_id" api:"required"`
	ViewID         string  `json:"view_id" api:"required" format:"uuid"`
	// Current playback rate, rounded to two decimals, such as 1, 1.5 or 2; from 0.01
	// to 16. Optional.
	PlaybackRate param.Opt[float64] `json:"playback_rate,omitzero"`
	// Current media position at this event, not the maximum reached.
	PlayheadSeconds param.Opt[float64] `json:"playhead_seconds,omitzero"`
	// Language tag (BCP 47) of the showing subtitles or captions track; und when the
	// track declares no language; null when subtitles are off. Optional.
	SubtitleLanguage param.Opt[string] `json:"subtitle_language,omitzero"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID param.Opt[string] `json:"user_id,omitzero"`
	// Optional human-readable video title for reports.
	VideoTitle param.Opt[string] `json:"video_title,omitzero"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState param.Opt[PlaybackErrorVisibilityState] `json:"visibility_state,omitzero"`
	// Cumulative playing time per playback rate for this attempt. At most 32 entries.
	// Optional.
	PlaybackRatePlayingTime []shared.PlaybackRatePlayingTimeParam `json:"playback_rate_playing_time,omitzero"`
	// Cumulative played media ranges for this attempt, sorted and merged without
	// overlaps. Seeking, pauses and buffering are excluded. Missing or null means
	// unavailable; an empty array means measured but no section played. Replaying a
	// section does not add another range.
	PlayedRanges []shared.PlayedRangeParam `json:"played_ranges,omitzero"`
	// Cumulative playing time per subtitle language for this attempt, null language
	// meaning subtitles off. At most 32 entries. Optional.
	SubtitlePlayingTime []shared.SubtitlePlayingTimeParam `json:"subtitle_playing_time,omitzero"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContextParam `json:"browser_context,omitzero"`
	// This field can be elided, and will marshal its zero value as
	// "chunkify.video.playback_error".
	EventName constant.ChunkifyVideoPlaybackError `json:"event_name" default:"chunkify.video.playback_error"`
	// This field can be elided, and will marshal its zero value as 1.
	SchemaVersion float64 `json:"schema_version,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The properties ConnectorName, ConnectorVersion, DeliveryHostname, DeliveryRequestCount, DeliveryThroughputBps, DeliveryTransferredBytes, DroppedVideoFrames, Environment, ErrorCategory, ErrorCode, ErrorFatal, ErrorPlayheadSeconds, EventID, EventName, FirstVideoFrameTimeMs, FurthestProgressRatio, MaximumPlayheadSeconds, MediaDurationSeconds, MediaHeightPx, MediaWidthPx, OccurredAt, PlayerHeightPx, PlayerName, PlayerVersion, PlayerWidthPx, PlayingTimeMs, Reason, RebufferCount, RebufferDurationMs, RebufferRatio, RenditionPlayingTime, RenditionSwitchCount, SchemaVersion, SDKName, SDKVersion, SeekCount, SeekDurationMs, SelectedRenditionBitrateBps, SelectedRenditionCodec, SelectedRenditionHeight, SelectedRenditionWidth, Sequence, StartupOutcome, StartupTimeMs, TotalVideoFrames, VideoID, ViewID, ViewerID are required.

func (PlaybackErrorParam) MarshalJSON

func (r PlaybackErrorParam) MarshalJSON() (data []byte, err error)

func (*PlaybackErrorParam) UnmarshalJSON

func (r *PlaybackErrorParam) UnmarshalJSON(data []byte) error

type PlaybackErrorReason

type PlaybackErrorReason string
const (
	PlaybackErrorReasonEnded         PlaybackErrorReason = "ended"
	PlaybackErrorReasonDestroyed     PlaybackErrorReason = "destroyed"
	PlaybackErrorReasonSourceChanged PlaybackErrorReason = "source_changed"
	PlaybackErrorReasonPageExit      PlaybackErrorReason = "page_exit"
)

type PlaybackErrorStartupOutcome

type PlaybackErrorStartupOutcome string
const (
	PlaybackErrorStartupOutcomeStarted           PlaybackErrorStartupOutcome = "started"
	PlaybackErrorStartupOutcomeFailedBeforeStart PlaybackErrorStartupOutcome = "failed_before_start"
	PlaybackErrorStartupOutcomeEndedBeforeStart  PlaybackErrorStartupOutcome = "ended_before_start"
)

type PlaybackErrorVisibilityState

type PlaybackErrorVisibilityState string

Tab visibility when the event was recorded. Hidden does not imply paused playback or identify the cause of a pause. Missing on older events; null when unavailable.

const (
	PlaybackErrorVisibilityStateVisible PlaybackErrorVisibilityState = "visible"
	PlaybackErrorVisibilityStateHidden  PlaybackErrorVisibilityState = "hidden"
)

type PlaybackRateChanged

type PlaybackRateChanged struct {
	ConnectorName    string `json:"connector_name" api:"required"`
	ConnectorVersion string `json:"connector_version" api:"required"`
	DeliveryHostname string `json:"delivery_hostname" api:"required"`
	Environment      string `json:"environment" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory        PlaybackRateChangedErrorCategory          `json:"error_category" api:"required"`
	ErrorCode            PlaybackRateChangedErrorCodeUnion         `json:"error_code" api:"required"`
	ErrorFatal           bool                                      `json:"error_fatal" api:"required"`
	ErrorPlayheadSeconds float64                                   `json:"error_playhead_seconds" api:"required"`
	EventID              string                                    `json:"event_id" api:"required" format:"uuid"`
	EventName            constant.ChunkifyVideoPlaybackRateChanged `json:"event_name" default:"chunkify.video.playback_rate_changed"`
	OccurredAt           time.Time                                 `json:"occurred_at" api:"required" format:"date-time"`
	// Rate after the change.
	PlaybackRate    float64 `json:"playback_rate" api:"required"`
	PlayerName      string  `json:"player_name" api:"required"`
	PlayerVersion   string  `json:"player_version" api:"required"`
	PlayheadSeconds float64 `json:"playhead_seconds" api:"required"`
	// Rate before the change.
	PreviousPlaybackRate float64 `json:"previous_playback_rate" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason        PlaybackRateChangedReason `json:"reason" api:"required"`
	SchemaVersion float64                   `json:"schema_version" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName    string `json:"sdk_name" api:"required"`
	SDKVersion string `json:"sdk_version" api:"required"`
	Sequence   int64  `json:"sequence" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome PlaybackRateChangedStartupOutcome `json:"startup_outcome" api:"required"`
	VideoID        string                            `json:"video_id" api:"required"`
	ViewID         string                            `json:"view_id" api:"required" format:"uuid"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID string `json:"viewer_id" api:"required"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext              shared.BrowserContext         `json:"browser_context" api:"nullable"`
	DeliveryRequestCount        float64                       `json:"delivery_request_count" api:"nullable"`
	DeliveryThroughputBps       float64                       `json:"delivery_throughput_bps" api:"nullable"`
	DeliveryTransferredBytes    float64                       `json:"delivery_transferred_bytes" api:"nullable"`
	DroppedVideoFrames          float64                       `json:"dropped_video_frames" api:"nullable"`
	FirstVideoFrameTimeMs       float64                       `json:"first_video_frame_time_ms" api:"nullable"`
	FurthestProgressRatio       float64                       `json:"furthest_progress_ratio" api:"nullable"`
	MaximumPlayheadSeconds      float64                       `json:"maximum_playhead_seconds"`
	MediaDurationSeconds        float64                       `json:"media_duration_seconds" api:"nullable"`
	MediaHeightPx               float64                       `json:"media_height_px" api:"nullable"`
	MediaWidthPx                float64                       `json:"media_width_px" api:"nullable"`
	PlayerHeightPx              float64                       `json:"player_height_px" api:"nullable"`
	PlayerWidthPx               float64                       `json:"player_width_px" api:"nullable"`
	PlayingTimeMs               float64                       `json:"playing_time_ms"`
	RebufferCount               float64                       `json:"rebuffer_count"`
	RebufferDurationMs          float64                       `json:"rebuffer_duration_ms"`
	RebufferRatio               float64                       `json:"rebuffer_ratio" api:"nullable"`
	RenditionPlayingTime        []shared.RenditionPlayingTime `json:"rendition_playing_time" api:"nullable"`
	RenditionSwitchCount        float64                       `json:"rendition_switch_count" api:"nullable"`
	SeekCount                   float64                       `json:"seek_count"`
	SeekDurationMs              float64                       `json:"seek_duration_ms"`
	SelectedRenditionBitrateBps float64                       `json:"selected_rendition_bitrate_bps" api:"nullable"`
	SelectedRenditionCodec      string                        `json:"selected_rendition_codec" api:"nullable"`
	SelectedRenditionHeight     float64                       `json:"selected_rendition_height" api:"nullable"`
	SelectedRenditionWidth      float64                       `json:"selected_rendition_width" api:"nullable"`
	StartupTimeMs               float64                       `json:"startup_time_ms" api:"nullable"`
	TotalVideoFrames            float64                       `json:"total_video_frames" api:"nullable"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID string `json:"user_id" api:"nullable"`
	// Optional human-readable video title for reports.
	VideoTitle string `json:"video_title" api:"nullable"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState PlaybackRateChangedVisibilityState `json:"visibility_state" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorName               respjson.Field
		ConnectorVersion            respjson.Field
		DeliveryHostname            respjson.Field
		Environment                 respjson.Field
		ErrorCategory               respjson.Field
		ErrorCode                   respjson.Field
		ErrorFatal                  respjson.Field
		ErrorPlayheadSeconds        respjson.Field
		EventID                     respjson.Field
		EventName                   respjson.Field
		OccurredAt                  respjson.Field
		PlaybackRate                respjson.Field
		PlayerName                  respjson.Field
		PlayerVersion               respjson.Field
		PlayheadSeconds             respjson.Field
		PreviousPlaybackRate        respjson.Field
		Reason                      respjson.Field
		SchemaVersion               respjson.Field
		SDKName                     respjson.Field
		SDKVersion                  respjson.Field
		Sequence                    respjson.Field
		StartupOutcome              respjson.Field
		VideoID                     respjson.Field
		ViewID                      respjson.Field
		ViewerID                    respjson.Field
		BrowserContext              respjson.Field
		DeliveryRequestCount        respjson.Field
		DeliveryThroughputBps       respjson.Field
		DeliveryTransferredBytes    respjson.Field
		DroppedVideoFrames          respjson.Field
		FirstVideoFrameTimeMs       respjson.Field
		FurthestProgressRatio       respjson.Field
		MaximumPlayheadSeconds      respjson.Field
		MediaDurationSeconds        respjson.Field
		MediaHeightPx               respjson.Field
		MediaWidthPx                respjson.Field
		PlayerHeightPx              respjson.Field
		PlayerWidthPx               respjson.Field
		PlayingTimeMs               respjson.Field
		RebufferCount               respjson.Field
		RebufferDurationMs          respjson.Field
		RebufferRatio               respjson.Field
		RenditionPlayingTime        respjson.Field
		RenditionSwitchCount        respjson.Field
		SeekCount                   respjson.Field
		SeekDurationMs              respjson.Field
		SelectedRenditionBitrateBps respjson.Field
		SelectedRenditionCodec      respjson.Field
		SelectedRenditionHeight     respjson.Field
		SelectedRenditionWidth      respjson.Field
		StartupTimeMs               respjson.Field
		TotalVideoFrames            respjson.Field
		UserID                      respjson.Field
		VideoTitle                  respjson.Field
		VisibilityState             respjson.Field
		ExtraFields                 map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlaybackRateChanged) RawJSON

func (r PlaybackRateChanged) RawJSON() string

Returns the unmodified JSON received from the API

func (PlaybackRateChanged) ToParam

ToParam converts this PlaybackRateChanged to a PlaybackRateChangedParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with PlaybackRateChangedParam.Overrides()

func (*PlaybackRateChanged) UnmarshalJSON

func (r *PlaybackRateChanged) UnmarshalJSON(data []byte) error

type PlaybackRateChangedErrorCategory

type PlaybackRateChangedErrorCategory string
const (
	PlaybackRateChangedErrorCategoryAborted     PlaybackRateChangedErrorCategory = "aborted"
	PlaybackRateChangedErrorCategoryNetwork     PlaybackRateChangedErrorCategory = "network"
	PlaybackRateChangedErrorCategoryDecode      PlaybackRateChangedErrorCategory = "decode"
	PlaybackRateChangedErrorCategoryUnsupported PlaybackRateChangedErrorCategory = "unsupported"
	PlaybackRateChangedErrorCategoryUnknown     PlaybackRateChangedErrorCategory = "unknown"
)

type PlaybackRateChangedErrorCodeUnion

type PlaybackRateChangedErrorCodeUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

PlaybackRateChangedErrorCodeUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (PlaybackRateChangedErrorCodeUnion) AsFloat

func (PlaybackRateChangedErrorCodeUnion) AsString

func (u PlaybackRateChangedErrorCodeUnion) AsString() (v string)

func (PlaybackRateChangedErrorCodeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*PlaybackRateChangedErrorCodeUnion) UnmarshalJSON

func (r *PlaybackRateChangedErrorCodeUnion) UnmarshalJSON(data []byte) error

type PlaybackRateChangedErrorCodeUnionParam

type PlaybackRateChangedErrorCodeUnionParam struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (PlaybackRateChangedErrorCodeUnionParam) MarshalJSON

func (u PlaybackRateChangedErrorCodeUnionParam) MarshalJSON() ([]byte, error)

func (*PlaybackRateChangedErrorCodeUnionParam) UnmarshalJSON

func (u *PlaybackRateChangedErrorCodeUnionParam) UnmarshalJSON(data []byte) error

type PlaybackRateChangedParam

type PlaybackRateChangedParam struct {
	ConnectorVersion param.Opt[string] `json:"connector_version,omitzero" api:"required"`
	DeliveryHostname param.Opt[string] `json:"delivery_hostname,omitzero" api:"required"`
	Environment      param.Opt[string] `json:"environment,omitzero" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory        param.Opt[PlaybackRateChangedErrorCategory] `json:"error_category,omitzero" api:"required"`
	ErrorFatal           param.Opt[bool]                             `json:"error_fatal,omitzero" api:"required"`
	ErrorPlayheadSeconds param.Opt[float64]                          `json:"error_playhead_seconds,omitzero" api:"required"`
	// Rate after the change.
	PlaybackRate    param.Opt[float64] `json:"playback_rate,omitzero" api:"required"`
	PlayerName      param.Opt[string]  `json:"player_name,omitzero" api:"required"`
	PlayerVersion   param.Opt[string]  `json:"player_version,omitzero" api:"required"`
	PlayheadSeconds param.Opt[float64] `json:"playhead_seconds,omitzero" api:"required"`
	// Rate before the change.
	PreviousPlaybackRate param.Opt[float64] `json:"previous_playback_rate,omitzero" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason param.Opt[PlaybackRateChangedReason] `json:"reason,omitzero" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome param.Opt[PlaybackRateChangedStartupOutcome] `json:"startup_outcome,omitzero" api:"required"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID      param.Opt[string]                      `json:"viewer_id,omitzero" api:"required"`
	ErrorCode     PlaybackRateChangedErrorCodeUnionParam `json:"error_code,omitzero" api:"required"`
	ConnectorName string                                 `json:"connector_name" api:"required"`
	EventID       string                                 `json:"event_id" api:"required" format:"uuid"`
	OccurredAt    time.Time                              `json:"occurred_at" api:"required" format:"date-time"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName                     string             `json:"sdk_name" api:"required"`
	SDKVersion                  string             `json:"sdk_version" api:"required"`
	Sequence                    int64              `json:"sequence" api:"required"`
	VideoID                     string             `json:"video_id" api:"required"`
	ViewID                      string             `json:"view_id" api:"required" format:"uuid"`
	DeliveryRequestCount        param.Opt[float64] `json:"delivery_request_count,omitzero"`
	DeliveryThroughputBps       param.Opt[float64] `json:"delivery_throughput_bps,omitzero"`
	DeliveryTransferredBytes    param.Opt[float64] `json:"delivery_transferred_bytes,omitzero"`
	DroppedVideoFrames          param.Opt[float64] `json:"dropped_video_frames,omitzero"`
	FirstVideoFrameTimeMs       param.Opt[float64] `json:"first_video_frame_time_ms,omitzero"`
	FurthestProgressRatio       param.Opt[float64] `json:"furthest_progress_ratio,omitzero"`
	MediaDurationSeconds        param.Opt[float64] `json:"media_duration_seconds,omitzero"`
	MediaHeightPx               param.Opt[float64] `json:"media_height_px,omitzero"`
	MediaWidthPx                param.Opt[float64] `json:"media_width_px,omitzero"`
	PlayerHeightPx              param.Opt[float64] `json:"player_height_px,omitzero"`
	PlayerWidthPx               param.Opt[float64] `json:"player_width_px,omitzero"`
	RebufferRatio               param.Opt[float64] `json:"rebuffer_ratio,omitzero"`
	RenditionSwitchCount        param.Opt[float64] `json:"rendition_switch_count,omitzero"`
	SelectedRenditionBitrateBps param.Opt[float64] `json:"selected_rendition_bitrate_bps,omitzero"`
	SelectedRenditionCodec      param.Opt[string]  `json:"selected_rendition_codec,omitzero"`
	SelectedRenditionHeight     param.Opt[float64] `json:"selected_rendition_height,omitzero"`
	SelectedRenditionWidth      param.Opt[float64] `json:"selected_rendition_width,omitzero"`
	StartupTimeMs               param.Opt[float64] `json:"startup_time_ms,omitzero"`
	TotalVideoFrames            param.Opt[float64] `json:"total_video_frames,omitzero"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID param.Opt[string] `json:"user_id,omitzero"`
	// Optional human-readable video title for reports.
	VideoTitle param.Opt[string] `json:"video_title,omitzero"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState        param.Opt[PlaybackRateChangedVisibilityState] `json:"visibility_state,omitzero"`
	MaximumPlayheadSeconds param.Opt[float64]                            `json:"maximum_playhead_seconds,omitzero"`
	PlayingTimeMs          param.Opt[float64]                            `json:"playing_time_ms,omitzero"`
	RebufferCount          param.Opt[float64]                            `json:"rebuffer_count,omitzero"`
	RebufferDurationMs     param.Opt[float64]                            `json:"rebuffer_duration_ms,omitzero"`
	SeekCount              param.Opt[float64]                            `json:"seek_count,omitzero"`
	SeekDurationMs         param.Opt[float64]                            `json:"seek_duration_ms,omitzero"`
	RenditionPlayingTime   []shared.RenditionPlayingTimeParam            `json:"rendition_playing_time,omitzero"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContextParam `json:"browser_context,omitzero"`
	// This field can be elided, and will marshal its zero value as
	// "chunkify.video.playback_rate_changed".
	EventName constant.ChunkifyVideoPlaybackRateChanged `json:"event_name" default:"chunkify.video.playback_rate_changed"`
	// This field can be elided, and will marshal its zero value as 1.
	SchemaVersion float64 `json:"schema_version,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The properties ConnectorName, ConnectorVersion, DeliveryHostname, Environment, ErrorCategory, ErrorCode, ErrorFatal, ErrorPlayheadSeconds, EventID, EventName, OccurredAt, PlaybackRate, PlayerName, PlayerVersion, PlayheadSeconds, PreviousPlaybackRate, Reason, SchemaVersion, SDKName, SDKVersion, Sequence, StartupOutcome, VideoID, ViewID, ViewerID are required.

func (PlaybackRateChangedParam) MarshalJSON

func (r PlaybackRateChangedParam) MarshalJSON() (data []byte, err error)

func (*PlaybackRateChangedParam) UnmarshalJSON

func (r *PlaybackRateChangedParam) UnmarshalJSON(data []byte) error

type PlaybackRateChangedReason

type PlaybackRateChangedReason string
const (
	PlaybackRateChangedReasonEnded         PlaybackRateChangedReason = "ended"
	PlaybackRateChangedReasonDestroyed     PlaybackRateChangedReason = "destroyed"
	PlaybackRateChangedReasonSourceChanged PlaybackRateChangedReason = "source_changed"
	PlaybackRateChangedReasonPageExit      PlaybackRateChangedReason = "page_exit"
)

type PlaybackRateChangedStartupOutcome

type PlaybackRateChangedStartupOutcome string
const (
	PlaybackRateChangedStartupOutcomeStarted           PlaybackRateChangedStartupOutcome = "started"
	PlaybackRateChangedStartupOutcomeFailedBeforeStart PlaybackRateChangedStartupOutcome = "failed_before_start"
	PlaybackRateChangedStartupOutcomeEndedBeforeStart  PlaybackRateChangedStartupOutcome = "ended_before_start"
)

type PlaybackRateChangedVisibilityState

type PlaybackRateChangedVisibilityState string

Tab visibility when the event was recorded. Hidden does not imply paused playback or identify the cause of a pause. Missing on older events; null when unavailable.

const (
	PlaybackRateChangedVisibilityStateVisible PlaybackRateChangedVisibilityState = "visible"
	PlaybackRateChangedVisibilityStateHidden  PlaybackRateChangedVisibilityState = "hidden"
)

type PlaybackRateGetParams

type PlaybackRateGetParams struct {
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent PlaybackRateGetParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType PlaybackRateGetParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PlaybackRateGetParams) URLQuery

func (r PlaybackRateGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes PlaybackRateGetParams's query parameters as `url.Values`.

type PlaybackRateGetParamsContinent

type PlaybackRateGetParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	PlaybackRateGetParamsContinentAf PlaybackRateGetParamsContinent = "AF"
	PlaybackRateGetParamsContinentAn PlaybackRateGetParamsContinent = "AN"
	PlaybackRateGetParamsContinentAs PlaybackRateGetParamsContinent = "AS"
	PlaybackRateGetParamsContinentEu PlaybackRateGetParamsContinent = "EU"
	PlaybackRateGetParamsContinentNa PlaybackRateGetParamsContinent = "NA"
	PlaybackRateGetParamsContinentOc PlaybackRateGetParamsContinent = "OC"
	PlaybackRateGetParamsContinentSa PlaybackRateGetParamsContinent = "SA"
)

type PlaybackRateGetParamsDeviceType

type PlaybackRateGetParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	PlaybackRateGetParamsDeviceTypeDesktop PlaybackRateGetParamsDeviceType = "desktop"
	PlaybackRateGetParamsDeviceTypeMobile  PlaybackRateGetParamsDeviceType = "mobile"
	PlaybackRateGetParamsDeviceTypeTablet  PlaybackRateGetParamsDeviceType = "tablet"
	PlaybackRateGetParamsDeviceTypeUnknown PlaybackRateGetParamsDeviceType = "unknown"
)

type PlaybackRateMetric

type PlaybackRateMetric struct {
	// Cumulative measured playing time at this rate, summed once per attempt.
	PlayingTimeMs float64 `json:"playing_time_ms" api:"required"`
	// Share of all measured playing time, including rows outside the returned limit.
	PlayingTimeRatio float64 `json:"playing_time_ratio" api:"required"`
	// Playback rate, rounded to two decimals.
	Rate float64 `json:"rate" api:"required"`
	// Distinct attempts with positive playing time at this rate.
	Views int64 `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PlayingTimeMs    respjson.Field
		PlayingTimeRatio respjson.Field
		Rate             respjson.Field
		Views            respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Watch time at one playback rate.

func (PlaybackRateMetric) RawJSON

func (r PlaybackRateMetric) RawJSON() string

Returns the unmodified JSON received from the API

func (*PlaybackRateMetric) UnmarshalJSON

func (r *PlaybackRateMetric) UnmarshalJSON(data []byte) error

type PlaybackRatePlayingTime

type PlaybackRatePlayingTime = shared.PlaybackRatePlayingTime

This is an alias to an internal type.

type PlaybackRatePlayingTimeParam

type PlaybackRatePlayingTimeParam = shared.PlaybackRatePlayingTimeParam

This is an alias to an internal type.

type PlaybackRateReport

type PlaybackRateReport struct {
	// Most-watched first, then value ascending with null first. Defaults to 100 rows,
	// maximum 1000. CSV exports include all matching rows.
	Rates []PlaybackRateMetric `json:"rates" api:"required"`
	// Attempts with positive measured playing time in this report. Older SDKs send no
	// measurement.
	SampleViews int64 `json:"sample_views" api:"required"`
	// Total measured playing time across all matching rows.
	TotalPlayingTimeMs float64 `json:"total_playing_time_ms" api:"required"`
	// Number of distinct values before applying the row limit.
	TotalRates int64 `json:"total_rates" api:"required"`
	// All attempts in the filtered start cohort.
	Views int64 `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Rates              respjson.Field
		SampleViews        respjson.Field
		TotalPlayingTimeMs respjson.Field
		TotalRates         respjson.Field
		Views              respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlaybackRateReport) RawJSON

func (r PlaybackRateReport) RawJSON() string

Returns the unmodified JSON received from the API

func (*PlaybackRateReport) UnmarshalJSON

func (r *PlaybackRateReport) UnmarshalJSON(data []byte) error

type PlaybackRateService

type PlaybackRateService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

PlaybackRateService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPlaybackRateService method instead.

func NewPlaybackRateService

func NewPlaybackRateService(opts ...option.RequestOption) (r PlaybackRateService)

NewPlaybackRateService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PlaybackRateService) Get

Summarize watch time per playback rate. Expand each view's cumulative playback_rate_playing_time array once; rates are rounded to two decimals. Playing time is wall-clock time, so a minute at 2 covers about two minutes of media. Use only the selected final event, or latest snapshot when no final exists, for the filtered view-start cohort. Missing or empty measurements contribute no time; older SDKs send none. Rank by playing time descending, then value ascending with null first; limit bounds returned rows only, while totals cover every matching row. Views can contribute to several rows and must not be summed. No cursor, group_by, sort_by or order. Export resource=playback_rates includes all matching rows.

type PlaybackScore

type PlaybackScore = shared.PlaybackScore

This is an alias to an internal type.

type PlaybackStateChanged

type PlaybackStateChanged struct {
	ConnectorName    string `json:"connector_name" api:"required"`
	ConnectorVersion string `json:"connector_version" api:"required"`
	DeliveryHostname string `json:"delivery_hostname" api:"required"`
	Environment      string `json:"environment" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory        PlaybackStateChangedErrorCategory          `json:"error_category" api:"required"`
	ErrorCode            PlaybackStateChangedErrorCodeUnion         `json:"error_code" api:"required"`
	ErrorFatal           bool                                       `json:"error_fatal" api:"required"`
	ErrorPlayheadSeconds float64                                    `json:"error_playhead_seconds" api:"required"`
	EventID              string                                     `json:"event_id" api:"required" format:"uuid"`
	EventName            constant.ChunkifyVideoPlaybackStateChanged `json:"event_name" default:"chunkify.video.playback_state_changed"`
	// Any of "startup", "resuming", "playing", "paused", "buffering", "seeking",
	// "error", "ended", "stopped".
	FromState               PlaybackStateChangedFromState `json:"from_state" api:"required"`
	OccurredAt              time.Time                     `json:"occurred_at" api:"required" format:"date-time"`
	PlayerName              string                        `json:"player_name" api:"required"`
	PlayerVersion           string                        `json:"player_version" api:"required"`
	PlayheadSeconds         float64                       `json:"playhead_seconds" api:"required"`
	PreviousStateDurationMs float64                       `json:"previous_state_duration_ms" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason        PlaybackStateChangedReason `json:"reason" api:"required"`
	SchemaVersion float64                    `json:"schema_version" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName    string `json:"sdk_name" api:"required"`
	SDKVersion string `json:"sdk_version" api:"required"`
	Sequence   int64  `json:"sequence" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome PlaybackStateChangedStartupOutcome `json:"startup_outcome" api:"required"`
	// Any of "startup", "resuming", "playing", "paused", "buffering", "seeking",
	// "error", "ended", "stopped".
	ToState PlaybackStateChangedToState `json:"to_state" api:"required"`
	VideoID string                      `json:"video_id" api:"required"`
	ViewID  string                      `json:"view_id" api:"required" format:"uuid"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID string `json:"viewer_id" api:"required"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext              shared.BrowserContext         `json:"browser_context" api:"nullable"`
	DeliveryRequestCount        float64                       `json:"delivery_request_count" api:"nullable"`
	DeliveryThroughputBps       float64                       `json:"delivery_throughput_bps" api:"nullable"`
	DeliveryTransferredBytes    float64                       `json:"delivery_transferred_bytes" api:"nullable"`
	DroppedVideoFrames          float64                       `json:"dropped_video_frames" api:"nullable"`
	FirstVideoFrameTimeMs       float64                       `json:"first_video_frame_time_ms" api:"nullable"`
	FurthestProgressRatio       float64                       `json:"furthest_progress_ratio" api:"nullable"`
	MaximumPlayheadSeconds      float64                       `json:"maximum_playhead_seconds"`
	MediaDurationSeconds        float64                       `json:"media_duration_seconds" api:"nullable"`
	MediaHeightPx               float64                       `json:"media_height_px" api:"nullable"`
	MediaWidthPx                float64                       `json:"media_width_px" api:"nullable"`
	PlayerHeightPx              float64                       `json:"player_height_px" api:"nullable"`
	PlayerWidthPx               float64                       `json:"player_width_px" api:"nullable"`
	PlayingTimeMs               float64                       `json:"playing_time_ms"`
	RebufferCount               float64                       `json:"rebuffer_count"`
	RebufferDurationMs          float64                       `json:"rebuffer_duration_ms"`
	RebufferRatio               float64                       `json:"rebuffer_ratio" api:"nullable"`
	RenditionPlayingTime        []shared.RenditionPlayingTime `json:"rendition_playing_time" api:"nullable"`
	RenditionSwitchCount        float64                       `json:"rendition_switch_count" api:"nullable"`
	SeekCount                   float64                       `json:"seek_count"`
	SeekDurationMs              float64                       `json:"seek_duration_ms"`
	SelectedRenditionBitrateBps float64                       `json:"selected_rendition_bitrate_bps" api:"nullable"`
	SelectedRenditionCodec      string                        `json:"selected_rendition_codec" api:"nullable"`
	SelectedRenditionHeight     float64                       `json:"selected_rendition_height" api:"nullable"`
	SelectedRenditionWidth      float64                       `json:"selected_rendition_width" api:"nullable"`
	StartupTimeMs               float64                       `json:"startup_time_ms" api:"nullable"`
	TotalVideoFrames            float64                       `json:"total_video_frames" api:"nullable"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID string `json:"user_id" api:"nullable"`
	// Optional human-readable video title for reports.
	VideoTitle string `json:"video_title" api:"nullable"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState PlaybackStateChangedVisibilityState `json:"visibility_state" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorName               respjson.Field
		ConnectorVersion            respjson.Field
		DeliveryHostname            respjson.Field
		Environment                 respjson.Field
		ErrorCategory               respjson.Field
		ErrorCode                   respjson.Field
		ErrorFatal                  respjson.Field
		ErrorPlayheadSeconds        respjson.Field
		EventID                     respjson.Field
		EventName                   respjson.Field
		FromState                   respjson.Field
		OccurredAt                  respjson.Field
		PlayerName                  respjson.Field
		PlayerVersion               respjson.Field
		PlayheadSeconds             respjson.Field
		PreviousStateDurationMs     respjson.Field
		Reason                      respjson.Field
		SchemaVersion               respjson.Field
		SDKName                     respjson.Field
		SDKVersion                  respjson.Field
		Sequence                    respjson.Field
		StartupOutcome              respjson.Field
		ToState                     respjson.Field
		VideoID                     respjson.Field
		ViewID                      respjson.Field
		ViewerID                    respjson.Field
		BrowserContext              respjson.Field
		DeliveryRequestCount        respjson.Field
		DeliveryThroughputBps       respjson.Field
		DeliveryTransferredBytes    respjson.Field
		DroppedVideoFrames          respjson.Field
		FirstVideoFrameTimeMs       respjson.Field
		FurthestProgressRatio       respjson.Field
		MaximumPlayheadSeconds      respjson.Field
		MediaDurationSeconds        respjson.Field
		MediaHeightPx               respjson.Field
		MediaWidthPx                respjson.Field
		PlayerHeightPx              respjson.Field
		PlayerWidthPx               respjson.Field
		PlayingTimeMs               respjson.Field
		RebufferCount               respjson.Field
		RebufferDurationMs          respjson.Field
		RebufferRatio               respjson.Field
		RenditionPlayingTime        respjson.Field
		RenditionSwitchCount        respjson.Field
		SeekCount                   respjson.Field
		SeekDurationMs              respjson.Field
		SelectedRenditionBitrateBps respjson.Field
		SelectedRenditionCodec      respjson.Field
		SelectedRenditionHeight     respjson.Field
		SelectedRenditionWidth      respjson.Field
		StartupTimeMs               respjson.Field
		TotalVideoFrames            respjson.Field
		UserID                      respjson.Field
		VideoTitle                  respjson.Field
		VisibilityState             respjson.Field
		ExtraFields                 map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PlaybackStateChanged) RawJSON

func (r PlaybackStateChanged) RawJSON() string

Returns the unmodified JSON received from the API

func (PlaybackStateChanged) ToParam

ToParam converts this PlaybackStateChanged to a PlaybackStateChangedParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with PlaybackStateChangedParam.Overrides()

func (*PlaybackStateChanged) UnmarshalJSON

func (r *PlaybackStateChanged) UnmarshalJSON(data []byte) error

type PlaybackStateChangedErrorCategory

type PlaybackStateChangedErrorCategory string
const (
	PlaybackStateChangedErrorCategoryAborted     PlaybackStateChangedErrorCategory = "aborted"
	PlaybackStateChangedErrorCategoryNetwork     PlaybackStateChangedErrorCategory = "network"
	PlaybackStateChangedErrorCategoryDecode      PlaybackStateChangedErrorCategory = "decode"
	PlaybackStateChangedErrorCategoryUnsupported PlaybackStateChangedErrorCategory = "unsupported"
	PlaybackStateChangedErrorCategoryUnknown     PlaybackStateChangedErrorCategory = "unknown"
)

type PlaybackStateChangedErrorCodeUnion

type PlaybackStateChangedErrorCodeUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

PlaybackStateChangedErrorCodeUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (PlaybackStateChangedErrorCodeUnion) AsFloat

func (PlaybackStateChangedErrorCodeUnion) AsString

func (u PlaybackStateChangedErrorCodeUnion) AsString() (v string)

func (PlaybackStateChangedErrorCodeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*PlaybackStateChangedErrorCodeUnion) UnmarshalJSON

func (r *PlaybackStateChangedErrorCodeUnion) UnmarshalJSON(data []byte) error

type PlaybackStateChangedErrorCodeUnionParam

type PlaybackStateChangedErrorCodeUnionParam struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (PlaybackStateChangedErrorCodeUnionParam) MarshalJSON

func (u PlaybackStateChangedErrorCodeUnionParam) MarshalJSON() ([]byte, error)

func (*PlaybackStateChangedErrorCodeUnionParam) UnmarshalJSON

func (u *PlaybackStateChangedErrorCodeUnionParam) UnmarshalJSON(data []byte) error

type PlaybackStateChangedFromState

type PlaybackStateChangedFromState string
const (
	PlaybackStateChangedFromStateStartup   PlaybackStateChangedFromState = "startup"
	PlaybackStateChangedFromStateResuming  PlaybackStateChangedFromState = "resuming"
	PlaybackStateChangedFromStatePlaying   PlaybackStateChangedFromState = "playing"
	PlaybackStateChangedFromStatePaused    PlaybackStateChangedFromState = "paused"
	PlaybackStateChangedFromStateBuffering PlaybackStateChangedFromState = "buffering"
	PlaybackStateChangedFromStateSeeking   PlaybackStateChangedFromState = "seeking"
	PlaybackStateChangedFromStateError     PlaybackStateChangedFromState = "error"
	PlaybackStateChangedFromStateEnded     PlaybackStateChangedFromState = "ended"
	PlaybackStateChangedFromStateStopped   PlaybackStateChangedFromState = "stopped"
)

type PlaybackStateChangedParam

type PlaybackStateChangedParam struct {
	ConnectorVersion param.Opt[string] `json:"connector_version,omitzero" api:"required"`
	DeliveryHostname param.Opt[string] `json:"delivery_hostname,omitzero" api:"required"`
	Environment      param.Opt[string] `json:"environment,omitzero" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory        param.Opt[PlaybackStateChangedErrorCategory] `json:"error_category,omitzero" api:"required"`
	ErrorFatal           param.Opt[bool]                              `json:"error_fatal,omitzero" api:"required"`
	ErrorPlayheadSeconds param.Opt[float64]                           `json:"error_playhead_seconds,omitzero" api:"required"`
	PlayerName           param.Opt[string]                            `json:"player_name,omitzero" api:"required"`
	PlayerVersion        param.Opt[string]                            `json:"player_version,omitzero" api:"required"`
	PlayheadSeconds      param.Opt[float64]                           `json:"playhead_seconds,omitzero" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason param.Opt[PlaybackStateChangedReason] `json:"reason,omitzero" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome param.Opt[PlaybackStateChangedStartupOutcome] `json:"startup_outcome,omitzero" api:"required"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID      param.Opt[string]                       `json:"viewer_id,omitzero" api:"required"`
	ErrorCode     PlaybackStateChangedErrorCodeUnionParam `json:"error_code,omitzero" api:"required"`
	ConnectorName string                                  `json:"connector_name" api:"required"`
	EventID       string                                  `json:"event_id" api:"required" format:"uuid"`
	// Any of "startup", "resuming", "playing", "paused", "buffering", "seeking",
	// "error", "ended", "stopped".
	FromState               PlaybackStateChangedFromState `json:"from_state,omitzero" api:"required"`
	OccurredAt              time.Time                     `json:"occurred_at" api:"required" format:"date-time"`
	PreviousStateDurationMs float64                       `json:"previous_state_duration_ms" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName    string `json:"sdk_name" api:"required"`
	SDKVersion string `json:"sdk_version" api:"required"`
	Sequence   int64  `json:"sequence" api:"required"`
	// Any of "startup", "resuming", "playing", "paused", "buffering", "seeking",
	// "error", "ended", "stopped".
	ToState                     PlaybackStateChangedToState `json:"to_state,omitzero" api:"required"`
	VideoID                     string                      `json:"video_id" api:"required"`
	ViewID                      string                      `json:"view_id" api:"required" format:"uuid"`
	DeliveryRequestCount        param.Opt[float64]          `json:"delivery_request_count,omitzero"`
	DeliveryThroughputBps       param.Opt[float64]          `json:"delivery_throughput_bps,omitzero"`
	DeliveryTransferredBytes    param.Opt[float64]          `json:"delivery_transferred_bytes,omitzero"`
	DroppedVideoFrames          param.Opt[float64]          `json:"dropped_video_frames,omitzero"`
	FirstVideoFrameTimeMs       param.Opt[float64]          `json:"first_video_frame_time_ms,omitzero"`
	FurthestProgressRatio       param.Opt[float64]          `json:"furthest_progress_ratio,omitzero"`
	MediaDurationSeconds        param.Opt[float64]          `json:"media_duration_seconds,omitzero"`
	MediaHeightPx               param.Opt[float64]          `json:"media_height_px,omitzero"`
	MediaWidthPx                param.Opt[float64]          `json:"media_width_px,omitzero"`
	PlayerHeightPx              param.Opt[float64]          `json:"player_height_px,omitzero"`
	PlayerWidthPx               param.Opt[float64]          `json:"player_width_px,omitzero"`
	RebufferRatio               param.Opt[float64]          `json:"rebuffer_ratio,omitzero"`
	RenditionSwitchCount        param.Opt[float64]          `json:"rendition_switch_count,omitzero"`
	SelectedRenditionBitrateBps param.Opt[float64]          `json:"selected_rendition_bitrate_bps,omitzero"`
	SelectedRenditionCodec      param.Opt[string]           `json:"selected_rendition_codec,omitzero"`
	SelectedRenditionHeight     param.Opt[float64]          `json:"selected_rendition_height,omitzero"`
	SelectedRenditionWidth      param.Opt[float64]          `json:"selected_rendition_width,omitzero"`
	StartupTimeMs               param.Opt[float64]          `json:"startup_time_ms,omitzero"`
	TotalVideoFrames            param.Opt[float64]          `json:"total_video_frames,omitzero"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID param.Opt[string] `json:"user_id,omitzero"`
	// Optional human-readable video title for reports.
	VideoTitle param.Opt[string] `json:"video_title,omitzero"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState        param.Opt[PlaybackStateChangedVisibilityState] `json:"visibility_state,omitzero"`
	MaximumPlayheadSeconds param.Opt[float64]                             `json:"maximum_playhead_seconds,omitzero"`
	PlayingTimeMs          param.Opt[float64]                             `json:"playing_time_ms,omitzero"`
	RebufferCount          param.Opt[float64]                             `json:"rebuffer_count,omitzero"`
	RebufferDurationMs     param.Opt[float64]                             `json:"rebuffer_duration_ms,omitzero"`
	SeekCount              param.Opt[float64]                             `json:"seek_count,omitzero"`
	SeekDurationMs         param.Opt[float64]                             `json:"seek_duration_ms,omitzero"`
	RenditionPlayingTime   []shared.RenditionPlayingTimeParam             `json:"rendition_playing_time,omitzero"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContextParam `json:"browser_context,omitzero"`
	// This field can be elided, and will marshal its zero value as
	// "chunkify.video.playback_state_changed".
	EventName constant.ChunkifyVideoPlaybackStateChanged `json:"event_name" default:"chunkify.video.playback_state_changed"`
	// This field can be elided, and will marshal its zero value as 1.
	SchemaVersion float64 `json:"schema_version,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The properties ConnectorName, ConnectorVersion, DeliveryHostname, Environment, ErrorCategory, ErrorCode, ErrorFatal, ErrorPlayheadSeconds, EventID, EventName, FromState, OccurredAt, PlayerName, PlayerVersion, PlayheadSeconds, PreviousStateDurationMs, Reason, SchemaVersion, SDKName, SDKVersion, Sequence, StartupOutcome, ToState, VideoID, ViewID, ViewerID are required.

func (PlaybackStateChangedParam) MarshalJSON

func (r PlaybackStateChangedParam) MarshalJSON() (data []byte, err error)

func (*PlaybackStateChangedParam) UnmarshalJSON

func (r *PlaybackStateChangedParam) UnmarshalJSON(data []byte) error

type PlaybackStateChangedReason

type PlaybackStateChangedReason string
const (
	PlaybackStateChangedReasonEnded         PlaybackStateChangedReason = "ended"
	PlaybackStateChangedReasonDestroyed     PlaybackStateChangedReason = "destroyed"
	PlaybackStateChangedReasonSourceChanged PlaybackStateChangedReason = "source_changed"
	PlaybackStateChangedReasonPageExit      PlaybackStateChangedReason = "page_exit"
)

type PlaybackStateChangedStartupOutcome

type PlaybackStateChangedStartupOutcome string
const (
	PlaybackStateChangedStartupOutcomeStarted           PlaybackStateChangedStartupOutcome = "started"
	PlaybackStateChangedStartupOutcomeFailedBeforeStart PlaybackStateChangedStartupOutcome = "failed_before_start"
	PlaybackStateChangedStartupOutcomeEndedBeforeStart  PlaybackStateChangedStartupOutcome = "ended_before_start"
)

type PlaybackStateChangedToState

type PlaybackStateChangedToState string
const (
	PlaybackStateChangedToStateStartup   PlaybackStateChangedToState = "startup"
	PlaybackStateChangedToStateResuming  PlaybackStateChangedToState = "resuming"
	PlaybackStateChangedToStatePlaying   PlaybackStateChangedToState = "playing"
	PlaybackStateChangedToStatePaused    PlaybackStateChangedToState = "paused"
	PlaybackStateChangedToStateBuffering PlaybackStateChangedToState = "buffering"
	PlaybackStateChangedToStateSeeking   PlaybackStateChangedToState = "seeking"
	PlaybackStateChangedToStateError     PlaybackStateChangedToState = "error"
	PlaybackStateChangedToStateEnded     PlaybackStateChangedToState = "ended"
	PlaybackStateChangedToStateStopped   PlaybackStateChangedToState = "stopped"
)

type PlaybackStateChangedVisibilityState

type PlaybackStateChangedVisibilityState string

Tab visibility when the event was recorded. Hidden does not imply paused playback or identify the cause of a pause. Missing on older events; null when unavailable.

const (
	PlaybackStateChangedVisibilityStateVisible PlaybackStateChangedVisibilityState = "visible"
	PlaybackStateChangedVisibilityStateHidden  PlaybackStateChangedVisibilityState = "hidden"
)

type PlayedRange

type PlayedRange = shared.PlayedRange

This is an alias to an internal type.

type PlayedRangeParam

type PlayedRangeParam = shared.PlayedRangeParam

This is an alias to an internal type.

type ProgressReached

type ProgressReached = shared.ProgressReached

Furthest progress on the selected final event or latest snapshot. Only views with a positive known media duration and a progress ratio in [0,1] are samples. Each milestone ratio uses sample_views. Seeking can count; this is not watched coverage or audience retention.

This is an alias to an internal type.

type Project

type Project struct {
	AllowedOrigins []string `json:"allowed_origins" api:"required"`
	// Combined shared and project origins.
	EffectiveAllowedOrigins []string `json:"effective_allowed_origins" api:"required"`
	// Effective retention in seconds after resolving the installation default. 0
	// disables expiration.
	EffectiveRetentionSeconds int64  `json:"effective_retention_seconds" api:"required"`
	Name                      string `json:"name" api:"required"`
	ProjectID                 string `json:"project_id" api:"required"`
	RestartRequired           bool   `json:"restart_required" api:"required"`
	// Retention by server receipt time, in seconds. 0 disables expiration; null
	// inherits the installation default.
	RetentionSeconds int64  `json:"retention_seconds" api:"required"`
	Warning          string `json:"warning"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AllowedOrigins            respjson.Field
		EffectiveAllowedOrigins   respjson.Field
		EffectiveRetentionSeconds respjson.Field
		Name                      respjson.Field
		ProjectID                 respjson.Field
		RestartRequired           respjson.Field
		RetentionSeconds          respjson.Field
		Warning                   respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Project) RawJSON

func (r Project) RawJSON() string

Returns the unmodified JSON received from the API

func (*Project) UnmarshalJSON

func (r *Project) UnmarshalJSON(data []byte) error

type ProjectKey

type ProjectKey struct {
	ID   string `json:"id" api:"required"`
	Name string `json:"name" api:"required"`
	// Any of "public", "secret".
	Permission ProjectKeyPermission `json:"permission" api:"required"`
	// True for a private key limited to analytics reads through HTTP and MCP. Public
	// keys always report false. Rotation preserves this setting.
	ReadOnly bool `json:"read_only" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Name        respjson.Field
		Permission  respjson.Field
		ReadOnly    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ProjectKey) RawJSON

func (r ProjectKey) RawJSON() string

Returns the unmodified JSON received from the API

func (*ProjectKey) UnmarshalJSON

func (r *ProjectKey) UnmarshalJSON(data []byte) error

type ProjectKeyNewParams

type ProjectKeyNewParams struct {
	// Key display name, up to 128 UTF-8 bytes. Whitespace-only names are rejected.
	Name string `json:"name" api:"required"`
	// Any of "public", "secret".
	Permission ProjectKeyNewParamsPermission `json:"permission,omitzero" api:"required"`
	// Only secret keys can be read-only. False grants full project management access
	// to secret keys; public keys only ingest events.
	ReadOnly param.Opt[bool] `json:"read_only,omitzero"`
	// contains filtered or unexported fields
}

func (ProjectKeyNewParams) MarshalJSON

func (r ProjectKeyNewParams) MarshalJSON() (data []byte, err error)

func (*ProjectKeyNewParams) UnmarshalJSON

func (r *ProjectKeyNewParams) UnmarshalJSON(data []byte) error

type ProjectKeyNewParamsPermission

type ProjectKeyNewParamsPermission string
const (
	ProjectKeyNewParamsPermissionPublic ProjectKeyNewParamsPermission = "public"
	ProjectKeyNewParamsPermissionSecret ProjectKeyNewParamsPermission = "secret"
)

type ProjectKeyPermission

type ProjectKeyPermission string
const (
	ProjectKeyPermissionPublic ProjectKeyPermission = "public"
	ProjectKeyPermissionSecret ProjectKeyPermission = "secret"
)

type ProjectKeyService

type ProjectKeyService struct {
	Options []option.RequestOption
}

Project origins and keys.

ProjectKeyService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewProjectKeyService method instead.

func NewProjectKeyService

func NewProjectKeyService(opts ...option.RequestOption) (r ProjectKeyService)

NewProjectKeyService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ProjectKeyService) List

func (r *ProjectKeyService) List(ctx context.Context, opts ...option.RequestOption) (res *ProjectKeys, err error)

List key IDs, names, and types. Key values are not returned. Requires a full-access private key; read-only keys receive 403.

func (*ProjectKeyService) New

Create a named public ingestion key or secret key in the authenticated project. Secret keys default to full project access; set read_only to true for analytics reads and exports only. Requires a full-access project secret key. Read-only keys receive 403 and the installation admin key is not accepted. The key is active immediately and its value is returned once; store it before leaving this response. Each project supports at most 64 active keys, including its initial keys.

func (*ProjectKeyService) Rotate

func (r *ProjectKeyService) Rotate(ctx context.Context, keyID string, opts ...option.RequestOption) (res *RotatedProjectKey, err error)

Replace a key in this project. The old value stops working immediately. Save the returned replacement. Requires a full-access private key; read-only keys receive 403. Only the selected key is rotated. If its replacement is lost, a trusted backend can rotate it again through the installation admin API.

type ProjectKeys

type ProjectKeys struct {
	Keys      []ProjectKey `json:"keys" api:"required"`
	ProjectID string       `json:"project_id" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Keys        respjson.Field
		ProjectID   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ProjectKeys) RawJSON

func (r ProjectKeys) RawJSON() string

Returns the unmodified JSON received from the API

func (*ProjectKeys) UnmarshalJSON

func (r *ProjectKeys) UnmarshalJSON(data []byte) error

type ProjectService

type ProjectService struct {
	Options []option.RequestOption
	// Project origins and keys.
	Keys ProjectKeyService
}

Project origins and keys.

ProjectService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewProjectService method instead.

func NewProjectService

func NewProjectService(opts ...option.RequestOption) (r ProjectService)

NewProjectService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ProjectService) Delete

func (r *ProjectService) Delete(ctx context.Context, opts ...option.RequestOption) (res *DeletedProject, err error)

Revoke all project keys. Stored events remain until their retention expires. Requires a full-access private key; read-only keys receive 403.

func (*ProjectService) Update

func (r *ProjectService) Update(ctx context.Context, body ProjectUpdateParams, opts ...option.RequestOption) (res *Project, err error)

Update the name, additional origins or retention of your project. Omitted fields stay unchanged. Set retention_seconds to null to inherit the installation default, or 0 to disable expiration. Changes apply to existing and new events without a restart. Requires a full-access private key; read-only keys receive 403.

type ProjectUpdateParams

type ProjectUpdateParams struct {
	// Retention by server receipt time, in seconds. 0 disables expiration; null
	// inherits the installation default. Omission leaves the current setting
	// unchanged. Applies to existing and new events; removed data cannot be recovered.
	RetentionSeconds param.Opt[int64]  `json:"retention_seconds,omitzero"`
	Name             param.Opt[string] `json:"name,omitzero"`
	// Additional project origins. Shared TOML origins are always included.
	AllowedOrigins []string `json:"allowed_origins,omitzero"`
	// contains filtered or unexported fields
}

func (ProjectUpdateParams) MarshalJSON

func (r ProjectUpdateParams) MarshalJSON() (data []byte, err error)

func (*ProjectUpdateParams) UnmarshalJSON

func (r *ProjectUpdateParams) UnmarshalJSON(data []byte) error

type Quality

type Quality struct {
	// Duration-weighted buffering. Startup wait, pauses and seeking are excluded by
	// the SDK. Unknown durations are not treated as zero.
	Buffering QualityBuffering `json:"buffering" api:"required"`
	// Observed fatal errors. Lost events can undercount this metric; absence of an
	// error is not proof of successful playback.
	FatalErrors   QualityFatalErrors   `json:"fatal_errors" api:"required"`
	PlaybackScore shared.PlaybackScore `json:"playback_score" api:"required"`
	// Mutually exclusive outcomes. An explicit startup_outcome on the selected final
	// event takes precedence. Otherwise an available startup time, including zero, or
	// positive playing time on the selected measurement proves started. All other
	// views are unknown. sample_views excludes unknown; every ratio uses all selected
	// attempts, including unknown. Missing final delivery does not prove an exit or
	// failure.
	StartupOutcomes shared.StartupOutcomes `json:"startup_outcomes" api:"required"`
	// Time from attempt to first playing, measured once per eligible view. This is not
	// first-frame timing.
	StartupTimeMs QualityStartupTimeMs `json:"startup_time_ms" api:"required"`
	// Selected playback attempts with a retained start, including failed attempts.
	Views int64 `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Buffering       respjson.Field
		FatalErrors     respjson.Field
		PlaybackScore   respjson.Field
		StartupOutcomes respjson.Field
		StartupTimeMs   respjson.Field
		Views           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Playback quality for the same start cohort as summary. All rates are fractions. Counts expose measurement coverage.

func (Quality) RawJSON

func (r Quality) RawJSON() string

Returns the unmodified JSON received from the API

func (*Quality) UnmarshalJSON

func (r *Quality) UnmarshalJSON(data []byte) error

type QualityBreakdownPage

type QualityBreakdownPage struct {
	// A custom dimension key, such as custom.plan.
	GroupBy    QualityBreakdownPageGroupBy `json:"group_by" api:"required"`
	Groups     []QualityBreakdownPageGroup `json:"groups" api:"required"`
	NextCursor string                      `json:"next_cursor" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		GroupBy     respjson.Field
		Groups      respjson.Field
		NextCursor  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (QualityBreakdownPage) RawJSON

func (r QualityBreakdownPage) RawJSON() string

Returns the unmodified JSON received from the API

func (*QualityBreakdownPage) UnmarshalJSON

func (r *QualityBreakdownPage) UnmarshalJSON(data []byte) error

type QualityBreakdownPageGroup

type QualityBreakdownPageGroup struct {
	// Playback quality for the same start cohort as summary. All rates are fractions.
	// Counts expose measurement coverage.
	Data  Quality `json:"data" api:"required"`
	Value string  `json:"value" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (QualityBreakdownPageGroup) RawJSON

func (r QualityBreakdownPageGroup) RawJSON() string

Returns the unmodified JSON received from the API

func (*QualityBreakdownPageGroup) UnmarshalJSON

func (r *QualityBreakdownPageGroup) UnmarshalJSON(data []byte) error

type QualityBreakdownPageGroupBy

type QualityBreakdownPageGroupBy string
const (
	QualityBreakdownPageGroupByBrowserName      QualityBreakdownPageGroupBy = "browser_name"
	QualityBreakdownPageGroupByOsName           QualityBreakdownPageGroupBy = "os_name"
	QualityBreakdownPageGroupByDeviceType       QualityBreakdownPageGroupBy = "device_type"
	QualityBreakdownPageGroupByContinent        QualityBreakdownPageGroupBy = "continent"
	QualityBreakdownPageGroupByCountry          QualityBreakdownPageGroupBy = "country"
	QualityBreakdownPageGroupByCity             QualityBreakdownPageGroupBy = "city"
	QualityBreakdownPageGroupByPageOrigin       QualityBreakdownPageGroupBy = "page_origin"
	QualityBreakdownPageGroupByPagePath         QualityBreakdownPageGroupBy = "page_path"
	QualityBreakdownPageGroupBySubtitleLanguage QualityBreakdownPageGroupBy = "subtitle_language"
	QualityBreakdownPageGroupByPlaybackRate     QualityBreakdownPageGroupBy = "playback_rate"
	QualityBreakdownPageGroupByVideoTitle       QualityBreakdownPageGroupBy = "video_title"
	QualityBreakdownPageGroupByUserID           QualityBreakdownPageGroupBy = "user_id"
)

type QualityBuffering

type QualityBuffering struct {
	// Total rebuffer time divided by combined playing and rebuffer time. Null without
	// samples. Multiply by 100 for percent.
	Ratio float64 `json:"ratio" api:"required"`
	// Views with playing and rebuffer durations available and positive combined
	// duration.
	SampleViews int64 `json:"sample_views" api:"required"`
	// Sum of playing time for eligible buffering samples only.
	TotalPlayingTimeMs float64 `json:"total_playing_time_ms" api:"required"`
	// Sum of rebuffer time for the same samples.
	TotalRebufferDurationMs float64 `json:"total_rebuffer_duration_ms" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Ratio                   respjson.Field
		SampleViews             respjson.Field
		TotalPlayingTimeMs      respjson.Field
		TotalRebufferDurationMs respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Duration-weighted buffering. Startup wait, pauses and seeking are excluded by the SDK. Unknown durations are not treated as zero.

func (QualityBuffering) RawJSON

func (r QualityBuffering) RawJSON() string

Returns the unmodified JSON received from the API

func (*QualityBuffering) UnmarshalJSON

func (r *QualityBuffering) UnmarshalJSON(data []byte) error

type QualityFatalErrors

type QualityFatalErrors struct {
	// Distinct selected views with at least one observed matching fatal
	// playback_error, including before playback starts.
	AffectedViews int64 `json:"affected_views" api:"required"`
	// Affected views divided by all selected attempts; null when views is zero.
	// Multiply by 100 for percent.
	Ratio float64 `json:"ratio" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AffectedViews respjson.Field
		Ratio         respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Observed fatal errors. Lost events can undercount this metric; absence of an error is not proof of successful playback.

func (QualityFatalErrors) RawJSON

func (r QualityFatalErrors) RawJSON() string

Returns the unmodified JSON received from the API

func (*QualityFatalErrors) UnmarshalJSON

func (r *QualityFatalErrors) UnmarshalJSON(data []byte) error

type QualityGetParams

type QualityGetParams struct {
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Use next_cursor from the previous page. Keep the same filters, sort_by and
	// order. Video cursors from earlier versions are invalid; start a new pagination
	// sequence after upgrading.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent QualityGetParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType QualityGetParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// Optional on summary, quality and engagement. Group views by this field on their
	// first retained start. Missing, null and nonstring context forms a null group;
	// the literal device type unknown stays separate. Groups sort by views descending,
	// then value ascending with null first for ties. Pagination is available only with
	// group_by. Location uses the first retained start too. City groups use the stored
	// name; filter by country to avoid combining names shared by different countries.
	// Page groups use the first retained start even if playback continues after
	// navigation. Filter by page_origin when grouping page_path to distinguish
	// identical paths on different sites. video_title groups by the title on each
	// view's first retained start, so a renamed video counts each view under the title
	// it started with. user_id groups by the user ID on each view's first retained
	// start. Use custom.<key>, such as custom.plan, to group by a custom dimension;
	// views without the key form the null group.
	GroupBy QualityGetParamsGroupBy `query:"group_by,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (QualityGetParams) URLQuery

func (r QualityGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes QualityGetParams's query parameters as `url.Values`.

type QualityGetParamsContinent

type QualityGetParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	QualityGetParamsContinentAf QualityGetParamsContinent = "AF"
	QualityGetParamsContinentAn QualityGetParamsContinent = "AN"
	QualityGetParamsContinentAs QualityGetParamsContinent = "AS"
	QualityGetParamsContinentEu QualityGetParamsContinent = "EU"
	QualityGetParamsContinentNa QualityGetParamsContinent = "NA"
	QualityGetParamsContinentOc QualityGetParamsContinent = "OC"
	QualityGetParamsContinentSa QualityGetParamsContinent = "SA"
)

type QualityGetParamsDeviceType

type QualityGetParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	QualityGetParamsDeviceTypeDesktop QualityGetParamsDeviceType = "desktop"
	QualityGetParamsDeviceTypeMobile  QualityGetParamsDeviceType = "mobile"
	QualityGetParamsDeviceTypeTablet  QualityGetParamsDeviceType = "tablet"
	QualityGetParamsDeviceTypeUnknown QualityGetParamsDeviceType = "unknown"
)

type QualityGetParamsGroupBy

type QualityGetParamsGroupBy string

Optional on summary, quality and engagement. Group views by this field on their first retained start. Missing, null and nonstring context forms a null group; the literal device type unknown stays separate. Groups sort by views descending, then value ascending with null first for ties. Pagination is available only with group_by. Location uses the first retained start too. City groups use the stored name; filter by country to avoid combining names shared by different countries. Page groups use the first retained start even if playback continues after navigation. Filter by page_origin when grouping page_path to distinguish identical paths on different sites. video_title groups by the title on each view's first retained start, so a renamed video counts each view under the title it started with. user_id groups by the user ID on each view's first retained start. Use custom.<key>, such as custom.plan, to group by a custom dimension; views without the key form the null group.

const (
	QualityGetParamsGroupByBrowserName      QualityGetParamsGroupBy = "browser_name"
	QualityGetParamsGroupByOsName           QualityGetParamsGroupBy = "os_name"
	QualityGetParamsGroupByDeviceType       QualityGetParamsGroupBy = "device_type"
	QualityGetParamsGroupByContinent        QualityGetParamsGroupBy = "continent"
	QualityGetParamsGroupByCountry          QualityGetParamsGroupBy = "country"
	QualityGetParamsGroupByCity             QualityGetParamsGroupBy = "city"
	QualityGetParamsGroupByPageOrigin       QualityGetParamsGroupBy = "page_origin"
	QualityGetParamsGroupByPagePath         QualityGetParamsGroupBy = "page_path"
	QualityGetParamsGroupBySubtitleLanguage QualityGetParamsGroupBy = "subtitle_language"
	QualityGetParamsGroupByPlaybackRate     QualityGetParamsGroupBy = "playback_rate"
	QualityGetParamsGroupByVideoTitle       QualityGetParamsGroupBy = "video_title"
	QualityGetParamsGroupByUserID           QualityGetParamsGroupBy = "user_id"
)

type QualityResponseUnion

type QualityResponseUnion struct {
	// This field is from variant [Quality].
	Buffering QualityBuffering `json:"buffering"`
	// This field is from variant [Quality].
	FatalErrors QualityFatalErrors `json:"fatal_errors"`
	// This field is from variant [Quality].
	PlaybackScore shared.PlaybackScore `json:"playback_score"`
	// This field is from variant [Quality].
	StartupOutcomes shared.StartupOutcomes `json:"startup_outcomes"`
	// This field is from variant [Quality].
	StartupTimeMs QualityStartupTimeMs `json:"startup_time_ms"`
	// This field is from variant [Quality].
	Views int64 `json:"views"`
	// This field is from variant [QualityBreakdownPage].
	GroupBy QualityBreakdownPageGroupBy `json:"group_by"`
	// This field is from variant [QualityBreakdownPage].
	Groups []QualityBreakdownPageGroup `json:"groups"`
	// This field is from variant [QualityBreakdownPage].
	NextCursor string `json:"next_cursor"`
	JSON       struct {
		Buffering       respjson.Field
		FatalErrors     respjson.Field
		PlaybackScore   respjson.Field
		StartupOutcomes respjson.Field
		StartupTimeMs   respjson.Field
		Views           respjson.Field
		GroupBy         respjson.Field
		Groups          respjson.Field
		NextCursor      respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

QualityResponseUnion contains all possible properties and values from Quality, QualityBreakdownPage.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (QualityResponseUnion) AsQuality

func (u QualityResponseUnion) AsQuality() (v Quality)

func (QualityResponseUnion) AsQualityBreakdownPage

func (u QualityResponseUnion) AsQualityBreakdownPage() (v QualityBreakdownPage)

func (QualityResponseUnion) RawJSON

func (u QualityResponseUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*QualityResponseUnion) UnmarshalJSON

func (r *QualityResponseUnion) UnmarshalJSON(data []byte) error

type QualityService

type QualityService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

QualityService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewQualityService method instead.

func NewQualityService

func NewQualityService(opts ...option.RequestOption) (r QualityService)

NewQualityService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*QualityService) Get

Get startup time, buffering, and observed fatal errors for matching playback attempts. Null means unavailable. Optionally group the full filtered view-start cohort with group_by=browser_name, os_name, device_type, continent, country or city. Without group_by the totals response is unchanged. With group_by, return paginated groups sorted by views descending. Equal view counts sort by value ascending, null first. Context comes from the first retained start; missing, null and nonstring values form a null group. Keep group_by and filters unchanged with each cursor. Unique viewers must not be summed across groups. Includes mutually exclusive startup outcomes; unknown outcomes remain explicit.

type QualityStartupTimeMs

type QualityStartupTimeMs struct {
	// Continuous median startup time in milliseconds, or null without samples.
	Median float64 `json:"median" api:"required"`
	// Continuous 95th percentile startup time in milliseconds, or null without
	// samples.
	P95 float64 `json:"p95" api:"required"`
	// Views with a non-null startup measurement on the selected final event or latest
	// snapshot.
	SampleViews int64 `json:"sample_views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Median      respjson.Field
		P95         respjson.Field
		SampleViews respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Time from attempt to first playing, measured once per eligible view. This is not first-frame timing.

func (QualityStartupTimeMs) RawJSON

func (r QualityStartupTimeMs) RawJSON() string

Returns the unmodified JSON received from the API

func (*QualityStartupTimeMs) UnmarshalJSON

func (r *QualityStartupTimeMs) UnmarshalJSON(data []byte) error

type QualityTimeseries

type QualityTimeseries struct {
	Buckets []QualityTimeseriesBucket `json:"buckets" api:"required"`
	// Inclusive query bound normalized to UTC milliseconds.
	From time.Time `json:"from" api:"required" format:"date-time"`
	// Any of "hour", "day".
	Interval QualityTimeseriesInterval `json:"interval" api:"required"`
	Kind     constant.Quality          `json:"kind" default:"quality"`
	Timezone constant.Utc              `json:"timezone" default:"UTC"`
	// Exclusive query bound normalized to UTC milliseconds.
	To time.Time `json:"to" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Buckets     respjson.Field
		From        respjson.Field
		Interval    respjson.Field
		Kind        respjson.Field
		Timezone    respjson.Field
		To          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (QualityTimeseries) RawJSON

func (r QualityTimeseries) RawJSON() string

Returns the unmodified JSON received from the API

func (*QualityTimeseries) UnmarshalJSON

func (r *QualityTimeseries) UnmarshalJSON(data []byte) error

type QualityTimeseriesBucket

type QualityTimeseriesBucket struct {
	BucketStart time.Time `json:"bucket_start" api:"required" format:"date-time"`
	// Duration-weighted buffering. Startup wait, pauses and seeking are excluded by
	// the SDK. Unknown durations are not treated as zero.
	Buffering QualityTimeseriesBucketBuffering `json:"buffering" api:"required"`
	// Observed fatal errors. Lost events can undercount this metric; absence of an
	// error is not proof of successful playback.
	FatalErrors   QualityTimeseriesBucketFatalErrors `json:"fatal_errors" api:"required"`
	PlaybackScore shared.PlaybackScore               `json:"playback_score" api:"required"`
	// Mutually exclusive outcomes. An explicit startup_outcome on the selected final
	// event takes precedence. Otherwise an available startup time, including zero, or
	// positive playing time on the selected measurement proves started. All other
	// views are unknown. sample_views excludes unknown; every ratio uses all selected
	// attempts, including unknown. Missing final delivery does not prove an exit or
	// failure.
	StartupOutcomes shared.StartupOutcomes `json:"startup_outcomes" api:"required"`
	// Time from attempt to first playing, measured once per eligible view. This is not
	// first-frame timing.
	StartupTimeMs QualityTimeseriesBucketStartupTimeMs `json:"startup_time_ms" api:"required"`
	// Selected playback attempts with a retained start, including failed attempts.
	Views int64 `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BucketStart     respjson.Field
		Buffering       respjson.Field
		FatalErrors     respjson.Field
		PlaybackScore   respjson.Field
		StartupOutcomes respjson.Field
		StartupTimeMs   respjson.Field
		Views           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Playback quality for the same start cohort as summary. All rates are fractions. Counts expose measurement coverage.

func (QualityTimeseriesBucket) RawJSON

func (r QualityTimeseriesBucket) RawJSON() string

Returns the unmodified JSON received from the API

func (*QualityTimeseriesBucket) UnmarshalJSON

func (r *QualityTimeseriesBucket) UnmarshalJSON(data []byte) error

type QualityTimeseriesBucketBuffering

type QualityTimeseriesBucketBuffering struct {
	// Total rebuffer time divided by combined playing and rebuffer time. Null without
	// samples. Multiply by 100 for percent.
	Ratio float64 `json:"ratio" api:"required"`
	// Views with playing and rebuffer durations available and positive combined
	// duration.
	SampleViews int64 `json:"sample_views" api:"required"`
	// Sum of playing time for eligible buffering samples only.
	TotalPlayingTimeMs float64 `json:"total_playing_time_ms" api:"required"`
	// Sum of rebuffer time for the same samples.
	TotalRebufferDurationMs float64 `json:"total_rebuffer_duration_ms" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Ratio                   respjson.Field
		SampleViews             respjson.Field
		TotalPlayingTimeMs      respjson.Field
		TotalRebufferDurationMs respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Duration-weighted buffering. Startup wait, pauses and seeking are excluded by the SDK. Unknown durations are not treated as zero.

func (QualityTimeseriesBucketBuffering) RawJSON

Returns the unmodified JSON received from the API

func (*QualityTimeseriesBucketBuffering) UnmarshalJSON

func (r *QualityTimeseriesBucketBuffering) UnmarshalJSON(data []byte) error

type QualityTimeseriesBucketFatalErrors

type QualityTimeseriesBucketFatalErrors struct {
	// Distinct selected views with at least one observed matching fatal
	// playback_error, including before playback starts.
	AffectedViews int64 `json:"affected_views" api:"required"`
	// Affected views divided by all selected attempts; null when views is zero.
	// Multiply by 100 for percent.
	Ratio float64 `json:"ratio" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AffectedViews respjson.Field
		Ratio         respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Observed fatal errors. Lost events can undercount this metric; absence of an error is not proof of successful playback.

func (QualityTimeseriesBucketFatalErrors) RawJSON

Returns the unmodified JSON received from the API

func (*QualityTimeseriesBucketFatalErrors) UnmarshalJSON

func (r *QualityTimeseriesBucketFatalErrors) UnmarshalJSON(data []byte) error

type QualityTimeseriesBucketStartupTimeMs

type QualityTimeseriesBucketStartupTimeMs struct {
	// Continuous median startup time in milliseconds, or null without samples.
	Median float64 `json:"median" api:"required"`
	// Continuous 95th percentile startup time in milliseconds, or null without
	// samples.
	P95 float64 `json:"p95" api:"required"`
	// Views with a non-null startup measurement on the selected final event or latest
	// snapshot.
	SampleViews int64 `json:"sample_views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Median      respjson.Field
		P95         respjson.Field
		SampleViews respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Time from attempt to first playing, measured once per eligible view. This is not first-frame timing.

func (QualityTimeseriesBucketStartupTimeMs) RawJSON

Returns the unmodified JSON received from the API

func (*QualityTimeseriesBucketStartupTimeMs) UnmarshalJSON

func (r *QualityTimeseriesBucketStartupTimeMs) UnmarshalJSON(data []byte) error

type QualityTimeseriesInterval

type QualityTimeseriesInterval string
const (
	QualityTimeseriesIntervalHour QualityTimeseriesInterval = "hour"
	QualityTimeseriesIntervalDay  QualityTimeseriesInterval = "day"
)

type RenditionChanged

type RenditionChanged struct {
	ConnectorName    string `json:"connector_name" api:"required"`
	ConnectorVersion string `json:"connector_version" api:"required"`
	DeliveryHostname string `json:"delivery_hostname" api:"required"`
	Environment      string `json:"environment" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory               RenditionChangedErrorCategory          `json:"error_category" api:"required"`
	ErrorCode                   RenditionChangedErrorCodeUnion         `json:"error_code" api:"required"`
	ErrorFatal                  bool                                   `json:"error_fatal" api:"required"`
	ErrorPlayheadSeconds        float64                                `json:"error_playhead_seconds" api:"required"`
	EventID                     string                                 `json:"event_id" api:"required" format:"uuid"`
	EventName                   constant.ChunkifyVideoRenditionChanged `json:"event_name" default:"chunkify.video.rendition_changed"`
	OccurredAt                  time.Time                              `json:"occurred_at" api:"required" format:"date-time"`
	PlayerHeightPx              float64                                `json:"player_height_px" api:"required"`
	PlayerName                  string                                 `json:"player_name" api:"required"`
	PlayerVersion               string                                 `json:"player_version" api:"required"`
	PlayerWidthPx               float64                                `json:"player_width_px" api:"required"`
	PlayheadSeconds             float64                                `json:"playhead_seconds" api:"required"`
	PreviousRenditionBitrateBps float64                                `json:"previous_rendition_bitrate_bps" api:"required"`
	PreviousRenditionCodec      string                                 `json:"previous_rendition_codec" api:"required"`
	PreviousRenditionFrameRate  float64                                `json:"previous_rendition_frame_rate" api:"required"`
	PreviousRenditionHeight     float64                                `json:"previous_rendition_height" api:"required"`
	PreviousRenditionWidth      float64                                `json:"previous_rendition_width" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason        RenditionChangedReason `json:"reason" api:"required"`
	SchemaVersion float64                `json:"schema_version" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName                     string  `json:"sdk_name" api:"required"`
	SDKVersion                  string  `json:"sdk_version" api:"required"`
	SelectedRenditionBitrateBps float64 `json:"selected_rendition_bitrate_bps" api:"required"`
	SelectedRenditionCodec      string  `json:"selected_rendition_codec" api:"required"`
	SelectedRenditionFrameRate  float64 `json:"selected_rendition_frame_rate" api:"required"`
	SelectedRenditionHeight     float64 `json:"selected_rendition_height" api:"required"`
	SelectedRenditionWidth      float64 `json:"selected_rendition_width" api:"required"`
	Sequence                    int64   `json:"sequence" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome RenditionChangedStartupOutcome `json:"startup_outcome" api:"required"`
	VideoID        string                         `json:"video_id" api:"required"`
	ViewID         string                         `json:"view_id" api:"required" format:"uuid"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID string `json:"viewer_id" api:"required"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext           shared.BrowserContext         `json:"browser_context" api:"nullable"`
	DeliveryRequestCount     float64                       `json:"delivery_request_count" api:"nullable"`
	DeliveryThroughputBps    float64                       `json:"delivery_throughput_bps" api:"nullable"`
	DeliveryTransferredBytes float64                       `json:"delivery_transferred_bytes" api:"nullable"`
	DroppedVideoFrames       float64                       `json:"dropped_video_frames" api:"nullable"`
	FirstVideoFrameTimeMs    float64                       `json:"first_video_frame_time_ms" api:"nullable"`
	FurthestProgressRatio    float64                       `json:"furthest_progress_ratio" api:"nullable"`
	MaximumPlayheadSeconds   float64                       `json:"maximum_playhead_seconds"`
	MediaDurationSeconds     float64                       `json:"media_duration_seconds" api:"nullable"`
	MediaHeightPx            float64                       `json:"media_height_px" api:"nullable"`
	MediaWidthPx             float64                       `json:"media_width_px" api:"nullable"`
	PlayingTimeMs            float64                       `json:"playing_time_ms"`
	RebufferCount            float64                       `json:"rebuffer_count"`
	RebufferDurationMs       float64                       `json:"rebuffer_duration_ms"`
	RebufferRatio            float64                       `json:"rebuffer_ratio" api:"nullable"`
	RenditionPlayingTime     []shared.RenditionPlayingTime `json:"rendition_playing_time" api:"nullable"`
	RenditionSwitchCount     float64                       `json:"rendition_switch_count" api:"nullable"`
	SeekCount                float64                       `json:"seek_count"`
	SeekDurationMs           float64                       `json:"seek_duration_ms"`
	StartupTimeMs            float64                       `json:"startup_time_ms" api:"nullable"`
	TotalVideoFrames         float64                       `json:"total_video_frames" api:"nullable"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID string `json:"user_id" api:"nullable"`
	// Optional human-readable video title for reports.
	VideoTitle string `json:"video_title" api:"nullable"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState RenditionChangedVisibilityState `json:"visibility_state" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorName               respjson.Field
		ConnectorVersion            respjson.Field
		DeliveryHostname            respjson.Field
		Environment                 respjson.Field
		ErrorCategory               respjson.Field
		ErrorCode                   respjson.Field
		ErrorFatal                  respjson.Field
		ErrorPlayheadSeconds        respjson.Field
		EventID                     respjson.Field
		EventName                   respjson.Field
		OccurredAt                  respjson.Field
		PlayerHeightPx              respjson.Field
		PlayerName                  respjson.Field
		PlayerVersion               respjson.Field
		PlayerWidthPx               respjson.Field
		PlayheadSeconds             respjson.Field
		PreviousRenditionBitrateBps respjson.Field
		PreviousRenditionCodec      respjson.Field
		PreviousRenditionFrameRate  respjson.Field
		PreviousRenditionHeight     respjson.Field
		PreviousRenditionWidth      respjson.Field
		Reason                      respjson.Field
		SchemaVersion               respjson.Field
		SDKName                     respjson.Field
		SDKVersion                  respjson.Field
		SelectedRenditionBitrateBps respjson.Field
		SelectedRenditionCodec      respjson.Field
		SelectedRenditionFrameRate  respjson.Field
		SelectedRenditionHeight     respjson.Field
		SelectedRenditionWidth      respjson.Field
		Sequence                    respjson.Field
		StartupOutcome              respjson.Field
		VideoID                     respjson.Field
		ViewID                      respjson.Field
		ViewerID                    respjson.Field
		BrowserContext              respjson.Field
		DeliveryRequestCount        respjson.Field
		DeliveryThroughputBps       respjson.Field
		DeliveryTransferredBytes    respjson.Field
		DroppedVideoFrames          respjson.Field
		FirstVideoFrameTimeMs       respjson.Field
		FurthestProgressRatio       respjson.Field
		MaximumPlayheadSeconds      respjson.Field
		MediaDurationSeconds        respjson.Field
		MediaHeightPx               respjson.Field
		MediaWidthPx                respjson.Field
		PlayingTimeMs               respjson.Field
		RebufferCount               respjson.Field
		RebufferDurationMs          respjson.Field
		RebufferRatio               respjson.Field
		RenditionPlayingTime        respjson.Field
		RenditionSwitchCount        respjson.Field
		SeekCount                   respjson.Field
		SeekDurationMs              respjson.Field
		StartupTimeMs               respjson.Field
		TotalVideoFrames            respjson.Field
		UserID                      respjson.Field
		VideoTitle                  respjson.Field
		VisibilityState             respjson.Field
		ExtraFields                 map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RenditionChanged) RawJSON

func (r RenditionChanged) RawJSON() string

Returns the unmodified JSON received from the API

func (RenditionChanged) ToParam

ToParam converts this RenditionChanged to a RenditionChangedParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with RenditionChangedParam.Overrides()

func (*RenditionChanged) UnmarshalJSON

func (r *RenditionChanged) UnmarshalJSON(data []byte) error

type RenditionChangedErrorCategory

type RenditionChangedErrorCategory string
const (
	RenditionChangedErrorCategoryAborted     RenditionChangedErrorCategory = "aborted"
	RenditionChangedErrorCategoryNetwork     RenditionChangedErrorCategory = "network"
	RenditionChangedErrorCategoryDecode      RenditionChangedErrorCategory = "decode"
	RenditionChangedErrorCategoryUnsupported RenditionChangedErrorCategory = "unsupported"
	RenditionChangedErrorCategoryUnknown     RenditionChangedErrorCategory = "unknown"
)

type RenditionChangedErrorCodeUnion

type RenditionChangedErrorCodeUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

RenditionChangedErrorCodeUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (RenditionChangedErrorCodeUnion) AsFloat

func (u RenditionChangedErrorCodeUnion) AsFloat() (v float64)

func (RenditionChangedErrorCodeUnion) AsString

func (u RenditionChangedErrorCodeUnion) AsString() (v string)

func (RenditionChangedErrorCodeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*RenditionChangedErrorCodeUnion) UnmarshalJSON

func (r *RenditionChangedErrorCodeUnion) UnmarshalJSON(data []byte) error

type RenditionChangedErrorCodeUnionParam

type RenditionChangedErrorCodeUnionParam struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (RenditionChangedErrorCodeUnionParam) MarshalJSON

func (u RenditionChangedErrorCodeUnionParam) MarshalJSON() ([]byte, error)

func (*RenditionChangedErrorCodeUnionParam) UnmarshalJSON

func (u *RenditionChangedErrorCodeUnionParam) UnmarshalJSON(data []byte) error

type RenditionChangedParam

type RenditionChangedParam struct {
	ConnectorVersion param.Opt[string] `json:"connector_version,omitzero" api:"required"`
	DeliveryHostname param.Opt[string] `json:"delivery_hostname,omitzero" api:"required"`
	Environment      param.Opt[string] `json:"environment,omitzero" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory               param.Opt[RenditionChangedErrorCategory] `json:"error_category,omitzero" api:"required"`
	ErrorFatal                  param.Opt[bool]                          `json:"error_fatal,omitzero" api:"required"`
	ErrorPlayheadSeconds        param.Opt[float64]                       `json:"error_playhead_seconds,omitzero" api:"required"`
	PlayerHeightPx              param.Opt[float64]                       `json:"player_height_px,omitzero" api:"required"`
	PlayerName                  param.Opt[string]                        `json:"player_name,omitzero" api:"required"`
	PlayerVersion               param.Opt[string]                        `json:"player_version,omitzero" api:"required"`
	PlayerWidthPx               param.Opt[float64]                       `json:"player_width_px,omitzero" api:"required"`
	PlayheadSeconds             param.Opt[float64]                       `json:"playhead_seconds,omitzero" api:"required"`
	PreviousRenditionBitrateBps param.Opt[float64]                       `json:"previous_rendition_bitrate_bps,omitzero" api:"required"`
	PreviousRenditionCodec      param.Opt[string]                        `json:"previous_rendition_codec,omitzero" api:"required"`
	PreviousRenditionFrameRate  param.Opt[float64]                       `json:"previous_rendition_frame_rate,omitzero" api:"required"`
	PreviousRenditionHeight     param.Opt[float64]                       `json:"previous_rendition_height,omitzero" api:"required"`
	PreviousRenditionWidth      param.Opt[float64]                       `json:"previous_rendition_width,omitzero" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason                      param.Opt[RenditionChangedReason] `json:"reason,omitzero" api:"required"`
	SelectedRenditionBitrateBps param.Opt[float64]                `json:"selected_rendition_bitrate_bps,omitzero" api:"required"`
	SelectedRenditionCodec      param.Opt[string]                 `json:"selected_rendition_codec,omitzero" api:"required"`
	SelectedRenditionFrameRate  param.Opt[float64]                `json:"selected_rendition_frame_rate,omitzero" api:"required"`
	SelectedRenditionHeight     param.Opt[float64]                `json:"selected_rendition_height,omitzero" api:"required"`
	SelectedRenditionWidth      param.Opt[float64]                `json:"selected_rendition_width,omitzero" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome param.Opt[RenditionChangedStartupOutcome] `json:"startup_outcome,omitzero" api:"required"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID      param.Opt[string]                   `json:"viewer_id,omitzero" api:"required"`
	ErrorCode     RenditionChangedErrorCodeUnionParam `json:"error_code,omitzero" api:"required"`
	ConnectorName string                              `json:"connector_name" api:"required"`
	EventID       string                              `json:"event_id" api:"required" format:"uuid"`
	OccurredAt    time.Time                           `json:"occurred_at" api:"required" format:"date-time"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName                  string             `json:"sdk_name" api:"required"`
	SDKVersion               string             `json:"sdk_version" api:"required"`
	Sequence                 int64              `json:"sequence" api:"required"`
	VideoID                  string             `json:"video_id" api:"required"`
	ViewID                   string             `json:"view_id" api:"required" format:"uuid"`
	DeliveryRequestCount     param.Opt[float64] `json:"delivery_request_count,omitzero"`
	DeliveryThroughputBps    param.Opt[float64] `json:"delivery_throughput_bps,omitzero"`
	DeliveryTransferredBytes param.Opt[float64] `json:"delivery_transferred_bytes,omitzero"`
	DroppedVideoFrames       param.Opt[float64] `json:"dropped_video_frames,omitzero"`
	FirstVideoFrameTimeMs    param.Opt[float64] `json:"first_video_frame_time_ms,omitzero"`
	FurthestProgressRatio    param.Opt[float64] `json:"furthest_progress_ratio,omitzero"`
	MediaDurationSeconds     param.Opt[float64] `json:"media_duration_seconds,omitzero"`
	MediaHeightPx            param.Opt[float64] `json:"media_height_px,omitzero"`
	MediaWidthPx             param.Opt[float64] `json:"media_width_px,omitzero"`
	RebufferRatio            param.Opt[float64] `json:"rebuffer_ratio,omitzero"`
	RenditionSwitchCount     param.Opt[float64] `json:"rendition_switch_count,omitzero"`
	StartupTimeMs            param.Opt[float64] `json:"startup_time_ms,omitzero"`
	TotalVideoFrames         param.Opt[float64] `json:"total_video_frames,omitzero"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID param.Opt[string] `json:"user_id,omitzero"`
	// Optional human-readable video title for reports.
	VideoTitle param.Opt[string] `json:"video_title,omitzero"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState        param.Opt[RenditionChangedVisibilityState] `json:"visibility_state,omitzero"`
	MaximumPlayheadSeconds param.Opt[float64]                         `json:"maximum_playhead_seconds,omitzero"`
	PlayingTimeMs          param.Opt[float64]                         `json:"playing_time_ms,omitzero"`
	RebufferCount          param.Opt[float64]                         `json:"rebuffer_count,omitzero"`
	RebufferDurationMs     param.Opt[float64]                         `json:"rebuffer_duration_ms,omitzero"`
	SeekCount              param.Opt[float64]                         `json:"seek_count,omitzero"`
	SeekDurationMs         param.Opt[float64]                         `json:"seek_duration_ms,omitzero"`
	RenditionPlayingTime   []shared.RenditionPlayingTimeParam         `json:"rendition_playing_time,omitzero"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContextParam `json:"browser_context,omitzero"`
	// This field can be elided, and will marshal its zero value as
	// "chunkify.video.rendition_changed".
	EventName constant.ChunkifyVideoRenditionChanged `json:"event_name" default:"chunkify.video.rendition_changed"`
	// This field can be elided, and will marshal its zero value as 1.
	SchemaVersion float64 `json:"schema_version,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The properties ConnectorName, ConnectorVersion, DeliveryHostname, Environment, ErrorCategory, ErrorCode, ErrorFatal, ErrorPlayheadSeconds, EventID, EventName, OccurredAt, PlayerHeightPx, PlayerName, PlayerVersion, PlayerWidthPx, PlayheadSeconds, PreviousRenditionBitrateBps, PreviousRenditionCodec, PreviousRenditionFrameRate, PreviousRenditionHeight, PreviousRenditionWidth, Reason, SchemaVersion, SDKName, SDKVersion, SelectedRenditionBitrateBps, SelectedRenditionCodec, SelectedRenditionFrameRate, SelectedRenditionHeight, SelectedRenditionWidth, Sequence, StartupOutcome, VideoID, ViewID, ViewerID are required.

func (RenditionChangedParam) MarshalJSON

func (r RenditionChangedParam) MarshalJSON() (data []byte, err error)

func (*RenditionChangedParam) UnmarshalJSON

func (r *RenditionChangedParam) UnmarshalJSON(data []byte) error

type RenditionChangedReason

type RenditionChangedReason string
const (
	RenditionChangedReasonEnded         RenditionChangedReason = "ended"
	RenditionChangedReasonDestroyed     RenditionChangedReason = "destroyed"
	RenditionChangedReasonSourceChanged RenditionChangedReason = "source_changed"
	RenditionChangedReasonPageExit      RenditionChangedReason = "page_exit"
)

type RenditionChangedStartupOutcome

type RenditionChangedStartupOutcome string
const (
	RenditionChangedStartupOutcomeStarted           RenditionChangedStartupOutcome = "started"
	RenditionChangedStartupOutcomeFailedBeforeStart RenditionChangedStartupOutcome = "failed_before_start"
	RenditionChangedStartupOutcomeEndedBeforeStart  RenditionChangedStartupOutcome = "ended_before_start"
)

type RenditionChangedVisibilityState

type RenditionChangedVisibilityState string

Tab visibility when the event was recorded. Hidden does not imply paused playback or identify the cause of a pause. Missing on older events; null when unavailable.

const (
	RenditionChangedVisibilityStateVisible RenditionChangedVisibilityState = "visible"
	RenditionChangedVisibilityStateHidden  RenditionChangedVisibilityState = "hidden"
)

type RenditionGetParams

type RenditionGetParams struct {
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent RenditionGetParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType RenditionGetParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (RenditionGetParams) URLQuery

func (r RenditionGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes RenditionGetParams's query parameters as `url.Values`.

type RenditionGetParamsContinent

type RenditionGetParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	RenditionGetParamsContinentAf RenditionGetParamsContinent = "AF"
	RenditionGetParamsContinentAn RenditionGetParamsContinent = "AN"
	RenditionGetParamsContinentAs RenditionGetParamsContinent = "AS"
	RenditionGetParamsContinentEu RenditionGetParamsContinent = "EU"
	RenditionGetParamsContinentNa RenditionGetParamsContinent = "NA"
	RenditionGetParamsContinentOc RenditionGetParamsContinent = "OC"
	RenditionGetParamsContinentSa RenditionGetParamsContinent = "SA"
)

type RenditionGetParamsDeviceType

type RenditionGetParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	RenditionGetParamsDeviceTypeDesktop RenditionGetParamsDeviceType = "desktop"
	RenditionGetParamsDeviceTypeMobile  RenditionGetParamsDeviceType = "mobile"
	RenditionGetParamsDeviceTypeTablet  RenditionGetParamsDeviceType = "tablet"
	RenditionGetParamsDeviceTypeUnknown RenditionGetParamsDeviceType = "unknown"
)

type RenditionMetric

type RenditionMetric struct {
	// Declared rendition bitrate in bits per second, not measured network throughput.
	BitrateBps float64 `json:"bitrate_bps" api:"required"`
	// Reported codec; null when unknown.
	Codec string `json:"codec" api:"required"`
	// Reported frames per second; null when unknown.
	FrameRate float64 `json:"frame_rate" api:"required"`
	// Reported height in pixels; null when unknown.
	Height float64 `json:"height" api:"required"`
	// Cumulative measured playing time for this rendition, summed once per attempt.
	PlayingTimeMs float64 `json:"playing_time_ms" api:"required"`
	// Share of all measured rendition playing time, including rows outside the
	// returned limit.
	PlayingTimeRatio float64 `json:"playing_time_ratio" api:"required"`
	// Distinct attempts with positive playing time for this rendition.
	Views int64 `json:"views" api:"required"`
	// Reported width in pixels; null when unknown.
	Width float64 `json:"width" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BitrateBps       respjson.Field
		Codec            respjson.Field
		FrameRate        respjson.Field
		Height           respjson.Field
		PlayingTimeMs    respjson.Field
		PlayingTimeRatio respjson.Field
		Views            respjson.Field
		Width            respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

One rendition identified by its dimensions, codec, declared bitrate and frame rate.

func (RenditionMetric) RawJSON

func (r RenditionMetric) RawJSON() string

Returns the unmodified JSON received from the API

func (*RenditionMetric) UnmarshalJSON

func (r *RenditionMetric) UnmarshalJSON(data []byte) error

type RenditionPlayingTime

type RenditionPlayingTime = shared.RenditionPlayingTime

This is an alias to an internal type.

type RenditionPlayingTimeParam

type RenditionPlayingTimeParam = shared.RenditionPlayingTimeParam

This is an alias to an internal type.

type RenditionReport

type RenditionReport struct {
	// Time-weighted mean declared bitrate. Null without playing time with a known
	// bitrate.
	AverageBitrateBps float64 `json:"average_bitrate_bps" api:"required"`
	// Measured playing time with a known rendition bitrate, used as the average
	// denominator.
	BitrateSamplePlayingTimeMs float64 `json:"bitrate_sample_playing_time_ms" api:"required"`
	// Most-played renditions first. Defaults to 100 rows, maximum 1000. CSV exports
	// include all matching rows.
	Renditions []RenditionMetric `json:"renditions" api:"required"`
	// Attempts with positive measured rendition playing time.
	SampleViews int64 `json:"sample_views" api:"required"`
	// Total measured rendition playing time across all matching rows. Can be less than
	// overall watch time when rendition information is missing.
	TotalPlayingTimeMs float64 `json:"total_playing_time_ms" api:"required"`
	// Number of distinct renditions before applying the row limit.
	TotalRenditions int64 `json:"total_renditions" api:"required"`
	// All attempts in the filtered start cohort.
	Views int64 `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AverageBitrateBps          respjson.Field
		BitrateSamplePlayingTimeMs respjson.Field
		Renditions                 respjson.Field
		SampleViews                respjson.Field
		TotalPlayingTimeMs         respjson.Field
		TotalRenditions            respjson.Field
		Views                      respjson.Field
		ExtraFields                map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RenditionReport) RawJSON

func (r RenditionReport) RawJSON() string

Returns the unmodified JSON received from the API

func (*RenditionReport) UnmarshalJSON

func (r *RenditionReport) UnmarshalJSON(data []byte) error

type RenditionService

type RenditionService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

RenditionService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRenditionService method instead.

func NewRenditionService

func NewRenditionService(opts ...option.RequestOption) (r RenditionService)

NewRenditionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RenditionService) Get

Summarize rendition measurements for the filtered view-start cohort. Use only the selected final event, or latest snapshot when no final exists. Expand its cumulative rendition_playing_time array once per view. Missing or empty measurements contribute no rendition time. Rank by playing time descending; limit bounds returned rows only, while totals and average cover every matching rendition. Average bitrate is sum(bitrate_bps \* playing_time_ms) divided by playing time with a known bitrate. Dimensions, codec, bitrate and frame rate together identify a rendition. Views can contribute to several renditions and must not be summed. No cursor, group_by, sort_by or order. Export resource=renditions includes all matching rows.

type RetentionBucket

type RetentionBucket struct {
	// Exclusive end of the section, capped at the reported duration.
	EndSeconds float64 `json:"end_seconds" api:"required"`
	// views divided by sample_views.
	Ratio float64 `json:"ratio" api:"required"`
	// Inclusive start of the video section.
	StartSeconds float64 `json:"start_seconds" api:"required"`
	// Distinct attempts that played any part of this section. Each attempt counts at
	// most once.
	Views int64 `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EndSeconds   respjson.Field
		Ratio        respjson.Field
		StartSeconds respjson.Field
		Views        respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RetentionBucket) RawJSON

func (r RetentionBucket) RawJSON() string

Returns the unmodified JSON received from the API

func (*RetentionBucket) UnmarshalJSON

func (r *RetentionBucket) UnmarshalJSON(data []byte) error

type RetentionGetParams

type RetentionGetParams struct {
	// Video to report. Retention measures one video at a time.
	VideoID string `query:"video_id" api:"required" json:"-"`
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent RetentionGetParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType RetentionGetParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (RetentionGetParams) URLQuery

func (r RetentionGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes RetentionGetParams's query parameters as `url.Values`.

type RetentionGetParamsContinent

type RetentionGetParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	RetentionGetParamsContinentAf RetentionGetParamsContinent = "AF"
	RetentionGetParamsContinentAn RetentionGetParamsContinent = "AN"
	RetentionGetParamsContinentAs RetentionGetParamsContinent = "AS"
	RetentionGetParamsContinentEu RetentionGetParamsContinent = "EU"
	RetentionGetParamsContinentNa RetentionGetParamsContinent = "NA"
	RetentionGetParamsContinentOc RetentionGetParamsContinent = "OC"
	RetentionGetParamsContinentSa RetentionGetParamsContinent = "SA"
)

type RetentionGetParamsDeviceType

type RetentionGetParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	RetentionGetParamsDeviceTypeDesktop RetentionGetParamsDeviceType = "desktop"
	RetentionGetParamsDeviceTypeMobile  RetentionGetParamsDeviceType = "mobile"
	RetentionGetParamsDeviceTypeTablet  RetentionGetParamsDeviceType = "tablet"
	RetentionGetParamsDeviceTypeUnknown RetentionGetParamsDeviceType = "unknown"
)

type RetentionReport

type RetentionReport struct {
	Buckets []RetentionBucket `json:"buckets" api:"required"`
	// Longest measured duration in this selection. Null when there are no measured
	// attempts.
	DurationSeconds float64 `json:"duration_seconds" api:"required"`
	// Bucket width, ceil(duration_seconds / 200), with a minimum of one second. Null
	// without measurements.
	IntervalSeconds float64 `json:"interval_seconds" api:"required"`
	// Attempts whose selected final or latest snapshot contains played ranges and a
	// finite positive media duration. Includes measured empty ranges.
	SampleViews int64 `json:"sample_views" api:"required"`
	// All matching attempts with a retained start.
	Views int64 `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Buckets         respjson.Field
		DurationSeconds respjson.Field
		IntervalSeconds respjson.Field
		SampleViews     respjson.Field
		Views           respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RetentionReport) RawJSON

func (r RetentionReport) RawJSON() string

Returns the unmodified JSON received from the API

func (*RetentionReport) UnmarshalJSON

func (r *RetentionReport) UnmarshalJSON(data []byte) error

type RetentionService

type RetentionService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

RetentionService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRetentionService method instead.

func NewRetentionService

func NewRetentionService(opts ...option.RequestOption) (r RetentionService)

NewRetentionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RetentionService) Get

Count views along the video using recorded played ranges. Requires video_id. Uses the final measurement, or the latest snapshot without an end event, for each retained start matching the date and audience filters. Each attempt counts once in each section it overlapped, including replays. Skipped sections do not count. Older events without played ranges and attempts without a finite positive duration are excluded from sample_views. Returns at most 200 consecutive buckets, including zero counts, at a width of at least one second. This is media position, not wall-clock time.

type RotatedProjectKey

type RotatedProjectKey struct {
	// New key value. Save it now; it is returned once.
	Key   string `json:"key" api:"required"`
	KeyID string `json:"key_id" api:"required"`
	// Any of "public", "secret".
	Permission RotatedProjectKeyPermission `json:"permission" api:"required"`
	ProjectID  string                      `json:"project_id" api:"required"`
	// True for a private key limited to analytics reads through HTTP and MCP. Public
	// keys always report false. Rotation preserves this setting.
	ReadOnly        bool   `json:"read_only" api:"required"`
	RestartRequired bool   `json:"restart_required" api:"required"`
	Warning         string `json:"warning"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Key             respjson.Field
		KeyID           respjson.Field
		Permission      respjson.Field
		ProjectID       respjson.Field
		ReadOnly        respjson.Field
		RestartRequired respjson.Field
		Warning         respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RotatedProjectKey) RawJSON

func (r RotatedProjectKey) RawJSON() string

Returns the unmodified JSON received from the API

func (*RotatedProjectKey) UnmarshalJSON

func (r *RotatedProjectKey) UnmarshalJSON(data []byte) error

type RotatedProjectKeyPermission

type RotatedProjectKeyPermission string
const (
	RotatedProjectKeyPermissionPublic RotatedProjectKeyPermission = "public"
	RotatedProjectKeyPermissionSecret RotatedProjectKeyPermission = "secret"
)

type SeekCompleted

type SeekCompleted struct {
	ConnectorName    string `json:"connector_name" api:"required"`
	ConnectorVersion string `json:"connector_version" api:"required"`
	DeliveryHostname string `json:"delivery_hostname" api:"required"`
	Environment      string `json:"environment" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory        SeekCompletedErrorCategory          `json:"error_category" api:"required"`
	ErrorCode            SeekCompletedErrorCodeUnion         `json:"error_code" api:"required"`
	ErrorFatal           bool                                `json:"error_fatal" api:"required"`
	ErrorPlayheadSeconds float64                             `json:"error_playhead_seconds" api:"required"`
	EventID              string                              `json:"event_id" api:"required" format:"uuid"`
	EventName            constant.ChunkifyVideoSeekCompleted `json:"event_name" default:"chunkify.video.seek_completed"`
	FromPlayheadSeconds  float64                             `json:"from_playhead_seconds" api:"required"`
	LastSeekedAt         time.Time                           `json:"last_seeked_at" api:"required" format:"date-time"`
	OccurredAt           time.Time                           `json:"occurred_at" api:"required" format:"date-time"`
	PlaybackResumedAt    time.Time                           `json:"playback_resumed_at" api:"required" format:"date-time"`
	PlayerName           string                              `json:"player_name" api:"required"`
	PlayerVersion        string                              `json:"player_version" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason        SeekCompletedReason `json:"reason" api:"required"`
	SchemaVersion float64             `json:"schema_version" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName                   string  `json:"sdk_name" api:"required"`
	SDKVersion                string  `json:"sdk_version" api:"required"`
	SeekInteractionDurationMs float64 `json:"seek_interaction_duration_ms" api:"required"`
	// Any of "resumed", "paused", "interrupted".
	SeekOutcome      SeekCompletedSeekOutcome `json:"seek_outcome" api:"required"`
	SeekResumeWaitMs float64                  `json:"seek_resume_wait_ms" api:"required"`
	SeekStartedAt    time.Time                `json:"seek_started_at" api:"required" format:"date-time"`
	Sequence         int64                    `json:"sequence" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome SeekCompletedStartupOutcome `json:"startup_outcome" api:"required"`
	// Any of "startup", "resuming", "playing", "paused", "buffering", "seeking",
	// "error", "ended", "stopped".
	StateAfterSeek SeekCompletedStateAfterSeek `json:"state_after_seek" api:"required"`
	// Any of "startup", "resuming", "playing", "paused", "buffering", "seeking",
	// "error", "ended", "stopped".
	StateBeforeSeek   SeekCompletedStateBeforeSeek `json:"state_before_seek" api:"required"`
	ToPlayheadSeconds float64                      `json:"to_playhead_seconds" api:"required"`
	VideoID           string                       `json:"video_id" api:"required"`
	ViewID            string                       `json:"view_id" api:"required" format:"uuid"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID string `json:"viewer_id" api:"required"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext              shared.BrowserContext         `json:"browser_context" api:"nullable"`
	DeliveryRequestCount        float64                       `json:"delivery_request_count" api:"nullable"`
	DeliveryThroughputBps       float64                       `json:"delivery_throughput_bps" api:"nullable"`
	DeliveryTransferredBytes    float64                       `json:"delivery_transferred_bytes" api:"nullable"`
	DroppedVideoFrames          float64                       `json:"dropped_video_frames" api:"nullable"`
	FirstVideoFrameTimeMs       float64                       `json:"first_video_frame_time_ms" api:"nullable"`
	FurthestProgressRatio       float64                       `json:"furthest_progress_ratio" api:"nullable"`
	MaximumPlayheadSeconds      float64                       `json:"maximum_playhead_seconds"`
	MediaDurationSeconds        float64                       `json:"media_duration_seconds" api:"nullable"`
	MediaHeightPx               float64                       `json:"media_height_px" api:"nullable"`
	MediaWidthPx                float64                       `json:"media_width_px" api:"nullable"`
	PlayerHeightPx              float64                       `json:"player_height_px" api:"nullable"`
	PlayerWidthPx               float64                       `json:"player_width_px" api:"nullable"`
	PlayingTimeMs               float64                       `json:"playing_time_ms"`
	RebufferCount               float64                       `json:"rebuffer_count"`
	RebufferDurationMs          float64                       `json:"rebuffer_duration_ms"`
	RebufferRatio               float64                       `json:"rebuffer_ratio" api:"nullable"`
	RenditionPlayingTime        []shared.RenditionPlayingTime `json:"rendition_playing_time" api:"nullable"`
	RenditionSwitchCount        float64                       `json:"rendition_switch_count" api:"nullable"`
	SeekCount                   float64                       `json:"seek_count"`
	SeekDurationMs              float64                       `json:"seek_duration_ms"`
	SelectedRenditionBitrateBps float64                       `json:"selected_rendition_bitrate_bps" api:"nullable"`
	SelectedRenditionCodec      string                        `json:"selected_rendition_codec" api:"nullable"`
	SelectedRenditionHeight     float64                       `json:"selected_rendition_height" api:"nullable"`
	SelectedRenditionWidth      float64                       `json:"selected_rendition_width" api:"nullable"`
	StartupTimeMs               float64                       `json:"startup_time_ms" api:"nullable"`
	TotalVideoFrames            float64                       `json:"total_video_frames" api:"nullable"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID string `json:"user_id" api:"nullable"`
	// Optional human-readable video title for reports.
	VideoTitle string `json:"video_title" api:"nullable"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState SeekCompletedVisibilityState `json:"visibility_state" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorName               respjson.Field
		ConnectorVersion            respjson.Field
		DeliveryHostname            respjson.Field
		Environment                 respjson.Field
		ErrorCategory               respjson.Field
		ErrorCode                   respjson.Field
		ErrorFatal                  respjson.Field
		ErrorPlayheadSeconds        respjson.Field
		EventID                     respjson.Field
		EventName                   respjson.Field
		FromPlayheadSeconds         respjson.Field
		LastSeekedAt                respjson.Field
		OccurredAt                  respjson.Field
		PlaybackResumedAt           respjson.Field
		PlayerName                  respjson.Field
		PlayerVersion               respjson.Field
		Reason                      respjson.Field
		SchemaVersion               respjson.Field
		SDKName                     respjson.Field
		SDKVersion                  respjson.Field
		SeekInteractionDurationMs   respjson.Field
		SeekOutcome                 respjson.Field
		SeekResumeWaitMs            respjson.Field
		SeekStartedAt               respjson.Field
		Sequence                    respjson.Field
		StartupOutcome              respjson.Field
		StateAfterSeek              respjson.Field
		StateBeforeSeek             respjson.Field
		ToPlayheadSeconds           respjson.Field
		VideoID                     respjson.Field
		ViewID                      respjson.Field
		ViewerID                    respjson.Field
		BrowserContext              respjson.Field
		DeliveryRequestCount        respjson.Field
		DeliveryThroughputBps       respjson.Field
		DeliveryTransferredBytes    respjson.Field
		DroppedVideoFrames          respjson.Field
		FirstVideoFrameTimeMs       respjson.Field
		FurthestProgressRatio       respjson.Field
		MaximumPlayheadSeconds      respjson.Field
		MediaDurationSeconds        respjson.Field
		MediaHeightPx               respjson.Field
		MediaWidthPx                respjson.Field
		PlayerHeightPx              respjson.Field
		PlayerWidthPx               respjson.Field
		PlayingTimeMs               respjson.Field
		RebufferCount               respjson.Field
		RebufferDurationMs          respjson.Field
		RebufferRatio               respjson.Field
		RenditionPlayingTime        respjson.Field
		RenditionSwitchCount        respjson.Field
		SeekCount                   respjson.Field
		SeekDurationMs              respjson.Field
		SelectedRenditionBitrateBps respjson.Field
		SelectedRenditionCodec      respjson.Field
		SelectedRenditionHeight     respjson.Field
		SelectedRenditionWidth      respjson.Field
		StartupTimeMs               respjson.Field
		TotalVideoFrames            respjson.Field
		UserID                      respjson.Field
		VideoTitle                  respjson.Field
		VisibilityState             respjson.Field
		ExtraFields                 map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SeekCompleted) RawJSON

func (r SeekCompleted) RawJSON() string

Returns the unmodified JSON received from the API

func (SeekCompleted) ToParam

func (r SeekCompleted) ToParam() SeekCompletedParam

ToParam converts this SeekCompleted to a SeekCompletedParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with SeekCompletedParam.Overrides()

func (*SeekCompleted) UnmarshalJSON

func (r *SeekCompleted) UnmarshalJSON(data []byte) error

type SeekCompletedErrorCategory

type SeekCompletedErrorCategory string
const (
	SeekCompletedErrorCategoryAborted     SeekCompletedErrorCategory = "aborted"
	SeekCompletedErrorCategoryNetwork     SeekCompletedErrorCategory = "network"
	SeekCompletedErrorCategoryDecode      SeekCompletedErrorCategory = "decode"
	SeekCompletedErrorCategoryUnsupported SeekCompletedErrorCategory = "unsupported"
	SeekCompletedErrorCategoryUnknown     SeekCompletedErrorCategory = "unknown"
)

type SeekCompletedErrorCodeUnion

type SeekCompletedErrorCodeUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

SeekCompletedErrorCodeUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (SeekCompletedErrorCodeUnion) AsFloat

func (u SeekCompletedErrorCodeUnion) AsFloat() (v float64)

func (SeekCompletedErrorCodeUnion) AsString

func (u SeekCompletedErrorCodeUnion) AsString() (v string)

func (SeekCompletedErrorCodeUnion) RawJSON

func (u SeekCompletedErrorCodeUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*SeekCompletedErrorCodeUnion) UnmarshalJSON

func (r *SeekCompletedErrorCodeUnion) UnmarshalJSON(data []byte) error

type SeekCompletedErrorCodeUnionParam

type SeekCompletedErrorCodeUnionParam struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (SeekCompletedErrorCodeUnionParam) MarshalJSON

func (u SeekCompletedErrorCodeUnionParam) MarshalJSON() ([]byte, error)

func (*SeekCompletedErrorCodeUnionParam) UnmarshalJSON

func (u *SeekCompletedErrorCodeUnionParam) UnmarshalJSON(data []byte) error

type SeekCompletedParam

type SeekCompletedParam struct {
	ConnectorVersion param.Opt[string] `json:"connector_version,omitzero" api:"required"`
	DeliveryHostname param.Opt[string] `json:"delivery_hostname,omitzero" api:"required"`
	Environment      param.Opt[string] `json:"environment,omitzero" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory        param.Opt[SeekCompletedErrorCategory] `json:"error_category,omitzero" api:"required"`
	ErrorFatal           param.Opt[bool]                       `json:"error_fatal,omitzero" api:"required"`
	ErrorPlayheadSeconds param.Opt[float64]                    `json:"error_playhead_seconds,omitzero" api:"required"`
	FromPlayheadSeconds  param.Opt[float64]                    `json:"from_playhead_seconds,omitzero" api:"required"`
	LastSeekedAt         param.Opt[time.Time]                  `json:"last_seeked_at,omitzero" api:"required" format:"date-time"`
	PlaybackResumedAt    param.Opt[time.Time]                  `json:"playback_resumed_at,omitzero" api:"required" format:"date-time"`
	PlayerName           param.Opt[string]                     `json:"player_name,omitzero" api:"required"`
	PlayerVersion        param.Opt[string]                     `json:"player_version,omitzero" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason           param.Opt[SeekCompletedReason] `json:"reason,omitzero" api:"required"`
	SeekResumeWaitMs param.Opt[float64]             `json:"seek_resume_wait_ms,omitzero" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome    param.Opt[SeekCompletedStartupOutcome] `json:"startup_outcome,omitzero" api:"required"`
	ToPlayheadSeconds param.Opt[float64]                     `json:"to_playhead_seconds,omitzero" api:"required"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID      param.Opt[string]                `json:"viewer_id,omitzero" api:"required"`
	ErrorCode     SeekCompletedErrorCodeUnionParam `json:"error_code,omitzero" api:"required"`
	ConnectorName string                           `json:"connector_name" api:"required"`
	EventID       string                           `json:"event_id" api:"required" format:"uuid"`
	OccurredAt    time.Time                        `json:"occurred_at" api:"required" format:"date-time"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName                   string  `json:"sdk_name" api:"required"`
	SDKVersion                string  `json:"sdk_version" api:"required"`
	SeekInteractionDurationMs float64 `json:"seek_interaction_duration_ms" api:"required"`
	// Any of "resumed", "paused", "interrupted".
	SeekOutcome   SeekCompletedSeekOutcome `json:"seek_outcome,omitzero" api:"required"`
	SeekStartedAt time.Time                `json:"seek_started_at" api:"required" format:"date-time"`
	Sequence      int64                    `json:"sequence" api:"required"`
	// Any of "startup", "resuming", "playing", "paused", "buffering", "seeking",
	// "error", "ended", "stopped".
	StateAfterSeek SeekCompletedStateAfterSeek `json:"state_after_seek,omitzero" api:"required"`
	// Any of "startup", "resuming", "playing", "paused", "buffering", "seeking",
	// "error", "ended", "stopped".
	StateBeforeSeek             SeekCompletedStateBeforeSeek `json:"state_before_seek,omitzero" api:"required"`
	VideoID                     string                       `json:"video_id" api:"required"`
	ViewID                      string                       `json:"view_id" api:"required" format:"uuid"`
	DeliveryRequestCount        param.Opt[float64]           `json:"delivery_request_count,omitzero"`
	DeliveryThroughputBps       param.Opt[float64]           `json:"delivery_throughput_bps,omitzero"`
	DeliveryTransferredBytes    param.Opt[float64]           `json:"delivery_transferred_bytes,omitzero"`
	DroppedVideoFrames          param.Opt[float64]           `json:"dropped_video_frames,omitzero"`
	FirstVideoFrameTimeMs       param.Opt[float64]           `json:"first_video_frame_time_ms,omitzero"`
	FurthestProgressRatio       param.Opt[float64]           `json:"furthest_progress_ratio,omitzero"`
	MediaDurationSeconds        param.Opt[float64]           `json:"media_duration_seconds,omitzero"`
	MediaHeightPx               param.Opt[float64]           `json:"media_height_px,omitzero"`
	MediaWidthPx                param.Opt[float64]           `json:"media_width_px,omitzero"`
	PlayerHeightPx              param.Opt[float64]           `json:"player_height_px,omitzero"`
	PlayerWidthPx               param.Opt[float64]           `json:"player_width_px,omitzero"`
	RebufferRatio               param.Opt[float64]           `json:"rebuffer_ratio,omitzero"`
	RenditionSwitchCount        param.Opt[float64]           `json:"rendition_switch_count,omitzero"`
	SelectedRenditionBitrateBps param.Opt[float64]           `json:"selected_rendition_bitrate_bps,omitzero"`
	SelectedRenditionCodec      param.Opt[string]            `json:"selected_rendition_codec,omitzero"`
	SelectedRenditionHeight     param.Opt[float64]           `json:"selected_rendition_height,omitzero"`
	SelectedRenditionWidth      param.Opt[float64]           `json:"selected_rendition_width,omitzero"`
	StartupTimeMs               param.Opt[float64]           `json:"startup_time_ms,omitzero"`
	TotalVideoFrames            param.Opt[float64]           `json:"total_video_frames,omitzero"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID param.Opt[string] `json:"user_id,omitzero"`
	// Optional human-readable video title for reports.
	VideoTitle param.Opt[string] `json:"video_title,omitzero"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState        param.Opt[SeekCompletedVisibilityState] `json:"visibility_state,omitzero"`
	MaximumPlayheadSeconds param.Opt[float64]                      `json:"maximum_playhead_seconds,omitzero"`
	PlayingTimeMs          param.Opt[float64]                      `json:"playing_time_ms,omitzero"`
	RebufferCount          param.Opt[float64]                      `json:"rebuffer_count,omitzero"`
	RebufferDurationMs     param.Opt[float64]                      `json:"rebuffer_duration_ms,omitzero"`
	SeekCount              param.Opt[float64]                      `json:"seek_count,omitzero"`
	SeekDurationMs         param.Opt[float64]                      `json:"seek_duration_ms,omitzero"`
	RenditionPlayingTime   []shared.RenditionPlayingTimeParam      `json:"rendition_playing_time,omitzero"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContextParam `json:"browser_context,omitzero"`
	// This field can be elided, and will marshal its zero value as
	// "chunkify.video.seek_completed".
	EventName constant.ChunkifyVideoSeekCompleted `json:"event_name" default:"chunkify.video.seek_completed"`
	// This field can be elided, and will marshal its zero value as 1.
	SchemaVersion float64 `json:"schema_version,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The properties ConnectorName, ConnectorVersion, DeliveryHostname, Environment, ErrorCategory, ErrorCode, ErrorFatal, ErrorPlayheadSeconds, EventID, EventName, FromPlayheadSeconds, LastSeekedAt, OccurredAt, PlaybackResumedAt, PlayerName, PlayerVersion, Reason, SchemaVersion, SDKName, SDKVersion, SeekInteractionDurationMs, SeekOutcome, SeekResumeWaitMs, SeekStartedAt, Sequence, StartupOutcome, StateAfterSeek, StateBeforeSeek, ToPlayheadSeconds, VideoID, ViewID, ViewerID are required.

func (SeekCompletedParam) MarshalJSON

func (r SeekCompletedParam) MarshalJSON() (data []byte, err error)

func (*SeekCompletedParam) UnmarshalJSON

func (r *SeekCompletedParam) UnmarshalJSON(data []byte) error

type SeekCompletedReason

type SeekCompletedReason string
const (
	SeekCompletedReasonEnded         SeekCompletedReason = "ended"
	SeekCompletedReasonDestroyed     SeekCompletedReason = "destroyed"
	SeekCompletedReasonSourceChanged SeekCompletedReason = "source_changed"
	SeekCompletedReasonPageExit      SeekCompletedReason = "page_exit"
)

type SeekCompletedSeekOutcome

type SeekCompletedSeekOutcome string
const (
	SeekCompletedSeekOutcomeResumed     SeekCompletedSeekOutcome = "resumed"
	SeekCompletedSeekOutcomePaused      SeekCompletedSeekOutcome = "paused"
	SeekCompletedSeekOutcomeInterrupted SeekCompletedSeekOutcome = "interrupted"
)

type SeekCompletedStartupOutcome

type SeekCompletedStartupOutcome string
const (
	SeekCompletedStartupOutcomeStarted           SeekCompletedStartupOutcome = "started"
	SeekCompletedStartupOutcomeFailedBeforeStart SeekCompletedStartupOutcome = "failed_before_start"
	SeekCompletedStartupOutcomeEndedBeforeStart  SeekCompletedStartupOutcome = "ended_before_start"
)

type SeekCompletedStateAfterSeek

type SeekCompletedStateAfterSeek string
const (
	SeekCompletedStateAfterSeekStartup   SeekCompletedStateAfterSeek = "startup"
	SeekCompletedStateAfterSeekResuming  SeekCompletedStateAfterSeek = "resuming"
	SeekCompletedStateAfterSeekPlaying   SeekCompletedStateAfterSeek = "playing"
	SeekCompletedStateAfterSeekPaused    SeekCompletedStateAfterSeek = "paused"
	SeekCompletedStateAfterSeekBuffering SeekCompletedStateAfterSeek = "buffering"
	SeekCompletedStateAfterSeekSeeking   SeekCompletedStateAfterSeek = "seeking"
	SeekCompletedStateAfterSeekError     SeekCompletedStateAfterSeek = "error"
	SeekCompletedStateAfterSeekEnded     SeekCompletedStateAfterSeek = "ended"
	SeekCompletedStateAfterSeekStopped   SeekCompletedStateAfterSeek = "stopped"
)

type SeekCompletedStateBeforeSeek

type SeekCompletedStateBeforeSeek string
const (
	SeekCompletedStateBeforeSeekStartup   SeekCompletedStateBeforeSeek = "startup"
	SeekCompletedStateBeforeSeekResuming  SeekCompletedStateBeforeSeek = "resuming"
	SeekCompletedStateBeforeSeekPlaying   SeekCompletedStateBeforeSeek = "playing"
	SeekCompletedStateBeforeSeekPaused    SeekCompletedStateBeforeSeek = "paused"
	SeekCompletedStateBeforeSeekBuffering SeekCompletedStateBeforeSeek = "buffering"
	SeekCompletedStateBeforeSeekSeeking   SeekCompletedStateBeforeSeek = "seeking"
	SeekCompletedStateBeforeSeekError     SeekCompletedStateBeforeSeek = "error"
	SeekCompletedStateBeforeSeekEnded     SeekCompletedStateBeforeSeek = "ended"
	SeekCompletedStateBeforeSeekStopped   SeekCompletedStateBeforeSeek = "stopped"
)

type SeekCompletedVisibilityState

type SeekCompletedVisibilityState string

Tab visibility when the event was recorded. Hidden does not imply paused playback or identify the cause of a pause. Missing on older events; null when unavailable.

const (
	SeekCompletedVisibilityStateVisible SeekCompletedVisibilityState = "visible"
	SeekCompletedVisibilityStateHidden  SeekCompletedVisibilityState = "hidden"
)

type StartupOutcomes

type StartupOutcomes = shared.StartupOutcomes

Mutually exclusive outcomes. An explicit startup_outcome on the selected final event takes precedence. Otherwise an available startup time, including zero, or positive playing time on the selected measurement proves started. All other views are unknown. sample_views excludes unknown; every ratio uses all selected attempts, including unknown. Missing final delivery does not prove an exit or failure.

This is an alias to an internal type.

type StoredEvent

type StoredEvent struct {
	// A schema version 1 playback event. Extra properties are preserved.
	Event AnalyticsEventUnion `json:"event" api:"required"`
	// ID of the public key used to receive this event. Null when unavailable.
	IngestKeyID string `json:"ingest_key_id" api:"required"`
	// Trusted project identifier resolved from the public key. Historical events
	// migrate to default.
	ProjectID  string    `json:"project_id" api:"required"`
	ReceivedAt time.Time `json:"received_at" api:"required" format:"date-time"`
	// Browser context and locally derived continent/country/city. Request IP addresses
	// are never added to events or stored context.
	EventContext shared.EventContext `json:"event_context"`
	// Legacy context present for an event received through OTLP by an earlier
	// collector version. Existing context remains readable; new ingestion accepts
	// native JSON events only.
	Otlp shared.StoredOtlpContext `json:"otlp"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Event        respjson.Field
		IngestKeyID  respjson.Field
		ProjectID    respjson.Field
		ReceivedAt   respjson.Field
		EventContext respjson.Field
		Otlp         respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (StoredEvent) RawJSON

func (r StoredEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*StoredEvent) UnmarshalJSON

func (r *StoredEvent) UnmarshalJSON(data []byte) error

type StoredOtlpContext

type StoredOtlpContext = shared.StoredOtlpContext

Legacy context present for an event received through OTLP by an earlier collector version. Existing context remains readable; new ingestion accepts native JSON events only.

This is an alias to an internal type.

type StoredOtlpContextResourceLogs

type StoredOtlpContextResourceLogs = shared.StoredOtlpContextResourceLogs

Original resource group excluding scopeLogs.

This is an alias to an internal type.

type StoredOtlpContextScopeLogs

type StoredOtlpContextScopeLogs = shared.StoredOtlpContextScopeLogs

Original scope group excluding logRecords.

This is an alias to an internal type.

type SubtitleChanged

type SubtitleChanged struct {
	ConnectorName    string `json:"connector_name" api:"required"`
	ConnectorVersion string `json:"connector_version" api:"required"`
	DeliveryHostname string `json:"delivery_hostname" api:"required"`
	Environment      string `json:"environment" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory        SubtitleChangedErrorCategory          `json:"error_category" api:"required"`
	ErrorCode            SubtitleChangedErrorCodeUnion         `json:"error_code" api:"required"`
	ErrorFatal           bool                                  `json:"error_fatal" api:"required"`
	ErrorPlayheadSeconds float64                               `json:"error_playhead_seconds" api:"required"`
	EventID              string                                `json:"event_id" api:"required" format:"uuid"`
	EventName            constant.ChunkifyVideoSubtitleChanged `json:"event_name" default:"chunkify.video.subtitle_changed"`
	OccurredAt           time.Time                             `json:"occurred_at" api:"required" format:"date-time"`
	PlayerName           string                                `json:"player_name" api:"required"`
	PlayerVersion        string                                `json:"player_version" api:"required"`
	PlayheadSeconds      float64                               `json:"playhead_seconds" api:"required"`
	// Language before the change; null when subtitles were off.
	PreviousSubtitleLanguage string `json:"previous_subtitle_language" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason        SubtitleChangedReason `json:"reason" api:"required"`
	SchemaVersion float64               `json:"schema_version" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName    string `json:"sdk_name" api:"required"`
	SDKVersion string `json:"sdk_version" api:"required"`
	Sequence   int64  `json:"sequence" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome SubtitleChangedStartupOutcome `json:"startup_outcome" api:"required"`
	// Language after the change; null when subtitles are now off.
	SubtitleLanguage string `json:"subtitle_language" api:"required"`
	VideoID          string `json:"video_id" api:"required"`
	ViewID           string `json:"view_id" api:"required" format:"uuid"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID string `json:"viewer_id" api:"required"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext              shared.BrowserContext         `json:"browser_context" api:"nullable"`
	DeliveryRequestCount        float64                       `json:"delivery_request_count" api:"nullable"`
	DeliveryThroughputBps       float64                       `json:"delivery_throughput_bps" api:"nullable"`
	DeliveryTransferredBytes    float64                       `json:"delivery_transferred_bytes" api:"nullable"`
	DroppedVideoFrames          float64                       `json:"dropped_video_frames" api:"nullable"`
	FirstVideoFrameTimeMs       float64                       `json:"first_video_frame_time_ms" api:"nullable"`
	FurthestProgressRatio       float64                       `json:"furthest_progress_ratio" api:"nullable"`
	MaximumPlayheadSeconds      float64                       `json:"maximum_playhead_seconds"`
	MediaDurationSeconds        float64                       `json:"media_duration_seconds" api:"nullable"`
	MediaHeightPx               float64                       `json:"media_height_px" api:"nullable"`
	MediaWidthPx                float64                       `json:"media_width_px" api:"nullable"`
	PlayerHeightPx              float64                       `json:"player_height_px" api:"nullable"`
	PlayerWidthPx               float64                       `json:"player_width_px" api:"nullable"`
	PlayingTimeMs               float64                       `json:"playing_time_ms"`
	RebufferCount               float64                       `json:"rebuffer_count"`
	RebufferDurationMs          float64                       `json:"rebuffer_duration_ms"`
	RebufferRatio               float64                       `json:"rebuffer_ratio" api:"nullable"`
	RenditionPlayingTime        []shared.RenditionPlayingTime `json:"rendition_playing_time" api:"nullable"`
	RenditionSwitchCount        float64                       `json:"rendition_switch_count" api:"nullable"`
	SeekCount                   float64                       `json:"seek_count"`
	SeekDurationMs              float64                       `json:"seek_duration_ms"`
	SelectedRenditionBitrateBps float64                       `json:"selected_rendition_bitrate_bps" api:"nullable"`
	SelectedRenditionCodec      string                        `json:"selected_rendition_codec" api:"nullable"`
	SelectedRenditionHeight     float64                       `json:"selected_rendition_height" api:"nullable"`
	SelectedRenditionWidth      float64                       `json:"selected_rendition_width" api:"nullable"`
	StartupTimeMs               float64                       `json:"startup_time_ms" api:"nullable"`
	TotalVideoFrames            float64                       `json:"total_video_frames" api:"nullable"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID string `json:"user_id" api:"nullable"`
	// Optional human-readable video title for reports.
	VideoTitle string `json:"video_title" api:"nullable"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState SubtitleChangedVisibilityState `json:"visibility_state" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorName               respjson.Field
		ConnectorVersion            respjson.Field
		DeliveryHostname            respjson.Field
		Environment                 respjson.Field
		ErrorCategory               respjson.Field
		ErrorCode                   respjson.Field
		ErrorFatal                  respjson.Field
		ErrorPlayheadSeconds        respjson.Field
		EventID                     respjson.Field
		EventName                   respjson.Field
		OccurredAt                  respjson.Field
		PlayerName                  respjson.Field
		PlayerVersion               respjson.Field
		PlayheadSeconds             respjson.Field
		PreviousSubtitleLanguage    respjson.Field
		Reason                      respjson.Field
		SchemaVersion               respjson.Field
		SDKName                     respjson.Field
		SDKVersion                  respjson.Field
		Sequence                    respjson.Field
		StartupOutcome              respjson.Field
		SubtitleLanguage            respjson.Field
		VideoID                     respjson.Field
		ViewID                      respjson.Field
		ViewerID                    respjson.Field
		BrowserContext              respjson.Field
		DeliveryRequestCount        respjson.Field
		DeliveryThroughputBps       respjson.Field
		DeliveryTransferredBytes    respjson.Field
		DroppedVideoFrames          respjson.Field
		FirstVideoFrameTimeMs       respjson.Field
		FurthestProgressRatio       respjson.Field
		MaximumPlayheadSeconds      respjson.Field
		MediaDurationSeconds        respjson.Field
		MediaHeightPx               respjson.Field
		MediaWidthPx                respjson.Field
		PlayerHeightPx              respjson.Field
		PlayerWidthPx               respjson.Field
		PlayingTimeMs               respjson.Field
		RebufferCount               respjson.Field
		RebufferDurationMs          respjson.Field
		RebufferRatio               respjson.Field
		RenditionPlayingTime        respjson.Field
		RenditionSwitchCount        respjson.Field
		SeekCount                   respjson.Field
		SeekDurationMs              respjson.Field
		SelectedRenditionBitrateBps respjson.Field
		SelectedRenditionCodec      respjson.Field
		SelectedRenditionHeight     respjson.Field
		SelectedRenditionWidth      respjson.Field
		StartupTimeMs               respjson.Field
		TotalVideoFrames            respjson.Field
		UserID                      respjson.Field
		VideoTitle                  respjson.Field
		VisibilityState             respjson.Field
		ExtraFields                 map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SubtitleChanged) RawJSON

func (r SubtitleChanged) RawJSON() string

Returns the unmodified JSON received from the API

func (SubtitleChanged) ToParam

ToParam converts this SubtitleChanged to a SubtitleChangedParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with SubtitleChangedParam.Overrides()

func (*SubtitleChanged) UnmarshalJSON

func (r *SubtitleChanged) UnmarshalJSON(data []byte) error

type SubtitleChangedErrorCategory

type SubtitleChangedErrorCategory string
const (
	SubtitleChangedErrorCategoryAborted     SubtitleChangedErrorCategory = "aborted"
	SubtitleChangedErrorCategoryNetwork     SubtitleChangedErrorCategory = "network"
	SubtitleChangedErrorCategoryDecode      SubtitleChangedErrorCategory = "decode"
	SubtitleChangedErrorCategoryUnsupported SubtitleChangedErrorCategory = "unsupported"
	SubtitleChangedErrorCategoryUnknown     SubtitleChangedErrorCategory = "unknown"
)

type SubtitleChangedErrorCodeUnion

type SubtitleChangedErrorCodeUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

SubtitleChangedErrorCodeUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (SubtitleChangedErrorCodeUnion) AsFloat

func (u SubtitleChangedErrorCodeUnion) AsFloat() (v float64)

func (SubtitleChangedErrorCodeUnion) AsString

func (u SubtitleChangedErrorCodeUnion) AsString() (v string)

func (SubtitleChangedErrorCodeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*SubtitleChangedErrorCodeUnion) UnmarshalJSON

func (r *SubtitleChangedErrorCodeUnion) UnmarshalJSON(data []byte) error

type SubtitleChangedErrorCodeUnionParam

type SubtitleChangedErrorCodeUnionParam struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (SubtitleChangedErrorCodeUnionParam) MarshalJSON

func (u SubtitleChangedErrorCodeUnionParam) MarshalJSON() ([]byte, error)

func (*SubtitleChangedErrorCodeUnionParam) UnmarshalJSON

func (u *SubtitleChangedErrorCodeUnionParam) UnmarshalJSON(data []byte) error

type SubtitleChangedParam

type SubtitleChangedParam struct {
	ConnectorVersion param.Opt[string] `json:"connector_version,omitzero" api:"required"`
	DeliveryHostname param.Opt[string] `json:"delivery_hostname,omitzero" api:"required"`
	Environment      param.Opt[string] `json:"environment,omitzero" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory        param.Opt[SubtitleChangedErrorCategory] `json:"error_category,omitzero" api:"required"`
	ErrorFatal           param.Opt[bool]                         `json:"error_fatal,omitzero" api:"required"`
	ErrorPlayheadSeconds param.Opt[float64]                      `json:"error_playhead_seconds,omitzero" api:"required"`
	PlayerName           param.Opt[string]                       `json:"player_name,omitzero" api:"required"`
	PlayerVersion        param.Opt[string]                       `json:"player_version,omitzero" api:"required"`
	PlayheadSeconds      param.Opt[float64]                      `json:"playhead_seconds,omitzero" api:"required"`
	// Language before the change; null when subtitles were off.
	PreviousSubtitleLanguage param.Opt[string] `json:"previous_subtitle_language,omitzero" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason param.Opt[SubtitleChangedReason] `json:"reason,omitzero" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome param.Opt[SubtitleChangedStartupOutcome] `json:"startup_outcome,omitzero" api:"required"`
	// Language after the change; null when subtitles are now off.
	SubtitleLanguage param.Opt[string] `json:"subtitle_language,omitzero" api:"required"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID      param.Opt[string]                  `json:"viewer_id,omitzero" api:"required"`
	ErrorCode     SubtitleChangedErrorCodeUnionParam `json:"error_code,omitzero" api:"required"`
	ConnectorName string                             `json:"connector_name" api:"required"`
	EventID       string                             `json:"event_id" api:"required" format:"uuid"`
	OccurredAt    time.Time                          `json:"occurred_at" api:"required" format:"date-time"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName                     string             `json:"sdk_name" api:"required"`
	SDKVersion                  string             `json:"sdk_version" api:"required"`
	Sequence                    int64              `json:"sequence" api:"required"`
	VideoID                     string             `json:"video_id" api:"required"`
	ViewID                      string             `json:"view_id" api:"required" format:"uuid"`
	DeliveryRequestCount        param.Opt[float64] `json:"delivery_request_count,omitzero"`
	DeliveryThroughputBps       param.Opt[float64] `json:"delivery_throughput_bps,omitzero"`
	DeliveryTransferredBytes    param.Opt[float64] `json:"delivery_transferred_bytes,omitzero"`
	DroppedVideoFrames          param.Opt[float64] `json:"dropped_video_frames,omitzero"`
	FirstVideoFrameTimeMs       param.Opt[float64] `json:"first_video_frame_time_ms,omitzero"`
	FurthestProgressRatio       param.Opt[float64] `json:"furthest_progress_ratio,omitzero"`
	MediaDurationSeconds        param.Opt[float64] `json:"media_duration_seconds,omitzero"`
	MediaHeightPx               param.Opt[float64] `json:"media_height_px,omitzero"`
	MediaWidthPx                param.Opt[float64] `json:"media_width_px,omitzero"`
	PlayerHeightPx              param.Opt[float64] `json:"player_height_px,omitzero"`
	PlayerWidthPx               param.Opt[float64] `json:"player_width_px,omitzero"`
	RebufferRatio               param.Opt[float64] `json:"rebuffer_ratio,omitzero"`
	RenditionSwitchCount        param.Opt[float64] `json:"rendition_switch_count,omitzero"`
	SelectedRenditionBitrateBps param.Opt[float64] `json:"selected_rendition_bitrate_bps,omitzero"`
	SelectedRenditionCodec      param.Opt[string]  `json:"selected_rendition_codec,omitzero"`
	SelectedRenditionHeight     param.Opt[float64] `json:"selected_rendition_height,omitzero"`
	SelectedRenditionWidth      param.Opt[float64] `json:"selected_rendition_width,omitzero"`
	StartupTimeMs               param.Opt[float64] `json:"startup_time_ms,omitzero"`
	TotalVideoFrames            param.Opt[float64] `json:"total_video_frames,omitzero"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID param.Opt[string] `json:"user_id,omitzero"`
	// Optional human-readable video title for reports.
	VideoTitle param.Opt[string] `json:"video_title,omitzero"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState        param.Opt[SubtitleChangedVisibilityState] `json:"visibility_state,omitzero"`
	MaximumPlayheadSeconds param.Opt[float64]                        `json:"maximum_playhead_seconds,omitzero"`
	PlayingTimeMs          param.Opt[float64]                        `json:"playing_time_ms,omitzero"`
	RebufferCount          param.Opt[float64]                        `json:"rebuffer_count,omitzero"`
	RebufferDurationMs     param.Opt[float64]                        `json:"rebuffer_duration_ms,omitzero"`
	SeekCount              param.Opt[float64]                        `json:"seek_count,omitzero"`
	SeekDurationMs         param.Opt[float64]                        `json:"seek_duration_ms,omitzero"`
	RenditionPlayingTime   []shared.RenditionPlayingTimeParam        `json:"rendition_playing_time,omitzero"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContextParam `json:"browser_context,omitzero"`
	// This field can be elided, and will marshal its zero value as
	// "chunkify.video.subtitle_changed".
	EventName constant.ChunkifyVideoSubtitleChanged `json:"event_name" default:"chunkify.video.subtitle_changed"`
	// This field can be elided, and will marshal its zero value as 1.
	SchemaVersion float64 `json:"schema_version,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The properties ConnectorName, ConnectorVersion, DeliveryHostname, Environment, ErrorCategory, ErrorCode, ErrorFatal, ErrorPlayheadSeconds, EventID, EventName, OccurredAt, PlayerName, PlayerVersion, PlayheadSeconds, PreviousSubtitleLanguage, Reason, SchemaVersion, SDKName, SDKVersion, Sequence, StartupOutcome, SubtitleLanguage, VideoID, ViewID, ViewerID are required.

func (SubtitleChangedParam) MarshalJSON

func (r SubtitleChangedParam) MarshalJSON() (data []byte, err error)

func (*SubtitleChangedParam) UnmarshalJSON

func (r *SubtitleChangedParam) UnmarshalJSON(data []byte) error

type SubtitleChangedReason

type SubtitleChangedReason string
const (
	SubtitleChangedReasonEnded         SubtitleChangedReason = "ended"
	SubtitleChangedReasonDestroyed     SubtitleChangedReason = "destroyed"
	SubtitleChangedReasonSourceChanged SubtitleChangedReason = "source_changed"
	SubtitleChangedReasonPageExit      SubtitleChangedReason = "page_exit"
)

type SubtitleChangedStartupOutcome

type SubtitleChangedStartupOutcome string
const (
	SubtitleChangedStartupOutcomeStarted           SubtitleChangedStartupOutcome = "started"
	SubtitleChangedStartupOutcomeFailedBeforeStart SubtitleChangedStartupOutcome = "failed_before_start"
	SubtitleChangedStartupOutcomeEndedBeforeStart  SubtitleChangedStartupOutcome = "ended_before_start"
)

type SubtitleChangedVisibilityState

type SubtitleChangedVisibilityState string

Tab visibility when the event was recorded. Hidden does not imply paused playback or identify the cause of a pause. Missing on older events; null when unavailable.

const (
	SubtitleChangedVisibilityStateVisible SubtitleChangedVisibilityState = "visible"
	SubtitleChangedVisibilityStateHidden  SubtitleChangedVisibilityState = "hidden"
)

type SubtitleGetParams

type SubtitleGetParams struct {
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent SubtitleGetParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType SubtitleGetParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SubtitleGetParams) URLQuery

func (r SubtitleGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes SubtitleGetParams's query parameters as `url.Values`.

type SubtitleGetParamsContinent

type SubtitleGetParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	SubtitleGetParamsContinentAf SubtitleGetParamsContinent = "AF"
	SubtitleGetParamsContinentAn SubtitleGetParamsContinent = "AN"
	SubtitleGetParamsContinentAs SubtitleGetParamsContinent = "AS"
	SubtitleGetParamsContinentEu SubtitleGetParamsContinent = "EU"
	SubtitleGetParamsContinentNa SubtitleGetParamsContinent = "NA"
	SubtitleGetParamsContinentOc SubtitleGetParamsContinent = "OC"
	SubtitleGetParamsContinentSa SubtitleGetParamsContinent = "SA"
)

type SubtitleGetParamsDeviceType

type SubtitleGetParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	SubtitleGetParamsDeviceTypeDesktop SubtitleGetParamsDeviceType = "desktop"
	SubtitleGetParamsDeviceTypeMobile  SubtitleGetParamsDeviceType = "mobile"
	SubtitleGetParamsDeviceTypeTablet  SubtitleGetParamsDeviceType = "tablet"
	SubtitleGetParamsDeviceTypeUnknown SubtitleGetParamsDeviceType = "unknown"
)

type SubtitleMetric

type SubtitleMetric struct {
	// Subtitle language tag; und for a track without a language; null for subtitles
	// off.
	Language string `json:"language" api:"required"`
	// Cumulative measured playing time in this language, summed once per attempt.
	PlayingTimeMs float64 `json:"playing_time_ms" api:"required"`
	// Share of all measured playing time, including rows outside the returned limit.
	PlayingTimeRatio float64 `json:"playing_time_ratio" api:"required"`
	// Distinct attempts with positive playing time in this language.
	Views int64 `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Language         respjson.Field
		PlayingTimeMs    respjson.Field
		PlayingTimeRatio respjson.Field
		Views            respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Watch time with one subtitle language, or with subtitles off.

func (SubtitleMetric) RawJSON

func (r SubtitleMetric) RawJSON() string

Returns the unmodified JSON received from the API

func (*SubtitleMetric) UnmarshalJSON

func (r *SubtitleMetric) UnmarshalJSON(data []byte) error

type SubtitlePlayingTime

type SubtitlePlayingTime = shared.SubtitlePlayingTime

This is an alias to an internal type.

type SubtitlePlayingTimeParam

type SubtitlePlayingTimeParam = shared.SubtitlePlayingTimeParam

This is an alias to an internal type.

type SubtitleReport

type SubtitleReport struct {
	// Most-watched first, then value ascending with null first. Defaults to 100 rows,
	// maximum 1000. CSV exports include all matching rows.
	Languages []SubtitleMetric `json:"languages" api:"required"`
	// Attempts with positive measured playing time in this report. Older SDKs send no
	// measurement.
	SampleViews int64 `json:"sample_views" api:"required"`
	// Number of distinct values before applying the row limit.
	TotalLanguages int64 `json:"total_languages" api:"required"`
	// Total measured playing time across all matching rows.
	TotalPlayingTimeMs float64 `json:"total_playing_time_ms" api:"required"`
	// All attempts in the filtered start cohort.
	Views int64 `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Languages          respjson.Field
		SampleViews        respjson.Field
		TotalLanguages     respjson.Field
		TotalPlayingTimeMs respjson.Field
		Views              respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SubtitleReport) RawJSON

func (r SubtitleReport) RawJSON() string

Returns the unmodified JSON received from the API

func (*SubtitleReport) UnmarshalJSON

func (r *SubtitleReport) UnmarshalJSON(data []byte) error

type SubtitleService

type SubtitleService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

SubtitleService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSubtitleService method instead.

func NewSubtitleService

func NewSubtitleService(opts ...option.RequestOption) (r SubtitleService)

NewSubtitleService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SubtitleService) Get

func (r *SubtitleService) Get(ctx context.Context, query SubtitleGetParams, opts ...option.RequestOption) (res *SubtitleReport, err error)

Summarize watch time per subtitle language. Expand each view's cumulative subtitle_playing_time array once; a null language is time with subtitles off. Use only the selected final event, or latest snapshot when no final exists, for the filtered view-start cohort. Missing or empty measurements contribute no time; older SDKs send none. Rank by playing time descending, then value ascending with null first; limit bounds returned rows only, while totals cover every matching row. Views can contribute to several rows and must not be summed. No cursor, group_by, sort_by or order. Export resource=subtitles includes all matching rows.

type SummaryGetParams

type SummaryGetParams struct {
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Use next_cursor from the previous page. Keep the same filters, sort_by and
	// order. Video cursors from earlier versions are invalid; start a new pagination
	// sequence after upgrading.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent SummaryGetParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType SummaryGetParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// Optional on summary, quality and engagement. Group views by this field on their
	// first retained start. Missing, null and nonstring context forms a null group;
	// the literal device type unknown stays separate. Groups sort by views descending,
	// then value ascending with null first for ties. Pagination is available only with
	// group_by. Location uses the first retained start too. City groups use the stored
	// name; filter by country to avoid combining names shared by different countries.
	// Page groups use the first retained start even if playback continues after
	// navigation. Filter by page_origin when grouping page_path to distinguish
	// identical paths on different sites. video_title groups by the title on each
	// view's first retained start, so a renamed video counts each view under the title
	// it started with. user_id groups by the user ID on each view's first retained
	// start. Use custom.<key>, such as custom.plan, to group by a custom dimension;
	// views without the key form the null group.
	GroupBy SummaryGetParamsGroupBy `query:"group_by,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SummaryGetParams) URLQuery

func (r SummaryGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes SummaryGetParams's query parameters as `url.Values`.

type SummaryGetParamsContinent

type SummaryGetParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	SummaryGetParamsContinentAf SummaryGetParamsContinent = "AF"
	SummaryGetParamsContinentAn SummaryGetParamsContinent = "AN"
	SummaryGetParamsContinentAs SummaryGetParamsContinent = "AS"
	SummaryGetParamsContinentEu SummaryGetParamsContinent = "EU"
	SummaryGetParamsContinentNa SummaryGetParamsContinent = "NA"
	SummaryGetParamsContinentOc SummaryGetParamsContinent = "OC"
	SummaryGetParamsContinentSa SummaryGetParamsContinent = "SA"
)

type SummaryGetParamsDeviceType

type SummaryGetParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	SummaryGetParamsDeviceTypeDesktop SummaryGetParamsDeviceType = "desktop"
	SummaryGetParamsDeviceTypeMobile  SummaryGetParamsDeviceType = "mobile"
	SummaryGetParamsDeviceTypeTablet  SummaryGetParamsDeviceType = "tablet"
	SummaryGetParamsDeviceTypeUnknown SummaryGetParamsDeviceType = "unknown"
)

type SummaryGetParamsGroupBy

type SummaryGetParamsGroupBy string

Optional on summary, quality and engagement. Group views by this field on their first retained start. Missing, null and nonstring context forms a null group; the literal device type unknown stays separate. Groups sort by views descending, then value ascending with null first for ties. Pagination is available only with group_by. Location uses the first retained start too. City groups use the stored name; filter by country to avoid combining names shared by different countries. Page groups use the first retained start even if playback continues after navigation. Filter by page_origin when grouping page_path to distinguish identical paths on different sites. video_title groups by the title on each view's first retained start, so a renamed video counts each view under the title it started with. user_id groups by the user ID on each view's first retained start. Use custom.<key>, such as custom.plan, to group by a custom dimension; views without the key form the null group.

const (
	SummaryGetParamsGroupByBrowserName      SummaryGetParamsGroupBy = "browser_name"
	SummaryGetParamsGroupByOsName           SummaryGetParamsGroupBy = "os_name"
	SummaryGetParamsGroupByDeviceType       SummaryGetParamsGroupBy = "device_type"
	SummaryGetParamsGroupByContinent        SummaryGetParamsGroupBy = "continent"
	SummaryGetParamsGroupByCountry          SummaryGetParamsGroupBy = "country"
	SummaryGetParamsGroupByCity             SummaryGetParamsGroupBy = "city"
	SummaryGetParamsGroupByPageOrigin       SummaryGetParamsGroupBy = "page_origin"
	SummaryGetParamsGroupByPagePath         SummaryGetParamsGroupBy = "page_path"
	SummaryGetParamsGroupBySubtitleLanguage SummaryGetParamsGroupBy = "subtitle_language"
	SummaryGetParamsGroupByPlaybackRate     SummaryGetParamsGroupBy = "playback_rate"
	SummaryGetParamsGroupByVideoTitle       SummaryGetParamsGroupBy = "video_title"
	SummaryGetParamsGroupByUserID           SummaryGetParamsGroupBy = "user_id"
)

type SummaryService

type SummaryService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

SummaryService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSummaryService method instead.

func NewSummaryService

func NewSummaryService(opts ...option.RequestOption) (r SummaryService)

NewSummaryService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SummaryService) Get

Get views, unique viewer IDs, and playing time for matching playback attempts. Optionally group the full filtered view-start cohort with group_by=browser_name, os_name, device_type, continent, country or city. Without group_by the totals response is unchanged. With group_by, return paginated groups sorted by views descending. Equal view counts sort by value ascending, null first. Context comes from the first retained start; missing, null and nonstring values form a null group. Keep group_by and filters unchanged with each cursor. Unique viewers must not be summed across groups.

type TimeBucket

type TimeBucket struct {
	// UTC interval start in RFC3339 with milliseconds and Z. May precede from in a
	// partial first bucket; only starts inside [from, to) contribute.
	BucketStart        time.Time `json:"bucket_start" api:"required" format:"date-time"`
	TotalPlayingTimeMs float64   `json:"total_playing_time_ms" api:"required"`
	UniqueViewers      int64     `json:"unique_viewers" api:"required"`
	Views              int64     `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BucketStart        respjson.Field
		TotalPlayingTimeMs respjson.Field
		UniqueViewers      respjson.Field
		Views              respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TimeBucket) RawJSON

func (r TimeBucket) RawJSON() string

Returns the unmodified JSON received from the API

func (*TimeBucket) UnmarshalJSON

func (r *TimeBucket) UnmarshalJSON(data []byte) error

type Timeseries

type Timeseries struct {
	Buckets []TimeBucket `json:"buckets" api:"required"`
	// Inclusive query bound normalized to UTC milliseconds.
	From time.Time `json:"from" api:"required" format:"date-time"`
	// Any of "hour", "day".
	Interval TimeseriesInterval `json:"interval" api:"required"`
	Kind     constant.Summary   `json:"kind" default:"summary"`
	Timezone constant.Utc       `json:"timezone" default:"UTC"`
	// Exclusive query bound normalized to UTC milliseconds.
	To time.Time `json:"to" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Buckets     respjson.Field
		From        respjson.Field
		Interval    respjson.Field
		Kind        respjson.Field
		Timezone    respjson.Field
		To          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Timeseries) RawJSON

func (r Timeseries) RawJSON() string

Returns the unmodified JSON received from the API

func (*Timeseries) UnmarshalJSON

func (r *Timeseries) UnmarshalJSON(data []byte) error

type TimeseriesInterval

type TimeseriesInterval string
const (
	TimeseriesIntervalHour TimeseriesInterval = "hour"
	TimeseriesIntervalDay  TimeseriesInterval = "day"
)

type TimeseriesResponseUnion

type TimeseriesResponseUnion struct {
	// This field is a union of [[]TimeBucket], [[]QualityTimeseriesBucket],
	// [[]EngagementTimeseriesBucket]
	Buckets  TimeseriesResponseUnionBuckets `json:"buckets"`
	From     time.Time                      `json:"from"`
	Interval string                         `json:"interval"`
	Kind     string                         `json:"kind"`
	// This field is from variant [Timeseries].
	Timezone constant.Utc `json:"timezone"`
	To       time.Time    `json:"to"`
	JSON     struct {
		Buckets  respjson.Field
		From     respjson.Field
		Interval respjson.Field
		Kind     respjson.Field
		Timezone respjson.Field
		To       respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

TimeseriesResponseUnion contains all possible properties and values from Timeseries, QualityTimeseries, EngagementTimeseries.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (TimeseriesResponseUnion) AsEngagementTimeseries

func (u TimeseriesResponseUnion) AsEngagementTimeseries() (v EngagementTimeseries)

func (TimeseriesResponseUnion) AsQualityTimeseries

func (u TimeseriesResponseUnion) AsQualityTimeseries() (v QualityTimeseries)

func (TimeseriesResponseUnion) AsTimeseries

func (u TimeseriesResponseUnion) AsTimeseries() (v Timeseries)

func (TimeseriesResponseUnion) RawJSON

func (u TimeseriesResponseUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*TimeseriesResponseUnion) UnmarshalJSON

func (r *TimeseriesResponseUnion) UnmarshalJSON(data []byte) error

type TimeseriesResponseUnionBuckets

type TimeseriesResponseUnionBuckets struct {
	// This field will be present if the value is a [[]TimeBucket] instead of an
	// object.
	OfTimeBucketArray []TimeBucket `json:",inline"`
	// This field will be present if the value is a [[]QualityTimeseriesBucket] instead
	// of an object.
	OfQualityTimeseriesBucketArray []QualityTimeseriesBucket `json:",inline"`
	// This field will be present if the value is a [[]EngagementTimeseriesBucket]
	// instead of an object.
	OfEngagementTimeseriesBucketArray []EngagementTimeseriesBucket `json:",inline"`
	JSON                              struct {
		OfTimeBucketArray                 respjson.Field
		OfQualityTimeseriesBucketArray    respjson.Field
		OfEngagementTimeseriesBucketArray respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

TimeseriesResponseUnionBuckets is an implicit subunion of TimeseriesResponseUnion. TimeseriesResponseUnionBuckets provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the TimeseriesResponseUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfTimeBucketArray OfQualityTimeseriesBucketArray OfEngagementTimeseriesBucketArray]

func (*TimeseriesResponseUnionBuckets) UnmarshalJSON

func (r *TimeseriesResponseUnionBuckets) UnmarshalJSON(data []byte) error

type TimeseryGetParams

type TimeseryGetParams struct {
	// Inclusive view-start time in RFC3339 format with a timezone.
	From time.Time `query:"from" api:"required" format:"date-time" json:"-"`
	// UTC hour or day. The requested range can contain at most 1000 buckets.
	//
	// Any of "hour", "day".
	Interval TimeseryGetParamsInterval `query:"interval,omitzero" api:"required" json:"-"`
	// Exclusive view-start time in RFC3339 format with a timezone. Must be later than
	// from.
	To time.Time `query:"to" api:"required" format:"date-time" json:"-"`
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent TimeseryGetParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType TimeseryGetParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// Metric set for every time bucket. Uses the same calculations and sample counts
	// as the corresponding totals route.
	//
	// Any of "summary", "quality", "engagement".
	Kind TimeseryGetParamsKind `query:"kind,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TimeseryGetParams) URLQuery

func (r TimeseryGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes TimeseryGetParams's query parameters as `url.Values`.

type TimeseryGetParamsContinent

type TimeseryGetParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	TimeseryGetParamsContinentAf TimeseryGetParamsContinent = "AF"
	TimeseryGetParamsContinentAn TimeseryGetParamsContinent = "AN"
	TimeseryGetParamsContinentAs TimeseryGetParamsContinent = "AS"
	TimeseryGetParamsContinentEu TimeseryGetParamsContinent = "EU"
	TimeseryGetParamsContinentNa TimeseryGetParamsContinent = "NA"
	TimeseryGetParamsContinentOc TimeseryGetParamsContinent = "OC"
	TimeseryGetParamsContinentSa TimeseryGetParamsContinent = "SA"
)

type TimeseryGetParamsDeviceType

type TimeseryGetParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	TimeseryGetParamsDeviceTypeDesktop TimeseryGetParamsDeviceType = "desktop"
	TimeseryGetParamsDeviceTypeMobile  TimeseryGetParamsDeviceType = "mobile"
	TimeseryGetParamsDeviceTypeTablet  TimeseryGetParamsDeviceType = "tablet"
	TimeseryGetParamsDeviceTypeUnknown TimeseryGetParamsDeviceType = "unknown"
)

type TimeseryGetParamsInterval

type TimeseryGetParamsInterval string

UTC hour or day. The requested range can contain at most 1000 buckets.

const (
	TimeseryGetParamsIntervalHour TimeseryGetParamsInterval = "hour"
	TimeseryGetParamsIntervalDay  TimeseryGetParamsInterval = "day"
)

type TimeseryGetParamsKind

type TimeseryGetParamsKind string

Metric set for every time bucket. Uses the same calculations and sample counts as the corresponding totals route.

const (
	TimeseryGetParamsKindSummary    TimeseryGetParamsKind = "summary"
	TimeseryGetParamsKindQuality    TimeseryGetParamsKind = "quality"
	TimeseryGetParamsKindEngagement TimeseryGetParamsKind = "engagement"
)

type TimeseryService

type TimeseryService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

TimeseryService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTimeseryService method instead.

func NewTimeseryService

func NewTimeseryService(opts ...option.RequestOption) (r TimeseryService)

NewTimeseryService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TimeseryService) Get

Supply from, to and interval=hour|day. kind defaults to summary and also accepts quality or engagement. Every bucket selects first retained starts in its UTC interval and includes each selected view's whole retained measurement and errors, even after to. Empty buckets have zero counts and null unavailable measurements or ratios. At most 1000 buckets. Unique viewer counts are not additive.

type VideoListParams

type VideoListParams struct {
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Use next_cursor from the previous page. Keep the same filters, sort_by and
	// order. Video cursors from earlier versions are invalid; start a new pagination
	// sequence after upgrading.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent VideoListParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType VideoListParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// Sort direction. Events and videos default to asc; views default to desc. Events
	// sort by ingestion sequence. Videos and views sort by sort_by with missing values
	// last. View ties use view_id in the requested direction; video metric ties use
	// video_id ascending.
	//
	// Any of "asc", "desc".
	Order VideoListParamsOrder `query:"order,omitzero" json:"-"`
	// Rank all matching videos before pagination. Missing scores come last in both
	// directions. Metric ties use video_id ascending. Keep sort_by, order and filters
	// unchanged with a cursor.
	//
	// Any of "video_id", "views", "unique_viewers", "total_playing_time_ms",
	// "playback_score".
	SortBy VideoListParamsSortBy `query:"sort_by,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (VideoListParams) URLQuery

func (r VideoListParams) URLQuery() (v url.Values, err error)

URLQuery serializes VideoListParams's query parameters as `url.Values`.

type VideoListParamsContinent

type VideoListParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	VideoListParamsContinentAf VideoListParamsContinent = "AF"
	VideoListParamsContinentAn VideoListParamsContinent = "AN"
	VideoListParamsContinentAs VideoListParamsContinent = "AS"
	VideoListParamsContinentEu VideoListParamsContinent = "EU"
	VideoListParamsContinentNa VideoListParamsContinent = "NA"
	VideoListParamsContinentOc VideoListParamsContinent = "OC"
	VideoListParamsContinentSa VideoListParamsContinent = "SA"
)

type VideoListParamsDeviceType

type VideoListParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	VideoListParamsDeviceTypeDesktop VideoListParamsDeviceType = "desktop"
	VideoListParamsDeviceTypeMobile  VideoListParamsDeviceType = "mobile"
	VideoListParamsDeviceTypeTablet  VideoListParamsDeviceType = "tablet"
	VideoListParamsDeviceTypeUnknown VideoListParamsDeviceType = "unknown"
)

type VideoListParamsOrder

type VideoListParamsOrder string

Sort direction. Events and videos default to asc; views default to desc. Events sort by ingestion sequence. Videos and views sort by sort_by with missing values last. View ties use view_id in the requested direction; video metric ties use video_id ascending.

const (
	VideoListParamsOrderAsc  VideoListParamsOrder = "asc"
	VideoListParamsOrderDesc VideoListParamsOrder = "desc"
)

type VideoListParamsSortBy

type VideoListParamsSortBy string

Rank all matching videos before pagination. Missing scores come last in both directions. Metric ties use video_id ascending. Keep sort_by, order and filters unchanged with a cursor.

const (
	VideoListParamsSortByVideoID            VideoListParamsSortBy = "video_id"
	VideoListParamsSortByViews              VideoListParamsSortBy = "views"
	VideoListParamsSortByUniqueViewers      VideoListParamsSortBy = "unique_viewers"
	VideoListParamsSortByTotalPlayingTimeMs VideoListParamsSortBy = "total_playing_time_ms"
	VideoListParamsSortByPlaybackScore      VideoListParamsSortBy = "playback_score"
)

type VideoMetrics

type VideoMetrics struct {
	PlaybackScore      shared.PlaybackScore `json:"playback_score" api:"required"`
	TotalPlayingTimeMs float64              `json:"total_playing_time_ms" api:"required"`
	UniqueViewers      int64                `json:"unique_viewers" api:"required"`
	VideoID            string               `json:"video_id" api:"required"`
	// Title from the most recently received selected start that supplied one.
	VideoTitle string `json:"video_title" api:"required"`
	Views      int64  `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PlaybackScore      respjson.Field
		TotalPlayingTimeMs respjson.Field
		UniqueViewers      respjson.Field
		VideoID            respjson.Field
		VideoTitle         respjson.Field
		Views              respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VideoMetrics) RawJSON

func (r VideoMetrics) RawJSON() string

Returns the unmodified JSON received from the API

func (*VideoMetrics) UnmarshalJSON

func (r *VideoMetrics) UnmarshalJSON(data []byte) error

type VideoPage

type VideoPage struct {
	NextCursor string         `json:"next_cursor" api:"required"`
	Videos     []VideoMetrics `json:"videos" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		NextCursor  respjson.Field
		Videos      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VideoPage) RawJSON

func (r VideoPage) RawJSON() string

Returns the unmodified JSON received from the API

func (*VideoPage) UnmarshalJSON

func (r *VideoPage) UnmarshalJSON(data []byte) error

type VideoService

type VideoService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

VideoService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewVideoService method instead.

func NewVideoService

func NewVideoService(opts ...option.RequestOption) (r VideoService)

NewVideoService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*VideoService) List

List per-video totals. Sort the entire filtered cohort by video_id, views, unique_viewers, total_playing_time_ms or playback_score before pagination. Defaults to video_id ascending. Missing scores come last; metric ties use video_id ascending in both directions. Unique viewer counts cannot be added across videos. Keep sort_by, order and filters unchanged with a cursor.

func (*VideoService) ListAutoPaging

List per-video totals. Sort the entire filtered cohort by video_id, views, unique_viewers, total_playing_time_ms or playback_score before pagination. Defaults to video_id ascending. Missing scores come last; metric ties use video_id ascending in both directions. Unique viewer counts cannot be added across videos. Keep sort_by, order and filters unchanged with a cursor.

type View

type View struct {
	BrowserName        string               `json:"browser_name" api:"required"`
	DeviceType         string               `json:"device_type" api:"required"`
	HasEndedEvent      bool                 `json:"has_ended_event" api:"required"`
	HasFatalError      bool                 `json:"has_fatal_error" api:"required"`
	OsName             string               `json:"os_name" api:"required"`
	PlaybackScore      shared.PlaybackScore `json:"playback_score" api:"required"`
	PlayingTimeMs      float64              `json:"playing_time_ms" api:"required"`
	ReachedEnd         bool                 `json:"reached_end" api:"required"`
	RebufferDurationMs float64              `json:"rebuffer_duration_ms" api:"required"`
	StartedAt          time.Time            `json:"started_at" api:"required" format:"date-time"`
	StartupTimeMs      float64              `json:"startup_time_ms" api:"required"`
	UserID             string               `json:"user_id" api:"required"`
	VideoID            string               `json:"video_id" api:"required"`
	VideoTitle         string               `json:"video_title" api:"required"`
	ViewID             string               `json:"view_id" api:"required"`
	ViewerID           string               `json:"viewer_id" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BrowserName        respjson.Field
		DeviceType         respjson.Field
		HasEndedEvent      respjson.Field
		HasFatalError      respjson.Field
		OsName             respjson.Field
		PlaybackScore      respjson.Field
		PlayingTimeMs      respjson.Field
		ReachedEnd         respjson.Field
		RebufferDurationMs respjson.Field
		StartedAt          respjson.Field
		StartupTimeMs      respjson.Field
		UserID             respjson.Field
		VideoID            respjson.Field
		VideoTitle         respjson.Field
		ViewID             respjson.Field
		ViewerID           respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (View) RawJSON

func (r View) RawJSON() string

Returns the unmodified JSON received from the API

func (*View) UnmarshalJSON

func (r *View) UnmarshalJSON(data []byte) error

type ViewDetail

type ViewDetail struct {
	Events     []StoredEvent `json:"events" api:"required"`
	NextCursor string        `json:"next_cursor" api:"required"`
	View       View          `json:"view" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Events      respjson.Field
		NextCursor  respjson.Field
		View        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ViewDetail) RawJSON

func (r ViewDetail) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewDetail) UnmarshalJSON

func (r *ViewDetail) UnmarshalJSON(data []byte) error

type ViewEnded

type ViewEnded struct {
	ConnectorName            string  `json:"connector_name" api:"required"`
	ConnectorVersion         string  `json:"connector_version" api:"required"`
	DeliveryHostname         string  `json:"delivery_hostname" api:"required"`
	DeliveryRequestCount     float64 `json:"delivery_request_count" api:"required"`
	DeliveryThroughputBps    float64 `json:"delivery_throughput_bps" api:"required"`
	DeliveryTransferredBytes float64 `json:"delivery_transferred_bytes" api:"required"`
	DroppedVideoFrames       float64 `json:"dropped_video_frames" api:"required"`
	Environment              string  `json:"environment" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory          ViewEndedErrorCategory          `json:"error_category" api:"required"`
	ErrorCode              ViewEndedErrorCodeUnion         `json:"error_code" api:"required"`
	ErrorFatal             bool                            `json:"error_fatal" api:"required"`
	ErrorPlayheadSeconds   float64                         `json:"error_playhead_seconds" api:"required"`
	EventID                string                          `json:"event_id" api:"required" format:"uuid"`
	EventName              constant.ChunkifyVideoViewEnded `json:"event_name" default:"chunkify.video.view_ended"`
	FirstVideoFrameTimeMs  float64                         `json:"first_video_frame_time_ms" api:"required"`
	FurthestProgressRatio  float64                         `json:"furthest_progress_ratio" api:"required"`
	MaximumPlayheadSeconds float64                         `json:"maximum_playhead_seconds" api:"required"`
	MediaDurationSeconds   float64                         `json:"media_duration_seconds" api:"required"`
	MediaHeightPx          float64                         `json:"media_height_px" api:"required"`
	MediaWidthPx           float64                         `json:"media_width_px" api:"required"`
	OccurredAt             time.Time                       `json:"occurred_at" api:"required" format:"date-time"`
	PlayerHeightPx         float64                         `json:"player_height_px" api:"required"`
	PlayerName             string                          `json:"player_name" api:"required"`
	PlayerVersion          string                          `json:"player_version" api:"required"`
	PlayerWidthPx          float64                         `json:"player_width_px" api:"required"`
	PlayingTimeMs          float64                         `json:"playing_time_ms" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason               ViewEndedReason               `json:"reason" api:"required"`
	RebufferCount        float64                       `json:"rebuffer_count" api:"required"`
	RebufferDurationMs   float64                       `json:"rebuffer_duration_ms" api:"required"`
	RebufferRatio        float64                       `json:"rebuffer_ratio" api:"required"`
	RenditionPlayingTime []shared.RenditionPlayingTime `json:"rendition_playing_time" api:"required"`
	RenditionSwitchCount float64                       `json:"rendition_switch_count" api:"required"`
	SchemaVersion        float64                       `json:"schema_version" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName                     string  `json:"sdk_name" api:"required"`
	SDKVersion                  string  `json:"sdk_version" api:"required"`
	SeekCount                   float64 `json:"seek_count" api:"required"`
	SeekDurationMs              float64 `json:"seek_duration_ms" api:"required"`
	SelectedRenditionBitrateBps float64 `json:"selected_rendition_bitrate_bps" api:"required"`
	SelectedRenditionCodec      string  `json:"selected_rendition_codec" api:"required"`
	SelectedRenditionHeight     float64 `json:"selected_rendition_height" api:"required"`
	SelectedRenditionWidth      float64 `json:"selected_rendition_width" api:"required"`
	Sequence                    int64   `json:"sequence" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome   ViewEndedStartupOutcome `json:"startup_outcome" api:"required"`
	StartupTimeMs    float64                 `json:"startup_time_ms" api:"required"`
	TotalVideoFrames float64                 `json:"total_video_frames" api:"required"`
	VideoID          string                  `json:"video_id" api:"required"`
	ViewID           string                  `json:"view_id" api:"required" format:"uuid"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID string `json:"viewer_id" api:"required"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContext `json:"browser_context" api:"nullable"`
	// Current playback rate, rounded to two decimals, such as 1, 1.5 or 2; from 0.01
	// to 16. Optional.
	PlaybackRate float64 `json:"playback_rate" api:"nullable"`
	// Cumulative playing time per playback rate for this attempt. At most 32 entries.
	// Optional.
	PlaybackRatePlayingTime []shared.PlaybackRatePlayingTime `json:"playback_rate_playing_time" api:"nullable"`
	// Cumulative played media ranges for this attempt, sorted and merged without
	// overlaps. Seeking, pauses and buffering are excluded. Missing or null means
	// unavailable; an empty array means measured but no section played. Replaying a
	// section does not add another range.
	PlayedRanges []shared.PlayedRange `json:"played_ranges" api:"nullable"`
	// Current media position at this event, not the maximum reached.
	PlayheadSeconds float64 `json:"playhead_seconds" api:"nullable"`
	// Language tag (BCP 47) of the showing subtitles or captions track; und when the
	// track declares no language; null when subtitles are off. Optional.
	SubtitleLanguage string `json:"subtitle_language" api:"nullable"`
	// Cumulative playing time per subtitle language for this attempt, null language
	// meaning subtitles off. At most 32 entries. Optional.
	SubtitlePlayingTime []shared.SubtitlePlayingTime `json:"subtitle_playing_time" api:"nullable"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID string `json:"user_id" api:"nullable"`
	// Optional human-readable video title for reports.
	VideoTitle string `json:"video_title" api:"nullable"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState ViewEndedVisibilityState `json:"visibility_state" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorName               respjson.Field
		ConnectorVersion            respjson.Field
		DeliveryHostname            respjson.Field
		DeliveryRequestCount        respjson.Field
		DeliveryThroughputBps       respjson.Field
		DeliveryTransferredBytes    respjson.Field
		DroppedVideoFrames          respjson.Field
		Environment                 respjson.Field
		ErrorCategory               respjson.Field
		ErrorCode                   respjson.Field
		ErrorFatal                  respjson.Field
		ErrorPlayheadSeconds        respjson.Field
		EventID                     respjson.Field
		EventName                   respjson.Field
		FirstVideoFrameTimeMs       respjson.Field
		FurthestProgressRatio       respjson.Field
		MaximumPlayheadSeconds      respjson.Field
		MediaDurationSeconds        respjson.Field
		MediaHeightPx               respjson.Field
		MediaWidthPx                respjson.Field
		OccurredAt                  respjson.Field
		PlayerHeightPx              respjson.Field
		PlayerName                  respjson.Field
		PlayerVersion               respjson.Field
		PlayerWidthPx               respjson.Field
		PlayingTimeMs               respjson.Field
		Reason                      respjson.Field
		RebufferCount               respjson.Field
		RebufferDurationMs          respjson.Field
		RebufferRatio               respjson.Field
		RenditionPlayingTime        respjson.Field
		RenditionSwitchCount        respjson.Field
		SchemaVersion               respjson.Field
		SDKName                     respjson.Field
		SDKVersion                  respjson.Field
		SeekCount                   respjson.Field
		SeekDurationMs              respjson.Field
		SelectedRenditionBitrateBps respjson.Field
		SelectedRenditionCodec      respjson.Field
		SelectedRenditionHeight     respjson.Field
		SelectedRenditionWidth      respjson.Field
		Sequence                    respjson.Field
		StartupOutcome              respjson.Field
		StartupTimeMs               respjson.Field
		TotalVideoFrames            respjson.Field
		VideoID                     respjson.Field
		ViewID                      respjson.Field
		ViewerID                    respjson.Field
		BrowserContext              respjson.Field
		PlaybackRate                respjson.Field
		PlaybackRatePlayingTime     respjson.Field
		PlayedRanges                respjson.Field
		PlayheadSeconds             respjson.Field
		SubtitleLanguage            respjson.Field
		SubtitlePlayingTime         respjson.Field
		UserID                      respjson.Field
		VideoTitle                  respjson.Field
		VisibilityState             respjson.Field
		ExtraFields                 map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ViewEnded) RawJSON

func (r ViewEnded) RawJSON() string

Returns the unmodified JSON received from the API

func (ViewEnded) ToParam

func (r ViewEnded) ToParam() ViewEndedParam

ToParam converts this ViewEnded to a ViewEndedParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ViewEndedParam.Overrides()

func (*ViewEnded) UnmarshalJSON

func (r *ViewEnded) UnmarshalJSON(data []byte) error

type ViewEndedErrorCategory

type ViewEndedErrorCategory string
const (
	ViewEndedErrorCategoryAborted     ViewEndedErrorCategory = "aborted"
	ViewEndedErrorCategoryNetwork     ViewEndedErrorCategory = "network"
	ViewEndedErrorCategoryDecode      ViewEndedErrorCategory = "decode"
	ViewEndedErrorCategoryUnsupported ViewEndedErrorCategory = "unsupported"
	ViewEndedErrorCategoryUnknown     ViewEndedErrorCategory = "unknown"
)

type ViewEndedErrorCodeUnion

type ViewEndedErrorCodeUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ViewEndedErrorCodeUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (ViewEndedErrorCodeUnion) AsFloat

func (u ViewEndedErrorCodeUnion) AsFloat() (v float64)

func (ViewEndedErrorCodeUnion) AsString

func (u ViewEndedErrorCodeUnion) AsString() (v string)

func (ViewEndedErrorCodeUnion) RawJSON

func (u ViewEndedErrorCodeUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewEndedErrorCodeUnion) UnmarshalJSON

func (r *ViewEndedErrorCodeUnion) UnmarshalJSON(data []byte) error

type ViewEndedErrorCodeUnionParam

type ViewEndedErrorCodeUnionParam struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ViewEndedErrorCodeUnionParam) MarshalJSON

func (u ViewEndedErrorCodeUnionParam) MarshalJSON() ([]byte, error)

func (*ViewEndedErrorCodeUnionParam) UnmarshalJSON

func (u *ViewEndedErrorCodeUnionParam) UnmarshalJSON(data []byte) error

type ViewEndedParam

type ViewEndedParam struct {
	ConnectorVersion         param.Opt[string]  `json:"connector_version,omitzero" api:"required"`
	DeliveryHostname         param.Opt[string]  `json:"delivery_hostname,omitzero" api:"required"`
	DeliveryRequestCount     param.Opt[float64] `json:"delivery_request_count,omitzero" api:"required"`
	DeliveryThroughputBps    param.Opt[float64] `json:"delivery_throughput_bps,omitzero" api:"required"`
	DeliveryTransferredBytes param.Opt[float64] `json:"delivery_transferred_bytes,omitzero" api:"required"`
	DroppedVideoFrames       param.Opt[float64] `json:"dropped_video_frames,omitzero" api:"required"`
	Environment              param.Opt[string]  `json:"environment,omitzero" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory         param.Opt[ViewEndedErrorCategory] `json:"error_category,omitzero" api:"required"`
	ErrorFatal            param.Opt[bool]                   `json:"error_fatal,omitzero" api:"required"`
	ErrorPlayheadSeconds  param.Opt[float64]                `json:"error_playhead_seconds,omitzero" api:"required"`
	FirstVideoFrameTimeMs param.Opt[float64]                `json:"first_video_frame_time_ms,omitzero" api:"required"`
	FurthestProgressRatio param.Opt[float64]                `json:"furthest_progress_ratio,omitzero" api:"required"`
	MediaDurationSeconds  param.Opt[float64]                `json:"media_duration_seconds,omitzero" api:"required"`
	MediaHeightPx         param.Opt[float64]                `json:"media_height_px,omitzero" api:"required"`
	MediaWidthPx          param.Opt[float64]                `json:"media_width_px,omitzero" api:"required"`
	PlayerHeightPx        param.Opt[float64]                `json:"player_height_px,omitzero" api:"required"`
	PlayerName            param.Opt[string]                 `json:"player_name,omitzero" api:"required"`
	PlayerVersion         param.Opt[string]                 `json:"player_version,omitzero" api:"required"`
	PlayerWidthPx         param.Opt[float64]                `json:"player_width_px,omitzero" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason                      param.Opt[ViewEndedReason] `json:"reason,omitzero" api:"required"`
	RebufferRatio               param.Opt[float64]         `json:"rebuffer_ratio,omitzero" api:"required"`
	RenditionSwitchCount        param.Opt[float64]         `json:"rendition_switch_count,omitzero" api:"required"`
	SelectedRenditionBitrateBps param.Opt[float64]         `json:"selected_rendition_bitrate_bps,omitzero" api:"required"`
	SelectedRenditionCodec      param.Opt[string]          `json:"selected_rendition_codec,omitzero" api:"required"`
	SelectedRenditionHeight     param.Opt[float64]         `json:"selected_rendition_height,omitzero" api:"required"`
	SelectedRenditionWidth      param.Opt[float64]         `json:"selected_rendition_width,omitzero" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome   param.Opt[ViewEndedStartupOutcome] `json:"startup_outcome,omitzero" api:"required"`
	StartupTimeMs    param.Opt[float64]                 `json:"startup_time_ms,omitzero" api:"required"`
	TotalVideoFrames param.Opt[float64]                 `json:"total_video_frames,omitzero" api:"required"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID               param.Opt[string]                  `json:"viewer_id,omitzero" api:"required"`
	ErrorCode              ViewEndedErrorCodeUnionParam       `json:"error_code,omitzero" api:"required"`
	RenditionPlayingTime   []shared.RenditionPlayingTimeParam `json:"rendition_playing_time,omitzero" api:"required"`
	ConnectorName          string                             `json:"connector_name" api:"required"`
	EventID                string                             `json:"event_id" api:"required" format:"uuid"`
	MaximumPlayheadSeconds float64                            `json:"maximum_playhead_seconds" api:"required"`
	OccurredAt             time.Time                          `json:"occurred_at" api:"required" format:"date-time"`
	PlayingTimeMs          float64                            `json:"playing_time_ms" api:"required"`
	RebufferCount          float64                            `json:"rebuffer_count" api:"required"`
	RebufferDurationMs     float64                            `json:"rebuffer_duration_ms" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName        string  `json:"sdk_name" api:"required"`
	SDKVersion     string  `json:"sdk_version" api:"required"`
	SeekCount      float64 `json:"seek_count" api:"required"`
	SeekDurationMs float64 `json:"seek_duration_ms" api:"required"`
	Sequence       int64   `json:"sequence" api:"required"`
	VideoID        string  `json:"video_id" api:"required"`
	ViewID         string  `json:"view_id" api:"required" format:"uuid"`
	// Current playback rate, rounded to two decimals, such as 1, 1.5 or 2; from 0.01
	// to 16. Optional.
	PlaybackRate param.Opt[float64] `json:"playback_rate,omitzero"`
	// Current media position at this event, not the maximum reached.
	PlayheadSeconds param.Opt[float64] `json:"playhead_seconds,omitzero"`
	// Language tag (BCP 47) of the showing subtitles or captions track; und when the
	// track declares no language; null when subtitles are off. Optional.
	SubtitleLanguage param.Opt[string] `json:"subtitle_language,omitzero"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID param.Opt[string] `json:"user_id,omitzero"`
	// Optional human-readable video title for reports.
	VideoTitle param.Opt[string] `json:"video_title,omitzero"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState param.Opt[ViewEndedVisibilityState] `json:"visibility_state,omitzero"`
	// Cumulative playing time per playback rate for this attempt. At most 32 entries.
	// Optional.
	PlaybackRatePlayingTime []shared.PlaybackRatePlayingTimeParam `json:"playback_rate_playing_time,omitzero"`
	// Cumulative played media ranges for this attempt, sorted and merged without
	// overlaps. Seeking, pauses and buffering are excluded. Missing or null means
	// unavailable; an empty array means measured but no section played. Replaying a
	// section does not add another range.
	PlayedRanges []shared.PlayedRangeParam `json:"played_ranges,omitzero"`
	// Cumulative playing time per subtitle language for this attempt, null language
	// meaning subtitles off. At most 32 entries. Optional.
	SubtitlePlayingTime []shared.SubtitlePlayingTimeParam `json:"subtitle_playing_time,omitzero"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContextParam `json:"browser_context,omitzero"`
	// This field can be elided, and will marshal its zero value as
	// "chunkify.video.view_ended".
	EventName constant.ChunkifyVideoViewEnded `json:"event_name" default:"chunkify.video.view_ended"`
	// This field can be elided, and will marshal its zero value as 1.
	SchemaVersion float64 `json:"schema_version,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The properties ConnectorName, ConnectorVersion, DeliveryHostname, DeliveryRequestCount, DeliveryThroughputBps, DeliveryTransferredBytes, DroppedVideoFrames, Environment, ErrorCategory, ErrorCode, ErrorFatal, ErrorPlayheadSeconds, EventID, EventName, FirstVideoFrameTimeMs, FurthestProgressRatio, MaximumPlayheadSeconds, MediaDurationSeconds, MediaHeightPx, MediaWidthPx, OccurredAt, PlayerHeightPx, PlayerName, PlayerVersion, PlayerWidthPx, PlayingTimeMs, Reason, RebufferCount, RebufferDurationMs, RebufferRatio, RenditionPlayingTime, RenditionSwitchCount, SchemaVersion, SDKName, SDKVersion, SeekCount, SeekDurationMs, SelectedRenditionBitrateBps, SelectedRenditionCodec, SelectedRenditionHeight, SelectedRenditionWidth, Sequence, StartupOutcome, StartupTimeMs, TotalVideoFrames, VideoID, ViewID, ViewerID are required.

func (ViewEndedParam) MarshalJSON

func (r ViewEndedParam) MarshalJSON() (data []byte, err error)

func (*ViewEndedParam) UnmarshalJSON

func (r *ViewEndedParam) UnmarshalJSON(data []byte) error

type ViewEndedReason

type ViewEndedReason string
const (
	ViewEndedReasonEnded         ViewEndedReason = "ended"
	ViewEndedReasonDestroyed     ViewEndedReason = "destroyed"
	ViewEndedReasonSourceChanged ViewEndedReason = "source_changed"
	ViewEndedReasonPageExit      ViewEndedReason = "page_exit"
)

type ViewEndedStartupOutcome

type ViewEndedStartupOutcome string
const (
	ViewEndedStartupOutcomeStarted           ViewEndedStartupOutcome = "started"
	ViewEndedStartupOutcomeFailedBeforeStart ViewEndedStartupOutcome = "failed_before_start"
	ViewEndedStartupOutcomeEndedBeforeStart  ViewEndedStartupOutcome = "ended_before_start"
)

type ViewEndedVisibilityState

type ViewEndedVisibilityState string

Tab visibility when the event was recorded. Hidden does not imply paused playback or identify the cause of a pause. Missing on older events; null when unavailable.

const (
	ViewEndedVisibilityStateVisible ViewEndedVisibilityState = "visible"
	ViewEndedVisibilityStateHidden  ViewEndedVisibilityState = "hidden"
)

type ViewGetParams

type ViewGetParams struct {
	// Use next_cursor from the previous page. Keep the same filters, sort_by and
	// order. Video cursors from earlier versions are invalid; start a new pagination
	// sequence after upgrading.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ViewGetParams) URLQuery

func (r ViewGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes ViewGetParams's query parameters as `url.Values`.

type ViewListParams

type ViewListParams struct {
	// Exact browser name, such as Chrome. Missing values do not match.
	BrowserName param.Opt[string] `query:"browser_name,omitzero" json:"-"`
	// Exact, case-sensitive city name from the local lookup, with 1 to 256 Unicode
	// characters. Use country alongside city to distinguish places with the same name.
	// Missing locations do not match.
	City param.Opt[string] `query:"city,omitzero" json:"-"`
	// Exact uppercase ISO 3166-1 alpha-2 country code, such as GB. Missing locations
	// do not match.
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Use next_cursor from the previous page. Keep the same filters, sort_by and
	// order. Video cursors from earlier versions are invalid; start a new pagination
	// sequence after upgrading.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Inclusive RFC3339 occurrence-time lower bound, with timezone. Summary/video
	// queries apply it to the selected view_started event. Must be before to.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Select attempts with or without an observed fatal error. Absence of an observed
	// error does not prove successful playback.
	HasFatalError param.Opt[bool] `query:"has_fatal_error,omitzero" json:"-"`
	// Maximum rows on this page. Events and videos always support pagination; summary,
	// quality and engagement support it only with group_by.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Exact operating-system name, such as macOS. Missing values do not match.
	OsName param.Opt[string] `query:"os_name,omitzero" json:"-"`
	// Exact, case-sensitive page origin captured by the player, such as
	// https://example.com. Metrics use the first retained view start; raw events use
	// each event context. Missing values do not match.
	PageOrigin param.Opt[string] `query:"page_origin,omitzero" json:"-"`
	// Exact, case-sensitive page path captured by the player, such as /watch/video.
	// Filter by page_origin as well to distinguish identical paths on different sites.
	// Metrics use the first retained view start; raw events use each event context.
	// Missing values do not match.
	PagePath param.Opt[string] `query:"page_path,omitzero" json:"-"`
	// Playback rate from 0.01 to 16 with at most two decimals, such as 1, 1.5 or 2;
	// 2.0 and 2 are the same rate. Metrics use the rate on the first retained view
	// start; raw events use each event's value.
	PlaybackRate param.Opt[string] `query:"playback_rate,omitzero" json:"-"`
	// Exact, case-sensitive, non-blank subtitle language tag, such as fr or en-US; und
	// for a subtitles track without a language. Metrics use the language showing on
	// the first retained view start; raw events use each event's value. Views without
	// subtitles at start do not match.
	SubtitleLanguage param.Opt[string] `query:"subtitle_language,omitzero" json:"-"`
	// Exclusive RFC3339 occurrence-time upper bound, with timezone. Summary/video
	// queries apply it to the selected view_started event.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Exact integrator-supplied user ID. Selects views by their start event; event
	// lists match each event's own value. Missing/null user IDs do not match. Reports
	// with this filter read one stored row per view.
	UserID param.Opt[string] `query:"user_id,omitzero" json:"-"`
	// Exact video ID; must not be blank. Combined with all other filters using AND.
	VideoID param.Opt[string] `query:"video_id,omitzero" json:"-"`
	// Exact, case-sensitive video title. Selects views by the title on their first
	// retained start; event lists match each event's own value. Views without a title
	// do not match. Reports with this filter read one stored row per view.
	VideoTitle param.Opt[string] `query:"video_title,omitzero" json:"-"`
	// Filter one playback attempt by view ID. Metrics use its first retained start.
	ViewID param.Opt[string] `query:"view_id,omitzero" json:"-"`
	// Exact viewer ID. The Chunkify player SDK generates one per browser; missing/null
	// viewer IDs do not match.
	ViewerID param.Opt[string] `query:"viewer_id,omitzero" json:"-"`
	// Exact continent code from the local lookup. Missing locations do not match.
	//
	// Any of "AF", "AN", "AS", "EU", "NA", "OC", "SA".
	Continent ViewListParamsContinent `query:"continent,omitzero" json:"-"`
	// Exact device class. unknown matches an explicit unknown value.
	//
	// Any of "desktop", "mobile", "tablet", "unknown".
	DeviceType ViewListParamsDeviceType `query:"device_type,omitzero" json:"-"`
	// Sort by started_at and then view_id in this direction. Defaults to newest first.
	// Keep the same order with each cursor.
	//
	// Any of "asc", "desc".
	Order ViewListParamsOrder `query:"order,omitzero" json:"-"`
	// Sort all matching sessions before pagination. Missing values come last in both
	// directions. Ties use view_id in the requested direction. Keep sort_by, order and
	// filters unchanged with a cursor.
	//
	// Any of "started_at", "video_id", "view_id", "device_type", "playing_time_ms",
	// "startup_time_ms", "rebuffer_duration_ms", "playback_score".
	SortBy ViewListParamsSortBy `query:"sort_by,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ViewListParams) URLQuery

func (r ViewListParams) URLQuery() (v url.Values, err error)

URLQuery serializes ViewListParams's query parameters as `url.Values`.

type ViewListParamsContinent

type ViewListParamsContinent string

Exact continent code from the local lookup. Missing locations do not match.

const (
	ViewListParamsContinentAf ViewListParamsContinent = "AF"
	ViewListParamsContinentAn ViewListParamsContinent = "AN"
	ViewListParamsContinentAs ViewListParamsContinent = "AS"
	ViewListParamsContinentEu ViewListParamsContinent = "EU"
	ViewListParamsContinentNa ViewListParamsContinent = "NA"
	ViewListParamsContinentOc ViewListParamsContinent = "OC"
	ViewListParamsContinentSa ViewListParamsContinent = "SA"
)

type ViewListParamsDeviceType

type ViewListParamsDeviceType string

Exact device class. unknown matches an explicit unknown value.

const (
	ViewListParamsDeviceTypeDesktop ViewListParamsDeviceType = "desktop"
	ViewListParamsDeviceTypeMobile  ViewListParamsDeviceType = "mobile"
	ViewListParamsDeviceTypeTablet  ViewListParamsDeviceType = "tablet"
	ViewListParamsDeviceTypeUnknown ViewListParamsDeviceType = "unknown"
)

type ViewListParamsOrder

type ViewListParamsOrder string

Sort by started_at and then view_id in this direction. Defaults to newest first. Keep the same order with each cursor.

const (
	ViewListParamsOrderAsc  ViewListParamsOrder = "asc"
	ViewListParamsOrderDesc ViewListParamsOrder = "desc"
)

type ViewListParamsSortBy

type ViewListParamsSortBy string

Sort all matching sessions before pagination. Missing values come last in both directions. Ties use view_id in the requested direction. Keep sort_by, order and filters unchanged with a cursor.

const (
	ViewListParamsSortByStartedAt          ViewListParamsSortBy = "started_at"
	ViewListParamsSortByVideoID            ViewListParamsSortBy = "video_id"
	ViewListParamsSortByViewID             ViewListParamsSortBy = "view_id"
	ViewListParamsSortByDeviceType         ViewListParamsSortBy = "device_type"
	ViewListParamsSortByPlayingTimeMs      ViewListParamsSortBy = "playing_time_ms"
	ViewListParamsSortByStartupTimeMs      ViewListParamsSortBy = "startup_time_ms"
	ViewListParamsSortByRebufferDurationMs ViewListParamsSortBy = "rebuffer_duration_ms"
	ViewListParamsSortByPlaybackScore      ViewListParamsSortBy = "playback_score"
)

type ViewPage

type ViewPage struct {
	NextCursor string `json:"next_cursor" api:"required"`
	Views      []View `json:"views" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		NextCursor  respjson.Field
		Views       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ViewPage) RawJSON

func (r ViewPage) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewPage) UnmarshalJSON

func (r *ViewPage) UnmarshalJSON(data []byte) error

type ViewService

type ViewService struct {
	Options []option.RequestOption
}

Private retained-event and view-cohort queries.

ViewService contains methods and other services that help with interacting with the Chunkify Analytics API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewViewService method instead.

func NewViewService

func NewViewService(opts ...option.RequestOption) (r ViewService)

NewViewService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ViewService) Get

func (r *ViewService) Get(ctx context.Context, viewID string, query ViewGetParams, opts ...option.RequestOption) (res *ViewDetail, err error)

Returns start context and selected measurements, plus a paginated history of all retained events for that view ID, in ingestion order. SDK sequence and occurrence times remain in each event. Follow next_cursor with the same view ID; the summary and event pages share the initial ingestion watermark. Orphaned events without a retained start remain available through /v1/events?view_id=... .

func (*ViewService) List

func (r *ViewService) List(ctx context.Context, query ViewListParams, opts ...option.RequestOption) (res *pagination.ViewsPage[View], err error)

One row per first retained start, using the same final/latest measurement selection as metrics. Filter by identity, context, dates or has_fatal_error. Order by started_at descending by default (newest first), or ascending with order=asc. Equal start times use view_id in the same direction. Cursors bind filters, order, fatal-error selection, project and ingestion watermark. Missing end or error events are not proof of an ongoing or successful playback. Sort the entire matching cohort by sort_by before pagination, with missing values last.

func (*ViewService) ListAutoPaging

One row per first retained start, using the same final/latest measurement selection as metrics. Filter by identity, context, dates or has_fatal_error. Order by started_at descending by default (newest first), or ascending with order=asc. Equal start times use view_id in the same direction. Cursors bind filters, order, fatal-error selection, project and ingestion watermark. Missing end or error events are not proof of an ongoing or successful playback. Sort the entire matching cohort by sort_by before pagination, with missing values last.

type ViewSnapshot

type ViewSnapshot struct {
	ConnectorName            string  `json:"connector_name" api:"required"`
	ConnectorVersion         string  `json:"connector_version" api:"required"`
	DeliveryHostname         string  `json:"delivery_hostname" api:"required"`
	DeliveryRequestCount     float64 `json:"delivery_request_count" api:"required"`
	DeliveryThroughputBps    float64 `json:"delivery_throughput_bps" api:"required"`
	DeliveryTransferredBytes float64 `json:"delivery_transferred_bytes" api:"required"`
	DroppedVideoFrames       float64 `json:"dropped_video_frames" api:"required"`
	Environment              string  `json:"environment" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory          ViewSnapshotErrorCategory          `json:"error_category" api:"required"`
	ErrorCode              ViewSnapshotErrorCodeUnion         `json:"error_code" api:"required"`
	ErrorFatal             bool                               `json:"error_fatal" api:"required"`
	ErrorPlayheadSeconds   float64                            `json:"error_playhead_seconds" api:"required"`
	EventID                string                             `json:"event_id" api:"required" format:"uuid"`
	EventName              constant.ChunkifyVideoViewSnapshot `json:"event_name" default:"chunkify.video.view_snapshot"`
	FirstVideoFrameTimeMs  float64                            `json:"first_video_frame_time_ms" api:"required"`
	FurthestProgressRatio  float64                            `json:"furthest_progress_ratio" api:"required"`
	MaximumPlayheadSeconds float64                            `json:"maximum_playhead_seconds" api:"required"`
	MediaDurationSeconds   float64                            `json:"media_duration_seconds" api:"required"`
	MediaHeightPx          float64                            `json:"media_height_px" api:"required"`
	MediaWidthPx           float64                            `json:"media_width_px" api:"required"`
	OccurredAt             time.Time                          `json:"occurred_at" api:"required" format:"date-time"`
	PlayerHeightPx         float64                            `json:"player_height_px" api:"required"`
	PlayerName             string                             `json:"player_name" api:"required"`
	PlayerVersion          string                             `json:"player_version" api:"required"`
	PlayerWidthPx          float64                            `json:"player_width_px" api:"required"`
	PlayingTimeMs          float64                            `json:"playing_time_ms" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason               ViewSnapshotReason            `json:"reason" api:"required"`
	RebufferCount        float64                       `json:"rebuffer_count" api:"required"`
	RebufferDurationMs   float64                       `json:"rebuffer_duration_ms" api:"required"`
	RebufferRatio        float64                       `json:"rebuffer_ratio" api:"required"`
	RenditionPlayingTime []shared.RenditionPlayingTime `json:"rendition_playing_time" api:"required"`
	RenditionSwitchCount float64                       `json:"rendition_switch_count" api:"required"`
	SchemaVersion        float64                       `json:"schema_version" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName                     string  `json:"sdk_name" api:"required"`
	SDKVersion                  string  `json:"sdk_version" api:"required"`
	SeekCount                   float64 `json:"seek_count" api:"required"`
	SeekDurationMs              float64 `json:"seek_duration_ms" api:"required"`
	SelectedRenditionBitrateBps float64 `json:"selected_rendition_bitrate_bps" api:"required"`
	SelectedRenditionCodec      string  `json:"selected_rendition_codec" api:"required"`
	SelectedRenditionHeight     float64 `json:"selected_rendition_height" api:"required"`
	SelectedRenditionWidth      float64 `json:"selected_rendition_width" api:"required"`
	Sequence                    int64   `json:"sequence" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome   ViewSnapshotStartupOutcome `json:"startup_outcome" api:"required"`
	StartupTimeMs    float64                    `json:"startup_time_ms" api:"required"`
	TotalVideoFrames float64                    `json:"total_video_frames" api:"required"`
	VideoID          string                     `json:"video_id" api:"required"`
	ViewID           string                     `json:"view_id" api:"required" format:"uuid"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID string `json:"viewer_id" api:"required"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContext `json:"browser_context" api:"nullable"`
	// Current playback rate, rounded to two decimals, such as 1, 1.5 or 2; from 0.01
	// to 16. Optional.
	PlaybackRate float64 `json:"playback_rate" api:"nullable"`
	// Cumulative playing time per playback rate for this attempt. At most 32 entries.
	// Optional.
	PlaybackRatePlayingTime []shared.PlaybackRatePlayingTime `json:"playback_rate_playing_time" api:"nullable"`
	// Cumulative played media ranges for this attempt, sorted and merged without
	// overlaps. Seeking, pauses and buffering are excluded. Missing or null means
	// unavailable; an empty array means measured but no section played. Replaying a
	// section does not add another range.
	PlayedRanges []shared.PlayedRange `json:"played_ranges" api:"nullable"`
	// Current media position at this event, not the maximum reached.
	PlayheadSeconds float64 `json:"playhead_seconds" api:"nullable"`
	// Language tag (BCP 47) of the showing subtitles or captions track; und when the
	// track declares no language; null when subtitles are off. Optional.
	SubtitleLanguage string `json:"subtitle_language" api:"nullable"`
	// Cumulative playing time per subtitle language for this attempt, null language
	// meaning subtitles off. At most 32 entries. Optional.
	SubtitlePlayingTime []shared.SubtitlePlayingTime `json:"subtitle_playing_time" api:"nullable"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID string `json:"user_id" api:"nullable"`
	// Optional human-readable video title for reports.
	VideoTitle string `json:"video_title" api:"nullable"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState ViewSnapshotVisibilityState `json:"visibility_state" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorName               respjson.Field
		ConnectorVersion            respjson.Field
		DeliveryHostname            respjson.Field
		DeliveryRequestCount        respjson.Field
		DeliveryThroughputBps       respjson.Field
		DeliveryTransferredBytes    respjson.Field
		DroppedVideoFrames          respjson.Field
		Environment                 respjson.Field
		ErrorCategory               respjson.Field
		ErrorCode                   respjson.Field
		ErrorFatal                  respjson.Field
		ErrorPlayheadSeconds        respjson.Field
		EventID                     respjson.Field
		EventName                   respjson.Field
		FirstVideoFrameTimeMs       respjson.Field
		FurthestProgressRatio       respjson.Field
		MaximumPlayheadSeconds      respjson.Field
		MediaDurationSeconds        respjson.Field
		MediaHeightPx               respjson.Field
		MediaWidthPx                respjson.Field
		OccurredAt                  respjson.Field
		PlayerHeightPx              respjson.Field
		PlayerName                  respjson.Field
		PlayerVersion               respjson.Field
		PlayerWidthPx               respjson.Field
		PlayingTimeMs               respjson.Field
		Reason                      respjson.Field
		RebufferCount               respjson.Field
		RebufferDurationMs          respjson.Field
		RebufferRatio               respjson.Field
		RenditionPlayingTime        respjson.Field
		RenditionSwitchCount        respjson.Field
		SchemaVersion               respjson.Field
		SDKName                     respjson.Field
		SDKVersion                  respjson.Field
		SeekCount                   respjson.Field
		SeekDurationMs              respjson.Field
		SelectedRenditionBitrateBps respjson.Field
		SelectedRenditionCodec      respjson.Field
		SelectedRenditionHeight     respjson.Field
		SelectedRenditionWidth      respjson.Field
		Sequence                    respjson.Field
		StartupOutcome              respjson.Field
		StartupTimeMs               respjson.Field
		TotalVideoFrames            respjson.Field
		VideoID                     respjson.Field
		ViewID                      respjson.Field
		ViewerID                    respjson.Field
		BrowserContext              respjson.Field
		PlaybackRate                respjson.Field
		PlaybackRatePlayingTime     respjson.Field
		PlayedRanges                respjson.Field
		PlayheadSeconds             respjson.Field
		SubtitleLanguage            respjson.Field
		SubtitlePlayingTime         respjson.Field
		UserID                      respjson.Field
		VideoTitle                  respjson.Field
		VisibilityState             respjson.Field
		ExtraFields                 map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ViewSnapshot) RawJSON

func (r ViewSnapshot) RawJSON() string

Returns the unmodified JSON received from the API

func (ViewSnapshot) ToParam

func (r ViewSnapshot) ToParam() ViewSnapshotParam

ToParam converts this ViewSnapshot to a ViewSnapshotParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ViewSnapshotParam.Overrides()

func (*ViewSnapshot) UnmarshalJSON

func (r *ViewSnapshot) UnmarshalJSON(data []byte) error

type ViewSnapshotErrorCategory

type ViewSnapshotErrorCategory string
const (
	ViewSnapshotErrorCategoryAborted     ViewSnapshotErrorCategory = "aborted"
	ViewSnapshotErrorCategoryNetwork     ViewSnapshotErrorCategory = "network"
	ViewSnapshotErrorCategoryDecode      ViewSnapshotErrorCategory = "decode"
	ViewSnapshotErrorCategoryUnsupported ViewSnapshotErrorCategory = "unsupported"
	ViewSnapshotErrorCategoryUnknown     ViewSnapshotErrorCategory = "unknown"
)

type ViewSnapshotErrorCodeUnion

type ViewSnapshotErrorCodeUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ViewSnapshotErrorCodeUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (ViewSnapshotErrorCodeUnion) AsFloat

func (u ViewSnapshotErrorCodeUnion) AsFloat() (v float64)

func (ViewSnapshotErrorCodeUnion) AsString

func (u ViewSnapshotErrorCodeUnion) AsString() (v string)

func (ViewSnapshotErrorCodeUnion) RawJSON

func (u ViewSnapshotErrorCodeUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewSnapshotErrorCodeUnion) UnmarshalJSON

func (r *ViewSnapshotErrorCodeUnion) UnmarshalJSON(data []byte) error

type ViewSnapshotErrorCodeUnionParam

type ViewSnapshotErrorCodeUnionParam struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ViewSnapshotErrorCodeUnionParam) MarshalJSON

func (u ViewSnapshotErrorCodeUnionParam) MarshalJSON() ([]byte, error)

func (*ViewSnapshotErrorCodeUnionParam) UnmarshalJSON

func (u *ViewSnapshotErrorCodeUnionParam) UnmarshalJSON(data []byte) error

type ViewSnapshotParam

type ViewSnapshotParam struct {
	ConnectorVersion         param.Opt[string]  `json:"connector_version,omitzero" api:"required"`
	DeliveryHostname         param.Opt[string]  `json:"delivery_hostname,omitzero" api:"required"`
	DeliveryRequestCount     param.Opt[float64] `json:"delivery_request_count,omitzero" api:"required"`
	DeliveryThroughputBps    param.Opt[float64] `json:"delivery_throughput_bps,omitzero" api:"required"`
	DeliveryTransferredBytes param.Opt[float64] `json:"delivery_transferred_bytes,omitzero" api:"required"`
	DroppedVideoFrames       param.Opt[float64] `json:"dropped_video_frames,omitzero" api:"required"`
	Environment              param.Opt[string]  `json:"environment,omitzero" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory         param.Opt[ViewSnapshotErrorCategory] `json:"error_category,omitzero" api:"required"`
	ErrorFatal            param.Opt[bool]                      `json:"error_fatal,omitzero" api:"required"`
	ErrorPlayheadSeconds  param.Opt[float64]                   `json:"error_playhead_seconds,omitzero" api:"required"`
	FirstVideoFrameTimeMs param.Opt[float64]                   `json:"first_video_frame_time_ms,omitzero" api:"required"`
	FurthestProgressRatio param.Opt[float64]                   `json:"furthest_progress_ratio,omitzero" api:"required"`
	MediaDurationSeconds  param.Opt[float64]                   `json:"media_duration_seconds,omitzero" api:"required"`
	MediaHeightPx         param.Opt[float64]                   `json:"media_height_px,omitzero" api:"required"`
	MediaWidthPx          param.Opt[float64]                   `json:"media_width_px,omitzero" api:"required"`
	PlayerHeightPx        param.Opt[float64]                   `json:"player_height_px,omitzero" api:"required"`
	PlayerName            param.Opt[string]                    `json:"player_name,omitzero" api:"required"`
	PlayerVersion         param.Opt[string]                    `json:"player_version,omitzero" api:"required"`
	PlayerWidthPx         param.Opt[float64]                   `json:"player_width_px,omitzero" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason                      param.Opt[ViewSnapshotReason] `json:"reason,omitzero" api:"required"`
	RebufferRatio               param.Opt[float64]            `json:"rebuffer_ratio,omitzero" api:"required"`
	RenditionSwitchCount        param.Opt[float64]            `json:"rendition_switch_count,omitzero" api:"required"`
	SelectedRenditionBitrateBps param.Opt[float64]            `json:"selected_rendition_bitrate_bps,omitzero" api:"required"`
	SelectedRenditionCodec      param.Opt[string]             `json:"selected_rendition_codec,omitzero" api:"required"`
	SelectedRenditionHeight     param.Opt[float64]            `json:"selected_rendition_height,omitzero" api:"required"`
	SelectedRenditionWidth      param.Opt[float64]            `json:"selected_rendition_width,omitzero" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome   param.Opt[ViewSnapshotStartupOutcome] `json:"startup_outcome,omitzero" api:"required"`
	StartupTimeMs    param.Opt[float64]                    `json:"startup_time_ms,omitzero" api:"required"`
	TotalVideoFrames param.Opt[float64]                    `json:"total_video_frames,omitzero" api:"required"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID               param.Opt[string]                  `json:"viewer_id,omitzero" api:"required"`
	ErrorCode              ViewSnapshotErrorCodeUnionParam    `json:"error_code,omitzero" api:"required"`
	RenditionPlayingTime   []shared.RenditionPlayingTimeParam `json:"rendition_playing_time,omitzero" api:"required"`
	ConnectorName          string                             `json:"connector_name" api:"required"`
	EventID                string                             `json:"event_id" api:"required" format:"uuid"`
	MaximumPlayheadSeconds float64                            `json:"maximum_playhead_seconds" api:"required"`
	OccurredAt             time.Time                          `json:"occurred_at" api:"required" format:"date-time"`
	PlayingTimeMs          float64                            `json:"playing_time_ms" api:"required"`
	RebufferCount          float64                            `json:"rebuffer_count" api:"required"`
	RebufferDurationMs     float64                            `json:"rebuffer_duration_ms" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName        string  `json:"sdk_name" api:"required"`
	SDKVersion     string  `json:"sdk_version" api:"required"`
	SeekCount      float64 `json:"seek_count" api:"required"`
	SeekDurationMs float64 `json:"seek_duration_ms" api:"required"`
	Sequence       int64   `json:"sequence" api:"required"`
	VideoID        string  `json:"video_id" api:"required"`
	ViewID         string  `json:"view_id" api:"required" format:"uuid"`
	// Current playback rate, rounded to two decimals, such as 1, 1.5 or 2; from 0.01
	// to 16. Optional.
	PlaybackRate param.Opt[float64] `json:"playback_rate,omitzero"`
	// Current media position at this event, not the maximum reached.
	PlayheadSeconds param.Opt[float64] `json:"playhead_seconds,omitzero"`
	// Language tag (BCP 47) of the showing subtitles or captions track; und when the
	// track declares no language; null when subtitles are off. Optional.
	SubtitleLanguage param.Opt[string] `json:"subtitle_language,omitzero"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID param.Opt[string] `json:"user_id,omitzero"`
	// Optional human-readable video title for reports.
	VideoTitle param.Opt[string] `json:"video_title,omitzero"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState param.Opt[ViewSnapshotVisibilityState] `json:"visibility_state,omitzero"`
	// Cumulative playing time per playback rate for this attempt. At most 32 entries.
	// Optional.
	PlaybackRatePlayingTime []shared.PlaybackRatePlayingTimeParam `json:"playback_rate_playing_time,omitzero"`
	// Cumulative played media ranges for this attempt, sorted and merged without
	// overlaps. Seeking, pauses and buffering are excluded. Missing or null means
	// unavailable; an empty array means measured but no section played. Replaying a
	// section does not add another range.
	PlayedRanges []shared.PlayedRangeParam `json:"played_ranges,omitzero"`
	// Cumulative playing time per subtitle language for this attempt, null language
	// meaning subtitles off. At most 32 entries. Optional.
	SubtitlePlayingTime []shared.SubtitlePlayingTimeParam `json:"subtitle_playing_time,omitzero"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContextParam `json:"browser_context,omitzero"`
	// This field can be elided, and will marshal its zero value as
	// "chunkify.video.view_snapshot".
	EventName constant.ChunkifyVideoViewSnapshot `json:"event_name" default:"chunkify.video.view_snapshot"`
	// This field can be elided, and will marshal its zero value as 1.
	SchemaVersion float64 `json:"schema_version,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The properties ConnectorName, ConnectorVersion, DeliveryHostname, DeliveryRequestCount, DeliveryThroughputBps, DeliveryTransferredBytes, DroppedVideoFrames, Environment, ErrorCategory, ErrorCode, ErrorFatal, ErrorPlayheadSeconds, EventID, EventName, FirstVideoFrameTimeMs, FurthestProgressRatio, MaximumPlayheadSeconds, MediaDurationSeconds, MediaHeightPx, MediaWidthPx, OccurredAt, PlayerHeightPx, PlayerName, PlayerVersion, PlayerWidthPx, PlayingTimeMs, Reason, RebufferCount, RebufferDurationMs, RebufferRatio, RenditionPlayingTime, RenditionSwitchCount, SchemaVersion, SDKName, SDKVersion, SeekCount, SeekDurationMs, SelectedRenditionBitrateBps, SelectedRenditionCodec, SelectedRenditionHeight, SelectedRenditionWidth, Sequence, StartupOutcome, StartupTimeMs, TotalVideoFrames, VideoID, ViewID, ViewerID are required.

func (ViewSnapshotParam) MarshalJSON

func (r ViewSnapshotParam) MarshalJSON() (data []byte, err error)

func (*ViewSnapshotParam) UnmarshalJSON

func (r *ViewSnapshotParam) UnmarshalJSON(data []byte) error

type ViewSnapshotReason

type ViewSnapshotReason string
const (
	ViewSnapshotReasonEnded         ViewSnapshotReason = "ended"
	ViewSnapshotReasonDestroyed     ViewSnapshotReason = "destroyed"
	ViewSnapshotReasonSourceChanged ViewSnapshotReason = "source_changed"
	ViewSnapshotReasonPageExit      ViewSnapshotReason = "page_exit"
)

type ViewSnapshotStartupOutcome

type ViewSnapshotStartupOutcome string
const (
	ViewSnapshotStartupOutcomeStarted           ViewSnapshotStartupOutcome = "started"
	ViewSnapshotStartupOutcomeFailedBeforeStart ViewSnapshotStartupOutcome = "failed_before_start"
	ViewSnapshotStartupOutcomeEndedBeforeStart  ViewSnapshotStartupOutcome = "ended_before_start"
)

type ViewSnapshotVisibilityState

type ViewSnapshotVisibilityState string

Tab visibility when the event was recorded. Hidden does not imply paused playback or identify the cause of a pause. Missing on older events; null when unavailable.

const (
	ViewSnapshotVisibilityStateVisible ViewSnapshotVisibilityState = "visible"
	ViewSnapshotVisibilityStateHidden  ViewSnapshotVisibilityState = "hidden"
)

type ViewStarted

type ViewStarted struct {
	ConnectorName            string  `json:"connector_name" api:"required"`
	ConnectorVersion         string  `json:"connector_version" api:"required"`
	DeliveryHostname         string  `json:"delivery_hostname" api:"required"`
	DeliveryRequestCount     float64 `json:"delivery_request_count" api:"required"`
	DeliveryThroughputBps    float64 `json:"delivery_throughput_bps" api:"required"`
	DeliveryTransferredBytes float64 `json:"delivery_transferred_bytes" api:"required"`
	DroppedVideoFrames       float64 `json:"dropped_video_frames" api:"required"`
	Environment              string  `json:"environment" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory          ViewStartedErrorCategory          `json:"error_category" api:"required"`
	ErrorCode              ViewStartedErrorCodeUnion         `json:"error_code" api:"required"`
	ErrorFatal             bool                              `json:"error_fatal" api:"required"`
	ErrorPlayheadSeconds   float64                           `json:"error_playhead_seconds" api:"required"`
	EventID                string                            `json:"event_id" api:"required" format:"uuid"`
	EventName              constant.ChunkifyVideoViewStarted `json:"event_name" default:"chunkify.video.view_started"`
	FirstVideoFrameTimeMs  float64                           `json:"first_video_frame_time_ms" api:"required"`
	FurthestProgressRatio  float64                           `json:"furthest_progress_ratio" api:"required"`
	MaximumPlayheadSeconds float64                           `json:"maximum_playhead_seconds" api:"required"`
	MediaDurationSeconds   float64                           `json:"media_duration_seconds" api:"required"`
	MediaHeightPx          float64                           `json:"media_height_px" api:"required"`
	MediaWidthPx           float64                           `json:"media_width_px" api:"required"`
	OccurredAt             time.Time                         `json:"occurred_at" api:"required" format:"date-time"`
	PlayerHeightPx         float64                           `json:"player_height_px" api:"required"`
	PlayerName             string                            `json:"player_name" api:"required"`
	PlayerVersion          string                            `json:"player_version" api:"required"`
	PlayerWidthPx          float64                           `json:"player_width_px" api:"required"`
	PlayingTimeMs          float64                           `json:"playing_time_ms" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason               ViewStartedReason             `json:"reason" api:"required"`
	RebufferCount        float64                       `json:"rebuffer_count" api:"required"`
	RebufferDurationMs   float64                       `json:"rebuffer_duration_ms" api:"required"`
	RebufferRatio        float64                       `json:"rebuffer_ratio" api:"required"`
	RenditionPlayingTime []shared.RenditionPlayingTime `json:"rendition_playing_time" api:"required"`
	RenditionSwitchCount float64                       `json:"rendition_switch_count" api:"required"`
	SchemaVersion        float64                       `json:"schema_version" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName                     string  `json:"sdk_name" api:"required"`
	SDKVersion                  string  `json:"sdk_version" api:"required"`
	SeekCount                   float64 `json:"seek_count" api:"required"`
	SeekDurationMs              float64 `json:"seek_duration_ms" api:"required"`
	SelectedRenditionBitrateBps float64 `json:"selected_rendition_bitrate_bps" api:"required"`
	SelectedRenditionCodec      string  `json:"selected_rendition_codec" api:"required"`
	SelectedRenditionHeight     float64 `json:"selected_rendition_height" api:"required"`
	SelectedRenditionWidth      float64 `json:"selected_rendition_width" api:"required"`
	Sequence                    int64   `json:"sequence" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome   ViewStartedStartupOutcome `json:"startup_outcome" api:"required"`
	StartupTimeMs    float64                   `json:"startup_time_ms" api:"required"`
	TotalVideoFrames float64                   `json:"total_video_frames" api:"required"`
	VideoID          string                    `json:"video_id" api:"required"`
	ViewID           string                    `json:"view_id" api:"required" format:"uuid"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID string `json:"viewer_id" api:"required"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContext `json:"browser_context" api:"nullable"`
	// Integrator-defined dimensions set once when the view starts: at most 10 keys of
	// 1 to 40 characters a-z, 0-9 and \_, each with text of 1 to 256 characters, a
	// number or a boolean. Reports compare values as text, exactly and
	// case-sensitively: numbers as their JSON text (5, 5.5; send whole numbers without
	// a decimal part, as JavaScript does), booleans as true or false. Only
	// view_started accepts custom. Never put personal data here; use user_id for user
	// identity.
	Custom shared.CustomDimensions `json:"custom"`
	// Current playback rate, rounded to two decimals, such as 1, 1.5 or 2; from 0.01
	// to 16. Optional.
	PlaybackRate float64 `json:"playback_rate" api:"nullable"`
	// Cumulative playing time per playback rate for this attempt. At most 32 entries.
	// Optional.
	PlaybackRatePlayingTime []shared.PlaybackRatePlayingTime `json:"playback_rate_playing_time" api:"nullable"`
	// Cumulative played media ranges for this attempt, sorted and merged without
	// overlaps. Seeking, pauses and buffering are excluded. Missing or null means
	// unavailable; an empty array means measured but no section played. Replaying a
	// section does not add another range.
	PlayedRanges []shared.PlayedRange `json:"played_ranges" api:"nullable"`
	// Current media position at this event, not the maximum reached.
	PlayheadSeconds float64 `json:"playhead_seconds" api:"nullable"`
	// Language tag (BCP 47) of the showing subtitles or captions track; und when the
	// track declares no language; null when subtitles are off. Optional.
	SubtitleLanguage string `json:"subtitle_language" api:"nullable"`
	// Cumulative playing time per subtitle language for this attempt, null language
	// meaning subtitles off. At most 32 entries. Optional.
	SubtitlePlayingTime []shared.SubtitlePlayingTime `json:"subtitle_playing_time" api:"nullable"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID string `json:"user_id" api:"nullable"`
	// Optional human-readable video title for reports.
	VideoTitle string `json:"video_title" api:"nullable"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState ViewStartedVisibilityState `json:"visibility_state" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConnectorName               respjson.Field
		ConnectorVersion            respjson.Field
		DeliveryHostname            respjson.Field
		DeliveryRequestCount        respjson.Field
		DeliveryThroughputBps       respjson.Field
		DeliveryTransferredBytes    respjson.Field
		DroppedVideoFrames          respjson.Field
		Environment                 respjson.Field
		ErrorCategory               respjson.Field
		ErrorCode                   respjson.Field
		ErrorFatal                  respjson.Field
		ErrorPlayheadSeconds        respjson.Field
		EventID                     respjson.Field
		EventName                   respjson.Field
		FirstVideoFrameTimeMs       respjson.Field
		FurthestProgressRatio       respjson.Field
		MaximumPlayheadSeconds      respjson.Field
		MediaDurationSeconds        respjson.Field
		MediaHeightPx               respjson.Field
		MediaWidthPx                respjson.Field
		OccurredAt                  respjson.Field
		PlayerHeightPx              respjson.Field
		PlayerName                  respjson.Field
		PlayerVersion               respjson.Field
		PlayerWidthPx               respjson.Field
		PlayingTimeMs               respjson.Field
		Reason                      respjson.Field
		RebufferCount               respjson.Field
		RebufferDurationMs          respjson.Field
		RebufferRatio               respjson.Field
		RenditionPlayingTime        respjson.Field
		RenditionSwitchCount        respjson.Field
		SchemaVersion               respjson.Field
		SDKName                     respjson.Field
		SDKVersion                  respjson.Field
		SeekCount                   respjson.Field
		SeekDurationMs              respjson.Field
		SelectedRenditionBitrateBps respjson.Field
		SelectedRenditionCodec      respjson.Field
		SelectedRenditionHeight     respjson.Field
		SelectedRenditionWidth      respjson.Field
		Sequence                    respjson.Field
		StartupOutcome              respjson.Field
		StartupTimeMs               respjson.Field
		TotalVideoFrames            respjson.Field
		VideoID                     respjson.Field
		ViewID                      respjson.Field
		ViewerID                    respjson.Field
		BrowserContext              respjson.Field
		Custom                      respjson.Field
		PlaybackRate                respjson.Field
		PlaybackRatePlayingTime     respjson.Field
		PlayedRanges                respjson.Field
		PlayheadSeconds             respjson.Field
		SubtitleLanguage            respjson.Field
		SubtitlePlayingTime         respjson.Field
		UserID                      respjson.Field
		VideoTitle                  respjson.Field
		VisibilityState             respjson.Field
		ExtraFields                 map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ViewStarted) RawJSON

func (r ViewStarted) RawJSON() string

Returns the unmodified JSON received from the API

func (ViewStarted) ToParam

func (r ViewStarted) ToParam() ViewStartedParam

ToParam converts this ViewStarted to a ViewStartedParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ViewStartedParam.Overrides()

func (*ViewStarted) UnmarshalJSON

func (r *ViewStarted) UnmarshalJSON(data []byte) error

type ViewStartedErrorCategory

type ViewStartedErrorCategory string
const (
	ViewStartedErrorCategoryAborted     ViewStartedErrorCategory = "aborted"
	ViewStartedErrorCategoryNetwork     ViewStartedErrorCategory = "network"
	ViewStartedErrorCategoryDecode      ViewStartedErrorCategory = "decode"
	ViewStartedErrorCategoryUnsupported ViewStartedErrorCategory = "unsupported"
	ViewStartedErrorCategoryUnknown     ViewStartedErrorCategory = "unknown"
)

type ViewStartedErrorCodeUnion

type ViewStartedErrorCodeUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	JSON    struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ViewStartedErrorCodeUnion contains all possible properties and values from [string], [float64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat]

func (ViewStartedErrorCodeUnion) AsFloat

func (u ViewStartedErrorCodeUnion) AsFloat() (v float64)

func (ViewStartedErrorCodeUnion) AsString

func (u ViewStartedErrorCodeUnion) AsString() (v string)

func (ViewStartedErrorCodeUnion) RawJSON

func (u ViewStartedErrorCodeUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ViewStartedErrorCodeUnion) UnmarshalJSON

func (r *ViewStartedErrorCodeUnion) UnmarshalJSON(data []byte) error

type ViewStartedErrorCodeUnionParam

type ViewStartedErrorCodeUnionParam struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ViewStartedErrorCodeUnionParam) MarshalJSON

func (u ViewStartedErrorCodeUnionParam) MarshalJSON() ([]byte, error)

func (*ViewStartedErrorCodeUnionParam) UnmarshalJSON

func (u *ViewStartedErrorCodeUnionParam) UnmarshalJSON(data []byte) error

type ViewStartedParam

type ViewStartedParam struct {
	ConnectorVersion         param.Opt[string]  `json:"connector_version,omitzero" api:"required"`
	DeliveryHostname         param.Opt[string]  `json:"delivery_hostname,omitzero" api:"required"`
	DeliveryRequestCount     param.Opt[float64] `json:"delivery_request_count,omitzero" api:"required"`
	DeliveryThroughputBps    param.Opt[float64] `json:"delivery_throughput_bps,omitzero" api:"required"`
	DeliveryTransferredBytes param.Opt[float64] `json:"delivery_transferred_bytes,omitzero" api:"required"`
	DroppedVideoFrames       param.Opt[float64] `json:"dropped_video_frames,omitzero" api:"required"`
	Environment              param.Opt[string]  `json:"environment,omitzero" api:"required"`
	// Any of "aborted", "network", "decode", "unsupported", "unknown".
	ErrorCategory         param.Opt[ViewStartedErrorCategory] `json:"error_category,omitzero" api:"required"`
	ErrorFatal            param.Opt[bool]                     `json:"error_fatal,omitzero" api:"required"`
	ErrorPlayheadSeconds  param.Opt[float64]                  `json:"error_playhead_seconds,omitzero" api:"required"`
	FirstVideoFrameTimeMs param.Opt[float64]                  `json:"first_video_frame_time_ms,omitzero" api:"required"`
	FurthestProgressRatio param.Opt[float64]                  `json:"furthest_progress_ratio,omitzero" api:"required"`
	MediaDurationSeconds  param.Opt[float64]                  `json:"media_duration_seconds,omitzero" api:"required"`
	MediaHeightPx         param.Opt[float64]                  `json:"media_height_px,omitzero" api:"required"`
	MediaWidthPx          param.Opt[float64]                  `json:"media_width_px,omitzero" api:"required"`
	PlayerHeightPx        param.Opt[float64]                  `json:"player_height_px,omitzero" api:"required"`
	PlayerName            param.Opt[string]                   `json:"player_name,omitzero" api:"required"`
	PlayerVersion         param.Opt[string]                   `json:"player_version,omitzero" api:"required"`
	PlayerWidthPx         param.Opt[float64]                  `json:"player_width_px,omitzero" api:"required"`
	// Any of "ended", "destroyed", "source_changed", "page_exit".
	Reason                      param.Opt[ViewStartedReason] `json:"reason,omitzero" api:"required"`
	RebufferRatio               param.Opt[float64]           `json:"rebuffer_ratio,omitzero" api:"required"`
	RenditionSwitchCount        param.Opt[float64]           `json:"rendition_switch_count,omitzero" api:"required"`
	SelectedRenditionBitrateBps param.Opt[float64]           `json:"selected_rendition_bitrate_bps,omitzero" api:"required"`
	SelectedRenditionCodec      param.Opt[string]            `json:"selected_rendition_codec,omitzero" api:"required"`
	SelectedRenditionHeight     param.Opt[float64]           `json:"selected_rendition_height,omitzero" api:"required"`
	SelectedRenditionWidth      param.Opt[float64]           `json:"selected_rendition_width,omitzero" api:"required"`
	// Any of "started", "failed_before_start", "ended_before_start".
	StartupOutcome   param.Opt[ViewStartedStartupOutcome] `json:"startup_outcome,omitzero" api:"required"`
	StartupTimeMs    param.Opt[float64]                   `json:"startup_time_ms,omitzero" api:"required"`
	TotalVideoFrames param.Opt[float64]                   `json:"total_video_frames,omitzero" api:"required"`
	// Anonymous browser identifier generated by the Chunkify player SDK and stored in
	// the page's localStorage.
	ViewerID               param.Opt[string]                  `json:"viewer_id,omitzero" api:"required"`
	ErrorCode              ViewStartedErrorCodeUnionParam     `json:"error_code,omitzero" api:"required"`
	RenditionPlayingTime   []shared.RenditionPlayingTimeParam `json:"rendition_playing_time,omitzero" api:"required"`
	ConnectorName          string                             `json:"connector_name" api:"required"`
	EventID                string                             `json:"event_id" api:"required" format:"uuid"`
	MaximumPlayheadSeconds float64                            `json:"maximum_playhead_seconds" api:"required"`
	OccurredAt             time.Time                          `json:"occurred_at" api:"required" format:"date-time"`
	PlayingTimeMs          float64                            `json:"playing_time_ms" api:"required"`
	RebufferCount          float64                            `json:"rebuffer_count" api:"required"`
	RebufferDurationMs     float64                            `json:"rebuffer_duration_ms" api:"required"`
	// Name of the SDK or integration that produced the event. Informational metadata,
	// preserved as received. Must contain at least one non-whitespace character.
	SDKName        string  `json:"sdk_name" api:"required"`
	SDKVersion     string  `json:"sdk_version" api:"required"`
	SeekCount      float64 `json:"seek_count" api:"required"`
	SeekDurationMs float64 `json:"seek_duration_ms" api:"required"`
	Sequence       int64   `json:"sequence" api:"required"`
	VideoID        string  `json:"video_id" api:"required"`
	ViewID         string  `json:"view_id" api:"required" format:"uuid"`
	// Current playback rate, rounded to two decimals, such as 1, 1.5 or 2; from 0.01
	// to 16. Optional.
	PlaybackRate param.Opt[float64] `json:"playback_rate,omitzero"`
	// Current media position at this event, not the maximum reached.
	PlayheadSeconds param.Opt[float64] `json:"playhead_seconds,omitzero"`
	// Language tag (BCP 47) of the showing subtitles or captions track; und when the
	// track declares no language; null when subtitles are off. Optional.
	SubtitleLanguage param.Opt[string] `json:"subtitle_language,omitzero"`
	// Optional integrator-supplied user ID, used to link views to the integrator's own
	// users.
	UserID param.Opt[string] `json:"user_id,omitzero"`
	// Optional human-readable video title for reports.
	VideoTitle param.Opt[string] `json:"video_title,omitzero"`
	// Tab visibility when the event was recorded. Hidden does not imply paused
	// playback or identify the cause of a pause. Missing on older events; null when
	// unavailable.
	//
	// Any of "visible", "hidden".
	VisibilityState param.Opt[ViewStartedVisibilityState] `json:"visibility_state,omitzero"`
	// Cumulative playing time per playback rate for this attempt. At most 32 entries.
	// Optional.
	PlaybackRatePlayingTime []shared.PlaybackRatePlayingTimeParam `json:"playback_rate_playing_time,omitzero"`
	// Cumulative played media ranges for this attempt, sorted and merged without
	// overlaps. Seeking, pauses and buffering are excluded. Missing or null means
	// unavailable; an empty array means measured but no section played. Replaying a
	// section does not add another range.
	PlayedRanges []shared.PlayedRangeParam `json:"played_ranges,omitzero"`
	// Cumulative playing time per subtitle language for this attempt, null language
	// meaning subtitles off. At most 32 entries. Optional.
	SubtitlePlayingTime []shared.SubtitlePlayingTimeParam `json:"subtitle_playing_time,omitzero"`
	// Browser and device information. The Chunkify player sends every field, with null
	// for unavailable measurements. Other integrations may omit any field except
	// schema_version. Extra properties are preserved.
	BrowserContext shared.BrowserContextParam `json:"browser_context,omitzero"`
	// Integrator-defined dimensions set once when the view starts: at most 10 keys of
	// 1 to 40 characters a-z, 0-9 and \_, each with text of 1 to 256 characters, a
	// number or a boolean. Reports compare values as text, exactly and
	// case-sensitively: numbers as their JSON text (5, 5.5; send whole numbers without
	// a decimal part, as JavaScript does), booleans as true or false. Only
	// view_started accepts custom. Never put personal data here; use user_id for user
	// identity.
	Custom shared.CustomDimensionsParam `json:"custom,omitzero"`
	// This field can be elided, and will marshal its zero value as
	// "chunkify.video.view_started".
	EventName constant.ChunkifyVideoViewStarted `json:"event_name" default:"chunkify.video.view_started"`
	// This field can be elided, and will marshal its zero value as 1.
	SchemaVersion float64 `json:"schema_version,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The properties ConnectorName, ConnectorVersion, DeliveryHostname, DeliveryRequestCount, DeliveryThroughputBps, DeliveryTransferredBytes, DroppedVideoFrames, Environment, ErrorCategory, ErrorCode, ErrorFatal, ErrorPlayheadSeconds, EventID, EventName, FirstVideoFrameTimeMs, FurthestProgressRatio, MaximumPlayheadSeconds, MediaDurationSeconds, MediaHeightPx, MediaWidthPx, OccurredAt, PlayerHeightPx, PlayerName, PlayerVersion, PlayerWidthPx, PlayingTimeMs, Reason, RebufferCount, RebufferDurationMs, RebufferRatio, RenditionPlayingTime, RenditionSwitchCount, SchemaVersion, SDKName, SDKVersion, SeekCount, SeekDurationMs, SelectedRenditionBitrateBps, SelectedRenditionCodec, SelectedRenditionHeight, SelectedRenditionWidth, Sequence, StartupOutcome, StartupTimeMs, TotalVideoFrames, VideoID, ViewID, ViewerID are required.

func (ViewStartedParam) MarshalJSON

func (r ViewStartedParam) MarshalJSON() (data []byte, err error)

func (*ViewStartedParam) UnmarshalJSON

func (r *ViewStartedParam) UnmarshalJSON(data []byte) error

type ViewStartedReason

type ViewStartedReason string
const (
	ViewStartedReasonEnded         ViewStartedReason = "ended"
	ViewStartedReasonDestroyed     ViewStartedReason = "destroyed"
	ViewStartedReasonSourceChanged ViewStartedReason = "source_changed"
	ViewStartedReasonPageExit      ViewStartedReason = "page_exit"
)

type ViewStartedStartupOutcome

type ViewStartedStartupOutcome string
const (
	ViewStartedStartupOutcomeStarted           ViewStartedStartupOutcome = "started"
	ViewStartedStartupOutcomeFailedBeforeStart ViewStartedStartupOutcome = "failed_before_start"
	ViewStartedStartupOutcomeEndedBeforeStart  ViewStartedStartupOutcome = "ended_before_start"
)

type ViewStartedVisibilityState

type ViewStartedVisibilityState string

Tab visibility when the event was recorded. Hidden does not imply paused playback or identify the cause of a pause. Missing on older events; null when unavailable.

const (
	ViewStartedVisibilityStateVisible ViewStartedVisibilityState = "visible"
	ViewStartedVisibilityStateHidden  ViewStartedVisibilityState = "hidden"
)

type WatchTimeDistribution

type WatchTimeDistribution = shared.WatchTimeDistribution

Playing time in milliseconds from one selected final event or latest snapshot per view. Measured zero is included; missing measurements are excluded. Percentiles use linear interpolation and are null without samples. This sample denominator differs from average_playing_time_ms, which uses all attempts.

This is an alias to an internal type.

type WatchTimeDistributionDistribution

type WatchTimeDistributionDistribution = shared.WatchTimeDistributionDistribution

Mutually exclusive playing-time buckets: [0,10s), [10s,30s), [30s,60s), [1m,5m), [5m,infinity). Counts sum to sample_views.

This is an alias to an internal type.

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages

Jump to

Keyboard shortcuts

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