Documentation
¶
Index ¶
- func DatasetVersionURL(datasetID, edition, version string) string
- func DatasetVersionURLWithTopic(topicSlug, datasetID, edition, version string) string
- func ExtractDatasetInfoFromPath(path string) (datasetID, edition, version string, err error)
- func GenerateSharingLink(socialType, currentURL, title string) string
- func GetAPIRouterVersion(rawurl string) (string, error)
- func GetContactDetails(d dpDatasetApiModels.Dataset) (contact.Details, bool)
- func GetCurrentURL(lang, siteDomain, urlPath string) string
- func GetDistributionFileURL(distributionList *[]dpDatasetApiModels.Distribution, requestedFormat string) string
- func GetDownloadFileURL(downloadList *dpDatasetApiModels.DownloadList, requestedFormat string) string
- func GetLatestVersionID(versionsList dpDatasetApiSdk.VersionsList) int
- func GetOSRLogoDetails(language string) osrlogo.OSRLogo
- func HasStringInSlice(a string, list []string) bool
- func IsBoolPtr(val *bool) bool
- func MapDownloadObjectExtensions(downloadList *dpDatasetApiModels.DownloadList) map[*dpDatasetApiModels.DownloadObject]string
- func MapVersionDownloads(sharedModelVersion *sharedModel.Version, ...)
- func PersistExistingParams(values []string, key, ignoreValue string, q url.Values)
- func PrefixPathWithTopic(topicID, rawURL string) (string, error)
- func ToBoolPtr(val bool) *bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DatasetVersionURL ¶ added in v1.56.0
DatasetVersionURL constructs a dataset version URL from the provided datasetID, edition and version values
func DatasetVersionURLWithTopic ¶ added in v1.81.0
DatasetVersionURLWithTopic constructs a dataset version URL with topic from the provided topicSlug, datasetID, edition and version values. This is used for static datasets as they require the topic prefix in the URL.
func ExtractDatasetInfoFromPath ¶
ExtractDatasetInfoFromPath gets the datasetID, edition and version from a given path
func GenerateSharingLink ¶ added in v1.28.0
GenerateSharingLink returns a sharing link for different types of social media
func GetAPIRouterVersion ¶ added in v1.18.0
GetAPIRouterVersion returns the path of the provided url, which corresponds to the api router version
func GetContactDetails ¶ added in v1.70.0
func GetContactDetails(d dpDatasetApiModels.Dataset) (contact.Details, bool)
Collects the contact details of a datset into a contacts object and provides a HasContactDetails flag.
func GetCurrentURL ¶ added in v1.56.0
GetCurrentURL returns a string of the current URL from language, site domain and url path parameters
func GetDistributionFileURL ¶ added in v1.69.0
func GetDistributionFileURL(distributionList *[]dpDatasetApiModels.Distribution, requestedFormat string) string
Loops through the input list of distributions to find a distribution with a format that matches the requested format. If a matching distribution is found, the download URL of that distribution is returned. If no matching distribution is found, it returns an empty string.
func GetDownloadFileURL ¶ added in v1.69.0
func GetDownloadFileURL(downloadList *dpDatasetApiModels.DownloadList, requestedFormat string) string
Loops through a list of download objects to find a download with a format that matches the requested format. If a matching download object is found, it returns the HRef (URL) of that download object. If no matching download object is found, it returns an empty string.
func GetLatestVersionID ¶ added in v1.71.0
func GetLatestVersionID(versionsList dpDatasetApiSdk.VersionsList) int
func GetOSRLogoDetails ¶ added in v1.63.0
GetOSRLogoDetails returns the official statistics logo details based on the language
func HasStringInSlice ¶ added in v1.39.0
HasStringInSlice checks for a string within in a string array
func MapDownloadObjectExtensions ¶ added in v1.69.0
func MapDownloadObjectExtensions(downloadList *dpDatasetApiModels.DownloadList) map[*dpDatasetApiModels.DownloadObject]string
Creates a mapping from download objects to their corresponding file extension strings
func MapVersionDownloads ¶ added in v1.69.0
func MapVersionDownloads(sharedModelVersion *sharedModel.Version, downloadList *dpDatasetApiModels.DownloadList)
Maps download objects from a dp-dataset-api Version to download details, including file extensions, sizes, and URIs
func PersistExistingParams ¶ added in v1.39.0
PersistExistingParams persists existing query string values and ignores a given value
func PrefixPathWithTopic ¶ added in v1.81.0
PrefixPathWithTopic returns the path of rawURL prefixed with topicID. The first path segment (assumed to be the API Router version) is always removed because frontend routes do not include the API version prefix.
Types ¶
This section is empty.