woffuapi

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL = "https://app.woffu.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIRequest

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

type AuthProvider

type AuthProvider interface {
	Authenticate(req *http.Request)
	Credentials() string
	Type() string
}

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

func (*BasicAuth) Authenticate

func (b *BasicAuth) Authenticate(req *http.Request)

func (*BasicAuth) Credentials

func (b *BasicAuth) Credentials() string

func (*BasicAuth) Type

func (b *BasicAuth) Type() string

type SignRequest

type SignRequest struct {
	UserId         int `json:"UserId"`
	TimezoneOffset int `json:"TimezoneOffset"`
}

type SignSlotEvent

type SignSlotEvent struct {
	ID            string `json:"$id"`
	ShortTrueTime string `json:"ShortTrueTime"`
	SignType      int    `json:"SignType"`
	SignEventId   string `json:"SignEventId"`
}

type SignSlots

type SignSlots []struct {
	ID     string        `json:"$id"`
	In     SignSlotEvent `json:"In"`
	Out    SignSlotEvent `json:"Out"`
	Motive struct {
		ID   string `json:"$id"`
		Name string `json:"Name"`
	} `json:"Motive"`
}

func (SignSlots) TimeWorked added in v0.2.0

func (s SignSlots) TimeWorked() time.Duration

type Signs

type Signs []struct {
	SignIn   bool   `json:"SignIn"`
	IP       string `json:"IP"`
	Date     string `json:"Date"`     // UTC
	TrueDate string `json:"TrueDate"` // Local Time
}

func (Signs) HasAlreadyClockedIn added in v0.2.0

func (s Signs) HasAlreadyClockedIn() bool

type Token

type Token string

type TokenAuth

type TokenAuth struct {
	Token string
}

func (*TokenAuth) Authenticate

func (t *TokenAuth) Authenticate(req *http.Request)

func (*TokenAuth) Credentials

func (t *TokenAuth) Credentials() string

func (*TokenAuth) Type

func (t *TokenAuth) Type() string

type TokenResponse

type TokenResponse struct {
	AccessToken Token `json:"access_token"`
}

type User

type User struct {
	UserId        int     `json:"UserId"`
	Email         string  `json:"Email"`
	FirstName     string  `json:"FirstName"`
	CompanyId     string  `json:"CompanyId"`
	CompanyName   string  `json:"CompanyName"`
	AllocatedDays float64 `json:"AllocatedDays"`
	ApprovedDays  float64 `json:"ApprovedDays"`
	UsedDays      float64 `json:"UsedDays"`
}

type WoffuAPI

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

func NewWithBasicAuth

func NewWithBasicAuth(username, password string) *WoffuAPI

func NewWithToken

func NewWithToken(token string) *WoffuAPI

func (WoffuAPI) CreateToken

func (w WoffuAPI) CreateToken() (*TokenResponse, error)

func (WoffuAPI) GetCurrentUser

func (w WoffuAPI) GetCurrentUser() (*User, error)

func (WoffuAPI) GetSignSlots

func (w WoffuAPI) GetSignSlots() (SignSlots, error)

func (WoffuAPI) GetSigns

func (w WoffuAPI) GetSigns() (Signs, error)

func (WoffuAPI) GetUserWorkDay

func (w WoffuAPI) GetUserWorkDay(userId int) (*WorkDay, error)

func (WoffuAPI) Sign

func (w WoffuAPI) Sign(userId int) (err error)

type WorkDay

type WorkDay struct {
	StartTime         string  `json:"StartTime"`
	TrueStartTime     string  `json:"TrueStartTime"`
	EndTime           string  `json:"EndTime"`
	TrueEndTime       string  `json:"TrueEndTime"`
	ScheduleHours     float64 `json:"ScheduleHours"`
	TrueScheduleHours float64 `json:"TrueScheduleHours"`
	IsWeekend         bool    `json:"IsWeekend"`
	IsHoliday         bool    `json:"IsHoliday"`
	IsEvent           bool    `json:"IsEvent"`
	IsFlexible        bool    `json:"IsFlexible"`
}

Jump to

Keyboard shortcuts

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