Categorygithub.com/companieshouse/api-sdk-manager-go-library

# Packages

No description provided by the author

# README

api-sdk-manager-go-library

Go implementation of the api-sdk-manager-java-library, to be used instead of go-sdk-manager when there is no session present to get the authorisation, so that the session manager is not needlessly imported. Users of the SDK will interact with the SDK manager, which wraps up some useful functionality that determines whether to initialise an OAuth2 or API Key-authenticated http client.

Requirements

In order to build this library locally you will need the following:

Getting started

The library is built using the following commands:

go get ./...
go build

Testing

The library can be tested by running the following in the command line (in the api-sdk-manager-go-library directory):

goconvey

Note: this library is not a standalone service, and can only be used within services or other libraries.

Environment Variables

The following environment variables are required when integrating the SDK manager into any Go service.

Note: These are OAuth2 config items, and are standard when using OAuth2.

KeyDescriptionScopeMandatory
OAUTH2_CLIENT_IDThe application ID of the clientConfigY
OAUTH2_CLIENT_SECRETThe application secret of the clientConfigY
OAUTH2_REDIRECT_URIThe URL that OAuth2 will redirect to after authorisationConfigY
OAUTH2_AUTH_URIThe authorisation endpointConfigY
OAUTH2_TOKEN_URIThe token endpointConfigY
SCOPEOptional requested permissionsConfigN
API_KEYThe application access key for the APIConfigY
API_URLThe application endpoint for the APIConfigY

Example library usage

To use the Manager package, add the following to the relevant package import:

  • "github.com/companieshouse/api-sdk-manager-go-library/manager"