hakuna

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright © 2021 Henning Dahlheim <hactar@cyberkraft.ch>

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Copyright © 2021 Henning Dahlheim <hactar@cyberkraft.ch>

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Absence

type Absence struct {
	ID                   int         `json:"id"`
	StartDate            string      `json:"start_date"`
	EndDate              string      `json:"end_date"`
	FirstHalfDay         bool        `json:"first_half_day"`
	SecondHalfDay        bool        `json:"second_half_day"`
	IsRecurring          bool        `json:"is_recurring"`
	WeeklyRepeatInterval int         `json:"weekly_repeat_interval"`
	User                 User        `json:"user"`
	AbsenceType          AbsenceType `json:"absence_type"`
}

type AbsenceType

type AbsenceType struct {
	ID             int    `json:"id"`
	Name           string `json:"name"`
	GrantsWorkTime bool   `json:"grants_work_time"`
	IsVacation     bool   `json:"is_vacation"`
	Archived       bool   `json:"archived"`
}

type Company

type Company struct {
	CompanyName            string `json:"company_name"`
	DurationFormat         string `json:"duration_format"`
	AbsenceRequestsEnabled bool   `json:"absence_requests_enabled"`
	ProjectsEnabled        bool   `json:"projects_enabled"`
	GroupsEnabled          bool   `json:"groups_enabled"`
}

type CreatTimeEntryReq

type CreatTimeEntryReq struct {
	Date      string `json:"date"`
	StartTime string `json:"start_time"`
	EndTime   string `json:"end_time"`
	Note      string `json:"note"`
	ProjectID int    `json:"project_id"`
	TaskID    int    `json:"task_id"`
}

type Hakuna

type Hakuna struct {
	SubDomain string
	Token     string
	Client    http.Client
}

func New

func New(subDomain string, token string, client http.Client) (*Hakuna, error)

func (Hakuna) GetAbsences

func (h Hakuna) GetAbsences(year string) ([]Absence, error)

func (Hakuna) GetOverview

func (h Hakuna) GetOverview() (Overview, error)

func (Hakuna) GetTasks

func (h Hakuna) GetTasks() ([]Task, error)

func (Hakuna) GetTimeEntries

func (h Hakuna) GetTimeEntries(start time.Time, end time.Time) ([]TimeEntry, error)

func (Hakuna) GetTimer

func (h Hakuna) GetTimer() (Timer, error)

func (Hakuna) Ping

func (h Hakuna) Ping() (Pong, error)

func (Hakuna) StartTimer

func (h Hakuna) StartTimer(data *StartTimerReq) (Timer, error)

func (Hakuna) StopTimer

func (h Hakuna) StopTimer(data *StopTimerReq) (TimeEntry, error)

type Overview

type Overview struct {
	Overtime          string   `json:"overtime"`
	OvertimeInSeconds float64  `json:"overtime_in_seconds"`
	Vacation          Vacation `json:"vacation"`
}

type Pong

type Pong struct {
	Pong time.Time `json:"pong"`
}

type Project

type Project struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Archived bool   `json:"archived"`
}

type ResponeError

type ResponeError struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

type StartTimerReq

type StartTimerReq struct {
	TaskId    int    `json:"task_id"`
	StartTime string `json:"start_time,omitempty"`
	ProjectId int    `json:"project_id,omitempty"`
	Note      string `json:"note,omitempty"`
}

func NewStartTimerReq

func NewStartTimerReq(taskId int, startTime time.Time, note string, projectId int) (*StartTimerReq, error)

type StopTimerReq

type StopTimerReq struct {
	EndTime string `json:"end_time"`
}

func NewStopTimerReq

func NewStopTimerReq(time time.Time) (*StopTimerReq, error)

type Task

type Task struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Archived bool   `json:"archived"`
}

type TimeEntry

type TimeEntry struct {
	ID                int     `json:"id"`
	Note              string  `json:"note"`
	Date              string  `json:"date"`
	Duration          string  `json:"duration"`
	DurationInSeconds float64 `json:"duration_in_seconds"`
	StartTime         string  `json:"start_time"`
	EndTime           string  `json:"end_time"`
	User              User    `json:"user"`
	Task              Task    `json:"task"`
	Project           Project `json:"project"`
}

type Timer

type Timer struct {
	Note              string  `json:"note"`
	Date              string  `json:"date"`
	Duration          string  `json:"duration"`
	DurationInSeconds float64 `json:"duration_in_seconds"`
	StartTime         string  `json:"start_time"`
	User              User    `json:"user"`
	Task              Task    `json:"task"`
	Project           Project `json:"project"`
}

type User

type User struct {
	ID     int      `json:"id"`
	Name   string   `json:"name"`
	Groups []string `json:"groups"`
}

type Vacation

type Vacation struct {
	RedeemedDays  float64 `json:"redeemed_days"`
	RemainingDays float64 `json:"remaining_days"`
}

Jump to

Keyboard shortcuts

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