Documentation
¶
Index ¶
- Constants
- func GetVacations(ctx context.Context, client *http.Client, param VacationRequest) (map[string]struct{}, error)
- func NewServer(req PeopleRequest, client *http.Client, options ...Option) *mux.Router
- type Auth
- type Department
- type Kind
- type List
- type Location
- type Option
- type PeopleRequest
- type Person
- type Response
- type Vacation
- type VacationRequest
Constants ¶
const DateLayout = "2006-01-02"
Variables ¶
This section is empty.
Functions ¶
func GetVacations ¶
func GetVacations(ctx context.Context, client *http.Client, param VacationRequest) (map[string]struct{}, error)
GetVacations returns IDs of users that are currently on vacation
Types ¶
type Auth ¶
Auth is API server auth parameters
func (Auth) RequestURL ¶
RequestURL returns request URL for a given core object by default, there's just one company corresponding to the api token however, according to API there may be multiple, in that case base API need be initialized to "/core/companies/{company_id}/"
type Department ¶
type Department struct {
ID string `json:"id" mapstructure:"dept_id"`
Name string `json:"name" mapstructure:"dept_name"`
}
Department see https://developers.zenefits.com/docs/department
type Kind ¶
type Kind interface {
Person | Department | Location | Vacation
}
Kind represents an object kind
type Location ¶
type Location struct {
ID string `json:"id" mapstructure:"loc_id"`
Name string `json:"name" mapstructure:"loc_name"`
Country string `json:"country" mapstructure:"loc_country"`
City string `json:"city" mapstructure:"loc_city"`
State string `json:"state" mapstructure:"loc_state"`
Street1 string `json:"street1" mapstructure:"loc_street1"`
Street2 string `json:"street2" mapstructure:"loc_street2"`
Phone string `json:"phone" mapstructure:"loc_phone"`
}
Location see https://developers.zenefits.com/docs/location
type Option ¶
type Option func(*apiServer)
Option to customize
func WithLogger ¶
func WithRemoveOnVacation ¶
type PeopleRequest ¶
func (*PeopleRequest) GetRequest ¶
type Person ¶
type Person struct {
ID string `json:"id" mapstructure:"zenefits_id"`
FirstName string `json:"first_name" mapstructure:"first_name"`
MiddleName string `json:"middle_name" mapstructure:"middle_name,omitempty"`
Lastname string `json:"last_name" mapstructure:"last_name"`
PreferredName string `json:"preferred_name" mapstructure:"preferred_name,omitempty"`
WorkEmail string `json:"work_email" mapstructure:"id,omitempty"`
WorkPhone string `json:"work_phone" mapstructure:"work_phone,omitempty"`
PersonalEmail string `json:"personal_email" mapstructure:"personal_email,omitempty"`
PersonalPhone string `json:"personal_phone" mapstructure:"personal_phone,omitempty"`
Department *Department `json:"department" mapstructure:",squash,omitempty"`
Title string `json:"title" mapstructure:"title"`
Status string `json:"status" mapstructure:"status"`
Type string `json:"type" mapstructure:"type"`
Location *Location `json:"location" mapstructure:",squash,omitempty"`
Country string `json:"country" mapstructure:"home_country,omitempty"`
State string `json:"state" mapstructure:"home_state,omitempty"`
City string `json:"city" mapstructure:"home_city,omitempty"`
Street1 string `json:"street1" mapstructure:"home_street1,omitempty"`
Street2 string `json:"street2" mapstructure:"home_street2,omitempty"`
}
Person see https://developers.zenefits.com/docs/people
func GetEmployees ¶
GetEmployees returns all employees for a company this method may be optimized by avoiding referenced objects inlining and fetching departments and locations (and other referenced fields, if necessary) individually or via list
type Response ¶
type Response[T Kind] struct { Error string `json:"error"` Status int `json:"status"` Data List[T] `json:"data"` }
Response is generic response from zenefits API
type Vacation ¶
type Vacation struct {
Person Person `json:"person"`
}
Vacation see https://developers.zenefits.com/docs/vacation-requests