Skip to content

GoDat is an unofficial Go client library for the Codat API.

License

Notifications You must be signed in to change notification settings

pj-simpson/godat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDat

GoDat is an Unofficial Go library for interacting with the Codat API.

Installation

go get github.com/pj-simpson/godat

Usage

Get the Codat token from an enviroment variable. Create a new Codat REST client. Set the pagination query params via the PaginatedResponseOptions struct, to obtain 25 comapanies. Call the 'Get Companies' method and print out the result.

package main

import (
	"fmt"
	"os"

	"github.com/pj-simpson/godat/pkg/godat"
	"github.com/pj-simpson/godat/pkg/models"
)

func main() {
	token := os.Getenv("CODAT_TOKEN")
	codat := godat.NewCodatClient(token)
	page := models.PaginatedResponseOptions{
		Page:     1,
		PageSize: 25,
	}

	comps, err := codat.GetCompanies(&page)

	if err != nil {
		fmt.Printf("%#v", err)
	}

	fmt.Printf("%#v", comps)
}

License

MIT

Caveats

Medium term aim for this package is to wrap the entire Codat Accounting API.

About

GoDat is an unofficial Go client library for the Codat API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages