bamboohr

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: MIT Imports: 8 Imported by: 0

README

bamboohr.go Build Status

Go implementation of BambooHR API client

Documentation

Find documentation with of examples at GoDoc

Documentation

Overview

Example (EstimateFutureTimeOffBalances)
package main

import (
	bamboohr "github.com/AkihikoITOH/bamboohr.go"
)

func main() {
	conf := bamboohr.NewConfig("api-domain", "api-key")
	api := bamboohr.NewAPI(conf)
	api.EstimateFutureTimeOffBalances("12345", "2019-03-30")
}
Output:

Example (GetADirectoryOfEmployees)
package main

import (
	bamboohr "github.com/AkihikoITOH/bamboohr.go"
)

func main() {
	conf := bamboohr.NewConfig("api-domain", "api-key")
	api := bamboohr.NewAPI(conf)
	api.GetADirectoryOfEmployees()
}
Output:

Example (GetAnEmployee)
package main

import (
	bamboohr "github.com/AkihikoITOH/bamboohr.go"
)

func main() {
	conf := bamboohr.NewConfig("api-domain", "api-key")
	api := bamboohr.NewAPI(conf)
	api.GetAnEmployee("99999", []string{"firstName", "lastName"})
}
Output:

Example (GetTimeOffRequests)
package main

import (
	bamboohr "github.com/AkihikoITOH/bamboohr.go"
)

func main() {
	conf := bamboohr.NewConfig("api-domain", "api-key")
	api := bamboohr.NewAPI(conf)
	filters := map[string]string{
		"start":  "2018-01-01",
		"end":    "2018-01-02",
		"status": "approved",
	}
	api.GetTimeOffRequests(filters)
}
Output:

Example (WhosOut)
package main

import (
	bamboohr "github.com/AkihikoITOH/bamboohr.go"
)

func main() {
	conf := bamboohr.NewConfig("api-domain", "api-key")
	api := bamboohr.NewAPI(conf)
	api.WhosOut("2018-01-01", "2019-03-31")
}
Output:

Index

Examples

Constants

View Source
const (
	// BambooHRAPIHost is the API host name.
	BambooHRAPIHost = "api.bamboohr.com"
	// BambooHRAPIRootPath is the API root path.
	BambooHRAPIRootPath = "api/gateway.php"
	// BambooHRAPIVersion is the API version number.
	BambooHRAPIVersion = "v1"
	// DefaultTimeout is the duration for which it waits for the API to respond.
	DefaultTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Config     *Config
	HTTPClient httpcmw.Doer
}

API object contains the API configuration and has methods to communicate with the API.

func NewAPI

func NewAPI(config *Config) *API

NewAPI creates and returns a new API object based on the given Config.

func (*API) EstimateFutureTimeOffBalances

func (api *API) EstimateFutureTimeOffBalances(employeeID, endDate string) ([]*types.TimeOffBalance, error)

EstimateFutureTimeOffBalances fetches a list of balances of various time offs for the employee at the given date. For more details, refer to https://www.bamboohr.com/api/documentation/time_off.php

func (*API) GetADirectoryOfEmployees

func (api *API) GetADirectoryOfEmployees() (*types.EmployeeDirectory, error)

GetADirectoryOfEmployees fetches a list of employees. For more details, refer to https://www.bamboohr.com/api/documentation/employees.php

func (*API) GetAnEmployee

func (api *API) GetAnEmployee(number string, fieldList []string) (*types.Employee, error)

GetAnEmployee fetches an employee with the given employee number from the BambooHR API. For more details, refer to https://www.bamboohr.com/api/documentation/employees.php

func (*API) GetTimeOffRequests

func (api *API) GetTimeOffRequests(filters map[string]string) ([]*types.TimeOffRequest, error)

GetTimeOffRequests fetches time off requests from the BambooHR API. For more details, refer to https://www.bamboohr.com/api/documentation/time_off.php

func (*API) WhosOut

func (api *API) WhosOut(start, end string) ([]*types.TimeOff, error)

WhosOut fetches a list of time offs, including holidays between the given dates. For more details, refer to https://www.bamboohr.com/api/documentation/time_off.php

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config contains configuration parameters of the BambooHR API.

func NewConfig

func NewConfig(apiDomain, apiKey string) *Config

NewConfig creates and returns a new Config object based on the given api domain and api key.

func (*Config) APIDomain

func (c *Config) APIDomain() string

APIDomain returns the api domain.

func (*Config) APIKey

func (c *Config) APIKey() string

APIKey returns the api key.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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