sdk

package
v1.85.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 16 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(datasetAPIUrl string) *Client

New creates a new instance of Client for the service

func NewWithHealthClient

func NewWithHealthClient(hcCli *health.Client) *Client

NewWithHealthClient creates a new instance of service API Client, reusing the URL and Clienter from the provided healthcheck client

func (*Client) Checker

func (c *Client) Checker(ctx context.Context, check *healthcheck.CheckState) error

Checker calls topic api health endpoint and returns a check object to the caller

func (*Client) DoAuthenticatedGetRequest added in v1.75.0

func (c *Client) DoAuthenticatedGetRequest(ctx context.Context, headers Headers, uri *url.URL) (resp *http.Response, err error)

Creates new request object, executes a get request using the input `headers` and `uri` and returns the response

func (*Client) DoAuthenticatedPutRequest added in v1.81.2

func (c *Client) DoAuthenticatedPutRequest(ctx context.Context, headers Headers, uri *url.URL, payload []byte) (*http.Response, error)

Creates new request object, executes a put request using the input `headers`, `uri`, and payload, and returns the response

func (*Client) GetDataset added in v1.76.0

func (c *Client) GetDataset(ctx context.Context, headers Headers, collectionID, datasetID string) (dataset models.Dataset, err error)

Get returns dataset level information for a given dataset id

func (*Client) GetDatasetByPath added in v1.76.0

func (c *Client) GetDatasetByPath(ctx context.Context, headers Headers, path string) (dataset models.Dataset, err error)

GetDatasetByPath returns dataset level information for a given dataset path

func (*Client) GetDatasetEditions added in v1.82.0

func (c *Client) GetDatasetEditions(ctx context.Context, headers Headers, queryParams *QueryParams) (datasetEditionsList DatasetEditionsList, err error)

GetDatasetEditions returns a list of dataset series that have unpublished versions or match the given state

func (*Client) GetEdition added in v1.76.0

func (c *Client) GetEdition(ctx context.Context, headers Headers, datasetID, editionID string) (edition models.Edition, err error)

GetEdition retrieves a single edition document from a given datasetID and edition label

func (*Client) GetEditions added in v1.76.0

func (c *Client) GetEditions(ctx context.Context, headers Headers, datasetID string, queryParams *QueryParams) (editionList EditionsList, err error)

GetEditions returns all editions for a dataset

func (*Client) GetVersion

func (c *Client) GetVersion(ctx context.Context, headers Headers, datasetID, editionID, versionID string) (version models.Version, err error)

GetVersion gets a specific version for an edition from the dataset api

func (*Client) GetVersionDimensionOptions added in v1.75.0

func (c *Client) GetVersionDimensionOptions(ctx context.Context, headers Headers, datasetID, editionID, versionID, dimensionID string, queryParams *QueryParams) (versionDimensionOptionsList VersionDimensionOptionsList, err error)

Returns the options for a dimension

func (*Client) GetVersionDimensions added in v1.75.0

func (c *Client) GetVersionDimensions(ctx context.Context, headers Headers, datasetID, editionID, versionID string) (versionDimensionsList VersionDimensionsList, err error)

GetVersionDimensions will return a list of dimensions for a given version of a dataset

func (*Client) GetVersionMetadata added in v1.75.0

func (c *Client) GetVersionMetadata(ctx context.Context, headers Headers, datasetID, editionID, versionID string) (metadata models.Metadata, err error)

GetVersionMetadata returns the metadata for a given dataset id, edition and version

func (*Client) GetVersionV2 added in v1.84.0

func (c *Client) GetVersionV2(ctx context.Context, headers Headers, datasetID, editionID, versionID string) (version models.Version, err error)

GetVersionV2 does the same as GetVersion but uses unmarshalResponseBodyExpectingErrorResponseV2

func (*Client) GetVersions added in v1.75.0

func (c *Client) GetVersions(ctx context.Context, headers Headers, datasetID, editionID string, queryParams *QueryParams) (versionsList VersionsList, err error)

GetVersions gets all versions for an edition from the dataset api

func (*Client) Health

func (c *Client) Health() *health.Client

Health returns the underlying Healthcheck Client for this API client

func (*Client) PutVersionState added in v1.81.2

func (c *Client) PutVersionState(ctx context.Context, headers Headers, datasetID, editionID, versionID, state string) (err error)

func (*Client) URL

func (c *Client) URL() string

