Skip to content

Latest commit

 

History

History
74 lines (60 loc) · 2.03 KB

README.md

File metadata and controls

74 lines (60 loc) · 2.03 KB

Ziggy

Unofficial Go client library for the Investec OpenAPI

Build Status Go Report Card GoDoc License

Installation

To install ziggy, use go get:

go get github.com/nickcorin/ziggy

Import the ziggy package into your code:

package main

import "github.com/nickcorin/ziggy"

func main() {
	client := ziggy.NewClient("user", "s3cr3t")
}

Usage

Creating a simple client.

client := ziggy.NewClient("user", "s3cr3t")

Configuring the client.

// You can chain configuration functions.
client := ziggy.NewClient("user", "s3cr3t").SetToken("mytoken")

// ...or you can configure it later.
client.SetProxy("https://proxy.ziggy.com")

Obtaining an access token.

token, err := client.GetAccessToken(context.Background(), ziggy.TokenScopeAccounts)
if err != nil {
	log.Fatal(err)
}

Fetching a list of your accounts.

accounts, err := z.GetAccounts(context.Background())
if err != nil {
	log.Fatal(err)
}

...and then fetching an account's balance.

balance, err := z.GetBalance(context.Background(), accounts[0].ID)
if err != nil {
	log.Fatal(err)
}

Contributing

Please feel free to submit issues, fork the repositoy and send pull requests!

License

This project is licensed under the terms of the MIT license.