rest

package
v0.14.28 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 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) 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) 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) 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 string, 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)

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

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)

Jump to

Keyboard shortcuts

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