URL returns the URL used by this client

type Clienter added in v1.81.0

type Clienter interface {
	Checker(ctx context.Context, check *healthcheck.CheckState) error
	Health() *health.Client
	URL() string
	DoAuthenticatedGetRequest(ctx context.Context, headers Headers, uri *url.URL) (resp *http.Response, err error)
	GetDataset(ctx context.Context, headers Headers, collectionID, datasetID string) (dataset models.Dataset, err error)
	GetDatasetByPath(ctx context.Context, headers Headers, path string) (dataset models.Dataset, err error)
	GetDatasetEditions(ctx context.Context, headers Headers, queryParams *QueryParams) (datasetEditionsList DatasetEditionsList, err error)
	GetEdition(ctx context.Context, headers Headers, datasetID, editionID string) (edition models.Edition, err error)
	GetEditions(ctx context.Context, headers Headers, datasetID string, queryParams *QueryParams) (editionList EditionsList, err error)
	GetVersion(ctx context.Context, headers Headers, datasetID, editionID, versionID string) (version models.Version, err error)
	GetVersionDimensions(ctx context.Context, headers Headers, datasetID, editionID, versionID string) (versionDimensionsList VersionDimensionsList, err error)
	GetVersionDimensionOptions(ctx context.Context, headers Headers, datasetID, editionID, versionID, dimensionID string, queryParams *QueryParams) (versionDimensionOptionsList VersionDimensionOptionsList, err error)
	GetVersionMetadata(ctx context.Context, headers Headers, datasetID, editionID, versionID string) (metadata models.Metadata, err error)
	GetVersions(ctx context.Context, headers Headers, datasetID, editionID string, queryParams *QueryParams) (versionsList VersionsList, err error)
	PutVersionState(ctx context.Context, headers Headers, datasetID, editionID, versionID, state string) (err error)
}

type DatasetEditionsList added in v1.82.0

type DatasetEditionsList struct {
	Items      []models.DatasetEdition `json:"items"`
	Count      int                     `json:"count"`
	Offset     int                     `json:"offset"`
	Limit      int                     `json:"limit"`
	TotalCount int                     `json:"total_count"`
}

DatasetEditionsList represents an object containing a list of paginated dataset editions. This struct is based on the `pagination.page` struct which is returned when we call the `api.getDatasetEditions` endpoint

type EditionsList added in v1.76.0

type EditionsList struct {
	Items      []models.Edition `json:"items"`
	Count      int              `json:"count"`
	Offset     int              `json:"offset"`
	Limit      int              `json:"limit"`
	TotalCount int              `json:"total_count"`
}

EditionList represents an object containing a list of paginated versions. This struct is based on the `pagination.page` struct which is returned when we call the `api.getEditions` endpoint

type Headers added in v1.75.0

type Headers struct {
	CollectionID         string
	DownloadServiceToken string
	ServiceToken         string
	UserAccessToken      string
}

Contains the headers to be added to any request

func (*Headers) Add added in v1.75.0

func (h *Headers) Add(request *http.Request)

Adds headers to the input request

type QueryParams added in v1.75.0

type QueryParams struct {
	IDs       []string
	IsBasedOn string
	State     string
	Limit     int
	Offset    int
}

QueryParams represents the possible query parameters that a caller can provide

func (*QueryParams) Validate added in v1.75.0

func (q *QueryParams) Validate() error

Validate validates tht no negative values are provided for limit or offset, and that the length of IDs is lower than the maximum

type VersionDimensionOptionsList added in v1.75.0

type VersionDimensionOptionsList struct {
	Items []models.PublicDimensionOption
}

VersionDimensionOptionsList represent a list of PublicDimensionOption

func (VersionDimensionOptionsList) ToString added in v1.79.0

func (m VersionDimensionOptionsList) ToString() string

type VersionDimensionsList added in v1.75.0

type VersionDimensionsList struct {
	Items []models.Dimension
}

VersionDimensionsList represent a list of Dimension

type VersionsList added in v1.75.0

type VersionsList struct {
	Items      []models.Version `json:"items"`
	Count      int              `json:"count"`
	Offset     int              `json:"offset"`
	Limit      int              `json:"limit"`
	TotalCount int              `json:"total_count"`
}

VersionsList represents an object containing a list of paginated versions. This struct is based on the `pagination.page` struct which is returned when we call the `api.getVersions` endpoint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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