api

package
v0.0.0-...-ced1abf Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotApproved = 10
	Approved    = 20
)
View Source
const DateNoYear = "01-02"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(username string, password string, gps GPSCoords, address string) *Client

func (*Client) Approve

func (c *Client) Approve(app *ShiftApplication) error

func (*Client) DoClock

func (c *Client) DoClock(shift *UserShift) error

func (*Client) FetchApplications

func (c *Client) FetchApplications(shift *Shift) ([]ShiftApplication, error)

func (*Client) FetchJobs

func (c *Client) FetchJobs() error

FetchJobs fetches the jobs from the server.

func (*Client) Jobs

func (c *Client) Jobs() []Job

func (*Client) Login

func (c *Client) Login() error

func (*Client) MyShifts

func (c *Client) MyShifts() []UserShift

func (*Client) UserId

func (c *Client) UserId() int

type FixedJsonValue

type FixedJsonValue[T any] struct {
	Value T
}

FixedJsonValue makes it possible to unmarshal an json value whose empty value is incorrectly encoded as empty string.

func (*FixedJsonValue[T]) UnmarshalJSON

func (v *FixedJsonValue[T]) UnmarshalJSON(data []byte) error

type GPSCoords

type GPSCoords struct {
	Lat float32 `json:"lat"`
	Lng float32 `json:"lng"`
}

type Job

type Job struct {
	Code   string
	Name   string
	Shifts []Shift
}

func (*Job) GetShift

func (j *Job) GetShift(openDate time.Time) *Shift

type JsonDate

type JsonDate time.Time

func (*JsonDate) MarshalJSON

func (d *JsonDate) MarshalJSON() ([]byte, error)

func (*JsonDate) UnmarshalJSON

func (d *JsonDate) UnmarshalJSON(data []byte) error

type JsonDateNoYear

type JsonDateNoYear time.Time

JsonDateNoYear is encoded as MM-dd.

func (*JsonDateNoYear) MarshalJSON

func (d *JsonDateNoYear) MarshalJSON() ([]byte, error)

func (*JsonDateNoYear) UnmarshalJSON

func (d *JsonDateNoYear) UnmarshalJSON(data []byte) error

func (*JsonDateNoYear) WithYear

func (d *JsonDateNoYear) WithYear(year int) time.Time

type JsonDateTime

type JsonDateTime time.Time

func (*JsonDateTime) MarshalJSON

func (d *JsonDateTime) MarshalJSON() ([]byte, error)

func (*JsonDateTime) UnmarshalJSON

func (d *JsonDateTime) UnmarshalJSON(data []byte) error

type Shift

type Shift struct {
	*Job
	UnitCode string
	// when the shift is open for application
	OpenDate time.Time
}

type ShiftApplication

type ShiftApplication struct {
	UnitCode    string
	Code        string `json:"code"`
	UserId      int    `json:"user,string"`
	UserName    string
	Ticket      string `json:"ticket"`
	TicketOrder string `json:"ticketOrder"`
}

type ShiftState

type ShiftState int

type UserShift

type UserShift struct {
	*Shift
	ApplyCode    string
	ClockInTime  time.Time
	ClockOutTime time.Time
	State        ShiftState
	Settled      bool
}

Jump to

Keyboard shortcuts

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