rest

package
v0.14.43 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasStatusCode

func HasStatusCode(err error, code int) bool

Types

type Client

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

Client implements our RESTful customer API

func New

func New(endpoint string, client *http.Client) *Client

New returns client to customer API

func (*Client) CreateReferenceTable

func (client *Client) CreateReferenceTable(ctx context.Context, input *ReferenceTableInput) (*ReferenceTable, error)

func (*Client) CreateReport added in v0.14.30

func (client *Client) CreateReport(ctx context.Context, req *ReportsDefinition) (*ReportsResource, error)

func (*Client) CreateServiceAccount added in v0.14.43

func (client *Client) CreateServiceAccount(ctx context.Context, req *ServiceAccountDefinition) (*ServiceAccountResource, error)

func (*Client) Delete

func (c *Client) Delete(path string) (*http.Response, error)

func (*Client) DeleteReferenceTable

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

func (*Client) DeleteReport added in v0.14.30

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

func (*Client) DeleteServiceAccount added in v0.14.43

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

func (*Client) Get

func (c *Client) Get(path string) (*http.Response, error)

func (*Client) GetReferenceTable

func (client *Client) GetReferenceTable(ctx context.Context, id string) (*ReferenceTable, error)

func (*Client) GetReport added in v0.14.30

func (client *Client) GetReport(ctx context.Context, id string) (*ReportsResource, error)

func (*Client) GetServiceAccount added in v0.14.43

func (client *Client) GetServiceAccount(ctx context.Context, id string) (*ServiceAccountResource, error)

func (*Client) ListServiceAccounts added in v0.14.43

func (client *Client) ListServiceAccounts(ctx context.Context) ([]ServiceAccountResource, error)

func (*Client) Login

func (c *Client) Login(ctx context.Context, user, password string) (string, error)

func (*Client) LookupReferenceTable

func (client *Client) LookupReferenceTable(ctx context.Context, label string) (*ReferenceTable, error)

func (*Client) Patch

func (c *Client) Patch(path string, contentType string, body io.Reader) (*http.Response, error)

func (*Client) Post

func (c *Client) Post(path, contentType string, body io.Reader) (*http.Response, error)

func (*Client) Put

func (c *Client) Put(path string, contentType string, body io.Reader) (*http.Response, error)

func (*Client) UpdateReferenceTable

func (client *Client) UpdateReferenceTable(ctx context.Context, id string, input *ReferenceTableInput) (*ReferenceTable, error)

func (*Client) UpdateReferenceTableMetadata

func (client *Client) UpdateReferenceTableMetadata(ctx context.Context, id string, input *ReferenceTableMetadataInput) (*ReferenceTable, error)

func (*Client) UpdateReport added in v0.14.30

func (client *Client) UpdateReport(ctx context.Context, id string, req *ReportsDefinition) (*ReportsResource, error)

func (*Client) UpdateServiceAccount added in v0.14.43

func (client *Client) UpdateServiceAccount(ctx context.Context, id string, req *ServiceAccountDefinition) (*ServiceAccountResource, error)

type ErrorWithStatusCode

type ErrorWithStatusCode struct {
	StatusCode int
	Err        error
}

func (ErrorWithStatusCode) Error

func (e ErrorWithStatusCode) Error() string

type ReferenceTable

type ReferenceTable struct {
	Id          string `json:"id"`
	Label       string `json:"label"`
	Description string `json:"description"`
	Checksum    string `json:"checksum"`
	DatasetId   string `json:"datasetId"`
}

func (*ReferenceTable) Oid

func (r *ReferenceTable) Oid() oid.OID

type ReferenceTableInput

type ReferenceTableInput struct {
	Metadata       ReferenceTableMetadataInput `json:"metadata"`
	SourceFilePath string                      `json:"-"`
	Schema         []ReferenceTableSchemaInput `json:"schema"`
}

TODO: generate from OpenAPI spec

func (*ReferenceTableInput) RequestBody

func (r *ReferenceTableInput) RequestBody() (body *bytes.Buffer, contentType string, err error)

type ReferenceTableListResponse

