employmenthero

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 10 Imported by: 0

README

CircleCI Coverage Status Go Reference

Go client for EmploymentHero REST API

The official EmploymentHero Go client library.

Requirements

  • Go 1.16 or later

Installation

Make sure your project is using Go Modules (it will have a go.mod file in its root if it already is):

go mod init

Then, reference stripe-go in a Go program with import:

import (
	"github.com/Thinkei/employmenthero-go"
)

Run any of the normal go commands (build/install/test). The Go toolchain will resolve and fetch the stripe-go module automatically.

Alternatively, you can also explicitly go get the package into a project:

go get -u github.com/Thinkei/employmenthero-go

Documentation

For a conprehensive list of examples, check out the API documentation

For details on all funtionality in this library, check out the Go documentation

Below are a few of simple examples:

Auth
import "github.com/Thinkei/employmenthero-go"

// Create a client instance
c, err := employmenthero.NewClient("clientID", "secretID", "redirectUri", "OAuthHost", "apiHost")
c.SetLog(os.Stdout) // Set log to terminal stdout

// Get Authorization code and then use it to get the EH OAuth2 Access tokens
authroizationCode = "<authorizationCode>"
responseToken, err := client.GetOAuth2Access(ctx, authorizationCode)

// Save the refresh_token to anywhere you want,
// but use it when you call other APIs to get our resources
refreshToken := responseToken.RefreshToken
c.SetRefreshToken(responseToken.RefreshToken)

// call other APIs
organisationsResp, err := client.ListOrganisations(ctx, employmenthero.ListParams{})

if err != nil {
	fmt.Printf("Get Organisation failed - %s", err)
}

