dp-api-clients-go

module
v1.30.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT

README

dp-api-clients-go Build Status GoDoc

Common client code - in go - for ONS APIs:

  • clientlog - logging
  • codelist
  • dataset
  • filter
  • headers - common API request headers
  • healthcheck -> health
  • hierarchy
  • identity
  • image
  • importapi
  • renderer
  • search
Usage

(WIP) Each client defines two constructor functions: one that creates a new healthcheck client (with a new dp-net/http Clienter), and the other that allows you to provide it externally, so that you can reuse it among different clients.

For example, you may create a new image API client like so:

    import  "github.com/ONSdigital/dp-api-clients-go/image"

    ...
    imageClient := image.NewAPIClient(<url>)
    ...

Or you may create it providing a Healthcheck client:

    import  "github.com/ONSdigital/dp-api-clients-go/image"
    import  "github.com/ONSdigital/dp-api-clients-go/health"

    ...
    hcClient := health.NewClient(<genericName>, <url>)
    imageClient := image.NewWithHealthClient(hcClient)
    ...
Package docs
Tests

Run tests using make test

Licence

Copyright ©‎ 2019, Crown Copyright (Office for National Statistics) (https://www.ons.gov.uk)

Released under MIT license, see LICENSE for details.

Directories

Path Synopsis
headers package provides header name constants and get/set functions for commonly used http headers in the dp-api-clients-go repo.
headers package provides header name constants and get/set functions for commonly used http headers in the dp-api-clients-go repo.

Jump to

Keyboard shortcuts

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