hrflow

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalendarDay added in v0.3.0

type CalendarDay struct {
	// Date is the midninght of the day.
	Date time.Time
	// Workday tells if you should work that day.
	Workday bool
	// HolidayCalc tells if the date should be used in Finnish annual holiday system.
	HolidayCalc bool
	// Description explains what holiday it is.
	Description string
	// Weekday tells the day of the week.
	Weekday time.Weekday
}

CalendarDay is a simplified and more useful form of the response object.

type Client

type Client struct {
	Employments []Employment

	HttpClient *http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(username, password string) *Client

func (*Client) Authenticate

func (c *Client) Authenticate() error

Authenticate runs the authentication process and stores the needed cookies and header values.

func (*Client) Calendar

func (c *Client) Calendar(startDate, endDate time.Time) ([]CalendarDay, error)

func (*Client) NewWorkLog

func (c *Client) NewWorkLog(startTime, endTime time.Time, salaryGroupValue string, comment string, project *string, lunch bool) error

func (*Client) NewWorkLogFactor

func (c *Client) NewWorkLogFactor(hours float64) WorkLogFactor

func (*Client) NewWorkLogRequest

func (c *Client) NewWorkLogRequest() WorkLogRequest

func (*Client) NewWorkLogRow

func (c *Client) NewWorkLogRow(
	employmentID, personID, groupID int64,
	startTime, endTime time.Time,
	salaryGroupValue string,
	comment string,
	project *string,
) WorkLogRow
func (c *Client) NewWorkLogRowLink(colNumber int64, listID string, project *string) WorkLogRowLink

type Employment

type Employment struct {
	IsPassive              bool     `json:"isPassive"`
	IsDefaultEmployment    bool     `json:"isDefaultEmployment"`
	EmploymentID           int64    `json:"employmentId"`
	PersonID               int64    `json:"personId"`
	Name                   string   `json:"name"`
	ListName               string   `json:"listName"`
	GroupID                int64    `json:"groupId"`
	GroupName              string   `json:"groupName"`
	ParentGroupID          int64    `json:"parentGroupId"`
	CustomerID             int64    `json:"customerId"`
	UserName               string   `json:"userName"`
	StartDate              string   `json:"startDate"`
	EndDate                *string  `json:"endDate"`
	EnterpriseName         string   `json:"enterpriseName"`
	AllEmploymentIDs       *[]int64 `json:"allEmploymentIds"`
	ValueSettings          string   `json:"valueSettings"`
	OrganizationPositionID int64    `json:"organizationPositionId"`
}

type WorkLogFactor

type WorkLogFactor struct {
	// id seems to always be 0
	Id int64 `json:"id"`
	// workLogRowID seems to always be 0.
	WorkLogRowID int64 `json:"workLogRowId"`
	// factorID seems to always be 1.
	FactorID int64 `json:"factorId"`
	// amount is the number of hours to be reported.
	Amount float64 `json:"amount"`
	// unit is always DURATION.
	Unit string `json:"unit"`
	// created is the time the entry was created.
	Created string `json:"created"`
	// creator is the same as username
	Creator string `json:"creator"`
	// modifiedBy is the same as username
	ModifiedBy string `json:"modifiedBy"`
	// modified date "2020-02-25 13:40:33.000"
	Modified string `json:"modified"`
}

type WorkLogRequest

type WorkLogRequest struct {
	IsFixedProcess                    bool         `json:"isFixedProcess,omitempty"`
	GetListsLabels                    bool         `json:"getListsLabels"`
	GetAll                            bool         `json:"getAll,omitempty"`
	IsSetStartAndEndDateFromCopyDates bool         `json:"isSetStartAndEndDateFromCopyDates"`
	IsUpdateRow                       bool         `json:"isUpdateRow"`
	ViewName                          string       `json:"viewName"`
	Lang                              string       `json:"lang"`
	Employments                       []Employment `json:"employments"`
	StartDate                         string       `json:"startDate"`
	EndDate                           string       `json:"endDate"`
	StatusList                        []string     `json:"statusList"`
	SearchDateType                    string       `json:"searchDateType,omitempty"`
	EmailReceiver                     string       `json:"emailReceiver"`
	// doesn't have to be filled
	EmailReceiverName string `json:"emailReceiverName,omitempty"`
	EmailChangesText  string `json:"emailChangesText,omitempty"`
	EmailComment      string `json:"emailComment,omitempty"`
}

type WorkLogRow

type WorkLogRow struct {
	// id is always 0.
	Id int64 `json:"id"`
	// customer_id is always 1.
	CustomerID   int64 `json:"customerId"`
	EmploymentID int64 `json:"employmentId"`
	PersonID     int64 `json:"personId"`
	GroupID      int64 `json:"groupId"`
	VersionID    int64 `json:"versionId"`
	// date is the day of the report, in format "2020-02-25 00:00:00.000".
	Date string `json:"date"`
	// mainSalaryFactorID seems to be always 1.
	MainSalaryFactorID int64 `json:"mainSalaryFactorId"`
	// mainAmount is the number of hours that should be reported as a string.
	MainAmount string `json:"mainAmount"`
	// mainUnit is DURATION for monthly workers, and HOURS for hourly workers.
	MainUnit       string          `json:"mainUnit"`
	WorkLogFactors []WorkLogFactor `json:"workLogFactors"`
	StartTime      string          `json:"startTime"`
	EndTime        string          `json:"endTime"`
	// 99002 for DURATION (monthly workers), 11000 for HOURS (hourly workers)
	SalaryGroupValue string `json:"salaryGroupValue"`
	// status is NEW if being created.
	Status string `json:"status"`
	// created date.
	Created                 string `json:"created"`
	LastModifierPersonId    int64  `json:"lastModifierPersonId"`
	LastModifierUserID      int64  `json:"lastModifierUser_Id"`
	LastModifierDisplayName string `json:"lastModifierDisplayName"`
	// modifiedBy is the same as username.
	ModifiedBy string `json:"modifiedBy"`
	// lunchBreak is the duration of the lunch break in minutes.
	LunchBreak int64 `json:"lunchBreak"`
	// cutLunchFromAmount is either Y or N depending on if lunch time should be deducted from total.
	CutLunchFromAmount string `json:"cutLunchFromAmount"`
	// entryText is the same as the comment field in the website.
	EntryText *string `json:"entryText"`
	// entryTextType is probably always TEXTHASHTAG
	EntryTextType     string           `json:"entryTextType"`
	WorkLogRowLinks   []WorkLogRowLink `json:"workLogRowLinks"`
	WorkLogComments   []string         `json:"workLogComments"`
	SourceId          *string          `json:"sourceId"`
	BunchId           *string          `json:"bunchId"`
	ExternalId        *string          `json:"externalId"`
	CreatedFromSource *string          `json:"createdFromSource"`
	StartDate         *string          `json:"startDate"`
	EndDate           *string          `json:"endDate"`
}
type WorkLogRowLink struct {
	// always 0
	Id int64 `json:"id"`
	// always 0
	WorkLogRowID int64 `json:"workLogRowId"`
	// 7 for OSASTOT, 8 for KUSTPAIKAT, 9 for PROJEKTIT
	ColNumber int64 `json:"colNumber"`
	// SELECT
	ColControlType string `json:"colControlType"`
	// LIST
	DimensionLinkType string `json:"dimensionLinkType"`
	// PARAM
	DimensionSourceType string `json:"dimensionSourceType"`
	// listID is the list the link is referencing.
	ListID  string  `json:"listId"`
	InputID *string `json:"inputId"`
	Value   *string `json:"value"`
	Label   *string `json:"label"`
}

Jump to

Keyboard shortcuts

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