Skip to content

valuetechdev/api-client-24so

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

24SevenOffice API client for Go

This package contains a generated API client based on the 24SevenOffice's SOAP API and payroll Swagger API.

Services currently covered in the package

Usage

go get github.com/valuetechdev/api-client-24so

Go example

import (
	"github.com/valuetechdev/api-client-24so/so24"
	"github.com/valuetechdev/api-client-24so/so24/account24"
)

func func() {
   so24Client, err := so24.NewAuthenticatedClient()
   if err != nil {
      return nil, err
   }

   so24RatesResult, err := so24Client.Account.GetTaxCodeList(&account24.GetTaxCodeList{})
   if err != nil {
      return nil, err
   }

   // Use the data
}

To use the API, you need to log in with username, password and applicationId. These are read from as environment variables.

The names are:

  • TWENTYFOURSEVEN_API_APPLICATIONID
  • TWENTYFOURSEVEN_API_USERNAME
  • TWENTYFOURSEVEN_API_PASSWORD

The program will panic in any are missing.

Usage is described in 24SevenOffice's API documentation

Changing identity

By default the client uses your accounts default identity (the one you log in to automatically in the UI).

id := auth24.Guid("new-identity")
_, err = so24Client.Auth.SetIdentityById(&auth24.SetIdentityById{IdentityId: &id})
if err != nil {
   return nil, err
}

SOAP: Adding or updating services

  1. Add or replace the .wsdl-file in ./wsdl/so24-directory, follow the same naming-convention as 24SevenOffice.
  2. Add the new service in clientsToGenerate in generate24.go.
  3. Add the new service in Client struct in client.go.
  4. Run make generate.
  5. Open a new PR.

Things to know

  • Only the payroll-API is using OpenAPI/Swagger.
    • It's originally based on Swagger 2.0, but it was converted to OpenAPI 3 using npx swagger2openapi -o <openapi>.json <swagger2>.json
    • It has been altered to with defined schemas/models that was missing.

About

24SevenOffice Api client for go

Resources

License

Stars

Watchers

Forks

Packages

No packages published