Documentation
¶
Overview ¶
Package bamboohr provides a library for the Bamboo HR API
Index ¶
- Constants
- type Client
- func (c *Client) GetEmployee(ctx context.Context, id string, fields ...EmployeeField) (Employee, error)
- func (c *Client) GetEmployeeDirectory(ctx context.Context) ([]Employee, error)
- func (c *Client) GetEmployeeFilesAndCategories(ctx context.Context, id string) ([]EmployeeCategory, error)
- func (c *Client) UploadEmployeeFile(ctx context.Context, employeeID, categoryID, fileName, filePath, share string) error
- type Employee
- type EmployeeCategory
- type EmployeeCategoryResponse
- type EmployeeField
- type EmployeeFields
- type EmployeeResponse
- type File
Constants ¶
const ( DisplayName EmployeeField = "DisplayName" FirstName = "FirstName" LastName = "LastName" PreferredName = "PreferredName" Gender = "Gender" JobTitle = "JobTitle" WorkPhone = "WorkPhone" MobilePhone = "MobilePhone" WorkEmail = "WorkEmail" Department = "Department" Location = "Location" Division = "Division" LinkedIn = "LinkedIn" WorkPhoneExtension = "WorkPhoneExtension" PhotoUploaded = "PhotoUploaded" PhotoURL = "PhotoURL" CanUploadPhoto = "CanUploadPhoto" )
Fields for GetEmployee
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// Base URL for Bamboo HR API which is set to v1 using the provided company domain if initiated with `bamboohr.New()`
BaseURL string
// HTTP Client to use for making requests allowing the user to supply their own if required.
HTTPClient *http.Client
// Base64 Encoded string based on the APIKey, used for Basic Authorization
Auth string
}
Client represents connectivity to the bamboo hr API
func New ¶
New is a helper function that returns a new instance of the bamboo hr client given a company domain and api key. An http.Client will be created if nil is provided.
func (*Client) GetEmployee ¶
func (c *Client) GetEmployee(ctx context.Context, id string, fields ...EmployeeField) (Employee, error)
GetEmployee retrieves a specific employee by ID and allows the caller to specify fields. All fields are returned if none are specified.
func (*Client) GetEmployeeDirectory ¶
GetEmployeeDirectory returns a list of employees
func (*Client) GetEmployeeFilesAndCategories ¶
func (c *Client) GetEmployeeFilesAndCategories(ctx context.Context, id string) ([]EmployeeCategory, error)
GetEmployeeFilesAndCategories returns a list of employee files and categories
func (*Client) UploadEmployeeFile ¶
func (c *Client) UploadEmployeeFile(ctx context.Context, employeeID, categoryID, fileName, filePath, share string) error
UploadEmployeeFile uploads a file to a specific employees files under the given category ID. Beware the inconsistent ID types Bamboo uses. We require all strings here.
type Employee ¶
type Employee struct {
ID string
DisplayName string
FirstName string
LastName string
PreferredName string
Gender string
JobTitle string
WorkPhone string
MobilePhone string
WorkEmail string
Department string
Location string
Division string
LinkedIn string
WorkPhoneExtension string
PhotoUploaded *bool // to avoid false when it's empty
PhotoURL string
CanUploadPhoto *int // to avoid 0 when it's empty
}
Employee represents a single person
type EmployeeCategory ¶
type EmployeeCategory struct {
ID int
Name string
CanRenameCategory string
CanDeleteCategory string
CanUploadFiles string
DisplayIfEmpty string
Files []File
}
EmployeeCategory represents a files category (or folder!)
type EmployeeCategoryResponse ¶
type EmployeeCategoryResponse struct {
EmployeeID struct {
ID int
} `json:"employee"`
Categories []EmployeeCategory
}
EmployeeCategoryResponse is the top level response from the API
type EmployeeField ¶
type EmployeeField string
EmployeeField are fields that can be requested on GetEmployee
type EmployeeFields ¶
type EmployeeFields []EmployeeField
EmployeeFields holds a slice of EmployeeField which are fields that can be requested on GetEmployee
func (EmployeeFields) Join ¶
func (ef EmployeeFields) Join(sep string) string
Join concatenates the elements of EmployeeFields to create a single string. The separator is placed between elements in the resulting string.
type EmployeeResponse ¶
type EmployeeResponse struct {
Employees []Employee
}
EmployeeResponse is the top level response from the API