govdata

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultURL = "https://data.gov.ua"

DefaultURL is a URL of official Ukrainian government data platform.

Variables

View Source
var BaseURL = DefaultURL

BaseURL is current base URL used for sending requests.

View Source
var DefaultClient = NewClient()

DefaultClient is a default HTTP client.

Functions

func ResourceRevision

func ResourceRevision(pkg, resource, revision string) (io.ReadCloser, error)

Revision returns information about specific revision of a specific resource. This is not a part of API, but it pretty important method for downloading updated version of a resource.

func Subscribe

func Subscribe(id string, ids ...string) <-chan Revision

Types

type Client

type Client struct {
	http.Client
}

Client is wrapper of http.Client for Ukrainian government data platform.

func NewClient

func NewClient() *Client

NewClient creates new instance of client with timeout equal 5 seconds.

func (*Client) ResourceRevision

func (client *Client) ResourceRevision(ctx context.Context, pkg, resource, revision string) (io.ReadCloser, error)

Revision returns information about specific revision of a specific resource. This is not a part of API, but it pretty important method for downloading updated version of a resource.

func (*Client) ResourceShow

func (client *Client) ResourceShow(ctx context.Context, id string) (*Resource, error)

ResourceShow returns information about resource by it's unique id. For more information: https://data.gov.ua/pages/aboutuser2.

type Resource

type Resource struct {
	Revisions []Revision `json:"resource_revisions"`
	PackageID string     `json:"package_id"`
}

Resource represents detailed information about resource and it's changes.

func ResourceShow

func ResourceShow(id string) (*Resource, error)

ResourceShow returns information about resource by it's unique id. For more information: https://data.gov.ua/pages/aboutuser2.

type Response

type Response struct {
	Result json.RawMessage `json:"result"`
}

Response is a general structure of platform response.

type Revision

type Revision struct {
	ID              string  `json:"id"`
	MimeType        string  `json:"mimetype"`
	Name            string  `json:"name"`
	Format          string  `json:"format"`
	URL             string  `json:"url"`
	FileHashSum     *string `json:"file_hash_sum"`
	ResourceCreated string  `json:"resource_created"`
	Size            int     `json:"size"`
}

Revision is an represents changes of a resource.

type Subscription

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

func NewSubscription

func NewSubscription(id string) *Subscription

Jump to

Keyboard shortcuts

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