redash

package module
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 13 Imported by: 1

README

redash-go

test Go Reference GitHub tag (latest by date) Go Report Card

Redash API client in Go.

Usage

package main

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

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

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

	ds, err := client.CreateDataSource(ctx, &redash.CreateDataSourceInput{
		Name: "postgres",
		Type: "pg",
		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
	job, err := client.ExecQueryJSON(ctx, query.ID, &buf)

	if err != nil {
		panic(err)
	}

	if job != nil {
		for {
			job, err := client.GetJob(ctx, job.Job.ID)

			if err != nil {
				panic(err)
			}

			if job.Job.Status != redash.JobStatusPending && job.Job.Status != redash.JobStatusStarted {
				buf = bytes.Buffer{}
				err := client.GetQueryResultsJSON(ctx, query.ID, &buf)

				if err != nil {
					panic(err)
				}

				break
			}

			time.Sleep(1 * time.Second)
		}
	}

	fmt.Println(buf.String())
}
Set debug mode
client := redash.MustNewClient("https://redash.example.com", "<secret>")
client.Debug = 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>")
NOTE: Dashboard API parameters are Redash version dependent
v8: slug(string)
client.GetDashboard(context.Background(), "my-dashboard")
v10: id(int)
client.GetDashboard(context.Background(), 1)

Tests

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

NOTE:

Documentation

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 added in v0.8.0

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

type AdminQuerisRqStatus added in v0.8.0

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

type AdminQuerisRqStatusDefault added in v0.8.0

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

type AdminQuerisRqStatusEmails added in v0.8.0

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

type AdminQuerisRqStatusPeriodic added in v0.8.0

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

type AdminQuerisRqStatusQueries added in v0.8.0

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

type AdminQuerisRqStatusQueues added in v0.8.0

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 added in v0.8.0

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

type AdminQuerisRqStatusWorker added in v0.8.0

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 {
	Debug bool
	// contains filtered or unexported fields
}

func MustNewClient added in v0.20.0

func MustNewClient(endpoint string, apiKey string) *Client

func MustNewClientWithHTTPClient added in v0.20.0

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

func NewClient

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

func NewClientWithHTTPClient added in v0.5.1

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, idOrSlug any) error

idOrSlug:

v8: int
v10: string

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, idOrSlug any) error

idOrSlug:

v8: int
v10: string

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 added in v0.3.0

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 added in v0.3.0

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

func (*Client) DeleteUser added in v0.12.0

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

func (*Client) DeleteWidget added in v0.7.0

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 added in v0.12.0

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

func (*Client) ExecQueryJSON

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

func (*Client) ForkQuery

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

func (*Client) FormatQuery added in v0.23.0

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 added in v0.8.0

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

func (*Client) GetAdminQueriesRqStatus added in v0.8.0

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 added in v0.2.0

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

func (*Client) GetDashboard

func (client *Client) GetDashboard(ctx context.Context, idOrSlug any) (*Dashboard, error)

idOrSlug:

v8: int
v10: string

func (*Client) GetDashboardTags added in v0.13.0

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 added in v0.14.0

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 added in v0.14.0

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 added in v0.22.0

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) 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) GetQuerySnippet added in v0.3.0

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

func (*Client) GetQueryTags added in v0.13.0

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

func (*Client) GetSession added in v0.5.0

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

func (*Client) GetSettingsOrganization added in v0.25.0

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

func (*Client) GetStatus added in v0.5.0

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 added in v0.9.0

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

func (*Client) ListFavoriteDashboards added in v0.19.0

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

func (*Client) ListFavoriteQueries added in v0.19.0

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 added in v0.19.0

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

func (*Client) ListMyQueries added in v0.19.0

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 added in v0.3.0

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

func (*Client) ListRecentQueries added in v0.24.0

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 added in v0.15.0

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

func (*Client) PauseDataSource added in v0.11.0

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

func (*Client) Ping added in v0.13.0

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) RefreshQuery added in v0.16.0

func (client *Client) RefreshQuery(ctx context.Context, id int) (*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 added in v0.11.0

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

func (*Client) SearchQueries added in v0.17.0

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

func (*Client) ShareDashboard added in v0.21.0

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 added in v0.11.0

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

func (*Client) UnmuteAlert added in v0.15.0

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

func (*Client) UnshareDashboard added in v0.21.0

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 added in v0.3.0

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

func (*Client) UpdateSettingsOrganization added in v0.25.0

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

func (*Client) UpdateUser added in v1.2.0

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) WithoutContext added in v0.10.0

func (client *Client) WithoutContext() *ClientWithoutContext

type ClientConfig added in v0.2.0

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 added in v0.10.0

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

func (*ClientWithoutContext) AddAlertSubscription added in v0.10.0

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

