client

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyRoundTripper

type APIKeyRoundTripper struct {
	Key               string
	AdditionalHeaders []config.Header

	// Transport is the underlying HTTP transport.
	// if nil, http.DefaultTransport is used.
	Transport http.RoundTripper
}

APIKeyRoundTripper is an HTTP transport which wraps the underlying transport and sets the Authorization header

func (*APIKeyRoundTripper) RoundTrip

func (t *APIKeyRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type Client

type Client struct {
	HTTPClient *http.Client
	Config     *config.Config
	// contains filtered or unexported fields
}

Client represents a HTTP client for making requests to the FullStory API.

func NewClient

func NewClient(config *config.Config, opts ...Option) *Client

NewClient returns a Client initialized with http.DefaultClient and the supplied apiToken.

func (*Client) CreateExport

func (c *Client) CreateExport(start time.Time, end time.Time, fields []string) (string, error)

func (*Client) GetExport

func (c *Client) GetExport(exportId string) (io.ReadCloser, error)

func (*Client) GetExportProgress

func (c *Client) GetExportProgress(operationId string) (int, string, error)

type DataExportClient

type DataExportClient interface {
	// CreateExport starts an asynchronous export of the "Everyone" segment for the specified time range.
	// The time bounds for start and stop are inclusive and exclusive, respectively.
	// If successful, returns the id for the created export which can be used to check the progress.
	CreateExport(start time.Time, end time.Time, fields []string) (string, error)

	// GetExportProgress returns the estimated progress of the export for the provided operation and the id
	// of the export if ready for download. The progress value is an integer between 1 and 100
	// and represents and estimated completion percentage.
	GetExportProgress(operationId string) (progress int, exportId string, err error)

	// GetExport returns a stream for the provided export ID. If the export is not ready, this
	// will fail with ErrExportNotReady.
	GetExport(exportId string) (io.ReadCloser, error)
}

DataExportClient represents an interface for interacting with the FullStory Data Export API

type ExportError

type ExportError struct {
	Details string
}

func (ExportError) Error

func (e ExportError) Error() string

type Option added in v1.3.0

type Option func(*Client)

func WithCreateExportRequestModifier added in v1.3.0

func WithCreateExportRequestModifier(rm func(r *http.Request)) Option

WithCreateExportRequestModifier allows for a modification to the CreateExport API request. This can be used to modify the request body to customize any of the request parameters.

func WithHttpClient added in v1.3.0

func WithHttpClient(httpClient *http.Client) Option

WithHttpClient replaces the default API key-based http client. This option can be used, for example, to customize the underlying transport.

type StatusError

type StatusError struct {
	Status     string
	StatusCode int
	RetryAfter time.Duration
	Body       io.Reader
}

StatusError is returned when the HTTP roundtrip succeeds, but the response status does not equal http.StatusOK.

func (StatusError) Error

func (e StatusError) Error() string

Jump to

Keyboard shortcuts

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