rest

package
v0.14.33 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: MPL-2.0 Imports: 12 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) 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) 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) 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)

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

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

Jump to

Keyboard shortcuts

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