Documentation
¶
Index ¶
- type Client
- func (c *Client) Checker(ctx context.Context, check *health.CheckState) error
- func (c *Client) GetCodeByID(ctx context.Context, userAuthToken string, serviceAuthToken string, ...) (CodeResult, error)
- func (c *Client) GetCodeListEditions(ctx context.Context, userAuthToken string, serviceAuthToken string, ...) (EditionsListResults, error)
- func (c *Client) GetCodes(ctx context.Context, userAuthToken string, serviceAuthToken string, ...) (CodesResults, error)
- func (c *Client) GetDatasetsByCode(ctx context.Context, userAuthToken string, serviceAuthToken string, ...) (DatasetsResult, error)
- func (c *Client) GetGeographyCodeLists(ctx context.Context, userAuthToken string, serviceAuthToken string) (CodeListResults, error)
- func (c *Client) GetIDNameMap(ctx context.Context, userAuthToken string, serviceAuthToken string, id string) (map[string]string, error)
- func (c *Client) GetValues(ctx context.Context, userAuthToken string, serviceAuthToken string, id string) (DimensionValues, error)
- func (c *Client) HealthClient() *healthcheck.Client
- func (c *Client) URL() string
- type CodeLinks
- type CodeList
- type CodeListLinks
- type CodeListResults
- type CodeResult
- type CodesResults
- type Dataset
- type DatasetEdition
- type DatasetEditionLink
- type DatasetLinks
- type DatasetsResult
- type DimensionValues
- type EditionsList
- type EditionsListLink
- type EditionsListResults
- type ErrInvalidCodelistAPIResponse
- type Item
- type Link
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
}
Client is a codelist api client which can be used to make requests to the server
func NewWithHealthClient ¶
func NewWithHealthClient(hcCli *healthcheck.Client) *Client
NewWithHealthClient creates a new instance of CodelistAPI Client, reusing the URL and Clienter from the provided healthcheck client.
func (*Client) Checker ¶
Checker calls codelist api health endpoint and returns a check object to the caller.
func (*Client) GetCodeByID ¶
func (c *Client) GetCodeByID(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string, codeID string) (CodeResult, error)
GetCodeByID returns information about a code
func (*Client) GetCodeListEditions ¶
func (c *Client) GetCodeListEditions(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string) (EditionsListResults, error)
GetCodeListEditions returns the editions for a codelist
func (*Client) GetCodes ¶
func (c *Client) GetCodes(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string) (CodesResults, error)
GetCodes returns the codes for a specific edition of a code list
func (*Client) GetDatasetsByCode ¶
func (c *Client) GetDatasetsByCode(ctx context.Context, userAuthToken string, serviceAuthToken string, codeListID string, edition string, codeID string) (DatasetsResult, error)
GetDatasetsByCode returns datasets containing the codelist codeID.
func (*Client) GetGeographyCodeLists ¶
func (c *Client) GetGeographyCodeLists(ctx context.Context, userAuthToken string, serviceAuthToken string) (CodeListResults, error)
GetGeographyCodeLists returns the geography codelists
func (*Client) GetIDNameMap ¶
func (c *Client) GetIDNameMap(ctx context.Context, userAuthToken string, serviceAuthToken string, id string) (map[string]string, error)
GetIDNameMap returns dimension values in the form of an id name map
func (*Client) GetValues ¶
func (c *Client) GetValues(ctx context.Context, userAuthToken string, serviceAuthToken string, id string) (DimensionValues, error)
GetValues returns dimension values from the codelist api
func (*Client) HealthClient ¶
func (c *Client) HealthClient() *healthcheck.Client
HealthClient returns the underlying Healthcheck Client for this codelistAPI client
type CodeLinks ¶
type CodeLinks struct {
CodeLists Link `json:"code_lists"`
Datasets Link `json:"datasets"`
Self Link `json:"self"`
}
CodeLinks represents the links an individual code item has
type CodeList ¶
type CodeList struct {
Links CodeListLinks `json:"links"`
}
CodeList containing links to all possible codes
type CodeListLinks ¶
CodeListLinks contains links for a code list resource
type CodeListResults ¶
type CodeListResults struct {
Items []CodeList `json:"items"`
Count int `json:"count"`
Offset int `json:"offset"`
Limit int `json:"limit"`
TotalCount int `json:"total_count"`
}
CodeListResults contains an array of code lists which can be paginated
type CodeResult ¶
CodeResult represents a code list item
type CodesResults ¶
type CodesResults struct {
Items []Item `json:"items"`
Count int `json:"count"`
Offset int `json:"offset"`
Limit int `json:"limit"`
TotalCount int `json:"total_count"`
}
CodesResults contains the list of codes for a specific code list and edition
type Dataset ¶
type Dataset struct {
Links DatasetLinks `json:"links"`
DimensionLabal string `json:"dimension_label"`
Editions []DatasetEdition `json:"editions"`
}
type DatasetEdition ¶
type DatasetEdition struct {
Links DatasetEditionLink `json:"links"`
}
type DatasetEditionLink ¶
type DatasetLinks ¶
type DatasetLinks struct {
Self Link `json:"self"`
}
type DatasetsResult ¶
type DimensionValues ¶
type DimensionValues struct {
Items []Item `json:"items"`
NumberOfResults int `json:"number_of_results"`
}
DimensionValues represent the dimension values returned by the codelist api
type EditionsList ¶
type EditionsList struct {
Edition string `json:"edition"`
Label string `json:"label"`
Links EditionsListLink `json:"links"`
}
EditionsList containing links to all possible codes
type EditionsListLink ¶
type EditionsListLink struct {
Self *Link `json:"self"`
Editions *Link `json:"editions"`
Codes *Link `json:"codes"`
}
EditionsListLink contains links for a code list resource
type EditionsListResults ¶
type EditionsListResults struct {
Items []EditionsList `json:"items"`
Count int `json:"count"`
Offset int `json:"offset"`
Limit int `json:"limit"`
TotalCount int `json:"total_count"`
}
EditionsListResults contains an array of code lists which can be paginated
type ErrInvalidCodelistAPIResponse ¶
type ErrInvalidCodelistAPIResponse struct {
// contains filtered or unexported fields
}
ErrInvalidCodelistAPIResponse is returned when the codelist api does not respond with a valid status
func (ErrInvalidCodelistAPIResponse) Code ¶
func (e ErrInvalidCodelistAPIResponse) Code() int
Code returns the status code received from code list api if an error is returned
func (ErrInvalidCodelistAPIResponse) Error ¶
func (e ErrInvalidCodelistAPIResponse) Error() string
Error should be called by the user to print out the stringified version of the error