func (*ClientWithoutContext) AddGroupDataSource added in v0.10.0

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

func (*ClientWithoutContext) AddGroupMember added in v0.10.0

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

func (*ClientWithoutContext) ArchiveDashboard added in v0.10.0

func (client *ClientWithoutContext) ArchiveDashboard(idOrSlug any) error

func (*ClientWithoutContext) ArchiveQuery added in v0.10.0

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

func (*ClientWithoutContext) CreateAlert added in v0.10.0

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

func (*ClientWithoutContext) CreateDashboard added in v0.10.0

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

func (*ClientWithoutContext) CreateDataSource added in v0.10.0

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

func (*ClientWithoutContext) CreateDestination added in v0.10.0

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

func (*ClientWithoutContext) CreateFavoriteDashboard added in v0.10.0

func (client *ClientWithoutContext) CreateFavoriteDashboard(idOrSlug any) error

func (*ClientWithoutContext) CreateFavoriteQuery added in v0.10.0

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

func (*ClientWithoutContext) CreateGroup added in v0.10.0

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

func (*ClientWithoutContext) CreateQuery added in v0.10.0

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

func (*ClientWithoutContext) CreateQuerySnippet added in v0.10.0

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

func (*ClientWithoutContext) CreateUser added in v0.10.0

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

func (*ClientWithoutContext) CreateWidget added in v0.10.0

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

func (*ClientWithoutContext) DeleteAlert added in v0.10.0

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

func (*ClientWithoutContext) DeleteDataSource added in v0.10.0

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

func (*ClientWithoutContext) DeleteDestination added in v0.10.0

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

func (*ClientWithoutContext) DeleteGroup added in v0.10.0

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

func (*ClientWithoutContext) DeleteQuerySnippet added in v0.10.0

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

func (*ClientWithoutContext) DeleteUser added in v0.12.0

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

func (*ClientWithoutContext) DeleteWidget added in v0.10.0

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

func (*ClientWithoutContext) DisableUser added in v0.10.0

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

func (*ClientWithoutContext) EnableUser added in v0.12.0

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

func (*ClientWithoutContext) ExecQueryJSON added in v0.10.0

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

func (*ClientWithoutContext) ForkQuery added in v0.10.0

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

func (*ClientWithoutContext) FormatQuery added in v0.23.0

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

func (*ClientWithoutContext) GetAdminQueriesOutdated added in v0.10.0

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

func (*ClientWithoutContext) GetAdminQueriesRqStatus added in v0.10.0

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

func (*ClientWithoutContext) GetAlert added in v0.10.0

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

func (*ClientWithoutContext) GetConfig added in v0.10.0

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

func (*ClientWithoutContext) GetDashboard added in v0.10.0

func (client *ClientWithoutContext) GetDashboard(idOrSlug any) (*Dashboard, error)

func (*ClientWithoutContext) GetDashboardTags added in v0.13.0

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

func (*ClientWithoutContext) GetDataSource added in v0.10.0

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

func (*ClientWithoutContext) GetDataSourceTypes added in v0.14.0

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

func (*ClientWithoutContext) GetDestination added in v0.10.0

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

func (*ClientWithoutContext) GetDestinationTypes added in v0.14.0

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

func (*ClientWithoutContext) GetGroup added in v0.10.0

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

func (*ClientWithoutContext) GetJob added in v0.10.0

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

func (*ClientWithoutContext) GetOrganizationStatus added in v0.22.0

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

func (*ClientWithoutContext) GetQuery added in v0.10.0

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

func (*ClientWithoutContext) GetQueryResults added in v0.10.0

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

func (*ClientWithoutContext) GetQueryResultsCSV added in v0.10.0

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

func (*ClientWithoutContext) GetQueryResultsJSON added in v0.10.0

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

func (*ClientWithoutContext) GetQuerySnippet added in v0.10.0

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

func (*ClientWithoutContext) GetQueryTags added in v0.13.0

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

func (*ClientWithoutContext) GetSession added in v0.10.0

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

func (*ClientWithoutContext) GetSettingsOrganization added in v0.25.0

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

func (*ClientWithoutContext) GetStatus added in v0.10.0

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

func (*ClientWithoutContext) GetUser added in v0.10.0

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

func (*ClientWithoutContext) ListAlertSubscriptions added in v0.10.0

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

func (*ClientWithoutContext) ListAlerts added in v0.10.0

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

func (*ClientWithoutContext) ListDashboards added in v0.10.0

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

func (*ClientWithoutContext) ListDataSources added in v0.10.0

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

func (*ClientWithoutContext) ListDestinations added in v0.10.0

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

func (*ClientWithoutContext) ListEvents added in v0.10.0

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

func (*ClientWithoutContext) ListFavoriteDashboards added in v0.19.0

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

