client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDatasetNotFound = errors.New("dataset not found")
)
View Source
var (
	ErrUnauthorized = errors.New("authorization error")
)
View Source
var (
	ErrWorkspaceNotFound = errors.New("workspace not found")
)
View Source
var FieldTypes = []string{
	"array",
	"bool",
	"float64",
	"int64",
	"object",
	"string",
	"timestamp",
}

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(baseURL string, key string, insecure bool) (*Client, error)

func (*Client) CreateDataset

func (c *Client) CreateDataset(workspaceID string, config DatasetConfig) (*Dataset, error)

func (*Client) DeleteDataset

func (c *Client) DeleteDataset(id string) error

DeleteDataset deletes dataset by ID.

func (*Client) GetDataset

func (c *Client) GetDataset(id string) (*Dataset, error)

func (*Client) GetTransform

func (c *Client) GetTransform(id string) (*Transform, error)

func (*Client) GetWorkspace

func (c *Client) GetWorkspace(id string) (*Workspace, error)

func (*Client) ListDatasets

func (c *Client) ListDatasets() (ds []*Dataset, err error)

ListDatasets retrieves all datasets across workspaces. No filtering provided for now.

func (*Client) ListWorkspaces

func (c *Client) ListWorkspaces() ([]*Workspace, error)

func (*Client) LookupDataset

func (c *Client) LookupDataset(workspaceID string, label string) (*Dataset, error)

func (*Client) Run

func (c *Client) Run(reqBody string, vars map[string]interface{}) (map[string]interface{}, error)

Run raw GraphQL query against API

func (*Client) SetTransform

func (c *Client) SetTransform(datasetID string, config *TransformConfig) (*Transform, error)

func (*Client) UpdateDataset

func (c *Client) UpdateDataset(workspaceID string, ID string, config DatasetConfig) (*Dataset, error)

func (*Client) Verify

func (c *Client) Verify() error

Verify checks if we can connect to API.

type Dataset

type Dataset struct {
	WorkspaceID string        `json:"workspaceId"`
	ID          string        `json:"id"`
	Config      DatasetConfig `json:"config"`
}

Dataset is published within a workspace

type DatasetConfig

type DatasetConfig struct {
	Name             string         `json:"name,omitempty"`
	FreshnessDesired *time.Duration `json:"freshnessDesired,omitempty"`
	IconURL          *string        `json:"iconUrl,omitempty"`

	// schema
	Fields []*Field `json:"fields,omitempty"`
}

DatasetConfig contains all the configurable elements of a dataset.

type Field

type Field struct {
	Name string `json:"field,omitempty"`
	Type string `json:"type,omitempty"`

	ValidTo   bool `json:"valid_to,omitempty"`
	ValidFrom bool `json:"valid_from,omitempty"`
	Label     bool `json:"label,omitempty"`
}

type ResultStatus

type ResultStatus struct {
	Success      bool                   `json:"success"`
	ErrorMessage string                 `json:"errorMessage"`
	DetailedInfo map[string]interface{} `json:"detailedInfo"`
}

func (*ResultStatus) Error

func (s *ResultStatus) Error() error

type Stage

type Stage struct {
	Name     string `json:"name,omitempty"`
	Input    string `json:"input,omitempty"`
	Pipeline string `json:"pipeline,omitempty"`
}

Stage declares a source to operate on, and a pipeline to execute

type Transform

type Transform struct {
	ID string `json:"id"`
	*TransformConfig
}

type TransformConfig

type TransformConfig struct {
	Inputs     map[string]string `json:"inputs"`
	References map[string]string `json:"references"`
	Stages     []*Stage          `json:"stages"`
	Metadata   map[string]string
	// contains filtered or unexported fields
}

TransformConfig describes a sequence of stages

func NewTransformConfig

func NewTransformConfig(inputs map[string]string, references, metadata map[string]string, stages ...*Stage) (*TransformConfig, error)

type Workspace

type Workspace struct {
	ID    string `json:"id"`
	Label string `json:"label"`
}

Jump to

Keyboard shortcuts

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