api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BookingResponse

type BookingResponse struct {
	Success                    bool   `json:"success"`
	Response                   string `json:"response"`
	Rejections                 bool   `json:"rejections"`
	AutoApproved               bool   `json:"autoApproved"`
	HolidayID                  int    `json:"holidayId"`
	OverrideRequired           bool   `json:"overrideRequired"`
	OverrideLockedDateRequired bool   `json:"overrideLockedDateRequired"`
}

type Day

type Day struct {
	DayChar   string `json:"dayChar"`
	DayNumber int    `json:"dayNumber"`
	Month     int    `json:"month"`
	IsToday   bool   `json:"isToday"`
}

type DepartmentResponse

type DepartmentResponse struct {
	ID             int    `json:"id"`
	OrganisationID int    `json:"organisationId"`
	Name           string `json:"name"`
	ManagerID      int    `json:"managerId"`
	BossID         int    `json:"bossId"`
	Archived       bool   `json:"archived"`
	UserCount      int    `json:"userCount"`
	MaxOff         int    `json:"maxOff"`
}

Define the struct to match the JSON structure

type Holiday

type Holiday struct {
	Day      int    `json:"day"`
	AmHolID  int    `json:"am_hol_id"`
	PmHolID  int    `json:"pm_hol_id"`
	AmLt     string `json:"am_lt"`
	PmLt     string `json:"pm_lt"`
	AmPend   bool   `json:"am_pend"`
	PmPend   bool   `json:"pm_pend"`
	AmLtName string `json:"am_lt_name"`
	PmLtName string `json:"pm_lt_name"`
	Icon     string `json:"icon"`
	IsStart  bool   `json:"isStart"`
	IsEnd    bool   `json:"isEnd"`
}

type LeaveRequest

type LeaveRequest struct {
	UserID               int    `json:"userId"`
	DepartmentID         int    `json:"departmentId"`
	LeaveTypeID          int    `json:"leaveTypeId"`
	Start                string `json:"start"` // Date string
	End                  string `json:"end"`   // Date string
	FromDayPart          int    `json:"fromDayPart"`
	ToDayPart            int    `json:"toDayPart"`
	FromTime             int    `json:"fromTime"`
	ToTime               int    `json:"toTime"`
	Reason               string `json:"reason"`
	AttachmentID         *int   `json:"attachmentId"` // Use pointer to handle null values
	AllDay               bool   `json:"allDay"`
	SpaceBeforeFractions bool   `json:"spaceBeforeFractions"`
}

type LeaveType

type LeaveType struct {
	ID                 int    `json:"id"`
	Name               string `json:"name"`
	OrganisationID     int    `json:"organisationId"`
	Deducted           bool   `json:"deducted"`
	RequiresApproval   bool   `json:"requiresApproval"`
	IncludeMaxOff      bool   `json:"includeMaxOff"`
	IsPrivate          bool   `json:"isPrivate"`
	Active             bool   `json:"active"`
	IsInUse            bool   `json:"isInUse"`
	Color              string `json:"color"`
	Icon               string `json:"icon"`
	CalendarVisibility int    `json:"calendarVisibility"`
	LimitHours         *int   `json:"limitHours"` // Use pointer to handle null values
	LimitDays          *int   `json:"limitDays"`  // Use pointer to handle null values
}

Define the struct to match the JSON structure

type NonWorkingDay

type NonWorkingDay struct {
	ID        interface{} `json:"id"`
	DayOffset int         `json:"dayOffset"`
	DayPart   int         `json:"dayPart"`
	Name      interface{} `json:"name"`
	Icon      interface{} `json:"icon"`
}

type TimetasticClient

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

func NewTimetasticClient

func NewTimetasticClient() *TimetasticClient

func (*TimetasticClient) BookLeave

func (c *TimetasticClient) BookLeave(department int, leaveType int, start string, end string) (*BookingResponse, error)

func (*TimetasticClient) GetDepartments

func (c *TimetasticClient) GetDepartments() (*[]DepartmentResponse, error)

func (*TimetasticClient) GetLeaveTypes

func (c *TimetasticClient) GetLeaveTypes() (*[]LeaveType, error)

func (*TimetasticClient) GetWallchart

func (c *TimetasticClient) GetWallchart(departmentId int) (*WallchartData, error)

type User

type User struct {
	Days            int             `json:"days"`
	Name            string          `json:"name"`
	Remaining       string          `json:"remaining"`
	DeptName        string          `json:"deptName"`
	UserID          int             `json:"userId"`
	GravatarURL     string          `json:"gravatarUrl"`
	NonWorkingDays  []NonWorkingDay `json:"nonworkingdays"`
	Holidays        []Holiday       `json:"holidays"`
	LockedDays      []interface{}   `json:"lockeddays"`
	DepartmentID    int             `json:"departmentId"`
	Birthday        string          `json:"birthday"`
	WorkAnniversary string          `json:"workAnniversary"`
	IsDeptManager   bool            `json:"isDeptManager"`
	CanViewCalendar bool            `json:"canViewCalendar"`
	CanManage       bool            `json:"canManage"`
	CanEdit         bool            `json:"canEdit"`
	FirstName       string          `json:"firstname"`
	Surname         string          `json:"surname"`
	IsFavourite     bool            `json:"isFavourite"`
	Initials        string          `json:"initials"`
	StartDate       string          `json:"startDate"`
	Year            int             `json:"year"`
}

type WallchartData

type WallchartData struct {
	Start          string      `json:"start"`
	End            string      `json:"end"`
	Users          []User      `json:"users"`
	Days           []Day       `json:"days"`
	EndText        interface{} `json:"endText"`
	StartText      interface{} `json:"startText"`
	MonthStart     int         `json:"monthstart"`
	Year           int         `json:"year"`
	CanPageForward bool        `json:"canPageForward"`
	CanPageBack    bool        `json:"canPageBack"`
	IsRestricted   bool        `json:"isRestricted"`
}

Jump to

Keyboard shortcuts

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