func (*ClientWithoutContext) ListFavoriteQueries added in v0.19.0

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

func (*ClientWithoutContext) ListGroupDataSources added in v0.10.0

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

func (*ClientWithoutContext) ListGroupMembers added in v0.10.0

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

func (*ClientWithoutContext) ListGroups added in v0.10.0

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

func (*ClientWithoutContext) ListMyDashboards added in v0.19.0

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

func (*ClientWithoutContext) ListMyQueries added in v0.19.0

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

func (*ClientWithoutContext) ListQueries added in v0.10.0

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

func (*ClientWithoutContext) ListQuerySnippets added in v0.10.0

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

func (*ClientWithoutContext) ListRecentQueries added in v0.24.0

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

func (*ClientWithoutContext) ListUsers added in v0.10.0

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

func (*ClientWithoutContext) MuteAlert added in v0.15.0

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

func (*ClientWithoutContext) PauseDataSource added in v0.11.0

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

func (*ClientWithoutContext) Ping added in v0.13.0

func (client *ClientWithoutContext) Ping() error

func (*ClientWithoutContext) RefreshQuery added in v0.16.0

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

func (*ClientWithoutContext) RemoveAlertSubscription added in v0.10.0

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

func (*ClientWithoutContext) RemoveGroupDataSource added in v0.10.0

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

func (*ClientWithoutContext) RemoveGroupMember added in v0.10.0

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

func (*ClientWithoutContext) ResumeDataSource added in v0.11.0

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

func (*ClientWithoutContext) SearchQueries added in v0.17.0

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

func (*ClientWithoutContext) ShareDashboard added in v0.21.0

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

func (*ClientWithoutContext) TestCredentials added in v0.10.0

func (client *ClientWithoutContext) TestCredentials() error

func (*ClientWithoutContext) TestDataSource added in v0.11.0

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

func (*ClientWithoutContext) UnmuteAlert added in v0.15.0

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

func (*ClientWithoutContext) UnshareDashboard added in v0.21.0

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

func (*ClientWithoutContext) UpdateAlert added in v0.10.0

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

func (*ClientWithoutContext) UpdateDashboard added in v0.10.0

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

func (*ClientWithoutContext) UpdateDataSource added in v0.10.0

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

func (*ClientWithoutContext) UpdateGroupDataSource added in v0.10.0

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

func (*ClientWithoutContext) UpdateQuery added in v0.10.0

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

func (*ClientWithoutContext) UpdateQuerySnippet added in v0.10.0

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

func (*ClientWithoutContext) UpdateSettingsOrganization added in v0.25.0

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

func (*ClientWithoutContext) UpdateUser added in v1.2.0

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

func (*ClientWithoutContext) UpdateVisualization added in v0.10.0

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

type Config added in v0.2.0

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 []map[string]any `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 added in v0.3.0

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 added in v0.13.0

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

type DashboardTagsTag added in v0.13.0

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 added in v0.14.0

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

type DataSourceTypeConfigurationSchema added in v0.14.0

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 added in v0.14.0

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 added in v0.14.0

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

type DestinationTypeConfigurationSchema added in v0.14.0

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 added in v0.14.0

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

type Event added in v0.9.0

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 added in v0.9.0

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

type FormatQueryOutput added in v0.23.0

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

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 added in v0.9.0

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

type ListFavoriteDashboardsInput added in v0.19.0

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

type ListFavoriteQueriesInput added in v0.19.0

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

type ListMyDashboardsInput added in v0.19.0

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

type ListMyQueriesInput added in v0.19.0

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 added in v0.22.0

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

type OrganizationStatusObjectCounters added in v0.22.0

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 added in v0.11.0

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

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 []map[string]any `json:"parameters"`
}

type QueryPage

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

type QuerySnippet added in v0.3.0

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 added in v0.13.0

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

type QueryTagsTag added in v0.13.0

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 SearchQueriesInput added in v0.17.0

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

type Session added in v0.5.0

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

type SettingsOrganization added in v0.25.0

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

type SettingsOrganizationSettings added in v0.25.0

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 added in v0.21.0

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

type Status added in v0.5.0

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 added in v0.5.0

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

type StatusManager added in v0.5.0

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 added in v0.5.0

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

type StatusManagerQueuesCelery added in v0.5.0

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

type StatusManagerQueuesQueries added in v0.5.0

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

type StatusManagerQueuesScheduledQueries added in v0.5.0

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

type TestDataSourceOutput added in v0.11.0

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"`
}

type UpdateQueryInputOptions

type UpdateQueryInputOptions struct {
	Parameters []map[string]any `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 added in v0.3.0

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

type UpdateSettingsOrganizationInput added in v0.25.0

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 added in v1.2.0

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 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