tockPackage

package
v0.0.0-...-989d8f1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2018 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIPages

type APIPages struct {
	Count   int    `json:"count"`
	NextURL string `json:"next"`
	PrevURL string `json:"previous"`
}

APIPages is a struct representation of a API page response from tock

type ReportingPeriod

type ReportingPeriod struct {
	StartDate         string `json:"start_date"`
	EndDate           string `json:"end_date"`
	ExactWorkingHours int    `json:"exact_working_hours"`
	MinWorkingHours   int    `json:"min_working_hours"`
	MaxWorkingHours   int    `json:"max_working_hours"`
}

ReportingPeriod is a struct representation of the reporting_period JSON object from tock

type ReportingPeriodAuditDetails

type ReportingPeriodAuditDetails struct {
	APIPages
	Users []User `json:"results"`
}

ReportingPeriodAuditDetails is a struct representation of an API response from the Reporting Period Audit details endpoint

type ReportingPeriodAuditList

type ReportingPeriodAuditList struct {
	APIPages
	ReportingPeriods []ReportingPeriod
}

ReportingPeriodAuditList is a struct representation of an API response from the Reporting Period Audit list endpoint

type Tock

type Tock struct {
	// Get Audit endpoint
	TockURL       string
	UserTockURL   string
	AuditEndpoint string
	DataFetcher   *helpers.DataFetcher
}

Tock struct contains the audit endpoint and methods associated with Tock

func InitTock

func InitTock() *Tock

InitTock initalizes the tock struct

func (*Tock) FetchTockUsers

func (tock *Tock) FetchTockUsers(endpoint string) *ReportingPeriodAuditDetails

FetchTockUsers is a function for collecting all the users who have not filled out thier time sheet for the current period

func (*Tock) TockUserGen

func (tock *Tock) TockUserGen() func() *ReportingPeriodAuditDetails

TockUserGen returns a generator that returns a steram of user data by paging through the api

func (*Tock) UserApplier

func (tock *Tock) UserApplier(applyFunc func(user User))

UserApplier loops through users and applies a anonymous function to a list of late tock users

type User

type User struct {
	ID        int    `json:"id"`
	Username  string `json:"username"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Email     string `json:"email"`
}

User is a struct representation of the user JSON object from tock

Jump to

Keyboard shortcuts

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