redash

package module
v2.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: MIT Imports: 14 Imported by: 1

README

redash-go

CI Go Reference GitHub tag (latest by date) Go Report Card codecov

Overview

Redash API client for Go that supports almost all APIs.

Usage

package main

import (
	"bytes"
	"context"
	"fmt"
	"time"

	"github.com/winebarrel/redash-go/v2"
)

func main() {
	client := redash.MustNewClient("https://redash.example.com", "<secret>")
	ctx := context.Background()

	ds, err := client.CreateDataSource(ctx, &redash.CreateDataSourceInput{
		Name: "postgres",
		Type: "pg",
		// see https://github.com/getredash/redash/blob/v25.1/redash/query_runner/pg.py#L149-L153
		Options: map[string]any{
			"dbname": "postgres",
			"host":   "postgres",
			"port":   5432,
			"user":   "postgres",
		},
	})

	if err != nil {
		panic(err)
	}

	query, err := client.CreateQuery(ctx, &redash.CreateQueryInput{
		DataSourceID: ds.ID,
		Name:         "my-query1",
		Query:        "select 1",
	})

	if err != nil {
		panic(err)
	}

	var buf bytes.Buffer

	// The API prefers to return a cached result.
	// If a cached result is not available then a new execution job begins and the job object is returned.
	// see https://redash.io/help/user-guide/integrations-and-api/api#Queries
	job, err := client.ExecQueryJSON(ctx, query.ID, nil, &buf)

	if err != nil {
		panic(err)
	}

	err = client.WaitQueryJSON(ctx, query.ID, job, nil, &buf)

	if err != nil {
		panic(err)
	}

	fmt.Println(buf.String())
}
max_age=0
input := &redash.ExecQueryJSONInput{
  WithoutOmittingMaxAge: true,
}

job, err := client.ExecQueryJSON(ctx, query.ID, input, nil)

if err != nil {
  panic(err)
}

err = client.WaitQueryJSON(ctx, query.ID, job, nil, &buf)

if err != nil {
  panic(err)
}

fmt.Println(buf.String())
Set debug mode
client := redash.MustNewClient("https://redash.example.com", "<secret>")
client.SetDebug(true)
client.GetStatus(context.Background())
% go run example.go
---request begin---
GET /status.json HTTP/1.1
Host: redash.example.com
Authorization: Key <secret>
Content-Type: application/json
User-Agent: redash-go


---request end---
---response begin---
HTTP/1.1 200 OK
...

