Documentation
¶
Index ¶
- type Alert
- type Breadcrumb
- type Client
- func (c *Client) Checker(ctx context.Context, check *health.CheckState) error
- func (c *Client) Get(ctx context.Context, userAccessToken, path string) ([]byte, error)
- func (c *Client) GetBreadcrumb(ctx context.Context, userAccessToken, collectionID, lang, uri string) ([]Breadcrumb, error)
- func (c *Client) GetCollection(ctx context.Context, userAccessToken, collectionID string) (Collection, error)
- func (c *Client) GetDataset(ctx context.Context, userAccessToken, collectionID, lang, uri string) (Dataset, error)
- func (c *Client) GetDatasetLandingPage(ctx context.Context, userAccessToken, collectionID, lang, path string) (DatasetLandingPage, error)
- func (c *Client) GetFileSize(ctx context.Context, userAccessToken, collectionID, lang, uri string) (FileSize, error)
- func (c *Client) GetHomepageContent(ctx context.Context, userAccessToken, collectionID, lang, path string) (HomepageContent, error)
- func (c *Client) GetPageTitle(ctx context.Context, userAccessToken, collectionID, lang, uri string) (PageTitle, error)
- func (c *Client) GetResourceBody(ctx context.Context, userAccessToken, collectionID, lang, uri string) ([]byte, error)
- func (c *Client) GetTimeseriesMainFigure(ctx context.Context, userAccessToken, collectionID, lang, uri string) (TimeseriesMainFigure, error)
- func (c *Client) GetWithHeaders(ctx context.Context, userAccessToken, path string) ([]byte, http.Header, error)
- func (c *Client) Put(ctx context.Context, userAccessToken, path string, payload []byte) (*http.Response, error)
- func (c *Client) PutDatasetInCollection(ctx context.Context, ...) error
- func (c *Client) PutDatasetVersionInCollection(ctx context.Context, ...) error
- type Collection
- type CollectionItem
- type CollectionState
- type Contact
- type Dataset
- type DatasetLandingPage
- type Description
- type Download
- type ErrInvalidZebedeeResponse
- type Featured
- type FileSize
- type HomepageContent
- type HomepageDescription
- type Intro
- type NodeDescription
- type PageTitle
- type Related
- type Section
- type SupplementaryFile
- type TimeseriesDataPoint
- type TimeseriesDescription
- type TimeseriesMainFigure
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
Date string `json:"date"`
Markdown string `json:"markdown"`
Type string `json:"type"`
}
Alert represents an alert within dataset landing page
type Breadcrumb ¶
type Breadcrumb struct {
URI string `json:"uri"`
Description NodeDescription `json:"description"`
Type string `json:"type"`
}
Breadcrumb represents a breadcrumb from zebedee
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a zebedee client
func New ¶
New creates a new Zebedee Client, set ZEBEDEE_REQUEST_TIMEOUT_SECOND environment variable to modify default client timeout as zebedee can often be slow to respond
func NewClientWithClienter ¶
NewWithSetTimeoutAndMaxRetry creates a new Zebedee Client, with a configurable timeout and maximum number of retries
func NewWithHealthClient ¶
func NewWithHealthClient(hcCli *healthcheck.Client) *Client
NewWithHealthClient creates a new instance of Client, reusing the URL and Clienter from the provided health check client.
func (*Client) Checker ¶
Checker calls zebedee health endpoint and returns a check object to the caller.
func (*Client) GetBreadcrumb ¶
func (c *Client) GetBreadcrumb(ctx context.Context, userAccessToken, collectionID, lang, uri string) ([]Breadcrumb, error)
GetBreadcrumb returns a Breadcrumb
func (*Client) GetCollection ¶
func (*Client) GetDataset ¶
func (c *Client) GetDataset(ctx context.Context, userAccessToken, collectionID, lang, uri string) (Dataset, error)
GetDataset returns details about a dataset from zebedee
func (*Client) GetDatasetLandingPage ¶
func (c *Client) GetDatasetLandingPage(ctx context.Context, userAccessToken, collectionID, lang, path string) (DatasetLandingPage, error)
GetDatasetLandingPage returns a DatasetLandingPage populated with data from a zebedee response. If an error is returned there is a chance that a partly completed DatasetLandingPage is returned
func (*Client) GetFileSize ¶
func (c *Client) GetFileSize(ctx context.Context, userAccessToken, collectionID, lang, uri string) (FileSize, error)
GetFileSize retrieves a given filesize from zebedee
func (*Client) GetHomepageContent ¶
func (*Client) GetPageTitle ¶
func (c *Client) GetPageTitle(ctx context.Context, userAccessToken, collectionID, lang, uri string) (PageTitle, error)
GetPageTitle retrieves a page title from zebedee
func (*Client) GetResourceBody ¶
func (c *Client) GetResourceBody(ctx context.Context, userAccessToken, collectionID, lang, uri string) ([]byte, error)
GetResourceBody returns body of a resource e.g. JSON definition of a table
func (*Client) GetTimeseriesMainFigure ¶
func (*Client) GetWithHeaders ¶
func (c *Client) GetWithHeaders(ctx context.Context, userAccessToken, path string) ([]byte, http.Header, error)
GetWithHeaders returns a response for the requested uri in zebedee, providing the headers too
func (*Client) Put ¶
func (c *Client) Put(ctx context.Context, userAccessToken, path string, payload []byte) (*http.Response, error)
Put updates a resource in zebedee
func (*Client) PutDatasetInCollection ¶
type Collection ¶
type Collection struct {
ID string `json:"id"`
Name string `json:"name"`
Inprogress []CollectionItem `json:"inProgress"`
Complete []CollectionItem `json:"complete"`
Reviewed []CollectionItem `json:"reviewed"`
Datasets []CollectionItem `json:"datasets"`
DatasetVersions []CollectionItem `json:"datasetVersions"`
ApprovalStatus string `json:"approvalStatus"`
Type string `json:"type"`
}
type CollectionItem ¶
type CollectionState ¶
type CollectionState struct {
State string `json:"state"`
}
type Contact ¶
type Contact struct {
Name string `json:"name"`
Email string `json:"email"`
Telephone string `json:"telephone"`
}
Contact represents a contact within dataset landing page
type Dataset ¶
type Dataset struct {
Type string `json:"type"`
URI string `json:"uri"`
Description Description `json:"description"`
Downloads []Download `json:"downloads"`
SupplementaryFiles []SupplementaryFile `json:"supplementaryFiles"`
Versions []Version `json:"versions"`
}
Dataset represents a dataset response from zebedee
type DatasetLandingPage ¶
type DatasetLandingPage struct {
Type string `json:"type"`
URI string `json:"uri"`
Description Description `json:"description"`
Section Section `json:"section"`
Datasets []Related `json:"datasets"`
RelatedLinks []Related `json:"links"`
RelatedFilterableDatasets []Related `json:"relatedFilterableDatasets"`
RelatedDatasets []Related `json:"relatedDatasets"`
RelatedDocuments []Related `json:"relatedDocuments"`
RelatedMethodology []Related `json:"relatedMethodology"`
RelatedMethodologyArticle []Related `json:"relatedMethodologyArticle"`
Alerts []Alert `json:"alerts"`
Timeseries bool `json:"timeseries"`
}
DatasetLandingPage is the page model of the Zebedee response for a dataset landing page type
type Description ¶
type Description struct {
Title string `json:"title"`
Edition string `json:"edition"`
Summary string `json:"summary"`
Keywords []string `json:"keywords"`
MetaDescription string `json:"metaDescription"`
NationalStatistic bool `json:"nationalStatistic"`
Contact Contact `json:"contact"`
ReleaseDate string `json:"releaseDate"`
NextRelease string `json:"nextRelease"`
DatasetID string `json:"datasetId"`
Unit string `json:"unit"`
PreUnit string `json:"preUnit"`
Source string `json:"source"`
VersionLabel string `json:"versionLabel"`
}
Description represents a description block within the dataset landing page
type ErrInvalidZebedeeResponse ¶
ErrInvalidZebedeeResponse is returned when zebedee does not respond with a valid status
func (ErrInvalidZebedeeResponse) Error ¶
func (e ErrInvalidZebedeeResponse) Error() string
Error should be called by the user to print out the stringified version of the error
type FileSize ¶
type FileSize struct {
Size int `json:"fileSize"`
}
FileSize represents a file size from zebedee
type HomepageContent ¶
type HomepageContent struct {
Intro Intro `json:"intro"`
FeaturedContent []Featured `json:"featuredContent"`
AroundONS []Featured `json:"aroundONS"`
ServiceMessage string `json:"serviceMessage"`
URI string `json:"uri"`
Type string `json:"type"`
Description HomepageDescription `json:"description"`
}
HomepageContent represents the page model of the Zebedee response for the ONS homepage
type HomepageDescription ¶
type NodeDescription ¶
type NodeDescription struct {
Title string `json:"title"`
}
NodeDescription represents a node description
type Related ¶
Related stores the Title and URI for any related data (eg related publications on a dataset page)
type Section ¶
type Section struct {
Markdown string `json:"markdown"`
}
Section represents a section within dataset landing page
type SupplementaryFile ¶
SupplementaryFile represents a SupplementaryFile within a dataset
type TimeseriesDataPoint ¶
type TimeseriesDescription ¶
type TimeseriesMainFigure ¶
type TimeseriesMainFigure struct {
Description TimeseriesDescription `json:"description"`
Years []TimeseriesDataPoint `json:"years"`
Quarters []TimeseriesDataPoint `json:"quarters"`
Months []TimeseriesDataPoint `json:"months"`
RelatedDocuments []Related `json:"relatedDocuments"`
URI string `json:"uri"`
}
TimeseriesMainFigure represents timeseries data for main figure on the homepage