Documentation ¶
Index ¶
- type Alert
- type Breadcrumb
- type Bulletin
- 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) GetBulletin(ctx context.Context, userAccessToken, collectionID, lang, uri string) (Bulletin, 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) GetPageDescription(ctx context.Context, userAccessToken, collectionID, lang, uri string) (PageDescription, error)
- func (c *Client) GetPageTitle(ctx context.Context, userAccessToken, collectionID, lang, uri string) (PageTitle, error)
- func (c *Client) GetPublishedData(ctx context.Context, uriString string) ([]byte, error)
- func (c *Client) GetPublishedIndex(ctx context.Context, params *PublishedIndexRequestParams) (PublishedIndex, error)
- func (c *Client) GetRelease(ctx context.Context, userAccessToken, collectionID, lang, uri string) (Release, 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 EmergencyBanner
- type ErrInvalidZebedeeResponse
- type Featured
- type Figure
- type FileSize
- type HomepageContent
- type HomepageDescription
- type Intro
- type Link
- type NodeDescription
- type PageDescription
- type PageTitle
- type PublishedIndex
- type PublishedIndexItem
- type PublishedIndexRequestParams
- type Related
- type Release
- type ReleaseDateChange
- 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
type Breadcrumb ¶
type Breadcrumb struct { URI string `json:"uri"` Description NodeDescription `json:"description"` Type string `json:"type"` }
Breadcrumb represents a breadcrumb from zebedee
type Bulletin ¶ added in v2.4.0
type Bulletin struct { RelatedBulletins []Link `json:"relatedBulletins"` Sections []Section `json:"sections"` Accordion []Section `json:"accordion"` RelatedData []Link `json:"relatedData"` Charts []Figure `json:"charts"` Tables []Figure `json:"tables"` Images []Figure `json:"images"` Equations []Figure `json:"equations"` Links []Link `json:"links"` Type string `json:"type"` URI string `json:"uri"` Description Description `json:"description"` Versions []Version `json:"versions"` Alerts []Alert `json:"alerts"` LatestReleaseURI string `json:"latestReleaseUri"` }
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) GetBulletin ¶ added in v2.4.0
func (c *Client) GetBulletin(ctx context.Context, userAccessToken, collectionID, lang, uri string) (Bulletin, error)
GetBulletin retrieves a bulletin from zebedee
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) GetPageDescription ¶ added in v2.9.7
func (c *Client) GetPageDescription(ctx context.Context, userAccessToken, collectionID, lang, uri string) (PageDescription, error)
GetPageDescription retrieves a page description from zebedee
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) GetPublishedData ¶ added in v2.2.0
GetPublishedData returns []byte
func (*Client) GetPublishedIndex ¶ added in v2.5.0
func (c *Client) GetPublishedIndex(ctx context.Context, params *PublishedIndexRequestParams) (PublishedIndex, error)
GetPublishedIndex returns PublishedIndex
func (*Client) GetRelease ¶ added in v2.9.7
func (c *Client) GetRelease(ctx context.Context, userAccessToken, collectionID, lang, uri string) (Release, error)
GetRelease retrieves a release 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"` LatestRelease bool `json:"latestRelease"` 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"` Finalised bool `json:"finalised,omitempty"` Cancelled bool `json:"cancelled,omitempty"` CancellationNotice []string `json:"cancellationNotice,omitempty"` Published bool `json:"published,omitempty"` ProvisionalDate string `json:"provisionalDate,omitempty"` }
Description represents a page description
type EmergencyBanner ¶ added in v2.4.9
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 Figure ¶ added in v2.4.0
type Figure struct { Title string `json:"title"` Filename string `json:"filename"` Version string `json:"version"` URI string `json:"uri"` }
Figure represents a figure (charts, tables)
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"` EmergencyBanner EmergencyBanner `json:"emergencyBanner"` }
HomepageContent represents the page model of the Zebedee response for the ONS homepage
type HomepageDescription ¶
type Link ¶ added in v2.4.0
type Link struct { Title string `json:"title"` Summary string `json:"summary,omitempty"` URI string `json:"uri"` }
Link represents any link on website
type NodeDescription ¶
type NodeDescription struct {
Title string `json:"title"`
}
NodeDescription represents a node description
type PageDescription ¶ added in v2.9.7
type PageDescription struct { URI string `json:"uri"` Description Description `json:"description"` }
PageDescription represents the content returned by zebedee when requesting a page description
type PageTitle ¶
type PageTitle struct { Title string `json:"title"` Edition string `json:"edition"` URI string `json:"uri"` }
PageTitle represents a page title from zebedee
type PublishedIndex ¶ added in v2.5.0
type PublishedIndex struct { Count int `json:"count"` Items []PublishedIndexItem `json:"items"` Limit int `json:"limit"` Offset int `json:"offset"` TotalCount int `json:"total_count"` }
PublishedIndex represents an index of published content
type PublishedIndexItem ¶ added in v2.5.0
type PublishedIndexItem struct {
URI string `json:"uri"`
}
PublishedIndexItem represents an individual content item returned from the PublishedIndex endpoint
type PublishedIndexRequestParams ¶ added in v2.5.0
PublishedIndexRequestParams represents request parameters for making paged PublishedIndex requests
type Related ¶
type Related = Link
Related stores the Title and URI for any related data (e.g. related publications on a dataset page) Deprecated: use Link
type Release ¶ added in v2.9.7
type Release struct { Markdown []string `json:"markdown"` RelatedDocuments []Link `json:"relatedDocuments"` RelatedDatasets []Link `json:"relatedDatasets"` RelatedMethodology []Link `json:"relatedMethodology"` RelatedMethodologyArticle []Link `json:"relatedMethodologyArticle"` Links []Link `json:"links"` DateChanges []ReleaseDateChange `json:"dateChanges"` URI string `json:"uri"` Description Description `json:"description"` }
type ReleaseDateChange ¶ added in v2.9.7
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