type ReferenceTableListResponse struct {
	TotalCount      int              `json:"totalCount"`
	ReferenceTables []ReferenceTable `json:"referenceTables"`
}

type ReferenceTableMetadataInput

type ReferenceTableMetadataInput struct {
	Label       *string   `json:"label,omitempty"`
	Description *string   `json:"description,omitempty"`
	PrimaryKey  *[]string `json:"primaryKey,omitempty"`
	LabelField  *string   `json:"labelField,omitempty"`
}

All fields are nullable + omitempty to support PATCH semantics (excluding field means leave as is)

type ReferenceTableSchemaInput added in v0.14.29

type ReferenceTableSchemaInput struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type ReportUser added in v0.14.30

type ReportUser struct {
	Id    string `json:"id"`
	Label string `json:"label"`
}

type ReportsDashboard added in v0.14.30

type ReportsDashboard struct {
	Id                         string                 `json:"id"`
	Label                      string                 `json:"label,omitempty"`
	Parameters                 map[string]interface{} `json:"parameters,omitempty"`
	QueryWindowDurationMinutes int32                  `json:"queryWindowDurationMinutes"`
}

type ReportsDefinition added in v0.14.30

type ReportsDefinition struct {
	Label              string           `json:"label"`
	Dashboard          ReportsDashboard `json:"dashboard"`
	Enabled            bool             `json:"enabled"`
	Schedule           ReportsSchedule  `json:"schedule"`
	EmailSubject       string           `json:"emailSubject,omitempty"`
	EmailBody          string           `json:"emailBody,omitempty"`
	EmailRecipients    []string         `json:"emailRecipients"`
	EmailBccRecipients []string         `json:"emailBccRecipients"`
}

type ReportsResource added in v0.14.30

type ReportsResource struct {
	Id                 string           `json:"id"` // backend sends this as string anyways
	CreatedBy          ReportUser       `json:"createdBy"`
	CreatedAt          string           `json:"createdAt"`
	UpdatedBy          ReportUser       `json:"updatedBy"`
	UpdatedAt          string           `json:"updatedAt"`
	Enabled            bool             `json:"enabled"`
	Label              string           `json:"label"`
	Dashboard          ReportsDashboard `json:"dashboard"`
	Schedule           ReportsSchedule  `json:"schedule"`
	EmailSubject       string           `json:"emailSubject"`
	EmailBody          string           `json:"emailBody"`
	EmailRecipients    []string         `json:"emailRecipients"`
	EmailBccRecipients []string         `json:"emailBccRecipients"`
	NextScheduleTime   *string          `json:"nextScheduleTime,omitempty"`
	LastRunTime        *string          `json:"lastRunTime,omitempty"`
	LastRunStatus      *string          `json:"lastRunStatus,omitempty"`
	LastRunError       *string          `json:"lastRunError,omitempty"`
}

func (*ReportsResource) Oid added in v0.14.30

func (r *ReportsResource) Oid() oid.OID

type ReportsSchedule added in v0.14.30

type ReportsSchedule struct {
	Frequency              string `json:"frequency"`
	Every                  int32  `json:"every"`
	TimeOfDay              string `json:"timeOfDay"`
	Timezone               string `json:"timezone"`
	DayOfTheWeek           string `json:"dayOfTheWeek,omitempty"`
	DayOfTheMonth          int    `json:"dayOfTheMonth,omitempty"`
	GenerationDelayMinutes int    `json:"generationDelayMinutes,omitempty"`
}

type ServiceAccountDefinition added in v0.14.43

type ServiceAccountDefinition struct {
	Label       string `json:"label"`
	Description string `json:"description,omitempty"`
	Disabled    bool   `json:"disabled"`
}

type ServiceAccountResource added in v0.14.43

type ServiceAccountResource struct {
	Id          string `json:"id"`
	Label       string `json:"label"`
	Description string `json:"description,omitempty"`
	Disabled    bool   `json:"disabled"`
}

func (*ServiceAccountResource) Oid added in v0.14.43

func (sa *ServiceAccountResource) Oid() oid.OID

Jump to

Keyboard shortcuts

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