fmt.Println(organisationsResp.Data.Items)
List Organisations
response, err := c.ListOrganisations(context.TODO(), ListParams{})
organistaions := response.Data.Items
Get Organisation details
response, err := c.GetOrganisation(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx")
organistaion := response.Data
List Employees
response, err := c.ListEmployees(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", ListParams{})
employees := response.Data.Items
Get Employee details
response, err := c.GetEmployee(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "90a34ef1-50e4-4930-a9d6-yyyy")
employee := response.Data
List Leave Requests
response, err := c.ListLeaveRequests(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", ListParams{})
leaveRequests := response.Data.Items
Get Leave Request details
response, err := c.GetLeaveRequest(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "90a34ef1-50e4-4930-a9d6-yyyy")
leaveRequest := response.Data
List Timesheet Entries
response, err := c.ListTimesheetEntries(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "-", ListParams{})
timesheetEntries := response.Data.Items
List Employemnt Histories
response, err := c.ListEmploymentHistories(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "xxxxxx-yyyy", ListParams{})
employmentHistories := response.Data.Items
List Emergency Contacts
response, err := c.ListEmergencyContacts(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "xxxx-yyy", ListParams{})
contacts := response.Data.Items
List Teams
response, err := c.ListTeams(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", ListParams{})
teams := response.Data.Items
List Employees by Team
response, err := c.ListEmployeesByTeam(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXXX-YYYY-ZZZZ", ListParams{})
employees := response.Data.Items
List Bank Accounts
response, err := c.ListBankAccounts(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
bankAccounts := response.Data.Items
Get Tax Declaration of 1 Employee
response, err := c.GetTaxDeclaration(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
taxDeclaration := response.Data
Get Superannuation Detail of 1 Employee
response, err := c.GetSuperannuationDetail(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
superannuationDetail := response.Data
List Pay Details
response, err := c.ListPayDetails(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
payDetails := response.Data.Items
List Certification
response, err := c.ListCertifications(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", ListParams{})
certifications := response.Data.Items
List Policies
response, err := c.ListPolicies(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", ListParams{})
policies := response.Data.Items
List Employee Certifications
response, err := c.ListEmployeeCertifications(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
employeeCertifications := response.Data.Items
List Payslips
response, err := c.ListPayslips(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
payslips := response.Data.Items

Development

Pull requests from the community are welcome. If you submit one, please keep the following guidelines in mind:

  1. Code must be go fmt compliant.
  2. Ensure that go test succeeds.

Test

The test suite needs testify's require package to run:

github.com/stretchr/testify/require

Before running the tests, make sure to grab all of the package's dependencies:

go get -t -v

Run all tests:

make test

For any requests, bug or comments, please [open an issue][issues] or [submit a pull request][pulls].

Documentation

Overview

Package employmenthero provides the binding for EmploymentHero REST APIs.

Index

Constants

View Source
const (
	RequestNewTokenBeforeExpiresIn = time.Duration(60) * time.Second // The TTL (Time To Live) of the access token

)

Variables

This section is empty.

Functions

This section is empty.

Types

type BankAccount

type BankAccount struct {
	Id             string `json:"id"` // Unique identifier for the object. (UUID format)
	AccountName    string `json:"account_name"`
	AccountNumber  string `json:"account_number"`
	Bsb            string `json:"bsb"`
	Amount         string `json:"amount"`
	PrimaryAccount bool   `json:"primary_account"`
}

BankAccount is the details of one BankAccount resource in EH system. [BankAccount Example]: https://developer.employmenthero.com/api-references/#the-bank-account-object

type BankAccountList

type BankAccountList struct {
	Items []BankAccount `json:"items"`
	ListResponse
}

type BankAccountListReponse

type BankAccountListReponse struct {
	Data BankAccountList `json:"data"`
}

type BasicData

type BasicData struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type Certification

type Certification struct {
	Id   string `json:"id"` // Unique identifier for the object. (UUID format)
	Name string `json:"name"`
	Type string `json:"type"`
}

Certification is the details of one Certification resource in EH system. [Certification Example]: https://developer.employmenthero.com/api-references/#the-certification-object

type CertificationListData

type CertificationListData struct {
	Items []Certification `json:"items"`
	ListResponse
}

type CertificationListResponse

type CertificationListResponse struct {
	Data CertificationListData `json:"data"`
}

type Client

type Client struct {

	// ClientID is a unique string representing the registration OAuth 2.0 application.
	ClientID string
	// Secret is a random secret used by client to authenticate to the Employment Hero Authorisation Server.
	Secret string
	// RedirectURI is one of your specified redirect url(s) in your OAuth 2.0 application
	RedirectURI string
	// The host of RESTful EmploymentHero API - https://api.employmenthero.com
	APIBase string
	// The host of OAuth2 EmploymentHero API - https://oauth.employmenthero.com
	OAuthBase string
	Client    HTTPClient
	Token     *TokenResponse
	Log       io.Writer
	// contains filtered or unexported fields
}

A Client is an entry point of this package, it includes all needded configurations and functions that we need to call EmploymentHero Apis

func NewClient

func NewClient(clientID, secret, redirectUri, OAuthBase, APIBase string) (*Client, error)

NewClient returns a new Client struct

func (*Client) GetAccessToken

func (c *Client) GetAccessToken(ctx context.Context) (*TokenResponse, error)

func (*Client) GetEmployee

func (c *Client) GetEmployee(ctx context.Context, oid string, eid string) (*EmployeeResponse, error)

Get returns the details of an Employee resource

Example:

response, err := c.GetEmployee(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "90a34ef1-50e4-4930-a9d6-yyyy")
employee := response.Data

func (*Client) GetLeaveRequest

func (c *Client) GetLeaveRequest(ctx context.Context, oid string, lid string) (*LeaveRequestResponse, error)

Get returns the details of one LeaveRequest resource

Example:

response, err := c.GetLeaveRequest(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "90a34ef1-50e4-4930-a9d6-yyyy")
leaveRequest := response.Data

func (*Client) GetOAuth2Access

func (c *Client) GetOAuth2Access(ctx context.Context, code string) (*TokenResponse, error)

GetOAuth2Access will call a HTTP request to EH OAuth server to authenticate with the input authorization code. If the API call is succeed, GetOAuth2Access will set the response into Token filed of the current Client instance

A successful GetOAuth2Access returns err == nil and a TokenResponse A failed GetOAuth2Access returns an error and TokenResponse == nil

func (*Client) GetOrganisation

func (c *Client) GetOrganisation(ctx context.Context, oid string) (*OrganisationResponse, error)

Get returns the details of one Organisation resource that the current user can access into

Example:

response, err := c.GetOrganisation(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx")
organistaion := response.Data

func (*Client) GetSuperannuationDetail

func (c *Client) GetSuperannuationDetail(ctx context.Context, oid string, eid string, ep ListParams) (*SuperannuationDetailResponse, error)

Get returns a list of SuperannuationDetail resources of one employee

Example:

response, err := c.GetSuperannuationDetail(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
superannuationDetail := response.Data

func (*Client) GetTaxDeclaration

func (c *Client) GetTaxDeclaration(ctx context.Context, oid string, eid string, ep ListParams) (*TaxDelcarationResponse, error)

Get returns a list of TaxDeclaration resources of one employee

Example:

response, err := c.GetTaxDeclaration(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
taxDeclaration := response.Data

func (*Client) ListBankAccounts

func (c *Client) ListBankAccounts(ctx context.Context, oid string, eid string, ep ListParams) (*BankAccountListReponse, error)

Get returns a list of BankAccount resources of one employee

Example:

response, err := c.ListBankAccounts(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
bankAccounts := response.Data.Items

func (*Client) ListCertifications

func (c *Client) ListCertifications(ctx context.Context, oid string, tp ListParams) (*CertificationListResponse, error)

Get returns a list of [certification] resources

Example:

response, err := c.ListCertifications(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", ListParams{})
certifications := response.Data.Items

func (*Client) ListEmergencyContacts

func (c *Client) ListEmergencyContacts(ctx context.Context, oid string, eid string, ep ListParams) (*EmergencyContactListResponse, error)

Get returns a list of EmergencyContact resources of one employee

Example:

response, err := c.ListEmergencyContacts(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "xxxx-yyy", ListParams{})
contacts := response.Data.Items

func (*Client) ListEmployeeCertifications

func (c *Client) ListEmployeeCertifications(ctx context.Context, oid string, eid string, hp ListParams) (*EmployeeCertificationListResponse, error)

Get returns a list of EmployeeCertification resources of one employee

Example:

response, err := c.ListEmployeeCertifications(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
employeeCertifications := response.Data.Items

func (*Client) ListEmployees

func (c *Client) ListEmployees(ctx context.Context, oid string, ep ListParams) (*EmployeeListReponse, error)

Get returns a list of Employee resources

Example:

response, err := c.ListEmployees(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", ListParams{})
employees := response.Data.Items

func (*Client) ListEmployeesByTeam

func (c *Client) ListEmployeesByTeam(ctx context.Context, oid string, tid string, tp ListParams) (*EmployeeListReponse, error)

Get returns a list of Employee resources which belong to one Team

Example:

response, err := c.ListEmployeesByTeam(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXXX-YYYY-ZZZZ", ListParams{})
employees := response.Data.Items

func (*Client) ListEmploymentHistories

func (c *Client) ListEmploymentHistories(ctx context.Context, oid string, eid string, hp ListParams) (*EmploymentHistoryListResponse, error)

Get returns a list of EmploymentHistory resources of one employee

Example:

response, err := c.ListEmploymentHistories(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "xxxxxx-yyyy", ListParams{})
employmentHistories := response.Data.Items

func (*Client) ListLeaveRequests

func (c *Client) ListLeaveRequests(ctx context.Context, oid string, ep ListParams) (*LeaveRequestListResponse, error)

Get returns a list of LeaveRequest resources

Example:

response, err := c.ListLeaveRequests(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", ListParams{})
leaveRequests := response.Data.Items

func (*Client) ListOrganisations

func (c *Client) ListOrganisations(ctx context.Context, op ListParams) (*OrganisationListResponse, error)

Get returns a list of Organisation resources that the current user can access into

Example:

response, err := c.ListOrganisations(context.TODO(), ListParams{})
organistaions := response.Data.Items

func (*Client) ListPayDetails

func (c *Client) ListPayDetails(ctx context.Context, oid string, eid string, tp ListParams) (*PayDetailListResponse, error)

Get returns a list of PayDetail resources of one employee

Example:

response, err := c.ListPayDetails(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
payDetails := response.Data.Items

func (*Client) ListPayslips

func (c *Client) ListPayslips(ctx context.Context, oid string, eid string, hp ListParams) (*PayslipListReponse, error)

Get returns a list of Payslip resources

Example:

response, err := c.ListPayslips(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "XXX-YY-ZZZ", ListParams{})
payslips := response.Data.Items

func (*Client) ListPolicies

func (c *Client) ListPolicies(ctx context.Context, oid string, tp ListParams) (*PolicyListResponse, error)

Get returns a list of Policy resources

Example:

response, err := c.ListPolicies(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", ListParams{})
policies := response.Data.Items

func (*Client) ListTeams

func (c *Client) ListTeams(ctx context.Context, oid string, tp ListParams) (*TeamListDataResponse, error)

Get returns a list of Team resources

Example:

response, err := c.ListTeams(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", ListParams{})
teams := response.Data.Items

func (*Client) ListTimesheetEntries

func (c *Client) ListTimesheetEntries(ctx context.Context, oid string, eid string, tp ListParams) (*TimesheetListResponse, error)

Get returns a list of [TimehseetEntry] resources

Example:

response, err := c.ListTimesheetEntries(context.TODO(), "90a34ef1-50e4-4930-a9d6-xxxx", "-", ListParams{})
timesheetEntries := response.Data.Items

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, url string, payload interface{}) (*http.Request, error)

NewRequest helps us build a http request with context.Context

func (*Client) Send

func (c *Client) Send(req *http.Request, v interface{}) error

func (*Client) SendWithAuth

func (c *Client) SendWithAuth(req *http.Request, v interface{}) error

SendWithAuth send a request to EH Backend with an added header automatically. If an access_token is soon expired, it will try to re-new it before making a new request client.Token will be updated when changed

func (*Client) SetLog

func (c *Client) SetLog(log io.Writer)

SetLog will set/change the output destination.

func (*Client) SetRefreshToken

func (c *Client) SetRefreshToken(refreshToken string)

SetRefreshToken will set/change the refreshToken value of the current client instance

It will re-initialize the [Token] value of Client and wipe out the old Token values that includes `ExpiresIn`, `AccessToken`, `RefreshToken`

type EmergencyContact

type EmergencyContact struct {
	Id                   int    `json:"id"` // Unique identifier for the object. (Integer)
	ContactName          string `json:"contact_name"`
	DaytimeContactNumber string `json:"daytime_contact_number"`
	AfterHoursNo         string `json:"after_hours_no"`
	AfterMobileNo        string `json:"after_mobile_no"`
	Relationship         string `json:"relationship"`
	ContactType          string `json:"contact_type"`
}

EmergencyContact is the details of one EmergencyContact resource in EH system. [EmergencyContact Example]: https://developer.employmenthero.com/api-references/#the-emergency-contact-object

type EmergencyContactList

type EmergencyContactList struct {
	Items []EmergencyContact `json:"items"`
	ListResponse
}

type EmergencyContactListResponse

type EmergencyContactListResponse struct {
	Data EmergencyContactList `json:"data"`
}

type Employee

type Employee struct {
	Id                   string      `json:"id"` // Unique identifier for the object. (UUID format)
	AccountEmail         string      `json:"account_email"`
	Title                string      `json:"title"`
	Role                 string      `json:"role"`
	FirstName            string      `json:"first_name"`
	LastName             string      `json:"last_name"`
	MiddleName           string      `json:"MiddleName"`
	Address              string      `json:"address"`
	AvatarURL            string      `json:"avatar_url"`
	KnownAs              string      `json:"known_as"`
	JobTitle             string      `json:"job_title"`
	Gender               string      `json:"gender"`
	Country              string      `json:"country"`
	Nationality          string      `json:"nationality"`
	DateOfBirth          string      `json:"date_of_birth"`
	MartialStatus        string      `json:"martial_status"`
	PersonalEmail        string      `json:"personal_email"`
	PersonalMobileNumber string      `json:"personal_mobile_number"`
	HomePhone            string      `json:"home_phone"`
	EmployingEntity      string      `json:"employing_entity"`
	Code                 string      `json:"code"`
	Location             string      `json:"location"`
	CompanyEmail         string      `json:"company_email"`
	CompanyNumber        string      `json:"company_number"`
	CompanyLandline      string      `json:"company_landline"`
	StartDate            string      `json:"start_date"`
	TerminationDate      string      `json:"termination_date"`
	PrimaryCostCentre    BasicData   `json:"primary_cost_centre"`
	SecondaryCostCentres []BasicData `json:"secondary_cost_centres"`
	PrimaryManager       BasicData   `json:"primary_manager"`
	SecondaryManager     BasicData   `json:"secondary_manager"`
	ExternalId           string      `json:"external_id"`
}

Employee is the details of one Employee resource in EH system. [Employee Example]: https://developer.employmenthero.com/api-references/#the-employee-object

type EmployeeCertification

type EmployeeCertification struct {
	Id              string `json:"id"` // Unique identifier for the object. (UUID format)
	Name            string `json:"name"`
	CertificationId string `json:"certification_id"`
	Type            string `json:"type"`
	ExpiryDate      string `json:"expiry_date"`
	CompletionDate  string `json:"completion_date"`
	DriverProblem   bool   `json:"driver_problem"`
	DriverDetails   string `json:"driver_details"`
	Status          string `json:"status"`
	Reason          string `json:"reason"`
}

EmployeeCertification is the details of one Certification resource of one employee in EH system [EmployeeCertification Example]: https://developer.employmenthero.com/api-references/#the-employee-certification-object

type EmployeeCertificationList

type EmployeeCertificationList struct {
	Items []EmployeeCertification `json:"items"`
	ListResponse
}

type EmployeeCertificationListResponse

type EmployeeCertificationListResponse struct {
	Data EmployeeCertificationList `json:"data"`
}

type EmployeeListData

type EmployeeListData struct {
	Items []Employee `json:"items"`
	ListResponse
}

type EmployeeListReponse

type EmployeeListReponse struct {
	Data EmployeeListData `json:"data"`
}

type EmployeeResponse

type EmployeeResponse struct {
	Data Employee `json:"data"`
}

type EmploymentHistory

type EmploymentHistory struct {
	Id             string `json:"id"` // Unique identifier for the object. (UUID format)
	Title          string `json:"title"`
	StartDate      string `json:"start_date"`
	EndDate        string `json:"end_date"`
	EmploymentType string `json:"employment_type"`
}

EmploymentHistory is the details of one employment history resource in EH system. [EmploymentHistory Example]: https://developer.employmenthero.com/api-references/#the-employment-history-object

type EmploymentHistoryList

type EmploymentHistoryList struct {
	Items []EmploymentHistory `json:"items"`
	ListResponse
}

type EmploymentHistoryListResponse

type EmploymentHistoryListResponse struct {
	Data EmploymentHistoryList `json:"data"`
}

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response
}

Reason for the failure.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type LeaveRequest

type LeaveRequest struct {
	Id                 string  `json:"id"` // Unique identifier for the object. (UUID format)
	StartDate          string  `json:"start_date"`
	EndDate            string  `json:"end_date"`
	TotalHours         float32 `json:"total_hours"`
	Comment            string  `json:"comment"`
	Status             string  `json:"status"`
	LeaveBalanceAmount float32 `json:"leave_balance_amount"`
	LeaveCategoryName  string  `json:"leave_category_name"`
	Reason             string  `json:"reason"`
	EmployeeId         string  `json:"employee_id"`
}

LeaveRequest is the details of one LeaveRequest resource in EH system. [LeaveRequest Example]: https://developer.employmenthero.com/api-references/#the-leave-request-object

type LeaveRequestListData

type LeaveRequestListData struct {
	Items []LeaveRequest `json:"items"`
	ListResponse
}

type LeaveRequestListResponse

type LeaveRequestListResponse struct {
	Data LeaveRequestListData `json:"data"`
}

type LeaveRequestResponse

type LeaveRequestResponse struct {
	Data LeaveRequest `json:"data"`
}

type ListParams

type ListParams struct {
	PageIndex   string `json:"page_index"`    // Default: 1
	ItemPerPage string `json:"item_per_page"` // Default: 20
}

type ListResponse

type ListResponse struct {
	PageIndex   int `json:"page_index"`
	ItemPerPage int `json:"item_per_page"`
	TotalPages  int `json:"total_pages"`
	TotalItems  int `json:"total_items"`
}

type Organisation

type Organisation struct {
	Id      string `json:"id"` // Unique identifier for the object. (UUID format)
	Name    string `json:"name"`
	Phone   string `json:"phone"`
	Country string `json:"country"`
	LogoURL string `json:"logo_url"`
}

Organisation is an object of one Organisation resource in EH system. It must be managed by you or the organisation which you work for.

type OrganisationData

type OrganisationData struct {
	Items []Organisation `json:"items"`
	ListResponse
}

type OrganisationDetail

type OrganisationDetail struct {
	Id                    string   `json:"id"` // Unique identifier for the object. (UUID format)
	Name                  string   `json:"name"`
	Phone                 string   `json:"phone"`
	Country               string   `json:"country"`
	LogoURL               string   `json:"logo_url"`
	PrimaryAddress        string   `json:"primary_address"`
	EndOfWeek             string   `json:"end_of_week"`
	TypicalWorkDay        string   `json:"typical_work_day"`
	PayrollAdminEmails    []string `json:"payroll_admin_emails"`
	SubscriptionPlan      string   `json:"subscription_plan"`
	SuperfundName         string   `json:"superfund_name"`
	EmployeesCount        int      `json:"employees_count"`
	ActiveEmployeesCount  int      `json:"active_employees_count"`
	PendingEmployeesCount int      `json:"pending_employees_count"`
	TimeZone              string   `json:"time_zone"`
	CreatedAt             string   `json:"created_at"`
}

OrganisationDetail is the details of one Organisation resource in EH system. It must be managed by you or the organisation which you work for. [Organistaion Example]: https://developer.employmenthero.com/api-references/#the-organisation-object

type OrganisationListResponse

type OrganisationListResponse struct {
	Data OrganisationData `json:"data"`
}

type OrganisationResponse

type OrganisationResponse struct {
	Data OrganisationDetail `json:"data"`
}

type PayDetail

type PayDetail struct {
	Id                     string  `json:"id"` // Unique identifier for the object. (UUID format)
	EffectiveFrom          string  `json:"effective_from"`
	Classification         string  `json:"classification"`
	IndustrialInstrument   string  `json:"industrial_instrument"`
	PayRateTemplate        string  `json:"pay_rate_template"`
	AnniversaryDate        string  `json:"anniversary_date"`
	Salary                 float32 `json:"salary"`
	SalaryType             string  `json:"salary_type"`
	PayUnit                string  `json:"pay_unit"`
	PayCategory            string  `json:"pay_category"`
	LeaveAllowanceTemplate string  `json:"leave_allowance_template"`
	ChangeReason           string  `json:"change_reason"`
	Comments               string  `json:"comments"`
}

PayDetail is the details of one PayDetail resource in EH system. [PayDetail Example]: https://developer.employmenthero.com/api-references/#the-pay-detail-object

type PayDetailListData

type PayDetailListData struct {
	Items []PayDetail `json:"items"`
	ListResponse
}

type PayDetailListResponse

type PayDetailListResponse struct {
	Data PayDetailListData `json:"data"`
}

type Payslip

type Payslip struct {
	Id               string  `json:"id"` // Unique identifier for the object. (UUID format)
	FirstName        string  `json:"first_name"`
	LastName         string  `json:"last_name"`
	TotalDeduction   int     `json:"total_deduction"`
	NetPay           float32 `json:"net_pay"`
	Super            float32 `json:"super"`
	Wages            float32 `json:"wages"`
	Reimbursements   float32 `json:"reimbursements"`
	Tax              float32 `json:"tax"`
	Name             string  `json:"name"`
	AddressLine1     string  `json:"address_line1"`
	AddressLine2     string  `json:"address_line2"`
	Suburb           string  `json:"suburb"`
	Postcode         string  `json:"postcode"`
	PostTaxDeduction float32 `json:"post_tax_deduction"`
	PreTaxDeduction  float32 `json:"pre_tax_deduction"`
	BaseRate         float32 `json:"base_rate"`
	HourlyRate       float32 `json:"hourly_rate"`
	BaseRateUnit     string  `json:"base_rate_unit"`
	EmploymentType   string  `json:"employment_type"`
	PaymentDate      string  `json:"payment_date"`
}

Payslip is the details of one Payslip resource in EH system [Payslip Example]: https://developer.employmenthero.com/api-references/#the-payslip-object

type PayslipList

type PayslipList struct {
	Items []Payslip `json:"items"`
	ListResponse
}

type PayslipListReponse

type PayslipListReponse struct {
	Data PayslipList `json:"data"`
}

type Policy

type Policy struct {
	Id        string `json:"id"` // Unique identifier for the object. (UUID format)
	Name      string `json:"name"`
	Induction bool   `json:"induction"`
	CreatedAt string `json:"created_at"`
}

Policy is the details of one Policy resource in EH system [Policy Example]: https://developer.employmenthero.com/api-references/#get-policies

type PolicyListData

type PolicyListData struct {
	Items []Policy `json:"items"`
	ListResponse
}

type PolicyListResponse

type PolicyListResponse struct {
	Data PolicyListData `json:"data"`
}

type SuperannuationDetail

type SuperannuationDetail struct {
	FundName                 string `json:"fund_name"`
	MemberNumber             string `json:"member_number"`
	ProductCode              string `json:"product_code"`
	EmployerNominatedFund    bool   `json:"employer_nominated_fund"`
	FundAbn                  string `json:"fund_abn"`
	ElectronicServiceAddress string `json:"electronic_service_address"`
	FundEmail                string `json:"fund_email"`
	AccountName              string `json:"account_name"`
	AccountBSB               string `json:"account_bsb"`
	AccountNumber            string `json:"account_number"`
}

SuperannuationDetail is the details of one SuperannuationDetail resource in EH system. [SuperannuationDetail Example]: https://developer.employmenthero.com/api-references/#the-superannuation-detail-object

type SuperannuationDetailResponse

type SuperannuationDetailResponse struct {
	Data SuperannuationDetail `json:"data"`
}

type TaxDeclaration

type TaxDeclaration struct {
	FirstName                  string `json:"first_name"`
	LastName                   string `json:"last_name"`
	TaxFileNumber              string `json:"tax_file_number"`
	TaxAuResident              bool   `json:"tax_au_resident"`
	TaxForeignResident         bool   `json:"tax_foreign_resident"`
	WorkingHolidayMaker        bool   `json:"working_holiday_maker"`
	TaxFree                    bool   `json:"tax_free"`
	TaxHelpDebt                bool   `json:"tax_help_debt"`
	TaxFinancialSupplementDebt bool   `json:"tax_financial_supplement_debt"`
}

TaxDeclaration is the details of one TaxDeclaration resource in EH system. [TaxDeclaration Example]: https://developer.employmenthero.com/api-references/#the-tax-declaration-object

type TaxDelcarationResponse

type TaxDelcarationResponse struct {
	Data TaxDeclaration `json:"data"`
}

type Team

type Team struct {
	Id     string `json:"id"` // Unique identifier for the object. (UUID format)
	Name   string `json:"name"`
	Status string `json:"status"`
}

Team is the details of one Team resource in EH system. [Team Example]: https://developer.employmenthero.com/api-references/#the-team-object

type TeamListData

type TeamListData struct {
	Items []Team `json:"items"`
	ListResponse
}

type TeamListDataResponse

type TeamListDataResponse struct {
	Data TeamListData `json:"data"`
}

type Timesheet

type Timesheet struct {
	Id         string    `json:"id"` // Unique identifier for the object. (UUID format)
	EmployeeId string    `json:"employee_id"`
	Date       string    `json:"date"`
	StartTime  string    `json:"start_time"`
	EndTime    string    `json:"end_time"`
	Status     string    `json:"status"`
	Units      float32   `json:"units"`
	Reason     string    `json:"reason"`
	Comment    string    `json:"comment"`
	Time       int       `json:"time"`
	CostCentre BasicData `json:"cost_centre"`
}

Timesheet is the details of one TimesheetEntry resource in EH system. [TimesheetEntry Example]: https://developer.employmenthero.com/api-references/#the-timesheet-object

type TimesheetListData

type TimesheetListData struct {
	Items []Timesheet `json:"items"`
	ListResponse
}

type TimesheetListResponse

type TimesheetListResponse struct {
	Data TimesheetListData `json:"data"`
}

type TokenResponse

type TokenResponse struct {
	RefreshToken string `json:"refresh_token"`
	Token        string `json:"access_token"`
	Type         string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
}

A response object sent from /oauth/token API wich

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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