{"dashboards_count": 0, "database_metrics": {"metrics": [ ...
With custom HTTP client
hc := &http.Client{
  Timeout: 3 * time.Second,
}
client := redash.MustNewClientWithHTTPClient("https://redash.example.com", "<secret>", hc)
client.GetStatus(context.Background())
Without context.Context
client0 := redash.MustNewClient("https://redash.example.com", "<secret>")
client := client0.WithoutContext()
client.GetStatus()
NewClient with error
client, err := redash.NewClient("https://redash.example.com", "<secret>")

Test

make test
Acceptance Test
docker compose up -d
make redash-setup
make testacc

NOTE:

Documentation

Overview

Redash API client for Go that supports almost all APIs.

Index

Constants

View Source
const (
	// see https://redash.io/help/user-guide/integrations-and-api/api#Jobs
	JobStatusPending   = 1
	JobStatusStarted   = 2
	JobStatusSuccess   = 3
	JobStatusFailure   = 4
	JobStatusCancelled = 5
)
View Source
const (
	UserAgent = "redash-go"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminQueriesOutdated

type AdminQueriesOutdated struct {
	Queries   []Query `json:"queries"`
	UpdatedAt string  `json:"updated_at"`
}

type AdminQuerisRqStatus

type AdminQuerisRqStatus struct {
	Queues  AdminQuerisRqStatusQueues   `json:"queues"`
	Workers []AdminQuerisRqStatusWorker `json:"workers"`
}

type AdminQuerisRqStatusDefault

type AdminQuerisRqStatusDefault struct {
	Name    string `json:"name"`
	Queued  int    `json:"queued"`
	Started []any  `json:"started"`
}

type AdminQuerisRqStatusEmails

type AdminQuerisRqStatusEmails struct {
	Name    string `json:"name"`
	Queued  int    `json:"queued"`
	Started []any  `json:"started"`
}

type AdminQuerisRqStatusPeriodic

type AdminQuerisRqStatusPeriodic struct {
	Name    string `json:"name"`
	Queued  int    `json:"queued"`
	Started []any  `json:"started"`
}

type AdminQuerisRqStatusQueries

type AdminQuerisRqStatusQueries struct {
	Name    string `json:"name"`
	Queued  int    `json:"queued"`
	Started []any  `json:"started"`
}

type AdminQuerisRqStatusQueues

type AdminQuerisRqStatusQueues struct {
	Default  *AdminQuerisRqStatusDefault  `json:"default"`
	Emails   *AdminQuerisRqStatusEmails   `json:"emails"`
	Periodic *AdminQuerisRqStatusPeriodic `json:"periodic"`
	Queries  *AdminQuerisRqStatusQueries  `json:"queries"`
	Schemas  *AdminQuerisRqStatusSchemas  `json:"schemas"`
}

type AdminQuerisRqStatusSchemas

type AdminQuerisRqStatusSchemas struct {
	Name    string `json:"name"`
	Queued  int    `json:"queued"`
	Started []any  `json:"started"`
}

type AdminQuerisRqStatusWorker

type AdminQuerisRqStatusWorker struct {
	BirthDate        string  `json:"birth_date"`
	CurrentJob       string  `json:"current_job"`
	FailedJobs       int     `json:"failed_jobs"`
	Hostname         string  `json:"hostname"`
	LastHeartbeat    string  `json:"last_heartbeat"`
	Name             string  `json:"name"`
	Pid              int     `json:"pid"`
	Queues           string  `json:"queues"`
	State            string  `json:"state"`
	SuccessfulJobs   int     `json:"successful_jobs"`
	TotalWorkingTime float64 `json:"total_working_time"`
}

type Alert

type Alert struct {
	CreatedAt       time.Time    `json:"created_at"`
	ID              int          `json:"id"`
	LastTriggeredAt time.Time    `json:"last_triggered_at"`
	Name            string       `json:"name"`
	Options         AlertOptions `json:"options"`
	Query           Query        `json:"query"`
	Rearm           int          `json:"rearm"`
	State           string       `json:"state"`
	UpdatedAt       time.Time    `json:"updated_at"`
	User            User         `json:"user"`
}

type AlertOptions

type AlertOptions struct {
	Column        string `json:"column"`
	Op            string `json:"op"`
	Value         int    `json:"value"`
	CustomSubject string `json:"custom_subject"`
	CustomBody    string `json:"custom_body"`
	// Deprecated: for backward compatibility
	Template string `json:"template"`
	Muted    bool   `json:"muted"`
}

type AlertSubscription

type AlertSubscription struct {
	AlertID     int          `json:"alert_id"`
	Destination *Destination `json:"destination"`
	ID          int          `json:"id"`
	User        User         `json:"user"`
}

type Client

type Client struct {

	// Deprecated: Use SetDebug() instead
	Debug bool
	// contains filtered or unexported fields
}

func MustNewClient

func MustNewClient(endpoint string, apiKey string) *Client

func MustNewClientWithHTTPClient

func MustNewClientWithHTTPClient(endpoint string, apiKey string, httpClient *http.Client) *Client

func NewClient

func NewClient(endpoint string, apiKey string) (*Client, error)

func NewClientWithHTTPClient

func NewClientWithHTTPClient(endpoint string, apiKey string, httpClient *http.Client) (*Client, error)

func (*Client) AddAlertSubscription

func (client *Client) AddAlertSubscription(ctx context.Context, id int, destinationId int) (*AlertSubscription, error)

func (*Client) AddGroupDataSource

func (client *Client) AddGroupDataSource(ctx context.Context, id int, dsId int) (*DataSource, error)

func (*Client) AddGroupMember

func (client *Client) AddGroupMember(ctx context.Context, id int, userId int) (*User, error)

func (*Client) ArchiveDashboard

func (client *Client) ArchiveDashboard(ctx context.Context, id int) error

func (*Client) ArchiveQuery

func (client *Client) ArchiveQuery(ctx context.Context, id int) error

func (*Client) CreateAlert

func (client *Client) CreateAlert(ctx context.Context, input *CreateAlertInput) (*Alert, error)

func (*Client) CreateDashboard

func (client *Client) CreateDashboard(ctx context.Context, input *CreateDashboardInput) (*Dashboard, error)

func (*Client) CreateDataSource

func (client *Client) CreateDataSource(ctx context.Context, input *CreateDataSourceInput) (*DataSource, error)

func (*Client) CreateDestination

func (client *Client) CreateDestination(ctx context.Context, input *CreateDestinationInput) (*Destination, error)

func (*Client) CreateFavoriteDashboard

func (client *Client) CreateFavoriteDashboard(ctx context.Context, id int) error

func (*Client) CreateFavoriteQuery

func (client *Client) CreateFavoriteQuery(ctx context.Context, id int) error

func (*Client) CreateGroup

func (client *Client) CreateGroup(ctx context.Context, input *CreateGroupInput) (*Group, error)

func (*Client) CreateQuery

func (client *Client) CreateQuery(ctx context.Context, input *CreateQueryInput) (*Query, error)

func (*Client) CreateQuerySnippet

func (client *Client) CreateQuerySnippet(ctx context.Context, input *CreateQuerySnippetInput) (*QuerySnippet, error)

func (*Client) CreateUser

func (client *Client) CreateUser(ctx context.Context, input *CreateUsersInput) (*User, error)

func (*Client) CreateWidget

func (client *Client) CreateWidget(ctx context.Context, input *CreateWidgetInput) (*Widget, error)

func (*Client) Delete

func (client *Client) Delete(ctx context.Context, path string) (*http.Response, responseCloser, error)

func (*Client) DeleteAlert

func (client *Client) DeleteAlert(ctx context.Context, id int) error

func (*Client) DeleteDataSource

func (client *Client) DeleteDataSource(ctx context.Context, id int) error

func (*Client) DeleteDestination

func (client *Client) DeleteDestination(ctx context.Context, id int) error

func (*Client) DeleteGroup

func (client *Client) DeleteGroup(ctx context.Context, id int) error

func (*Client) DeleteQuerySnippet

func (client *Client) DeleteQuerySnippet(ctx context.Context, id int) error

func (*Client) DeleteUser

func (client *Client) DeleteUser(ctx context.Context, id int) error

func (*Client) DeleteWidget

func (client *Client) DeleteWidget(ctx context.Context, id int) error

func (*Client) DisableUser

func (client *Client) DisableUser(ctx context.Context, id int) (*User, error)

func (*Client) EnableUser

func (client *Client) EnableUser(ctx context.Context, id int) (*User, error)

func (*Client) ExecQueryJSON

func (client *Client) ExecQueryJSON(ctx context.Context, id int, input *ExecQueryJSONInput, out io.Writer) (*JobResponse, error)

func (*Client) ForkQuery

func (client *Client) ForkQuery(ctx context.Context, id int) (*Query, error)

func (*Client) FormatQuery

func (client *Client) FormatQuery(ctx context.Context, query string) (*FormatQueryOutput, error)

func (*Client) Get

func (client *Client) Get(ctx context.Context, path string, params any) (*http.Response, responseCloser, error)

func (*Client) GetAdminQueriesOutdated

func (client *Client) GetAdminQueriesOutdated(ctx context.Context) (*AdminQueriesOutdated, error)

func (*Client) GetAdminQueriesRqStatus

func (client *Client) GetAdminQueriesRqStatus(ctx context.Context) (*AdminQuerisRqStatus, error)

func (*Client) GetAlert

func (client *Client) GetAlert(ctx context.Context, id int) (*Alert, error)

func (*Client) GetConfig

func (client *Client) GetConfig(ctx context.Context) (*Config, error)

func (*Client) GetDashboard

func (client *Client) GetDashboard(ctx context.Context, id int) (*Dashboard, error)

func (*Client) GetDashboardTags

func (client *Client) GetDashboardTags(ctx context.Context) (*DashboardTags, error)

func (*Client) GetDataSource

func (client *Client) GetDataSource(ctx context.Context, id int) (*DataSource, error)

func (*Client) GetDataSourceTypes

func (client *Client) GetDataSourceTypes(ctx context.Context) ([]DataSourceType, error)

func (*Client) GetDestination

func (client *Client) GetDestination(ctx context.Context, id int) (*Destination, error)

func (*Client) GetDestinationTypes

func (client *Client) GetDestinationTypes(ctx context.Context) ([]DestinationType, error)

func (*Client) GetGroup

func (client *Client) GetGroup(ctx context.Context, id int) (*Group, error)

func (*Client) GetJob

func (client *Client) GetJob(ctx context.Context, id string) (*JobResponse, error)

func (*Client) GetOrganizationStatus

func (client *Client) GetOrganizationStatus(ctx context.Context) (*OrganizationStatus, error)

func (*Client) GetQuery

func (client *Client) GetQuery(ctx context.Context, id int) (*Query, error)

func (*Client) GetQueryResultByID added in v2.4.1

func (client *Client) GetQueryResultByID(ctx context.Context, queryResultId int, ext string, out *bytes.Buffer) error

func (*Client) GetQueryResults

func (client *Client) GetQueryResults(ctx context.Context, id int, ext string, out io.Writer) error

func (*Client) GetQueryResultsCSV

func (client *Client) GetQueryResultsCSV(ctx context.Context, id int, out io.Writer) error

func (*Client) GetQueryResultsJSON

func (client *Client) GetQueryResultsJSON(ctx context.Context, id int, out io.Writer) error

func (*Client) GetQueryResultsStruct added in v2.2.0

func (client *Client) GetQueryResultsStruct(ctx context.Context, id int) (*GetQueryResultsOutput, error)

func (*Client) GetQuerySnippet

func (client *Client) GetQuerySnippet(ctx context.Context, id int) (*QuerySnippet, error)

func (*Client) GetQueryTags

func (client *Client) GetQueryTags(ctx context.Context) (*QueryTags, error)

func (*Client) GetSession

func (client *Client) GetSession(ctx context.Context) (*Session, error)

func (*Client) GetSettingsOrganization

func (client *Client) GetSettingsOrganization(ctx context.Context) (*SettingsOrganization, error)

func (*Client) GetStatus

func (client *Client) GetStatus(ctx context.Context) (*Status, error)

func (*Client) GetUser

func (client *Client) GetUser(ctx context.Context, id int) (*User, error)

func (*Client) ListAlertSubscriptions

func (client *Client) ListAlertSubscriptions(ctx context.Context, id int) ([]AlertSubscription, error)

func (*Client) ListAlerts

func (client *Client) ListAlerts(ctx context.Context) ([]Alert, error)

func (*Client) ListDashboards

func (client *Client) ListDashboards(ctx context.Context, input *ListDashboardsInput) (*DashboardPage, error)

func (*Client) ListDataSources

func (client *Client) ListDataSources(ctx context.Context) ([]DataSource, error)

func (*Client) ListDestinations

func (client *Client) ListDestinations(ctx context.Context) ([]Destination, error)

func (*Client) ListEvents

func (client *Client) ListEvents(ctx context.Context, input *ListEventsInput) (*EventPage, error)

func (*Client) ListFavoriteDashboards

func (client *Client) ListFavoriteDashboards(ctx context.Context, input *ListFavoriteDashboardsInput) (*DashboardPage, error)

func (*Client) ListFavoriteQueries

func (client *Client) ListFavoriteQueries(ctx context.Context, input *ListFavoriteQueriesInput) (*QueryPage, error)

func (*Client) ListGroupDataSources

func (client *Client) ListGroupDataSources(ctx context.Context, id int) ([]DataSource, error)

func (*Client) ListGroupMembers

func (client *Client) ListGroupMembers(ctx context.Context, id int) ([]User, error)

func (*Client) ListGroups

func (client *Client) ListGroups(ctx context.Context) ([]Group, error)

func (*Client) ListMyDashboards

func (client *Client) ListMyDashboards(ctx context.Context, input *ListMyDashboardsInput) (*DashboardPage, error)

func (*Client) ListMyQueries

func (client *Client) ListMyQueries(ctx context.Context, input *ListMyQueriesInput) (*QueryPage, error)

func (*Client) ListQueries

func (client *Client) ListQueries(ctx context.Context, input *ListQueriesInput) (*QueryPage, error)

func (*Client) ListQuerySnippets

func (client *Client) ListQuerySnippets(ctx context.Context) ([]QuerySnippet, error)

func (*Client) ListRecentQueries

func (client *Client) ListRecentQueries(ctx context.Context) ([]Query, error)

func (*Client) ListUsers

func (client *Client) ListUsers(ctx context.Context, input *ListUsersInput) (*UserPage, error)

func (*Client) MuteAlert

func (client *Client) MuteAlert(ctx context.Context, id int) error

func (*Client) PauseDataSource

func (client *Client) PauseDataSource(ctx context.Context, id int, input *PauseDataSourceInput) (*DataSource, error)

func (*Client) Ping

func (client *Client) Ping(ctx context.Context) error

func (*Client) Post

func (client *Client) Post(ctx context.Context, path string, body any) (*http.Response, responseCloser, error)

func (*Client) PublishQuery added in v2.6.0

func (client *Client) PublishQuery(ctx context.Context, id int) error

func (*Client) RefreshQuery

func (client *Client) RefreshQuery(ctx context.Context, id int, input *RefreshQueryInput) (*JobResponse, error)

func (*Client) RemoveAlertSubscription

func (client *Client) RemoveAlertSubscription(ctx context.Context, id int, subscriptionId int) error

func (*Client) RemoveGroupDataSource

func (client *Client) RemoveGroupDataSource(ctx context.Context, id int, dsId int) error

func (*Client) RemoveGroupMember

func (client *Client) RemoveGroupMember(ctx context.Context, id int, userId int) error

func (*Client) ResumeDataSource

func (client *Client) ResumeDataSource(ctx context.Context, id int) (*DataSource, error)

func (*Client) SearchQueries

func (client *Client) SearchQueries(ctx context.Context, input *SearchQueriesInput) (*QueryPage, error)

func (*Client) SetDebug added in v2.2.1

func (client *Client) SetDebug(debug bool)

func (*Client) ShareDashboard

func (client *Client) ShareDashboard(ctx context.Context, id int) (*ShareDashboardOutput, error)

func (*Client) TestCredentials

func (client *Client) TestCredentials(ctx context.Context) error

func (*Client) TestDataSource

func (client *Client) TestDataSource(ctx context.Context, id int) (*TestDataSourceOutput, error)

func (*Client) UnmuteAlert

func (client *Client) UnmuteAlert(ctx context.Context, id int) error

func (*Client) UnpublishQuery added in v2.6.0

func (client *Client) UnpublishQuery(ctx context.Context, id int) error

func (*Client) UnshareDashboard

func (client *Client) UnshareDashboard(ctx context.Context, id int) error

func (*Client) UpdateAlert

func (client *Client) UpdateAlert(ctx context.Context, id int, input *UpdateAlertInput) (*Alert, error)

func (*Client) UpdateDashboard

func (client *Client) UpdateDashboard(ctx context.Context, id int, input *UpdateDashboardInput) (*Dashboard, error)

func (*Client) UpdateDataSource

func (client *Client) UpdateDataSource(ctx context.Context, id int, input *UpdateDataSourceInput) (*DataSource, error)

func (*Client) UpdateGroupDataSource

func (client *Client) UpdateGroupDataSource(ctx context.Context, id int, dsId int, input *UpdateGroupDataSourceInput) (*DataSource, error)

func (*Client) UpdateQuery

func (client *Client) UpdateQuery(ctx context.Context, id int, input *UpdateQueryInput) (*Query, error)

func (*Client) UpdateQuerySnippet

func (client *Client) UpdateQuerySnippet(ctx context.Context, id int, input *UpdateQuerySnippetInput) (*QuerySnippet, error)

func (*Client) UpdateSettingsOrganization

func (client *Client) UpdateSettingsOrganization(ctx context.Context, input *UpdateSettingsOrganizationInput) (*SettingsOrganization, error)

func (*Client) UpdateUser

func (client *Client) UpdateUser(ctx context.Context, id int, input *UpdateUserInput) (*User, error)

func (*Client) UpdateVisualization

func (client *Client) UpdateVisualization(ctx context.Context, id int, input *UpdateVisualizationInput) (*Visualization, error)

func (*Client) WaitQueryJSON added in v2.3.0

func (client *Client) WaitQueryJSON(ctx context.Context, queryId int, job *JobResponse, option *WaitQueryJSONOption, out io.Writer) error

func (*Client) WaitQueryStruct added in v2.3.0

func (client *Client) WaitQueryStruct(ctx context.Context, queryId int, job *JobResponse, option *WaitQueryJSONOption, buf *bytes.Buffer) (*GetQueryResultsOutput, error)

func (*Client) WithoutContext

func (client *Client) WithoutContext() *ClientWithoutContext

type ClientConfig

type ClientConfig struct {
	AllowCustomJSVisualizations bool     `json:"allowCustomJSVisualizations"`
	AllowScriptsInUserInput     bool     `json:"allowScriptsInUserInput"`
	AutoPublishNamedQueries     bool     `json:"autoPublishNamedQueries"`
	BasePath                    string   `json:"basePath"`
	DashboardRefreshIntervals   []int    `json:"dashboardRefreshIntervals"`
	DateFormat                  string   `json:"dateFormat"`
	DateFormatList              []string `json:"dateFormatList"`
	DateTimeFormat              string   `json:"dateTimeFormat"`
	ExtendedAlertOptions        bool     `json:"extendedAlertOptions"`
	FloatFormat                 string   `json:"floatFormat"`
	GoogleLoginEnabled          bool     `json:"googleLoginEnabled"`
	IntegerFormat               string   `json:"integerFormat"`
	MailSettingsMissing         bool     `json:"mailSettingsMissing"`
	NewVersionAvailable         bool     `json:"newVersionAvailable"`
	PageSize                    int      `json:"pageSize"`
	PageSizeOptions             []int    `json:"pageSizeOptions"`
	QueryRefreshIntervals       []int    `json:"queryRefreshIntervals"`
	ShowBeaconConsentMessage    bool     `json:"showBeaconConsentMessage"`
	ShowPermissionsControl      bool     `json:"showPermissionsControl"`
	TableCellMaxJSONSize        int      `json:"tableCellMaxJSONSize"`
	TimeFormatList              []string `json:"timeFormatList"`
	Version                     string   `json:"version"`
}

type ClientWithoutContext

type ClientWithoutContext struct {
	// contains filtered or unexported fields
}

func (*ClientWithoutContext) AddAlertSubscription

func (client *ClientWithoutContext) AddAlertSubscription(id int, destinationId int) (*AlertSubscription, error)

func (*ClientWithoutContext) AddGroupDataSource

func (client *ClientWithoutContext) AddGroupDataSource(id int, dsId int) (*DataSource, error)

func (*ClientWithoutContext) AddGroupMember

func (client *ClientWithoutContext) AddGroupMember(id int, userId int) (*User, error)

func (*ClientWithoutContext) ArchiveDashboard

func (client *ClientWithoutContext) ArchiveDashboard(id int) error

func (*ClientWithoutContext) ArchiveQuery

func (client *ClientWithoutContext) ArchiveQuery(id int) error

func (*ClientWithoutContext) CreateAlert

func (client *ClientWithoutContext) CreateAlert(input *CreateAlertInput) (*Alert, error)

func (*ClientWithoutContext) CreateDashboard

func (client *ClientWithoutContext) CreateDashboard(input *CreateDashboardInput) (*Dashboard, error)

func (*ClientWithoutContext) CreateDataSource

func (client *ClientWithoutContext) CreateDataSource(input *CreateDataSourceInput) (*DataSource, error)

func (*ClientWithoutContext) CreateDestination

func (client *ClientWithoutContext) CreateDestination(input *CreateDestinationInput) (*Destination, error)

func (*ClientWithoutContext) CreateFavoriteDashboard

func (client *ClientWithoutContext) CreateFavoriteDashboard(id int) error

func (*ClientWithoutContext) CreateFavoriteQuery

func (client *ClientWithoutContext) CreateFavoriteQuery(id int) error

func (*ClientWithoutContext) CreateGroup

func (client *ClientWithoutContext) CreateGroup(input *CreateGroupInput) (*Group, error)

func (*ClientWithoutContext) CreateQuery

func (client *ClientWithoutContext) CreateQuery(input *CreateQueryInput) (*Query, error)

func (*ClientWithoutContext) CreateQuerySnippet

func (client *ClientWithoutContext) CreateQuerySnippet(input *CreateQuerySnippetInput) (*QuerySnippet, error)

func (*ClientWithoutContext) CreateUser

func (client *ClientWithoutContext) CreateUser(input *CreateUsersInput) (*User, error)

func (*ClientWithoutContext) CreateWidget

func (client *ClientWithoutContext) CreateWidget(input *CreateWidgetInput) (*Widget, error)

func (*ClientWithoutContext) DeleteAlert

func (client *ClientWithoutContext) DeleteAlert(id int) error

func (*ClientWithoutContext) DeleteDataSource

func (client *ClientWithoutContext) DeleteDataSource(id int) error

func (*ClientWithoutContext) DeleteDestination

func (client *ClientWithoutContext) DeleteDestination(id int) error

func (*ClientWithoutContext) DeleteGroup

func (client *ClientWithoutContext) DeleteGroup(id int) error

func (*ClientWithoutContext) DeleteQuerySnippet

func (client *ClientWithoutContext) DeleteQuerySnippet(id int) error

func (*ClientWithoutContext) DeleteUser

func (client *ClientWithoutContext) DeleteUser(id int) error

func (*ClientWithoutContext) DeleteWidget

func (client *ClientWithoutContext) DeleteWidget(id int) error

func (*ClientWithoutContext) DisableUser

func (client *ClientWithoutContext) DisableUser(id int) (*User, error)

func (*ClientWithoutContext) EnableUser

func (client *ClientWithoutContext) EnableUser(id int) (*User, error)

func (*ClientWithoutContext) ExecQueryJSON

func (client *ClientWithoutContext) ExecQueryJSON(id int, input *ExecQueryJSONInput, out io.Writer) (*JobResponse, error)

func (*ClientWithoutContext) ForkQuery

func (client *ClientWithoutContext) ForkQuery(id int) (*Query, error)

func (*ClientWithoutContext) FormatQuery

func (client *ClientWithoutContext) FormatQuery(query string) (*FormatQueryOutput, error)

func (*ClientWithoutContext) GetAdminQueriesOutdated

func (client *ClientWithoutContext) GetAdminQueriesOutdated() (*AdminQueriesOutdated, error)

func (*ClientWithoutContext) GetAdminQueriesRqStatus

func (client *ClientWithoutContext) GetAdminQueriesRqStatus() (*AdminQuerisRqStatus, error)

func (*ClientWithoutContext) GetAlert

func (client *ClientWithoutContext) GetAlert(id int) (*Alert, error)

func (*ClientWithoutContext) GetConfig

func (client *ClientWithoutContext) GetConfig() (*Config, error)

func (*ClientWithoutContext) GetDashboard

func (client *ClientWithoutContext) GetDashboard(id int) (*Dashboard, error)

func (*ClientWithoutContext) GetDashboardTags

func (client *ClientWithoutContext) GetDashboardTags() (*DashboardTags, error)

func (*ClientWithoutContext) GetDataSource

func (client *ClientWithoutContext) GetDataSource(id int) (*DataSource, error)

func (*ClientWithoutContext) GetDataSourceTypes

func (client *ClientWithoutContext) GetDataSourceTypes() ([]DataSourceType, error)

func (*ClientWithoutContext) GetDestination

func (client *ClientWithoutContext) GetDestination(id int) (*Destination, error)

func (*ClientWithoutContext) GetDestinationTypes

func (client *ClientWithoutContext) GetDestinationTypes() ([]DestinationType, error)

func (*ClientWithoutContext) GetGroup

func (client *ClientWithoutContext) GetGroup(id int) (*Group, error)

func (*ClientWithoutContext) GetJob

func (client *ClientWithoutContext) GetJob(id string) (*JobResponse, error)

func (*ClientWithoutContext) GetOrganizationStatus

func (client *ClientWithoutContext) GetOrganizationStatus() (*OrganizationStatus, error)

func (*ClientWithoutContext) GetQuery

func (client *ClientWithoutContext) GetQuery(id int) (*Query, error)

func (*ClientWithoutContext) GetQueryResultByID added in v2.4.1

func (client *ClientWithoutContext) GetQueryResultByID(queryResultId int, ext string, out *bytes.Buffer) error

func (*ClientWithoutContext) GetQueryResults

func (client *ClientWithoutContext) GetQueryResults(id int, ext string, out io.Writer) error

func (*ClientWithoutContext) GetQueryResultsCSV

func (client *ClientWithoutContext) GetQueryResultsCSV(id int, out io.Writer) error

func (*ClientWithoutContext) GetQueryResultsJSON

func (client *ClientWithoutContext) GetQueryResultsJSON(id int, out io.Writer) error

func (*ClientWithoutContext) GetQueryResultsStruct added in v2.2.0

func (client *ClientWithoutContext) GetQueryResultsStruct(id int) (*GetQueryResultsOutput, error)

func (*ClientWithoutContext) GetQuerySnippet

func (client *ClientWithoutContext) GetQuerySnippet(id int) (*QuerySnippet, error)

func (*ClientWithoutContext) GetQueryTags

func (client *ClientWithoutContext) GetQueryTags() (*QueryTags, error)

func (*ClientWithoutContext) GetSession

func (client *ClientWithoutContext) GetSession() (*Session, error)

func (*ClientWithoutContext) GetSettingsOrganization

func (client *ClientWithoutContext) GetSettingsOrganization() (*SettingsOrganization, error)

func (*ClientWithoutContext) GetStatus

func (client *ClientWithoutContext) GetStatus() (*Status, error)

func (*ClientWithoutContext) GetUser

func (client *ClientWithoutContext) GetUser(id int) (*User, error)

func (*ClientWithoutContext) ListAlertSubscriptions

func (client *ClientWithoutContext) ListAlertSubscriptions(id int) ([]AlertSubscription, error)

func (*ClientWithoutContext) ListAlerts

func (client *ClientWithoutContext) ListAlerts() ([]Alert, error)

func (*ClientWithoutContext) ListDashboards

func (client *ClientWithoutContext) ListDashboards(input *ListDashboardsInput) (*DashboardPage, error)

func (*ClientWithoutContext) ListDataSources

func (client *ClientWithoutContext) ListDataSources() ([]DataSource, error)

func (*ClientWithoutContext) ListDestinations

func (client *ClientWithoutContext) ListDestinations() ([]Destination, error)

func (*ClientWithoutContext) ListEvents

func (client *ClientWithoutContext) ListEvents(input *ListEventsInput) (*EventPage, error)

func (*ClientWithoutContext) ListFavoriteDashboards

func (client *ClientWithoutContext) ListFavoriteDashboards(input *ListFavoriteDashboardsInput) (*DashboardPage, error)

func (*ClientWithoutContext) ListFavoriteQueries

func (client *ClientWithoutContext) ListFavoriteQueries(input *ListFavoriteQueriesInput) (*QueryPage, error)

func (*ClientWithoutContext) ListGroupDataSources

func (client *ClientWithoutContext) ListGroupDataSources(id int) ([]DataSource, error)

func (*ClientWithoutContext) ListGroupMembers

func (client *ClientWithoutContext) ListGroupMembers(id int) ([]User, error)

func (*ClientWithoutContext) ListGroups

func (client *ClientWithoutContext) ListGroups() ([]Group, error)

func (*ClientWithoutContext) ListMyDashboards

func (client *ClientWithoutContext) ListMyDashboards(input *ListMyDashboardsInput) (*DashboardPage, error)

func (*ClientWithoutContext) ListMyQueries

func (client *ClientWithoutContext) ListMyQueries(input *ListMyQueriesInput) (*QueryPage, error)

func (*ClientWithoutContext) ListQueries

func (client *ClientWithoutContext) ListQueries(input *ListQueriesInput) (*QueryPage, error)

func (*ClientWithoutContext) ListQuerySnippets

func (client *ClientWithoutContext) ListQuerySnippets() ([]QuerySnippet, error)

func (*ClientWithoutContext) ListRecentQueries

func (client *ClientWithoutContext) ListRecentQueries() ([]Query, error)

func (*ClientWithoutContext) ListUsers

func (client *ClientWithoutContext) ListUsers(input *ListUsersInput) (*UserPage, error)

func (*ClientWithoutContext) MuteAlert

func (client *ClientWithoutContext) MuteAlert(id int) error

func (*ClientWithoutContext) PauseDataSource

func (client *ClientWithoutContext) PauseDataSource(id int, input *PauseDataSourceInput) (*DataSource, error)

func (*ClientWithoutContext) Ping

func (client *ClientWithoutContext) Ping() error

func (*ClientWithoutContext) PublishQuery added in v2.6.0

func (client *ClientWithoutContext) PublishQuery(id int) error

func (*ClientWithoutContext) RefreshQuery

func (client *ClientWithoutContext) RefreshQuery(id int, input *RefreshQueryInput) (*JobResponse, error)

func (*ClientWithoutContext) RemoveAlertSubscription

func (client *ClientWithoutContext) RemoveAlertSubscription(id int, subscriptionId int) error

func (*ClientWithoutContext) RemoveGroupDataSource

func (client *ClientWithoutContext) RemoveGroupDataSource(id int, dsId int) error

func (*ClientWithoutContext) RemoveGroupMember

func (client *ClientWithoutContext) RemoveGroupMember(id int, userId int) error

func (*ClientWithoutContext) ResumeDataSource

func (client *ClientWithoutContext) ResumeDataSource(id int) (*DataSource, error)

func (*ClientWithoutContext) SearchQueries

func (client *ClientWithoutContext) SearchQueries(input *SearchQueriesInput) (*QueryPage, error)

func (*ClientWithoutContext) SetDebug added in v2.2.1

func (client *ClientWithoutContext) SetDebug(debug bool)

func (*ClientWithoutContext) ShareDashboard

func (client *ClientWithoutContext) ShareDashboard(id int) (*ShareDashboardOutput, error)

func (*ClientWithoutContext) TestCredentials

func (client *ClientWithoutContext) TestCredentials() error

func (*ClientWithoutContext) TestDataSource

func (client *ClientWithoutContext) TestDataSource(id int) (*TestDataSourceOutput, error)

func (*ClientWithoutContext) UnmuteAlert

func (client *ClientWithoutContext) UnmuteAlert(id int) error

func (*ClientWithoutContext) UnpublishQuery added in v2.6.0

func (client *ClientWithoutContext) UnpublishQuery(id int) error

func (*ClientWithoutContext) UnshareDashboard

func (client *ClientWithoutContext) UnshareDashboard(id int) error

func (*ClientWithoutContext) UpdateAlert

func (client *ClientWithoutContext) UpdateAlert(id int, input *UpdateAlertInput) (*Alert, error)

func (*ClientWithoutContext) UpdateDashboard

func (client *ClientWithoutContext) UpdateDashboard(id int, input *UpdateDashboardInput) (*Dashboard, error)

func (*ClientWithoutContext) UpdateDataSource

func (client *ClientWithoutContext) UpdateDataSource(id int, input *UpdateDataSourceInput) (*DataSource, error)

func (*ClientWithoutContext) UpdateGroupDataSource

func (client *ClientWithoutContext) UpdateGroupDataSource(id int, dsId int, input *UpdateGroupDataSourceInput) (*DataSource, error)

func (*ClientWithoutContext) UpdateQuery

func (client *ClientWithoutContext) UpdateQuery(id int, input *UpdateQueryInput) (*Query, error)

func (*ClientWithoutContext) UpdateQuerySnippet

func (client *ClientWithoutContext) UpdateQuerySnippet(id int, input *UpdateQuerySnippetInput) (*QuerySnippet, error)

func (*ClientWithoutContext) UpdateSettingsOrganization

func (client *ClientWithoutContext) UpdateSettingsOrganization(input *UpdateSettingsOrganizationInput) (*SettingsOrganization, error)

func (*ClientWithoutContext) UpdateUser

func (client *ClientWithoutContext) UpdateUser(id int, input *UpdateUserInput) (*User, error)

func (*ClientWithoutContext) UpdateVisualization

func (client *ClientWithoutContext) UpdateVisualization(id int, input *UpdateVisualizationInput) (*Visualization, error)

func (*ClientWithoutContext) WaitQueryJSON added in v2.3.0

func (client *ClientWithoutContext) WaitQueryJSON(queryId int, job *JobResponse, option *WaitQueryJSONOption, out io.Writer) error

func (*ClientWithoutContext) WaitQueryStruct added in v2.3.0

func (client *ClientWithoutContext) WaitQueryStruct(queryId int, job *JobResponse, option *WaitQueryJSONOption, buf *bytes.Buffer) (*GetQueryResultsOutput, error)

type Config

type Config struct {
	ClientConfig ClientConfig `json:"client_config"`
	OrgSlug      string       `json:"org_slug"`
}

type CreateAlertInput

type CreateAlertInput struct {
	Name    string             `json:"name"`
	Options CreateAlertOptions `json:"options"`
	QueryId int                `json:"query_id"`
	Rearm   int                `json:"rearm,omitempty"`
}

type CreateAlertOptions

type CreateAlertOptions struct {
	Column        string `json:"column"`
	Op            string `json:"op"`
	Value         int    `json:"value"`
	CustomSubject string `json:"custom_subject,omitempty"`
	CustomBody    string `json:"custom_body,omitempty"`
	// Deprecated: for backward compatibility
	Template string `json:"template,omitempty"`
}

type CreateDashboardInput

type CreateDashboardInput struct {
	Name string `json:"name"`
}

type CreateDataSourceInput

type CreateDataSourceInput struct {
	Name    string         `json:"name"`
	Options map[string]any `json:"options"`
	Type    string         `json:"type"`
}

type CreateDestinationInput

type CreateDestinationInput struct {
	Name    string         `json:"name"`
	Options map[string]any `json:"options"`
	Type    string         `json:"type"`
}

type CreateGroupInput

type CreateGroupInput struct {
	Name string `json:"name"`
}

type CreateQueryInput

type CreateQueryInput struct {
	DataSourceID int                       `json:"data_source_id"`
	Description  string                    `json:"description,omitempty"`
	Name         string                    `json:"name"`
	Options      *CreateQueryInputOptions  `json:"options,omitempty"`
	Query        string                    `json:"query"`
	Schedule     *CreateQueryInputSchedule `json:"schedule,omitempty"`
	Tags         []string                  `json:"tags,omitempty"`
}

type CreateQueryInputOptions

type CreateQueryInputOptions struct {
	Parameters []QueryOptionsParameter `json:"parameters"`
}

type CreateQueryInputSchedule

type CreateQueryInputSchedule struct {
	Interval  int     `json:"interval"`
	Time      *string `json:"time"`
	Until     *string `json:"until"`
	DayOfWeek *string `json:"day_of_week"`
}

type CreateQuerySnippetInput

type CreateQuerySnippetInput struct {
	Description string `json:"description"`
	Snippet     string `json:"snippet"`
	Trigger     string `json:"trigger"`
}

type CreateUsersInput

type CreateUsersInput struct {
	AuthType string `json:"auth_type"`
	Email    string `json:"email"`
	Name     string `json:"name"`
}

type CreateWidgetInput

type CreateWidgetInput struct {
	DashboardID     int            `json:"dashboard_id"`
	Options         map[string]any `json:"options"`
	Text            string         `json:"text,omitempty"`
	VisualizationID int            `json:"visualization_id"`
	Width           int            `json:"width"`
}

type Dashboard

type Dashboard struct {
	CanEdit                 bool      `json:"can_edit"`
	CreatedAt               time.Time `json:"created_at"`
	DashboardFiltersEnabled bool      `json:"dashboard_filters_enabled"`
	ID                      int       `json:"id"`
	IsArchived              bool      `json:"is_archived"`
	IsDraft                 bool      `json:"is_draft"`
	IsFavorite              bool      `json:"is_favorite"`
	Layout                  any       `json:"layout"`
	Name                    string    `json:"name"`
	Slug                    string    `json:"slug"`
	Tags                    []string  `json:"tags"`
	UpdatedAt               time.Time `json:"updated_at"`
	User                    User      `json:"user"`
	UserID                  int       `json:"user_id"`
	Version                 int       `json:"version"`
	Widgets                 []Widget  `json:"widgets"`
}

type DashboardPage

type DashboardPage struct {
	Count    int         `json:"count"`
	Page     int         `json:"page"`
	PageSize int         `json:"page_size"`
	Results  []Dashboard `json:"results"`
}

type DashboardTags

type DashboardTags struct {
	Tags []DashboardTagsTag `json:"tags"`
}

type DashboardTagsTag

type DashboardTagsTag struct {
	Count int    `json:"count"`
	Name  string `json:"name"`
}

type DataSource

type DataSource struct {
	Groups             map[int]bool   `json:"groups"`
	ID                 int            `json:"id"`
	Name               string         `json:"name"`
	Options            map[string]any `json:"options"`
	Paused             int            `json:"paused"`
	PauseReason        string         `json:"pause_reason"`
	QueueName          string         `json:"queue_name"`
	ScheduledQueueName string         `json:"scheduled_queue_name"`
	Syntax             string         `json:"syntax"`
	Type               string         `json:"type"`
	ViewOnly           bool           `json:"view_only"`
}

type DataSourceType

type DataSourceType struct {
	ConfigurationSchema DataSourceTypeConfigurationSchema `json:"configuration_schema"`
	Name                string                            `json:"name"`
	Type                string                            `json:"type"`
}

type DataSourceTypeConfigurationSchema

type DataSourceTypeConfigurationSchema struct {
	ExtraOptions []string                                             `json:"extra_options"`
	Order        []string                                             `json:"order"`
	Properties   map[string]DataSourceTypeConfigurationSchemaProperty `json:"properties"`
	Required     []string                                             `json:"required"`
	Secret       []string                                             `json:"secret"`
	Type         string                                               `json:"type"`
}

type DataSourceTypeConfigurationSchemaProperty

type DataSourceTypeConfigurationSchemaProperty struct {
	Default any    `json:"default"`
	Title   string `json:"title"`
	Type    string `json:"type"`
}

type Destination

type Destination struct {
	Icon    string         `json:"icon"`
	ID      int            `json:"id"`
	Name    string         `json:"name"`
	Options map[string]any `json:"options"`
	Type    string         `json:"type"`
}

type DestinationType

type DestinationType struct {
	ConfigurationSchema DestinationTypeConfigurationSchema `json:"configuration_schema"`
	Icon                string                             `json:"icon"`
	Name                string                             `json:"name"`
	Type                string                             `json:"type"`
}

type DestinationTypeConfigurationSchema

type DestinationTypeConfigurationSchema struct {
	ExtraOptions []string                                              `json:"extra_options"`
	Properties   map[string]DestinationTypeConfigurationSchemaProperty `json:"properties"`
	Required     []string                                              `json:"required"`
	Secret       any                                                   `json:"secret"`
	Type         string                                                `json:"type"`
}

type DestinationTypeConfigurationSchemaProperty

type DestinationTypeConfigurationSchemaProperty struct {
	Default any    `json:"default"`
	Title   string `json:"title"`
	Type    string `json:"type"`
}

type Event

type Event struct {
	Action     string            `json:"action"`
	Browser    string            `json:"browser"`
	CreatedAt  time.Time         `json:"created_at"`
	Details    map[string]string `json:"details"`
	Location   string            `json:"location"`
	ObjectID   string            `json:"object_id"`
	ObjectType string            `json:"object_type"`
	OrgID      int               `json:"org_id"`
	UserID     int               `json:"user_id"`
	UserName   string            `json:"user_name"`
}

type EventPage

type EventPage struct {
	Count    int     `json:"count"`
	Page     int     `json:"page"`
	PageSize int     `json:"page_size"`
	Results  []Event `json:"results"`
}

type ExecQueryJSONInput added in v2.1.0

type ExecQueryJSONInput struct {
	Parameters            map[string]any `json:"parameters,omitempty"`
	ApplyAutoLimit        bool           `json:"apply_auto_limit,omitempty"`
	MaxAge                int            `json:"max_age,omitempty"`
	WithoutOmittingMaxAge bool           `json:"-"`
}

type FormatQueryOutput

type FormatQueryOutput struct {
	Query string `json:"query"`
}

type GetQueryResultsOutput added in v2.2.0

type GetQueryResultsOutput struct {
	QueryResult GetQueryResultsOutputQueryResult `json:"query_result"`
}

func JsonToGetQueryResultsOutput added in v2.3.0

func JsonToGetQueryResultsOutput(bs []byte) (*GetQueryResultsOutput, error)

type GetQueryResultsOutputQueryResult added in v2.2.0

type GetQueryResultsOutputQueryResult struct {
	ID           int                                  `json:"id"`
	QueryHash    string                               `json:"query_hash"`
	Query        string                               `json:"query"`
	Data         GetQueryResultsOutputQueryResultData `json:"data"`
	DataSourceID int                                  `json:"data_source_id"`
	Runtime      float64                              `json:"runtime"`
	RetrievedAt  time.Time                            `json:"retrieved_at"`
}

type GetQueryResultsOutputQueryResultData added in v2.2.0

type GetQueryResultsOutputQueryResultData struct {
	Columns []GetQueryResultsOutputQueryResultDataColumn `json:"columns"`
	Rows    []map[string]any                             `json:"rows"`
}

type GetQueryResultsOutputQueryResultDataColumn added in v2.2.0

type GetQueryResultsOutputQueryResultDataColumn struct {
	Name         string `json:"name"`
	FriendlyName string `json:"friendly_name"`
	Type         string `json:"type"`
}

type Group

type Group struct {
	CreatedAt   time.Time `json:"created_at"`
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Permissions []string  `json:"permissions"`
	Type        string    `json:"type"`
}

type Job

type Job struct {
	Error         string `json:"error"`
	ID            string `json:"id"`
	QueryResultID int    `json:"query_result_id"`
	Status        int    `json:"status"`
	UpdatedAt     any    `json:"updated_at"`
}

type JobResponse

type JobResponse struct {
	Job Job `json:"job"`
}

type ListDashboardsInput

type ListDashboardsInput struct {
	OnlyFavorites bool   `url:"only_favorites,omitempty"`
	Page          int    `url:"page,omitempty"`
	PageSize      int    `url:"page_size,omitempty"`
	Q             string `url:"q,omitempty"`
}

type ListEventsInput

type ListEventsInput struct {
	Page     int `url:"page,omitempty"`
	PageSize int `url:"page_size,omitempty"`
}

type ListFavoriteDashboardsInput

type ListFavoriteDashboardsInput struct {
	Page     int    `url:"page,omitempty"`
	PageSize int    `url:"page_size,omitempty"`
	Q        string `url:"q,omitempty"`
}

type ListFavoriteQueriesInput

type ListFavoriteQueriesInput struct {
	Page     int    `url:"page,omitempty"`
	PageSize int    `url:"page_size,omitempty"`
	Q        string `url:"q,omitempty"`
}

type ListMyDashboardsInput

type ListMyDashboardsInput struct {
	Page     int    `url:"page,omitempty"`
	PageSize int    `url:"page_size,omitempty"`
	Q        string `url:"q,omitempty"`
}

type ListMyQueriesInput

type ListMyQueriesInput struct {
	Page     int    `url:"page,omitempty"`
	PageSize int    `url:"page_size,omitempty"`
	Q        string `url:"q,omitempty"`
}

type ListQueriesInput

type ListQueriesInput struct {
	OnlyFavorites bool   `url:"only_favorites,omitempty"`
	Page          int    `url:"page,omitempty"`
	PageSize      int    `url:"page_size,omitempty"`
	Q             string `url:"q,omitempty"`
}

type ListUsersInput

type ListUsersInput struct {
	Page     int `url:"page,omitempty"`
	PageSize int `url:"page_size,omitempty"`
}

type OrganizationStatus

type OrganizationStatus struct {
	ObjectCounters OrganizationStatusObjectCounters `json:"object_counters"`
}

type OrganizationStatusObjectCounters

type OrganizationStatusObjectCounters struct {
	Alerts      int `json:"alerts"`
	Dashboards  int `json:"dashboards"`
	DataSources int `json:"data_sources"`
	Queries     int `json:"queries"`
	Users       int `json:"users"`
}

type PauseDataSourceInput

type PauseDataSourceInput struct {
	Reason string `json:"reason,omitempty"`
}

type PublishQueryInput added in v2.6.0

type PublishQueryInput struct {
	IsDraft bool `json:"is_draft"`
}

type Query

type Query struct {
	APIKey            string          `json:"api_key"`
	CanEdit           bool            `json:"can_edit"`
	CreatedAt         time.Time       `json:"created_at"`
	DataSourceID      int             `json:"data_source_id"`
	Description       string          `json:"description"`
	ID                int             `json:"id"`
	IsArchived        bool            `json:"is_archived"`
	IsDraft           bool            `json:"is_draft"`
	IsFavorite        bool            `json:"is_favorite"`
	IsSafe            bool            `json:"is_safe"`
	LastModifiedBy    *User           `json:"last_modified_by"`
	LastModifiedByID  int             `json:"last_modified_by_id"`
	LatestQueryDataID int             `json:"latest_query_data_id"`
	Name              string          `json:"name"`
	Options           QueryOptions    `json:"options"`
	Query             string          `json:"query"`
	QueryHash         string          `json:"query_hash"`
	RetrievedAt       time.Time       `json:"retrieved_at"`
	Runtime           float64         `json:"runtime"`
	Schedule          *QueueSchedule  `json:"schedule"`
	Tags              []string        `json:"tags"`
	UpdatedAt         time.Time       `json:"updated_at"`
	User              User            `json:"user"`
	Version           int             `json:"version"`
	Visualizations    []Visualization `json:"visualizations"`
}

type QueryOptions

type QueryOptions struct {
	Parameters []QueryOptionsParameter `json:"parameters"`
}

type QueryOptionsParameter added in v2.1.0

type QueryOptionsParameter struct {
	Global             bool                                     `json:"global"`
	Type               string                                   `json:"type"`
	Name               string                                   `json:"name"`
	Value              any                                      `json:"value,omitempty"`
	Title              string                                   `json:"title"`
	Regex              string                                   `json:"regex,omitempty"`
	EnumOptions        string                                   `json:"enumOptions,omitempty"`
	MultiValuesOptions *QueryOptionsParameterMultiValuesOptions `json:"multiValuesOptions,omitempty"`
	QueryID            int                                      `json:"queryId,omitempty"`
}

type QueryOptionsParameterMultiValuesOptions added in v2.5.0

type QueryOptionsParameterMultiValuesOptions struct {
	Prefix    string `json:"prefix"`
	Suffix    string `json:"suffix"`
	Separator string `json:"separator"`
}

type QueryPage

type QueryPage struct {
	Count    int     `json:"count"`
	Page     int     `json:"page"`
	PageSize int     `json:"page_size"`
	Results  []Query `json:"results"`
}

type QuerySnippet

type QuerySnippet struct {
	CreatedAt   time.Time `json:"created_at"`
	Description string    `json:"description"`
	ID          int       `json:"id"`
	Snippet     string    `json:"snippet"`
	Trigger     string    `json:"trigger"`
	UpdatedAt   time.Time `json:"updated_at"`
	User        User      `json:"user"`
}

type QueryTags

type QueryTags struct {
	Tags []QueryTagsTag `json:"tags"`
}

type QueryTagsTag

type QueryTagsTag struct {
	Count int    `json:"count"`
	Name  string `json:"name"`
}

type QueueSchedule

type QueueSchedule struct {
	DayOfWeek string `json:"day_of_week"`
	Interval  int    `json:"interval"`
	Time      string `json:"time"`
	Until     string `json:"until"`
}

type RefreshQueryInput added in v2.4.0

type RefreshQueryInput struct {
	ApplyAutoLimit bool `json:"apply_auto_limit"`
}

type SearchQueriesInput

type SearchQueriesInput struct {
	Q string `url:"q"`
}

type Session

type Session struct {
	ClientConfig ClientConfig `json:"client_config"`
	Messages     []string     `json:"messages"`
	OrgSlug      string       `json:"org_slug"`
	User         User         `json:"user"`
}

type SettingsOrganization

type SettingsOrganization struct {
	SettingsOrganizationSettings `json:"settings"`
}

type SettingsOrganizationSettings

type SettingsOrganizationSettings struct {
	AuthGoogleAppsDomains             []string `json:"auth_google_apps_domains"`
	AuthJwtAuthAlgorithms             []string `json:"auth_jwt_auth_algorithms"`
	AuthJwtAuthAudience               string   `json:"auth_jwt_auth_audience"`
	AuthJwtAuthCookieName             string   `json:"auth_jwt_auth_cookie_name"`
	AuthJwtAuthHeaderName             string   `json:"auth_jwt_auth_header_name"`
	AuthJwtAuthIssuer                 string   `json:"auth_jwt_auth_issuer"`
	AuthJwtAuthPublicCertsURL         string   `json:"auth_jwt_auth_public_certs_url"`
	AuthJwtLoginEnabled               bool     `json:"auth_jwt_login_enabled"`
	AuthPasswordLoginEnabled          bool     `json:"auth_password_login_enabled"`
	AuthSamlEnabled                   bool     `json:"auth_saml_enabled"`
	AuthSamlEntityID                  string   `json:"auth_saml_entity_id"`
	AuthSamlMetadataURL               string   `json:"auth_saml_metadata_url"`
	AuthSamlNameidFormat              string   `json:"auth_saml_nameid_format"`
	AuthSamlSsoURL                    string   `json:"auth_saml_sso_url"`
	AuthSamlType                      string   `json:"auth_saml_type"`
	AuthSamlX509Cert                  string   `json:"auth_saml_x509_cert"`
	BeaconConsent                     bool     `json:"beacon_consent"`
	DateFormat                        string   `json:"date_format"`
	DisablePublicUrls                 bool     `json:"disable_public_urls"`
	FeatureShowPermissionsControl     bool     `json:"feature_show_permissions_control"`
	FloatFormat                       string   `json:"float_format"`
	HidePlotlyModeBar                 bool     `json:"hide_plotly_mode_bar"`
	IntegerFormat                     string   `json:"integer_format"`
	MultiByteSearchEnabled            bool     `json:"multi_byte_search_enabled"`
	SendEmailOnFailedScheduledQueries bool     `json:"send_email_on_failed_scheduled_queries"`
	TimeFormat                        string   `json:"time_format"`
}

type ShareDashboardOutput

type ShareDashboardOutput struct {
	APIKey    string `json:"api_key"`
	PublicURL string `json:"public_url"`
}

type Status

type Status struct {
	DashboardsCount         int                   `json:"dashboards_count"`
	DatabaseMetrics         StatusDatabaseMetrics `json:"database_metrics"`
	Manager                 StatusManager         `json:"manager"`
	QueriesCount            int                   `json:"queries_count"`
	QueryResultsCount       int                   `json:"query_results_count"`
	RedisUsedMemory         int                   `json:"redis_used_memory"`
	RedisUsedMemoryHuman    string                `json:"redis_used_memory_human"`
	UnusedQueryResultsCount int                   `json:"unused_query_results_count"`
	Version                 string                `json:"version"`
	WidgetsCount            int                   `json:"widgets_count"`
	Workers                 []any                 `json:"workers"`
}

type StatusDatabaseMetrics

type StatusDatabaseMetrics struct {
	Metrics [][]any `json:"metrics"`
}

type StatusManager

type StatusManager struct {
	LastRefreshAt        string              `json:"last_refresh_at"`
	OutdatedQueriesCount string              `json:"outdated_queries_count"`
	QueryIds             string              `json:"query_ids"`
	Queues               StatusManagerQueues `json:"queues"`
}

type StatusManagerQueues

type StatusManagerQueues struct {
	Celery           StatusManagerQueuesCelery           `json:"celery"`
	Queries          StatusManagerQueuesQueries          `json:"queries"`
	ScheduledQueries StatusManagerQueuesScheduledQueries `json:"scheduled_queries"`
}

type StatusManagerQueuesCelery

type StatusManagerQueuesCelery struct {
	Size int `json:"size"`
}

type StatusManagerQueuesQueries

type StatusManagerQueuesQueries struct {
	Size int `json:"size"`
}

type StatusManagerQueuesScheduledQueries

type StatusManagerQueuesScheduledQueries struct {
	Size int `json:"size"`
}

type TestDataSourceOutput

type TestDataSourceOutput struct {
	Message string `json:"message"`
	Ok      bool   `json:"ok"`
}

type UpdateAlertInput

type UpdateAlertInput struct {
	Name    string              `json:"name,omitempty"`
	Options *UpdateAlertOptions `json:"options,omitempty"`
	QueryId int                 `json:"query_id,omitempty"`
	Rearm   int                 `json:"rearm"`
}

type UpdateAlertOptions

type UpdateAlertOptions struct {
	Column        string `json:"column"`
	Value         int    `json:"value"`
	Op            string `json:"op"`
	CustomSubject string `json:"custom_subject,omitempty"`
	CustomBody    string `json:"custom_body,omitempty"`
	// Deprecated: for backward compatibility
	Template string `json:"template,omitempty"`
}

type UpdateDashboardInput

type UpdateDashboardInput struct {
	DashboardFiltersEnabled bool      `json:"dashboard_filters_enabled,omitempty"`
	IsArchived              bool      `json:"is_archived,omitempty"`
	IsDraft                 bool      `json:"is_draft,omitempty"`
	Layout                  []any     `json:"layout,omitempty"`
	Name                    string    `json:"name,omitempty"`
	Options                 any       `json:"options,omitempty"`
	Tags                    *[]string `json:"tags,omitempty"`
	Version                 int       `json:"version,omitempty"`
}

type UpdateDataSourceInput

type UpdateDataSourceInput struct {
	Name    string         `json:"name"`
	Options map[string]any `json:"options"`
	Type    string         `json:"type"`
}

type UpdateGroupDataSourceInput

type UpdateGroupDataSourceInput struct {
	ViewOnly bool `json:"view_only"`
}

type UpdateQueryInput

type UpdateQueryInput struct {
	DataSourceID int                       `json:"data_source_id,omitempty"`
	Description  string                    `json:"description,omitempty"`
	Name         string                    `json:"name,omitempty"`
	Options      *UpdateQueryInputOptions  `json:"options,omitempty"`
	Query        string                    `json:"query,omitempty"`
	Schedule     *UpdateQueryInputSchedule `json:"schedule,omitempty"`
	Tags         *[]string                 `json:"tags,omitempty"`
	IsDraft      *bool                     `json:"is_draft,omitempty"`
}

type UpdateQueryInputOptions

type UpdateQueryInputOptions struct {
	Parameters []QueryOptionsParameter `json:"parameters"`
}

type UpdateQueryInputSchedule

type UpdateQueryInputSchedule struct {
	Interval  int     `json:"interval"`
	Time      *string `json:"time"`
	Until     *string `json:"until"`
	DayOfWeek *string `json:"day_of_week"`
}

type UpdateQuerySnippetInput

type UpdateQuerySnippetInput struct {
	Description string `json:"description,omitempty"`
	Snippet     string `json:"snippet,omitempty"`
	Trigger     string `json:"trigger,omitempty"`
}

type UpdateSettingsOrganizationInput

type UpdateSettingsOrganizationInput struct {
	AuthGoogleAppsDomains             []string `json:"auth_google_apps_domains,omitempty"`
	AuthJwtAuthAlgorithms             []string `json:"auth_jwt_auth_algorithms,omitempty"`
	AuthJwtAuthAudience               string   `json:"auth_jwt_auth_audience,omitempty"`
	AuthJwtAuthCookieName             string   `json:"auth_jwt_auth_cookie_name,omitempty"`
	AuthJwtAuthHeaderName             string   `json:"auth_jwt_auth_header_name,omitempty"`
	AuthJwtAuthIssuer                 string   `json:"auth_jwt_auth_issuer,omitempty"`
	AuthJwtAuthPublicCertsURL         string   `json:"auth_jwt_auth_public_certs_url,omitempty"`
	AuthJwtLoginEnabled               bool     `json:"auth_jwt_login_enabled,omitempty"`
	AuthPasswordLoginEnabled          bool     `json:"auth_password_login_enabled,omitempty"`
	AuthSamlEnabled                   bool     `json:"auth_saml_enabled,omitempty"`
	AuthSamlEntityID                  string   `json:"auth_saml_entity_id,omitempty"`
	AuthSamlMetadataURL               string   `json:"auth_saml_metadata_url,omitempty"`
	AuthSamlNameidFormat              string   `json:"auth_saml_nameid_format,omitempty"`
	AuthSamlSsoURL                    string   `json:"auth_saml_sso_url,omitempty"`
	AuthSamlType                      string   `json:"auth_saml_type,omitempty"`
	AuthSamlX509Cert                  string   `json:"auth_saml_x509_cert,omitempty"`
	BeaconConsent                     bool     `json:"beacon_consent,omitempty"`
	DateFormat                        string   `json:"date_format,omitempty"`
	DisablePublicUrls                 bool     `json:"disable_public_urls,omitempty"`
	FeatureShowPermissionsControl     bool     `json:"feature_show_permissions_control,omitempty"`
	FloatFormat                       string   `json:"float_format,omitempty"`
	HidePlotlyModeBar                 bool     `json:"hide_plotly_mode_bar,omitempty"`
	IntegerFormat                     string   `json:"integer_format,omitempty"`
	MultiByteSearchEnabled            bool     `json:"multi_byte_search_enabled,omitempty"`
	SendEmailOnFailedScheduledQueries bool     `json:"send_email_on_failed_scheduled_queries,omitempty"`
	TimeFormat                        string   `json:"time_format,omitempty"`
}

type UpdateUserInput

type UpdateUserInput struct {
	Email string `json:"email,omitempty"`
	Name  string `json:"name,omitempty"`
}

type UpdateVisualizationInput

type UpdateVisualizationInput struct {
	Description string `json:"description,omitempty"`
	Name        string `json:"name,omitempty"`
	Options     any    `json:"options,omitempty"`
	Type        string `json:"type,omitempty"`
}

type User

type User struct {
	ActiveAt            time.Time `json:"active_at"`
	APIKey              string    `json:"api_key"`
	AuthType            string    `json:"auth_type"`
	CreatedAt           time.Time `json:"created_at"`
	DisabledAt          time.Time `json:"disabled_at"`
	Email               string    `json:"email"`
	Groups              []any     `json:"groups"`
	ID                  int       `json:"id"`
	IsDisabled          bool      `json:"is_disabled"`
	IsEmailVerified     bool      `json:"is_email_verified"`
	IsInvitationPending bool      `json:"is_invitation_pending"`
	Name                string    `json:"name"`
	ProfileImageURL     string    `json:"profile_image_url"`
	UpdatedAt           time.Time `json:"updated_at"`
}

type UserPage

type UserPage struct {
	Count    int    `json:"count"`
	Page     int    `json:"page"`
	PageSize int    `json:"page_size"`
	Results  []User `json:"results"`
}

type Visualization

type Visualization struct {
	CreatedAt   time.Time `json:"created_at"`
	Description string    `json:"description"`
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Options     any       `json:"options"`
	Query       Query     `json:"query"`
	Type        string    `json:"type"`
	UpdatedAt   time.Time `json:"updated_at"`
}

type WaitQueryJSONOption added in v2.3.0

type WaitQueryJSONOption struct {
	WaitStatuses []int
	Interval     time.Duration
}

type Widget

type Widget struct {
	CreatedAt     time.Time      `json:"created_at"`
	DashboardID   int            `json:"dashboard_id"`
	ID            int            `json:"id"`
	Options       map[string]any `json:"options"`
	Text          string         `json:"text"`
	UpdatedAt     time.Time      `json:"updated_at"`
	Visualization *Visualization `json:"visualization"`
	Width         int            `json:"width"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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