clockogo

package module
v0.0.0-...-4b1bca8 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 9 Imported by: 0

README

clockogo

  • api/absences
  • api/v2/clock
  • api/v2/customers
  • api/v2/entries
  • api/v2/entriesTexts
  • api/v2/entrygroups
  • api/holidayscarry
  • api/holidaysquota
  • api/v2/lumpsumservices
  • api/nonbusinessdays
  • api/nonbusinessgroups
  • api/overtimecarry
  • api/v2/projects
  • api/register
  • api/v2/services
  • api/v2/surcharges
  • api/targethours
  • api/v2/teams
  • api/userreports
  • api/v2/users
  • api/v2/users/access/customers-projects
  • api/v2/users/access/services
  • api/v2/aggregates/users/me

Documentation

Index

Constants

View Source
const (
	BaseURL = "https://my.clockodo.com"
)

Variables

This section is empty.

Functions

func NewAPIError

func NewAPIError(code int, body []byte) error

Types

type APIError

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

func (APIError) Error

func (err APIError) Error() string

type APIKeyAuth

type APIKeyAuth struct {
	ClientId
	// contains filtered or unexported fields
}

func (APIKeyAuth) NewRequest

func (a APIKeyAuth) NewRequest(method string, url string, body io.Reader) (*http.Request, error)

type Auth

type Auth interface {
	NewRequest(method string, url string, body io.Reader) (*http.Request, error)
}

type BasicAuth

type BasicAuth struct {
	ClientId
	// contains filtered or unexported fields
}

func (BasicAuth) NewRequest

func (a BasicAuth) NewRequest(method string, url string, body io.Reader) (*http.Request, error)

type BillableType

type BillableType uint8
const (
	NotBillable BillableType = iota
	Billable
	AlreadyBilled
)

type BudgetType

type BudgetType string
const (
	Strict           BudgetType = "strict"
	StrictCompleted  BudgetType = "strict-completed"
	StrictIncomplete BudgetType = "strict-incomplete"
	Soft             BudgetType = "soft"
	SoftCompleted    BudgetType = "soft-completed"
	SoftIncomplete   BudgetType = "soft-incomplete"
	Without          BudgetType = "without"
	WithoutStrict    BudgetType = "without-strict"
)

type Client

type Client struct {
	Entries      *EntriesAPI
	EntriesTexts *EntriesTextsAPI
	// contains filtered or unexported fields
}

func NewClient

func NewClient(auth Auth, opts ...HTTPClientOption) *Client

func (*Client) Do

func (c *Client) Do(req *http.Request, v any) error

type ClientId

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

type Entries

type Entries struct {
	Paging  `json:"paging"`
	Filter  interface{} `json:"filter"`
	Entries []Entry     `json:"entries"`
}

type EntriesAPI

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

func (EntriesAPI) Create

func (api EntriesAPI) Create(entry Entry) (*Entry, error)

func (EntriesAPI) Delete

func (api EntriesAPI) Delete(id int) error

func (EntriesAPI) List

func (api EntriesAPI) List(q EntriesListParams) (*Entries, error)

func (EntriesAPI) Read

func (api EntriesAPI) Read(id int) (*Entry, error)

func (EntriesAPI) Update

func (api EntriesAPI) Update(entry Entry) (*Entry, error)

type EntriesListParams

type EntriesListParams struct {
	TimeSince                                 ISO8601UTC   `url:"time_since"`
	TimeUntil                                 ISO8601UTC   `url:"time_until"`
	FilterUsersId                             int          `url:"filter[users_id],omitempty"`
	FilterCustomersId                         int          `url:"filter[customers_id],omitempty"`
	FilterProjectsId                          int          `url:"filter[projects_id],omitempty"`
	FilterServicesId                          int          `url:"filter[services_id],omitempty"`
	FilterLumpsumServicesId                   int          `url:"filter[lumpsum_services_id],omitempty"`
	FilterBillable                            BillableType `url:"filter[billable],omitempty"`
	FilterText                                string       `url:"filter[text],omitempty"`
	FilterTextsId                             int          `url:"filter[texts_id],omitempty"`
	FilterBudgetType                          BudgetType   `url:"filter[budget_type],omitempty"`
	CalcAlsoRevenuesForProjectsWithHardBudget bool         `url:"calc_also_revenues_for_projects_with_hard_budget,omitempty"`
	EnhancedList                              bool         `url:"enhanced_list,omitempty"`
	Page                                      int          `url:"page,omitempty"`
}

type EntriesTexts

type EntriesTexts struct {
	Paging   `json:"paging"`
	Filter   interface{}       `json:"filter"`
	Mode     EntriesTextsMode  `json:"mode"`
	Sort     EntriesTextsSort  `json:"sort"`
	TextsRaw interface{}       `json:"texts"`
	Texts    map[string]string `json:"-"`
}

type EntriesTextsAPI

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

func (EntriesTextsAPI) List

type EntriesTextsListParams

type EntriesTextsListParams struct {
	Text                    string           `url:"text"`
	Mode                    EntriesTextsMode `url:"mode,omitempty"`
	Sort                    EntriesTextsSort `url:"sort,omitempty"`
	FilterTimeSince         *ISO8601UTC      `url:"filter[time_since],omitempty"`
	FilterTimeUntil         *ISO8601UTC      `url:"filter[time_until],omitempty"`
	FilterUsersId           int              `url:"filter[users_id],omitempty"`
	FilterCustomersId       int              `url:"filter[customers_id],omitempty"`
	FilterProjectsId        int              `url:"filter[projects_id],omitempty"`
	FilterServicesId        int              `url:"filter[services_id],omitempty"`
	FilterLumpsumServicesId int              `url:"filter[lumpsum_services_id],omitempty"`
	FilterBillable          BillableType     `url:"filter[billable],omitempty"`
	Page                    int              `url:"page,omitempty"`
}

type EntriesTextsMode

type EntriesTextsMode string
const (
	ExactMatch EntriesTextsMode = "exact_match"
	StartsWith EntriesTextsMode = "starts_with"
	EndsWith   EntriesTextsMode = "ends_with"
	Contains   EntriesTextsMode = "contains"
)
const (
	TextAsc  EntriesTextsMode = "text_asc"
	TextDesc EntriesTextsMode = "text_desc"
	TimeAsc  EntriesTextsMode = "time_asc"
	TimeDesc EntriesTextsMode = "time_desc"
)

type EntriesTextsSort

type EntriesTextsSort string

type Entry

type Entry struct {
	Id                     *int          `json:"id" url:"-"`
	CustomersId            int           `json:"customers_id" url:"customers_id"`
	ProjectsId             *int          `json:"projects_id" url:"projects_id,omitempty"`
	UsersId                *int          `json:"users_id" url:"users_id,omitempty"`
	Billable               *BillableType `json:"billable" url:"billable"`
	TextsId                *int          `json:"texts_id" url:"-"`
	TimeSince              ISO8601UTC    `json:"time_since" url:"time_since"`
	TimeUntil              *ISO8601UTC   `json:"time_until" url:"time_until,omitempty"`
	TimeInsert             *ISO8601UTC   `json:"time_insert" url:"-"`
	TimeLastChange         *ISO8601UTC   `json:"time_last_change" url:"-"`
	CustomersName          *string       `json:"customers_name" url:"-"`
	ProjectsName           *string       `json:"projects_name" url:"-"`
	UsersName              *string       `json:"users_name" url:"-"`
	Text                   *string       `json:"text" url:"text,omitempty"`
	Revenue                *float64      `json:"revenue" url:"-"`
	Type                   EntryType     `json:"type" url:"type"`
	ServicesId             *int          `json:"services_id" url:"services_id,omitempty"`
	Duration               *int          `json:"duration" url:"duration,omitempty"`
	Offset                 *int          `json:"offset" url:"-"`
	Clocked                *bool         `json:"clocked" url:"-"`
	ClockedOffline         *bool         `json:"clocked_offline" url:"-"`
	TimeClockedSince       *ISO8601UTC   `json:"time_clocked_since" url:"-"`
	TimeLastChangeWorktime *ISO8601UTC   `json:"time_last_change_worktime" url:"-"`
	HourlyRate             *float64      `json:"hourly_rate" url:"hourly_rate,omitempty"`
	ServicesName           *string       `json:"services_name" url:"-"`
	Lumpsum                *float64      `json:"lumpsum" url:"lumpsum,omitempty"`
	LumpsumServicesId      *int          `json:"lumpsum_services_id" url:"lumpsum_services_id,omitempty"`
	LumpsumServicesAmount  *float64      `json:"lumpsum_services_amount" url:"lumpsum_services_amount,omitempty"`
	LumpsumServicesPrice   *float64      `json:"lumpsum_services_price" url:"-"`
}

func NewLumpsumServiceEntry

func NewLumpsumServiceEntry(customersId int, lumpsumServicesId int, lumpsumServicesAmount float64, billable BillableType, timeSince ISO8601UTC) Entry

func NewLumpsumValueEntry

func NewLumpsumValueEntry(customersId int, servicesId int, lumpsum float64, billable BillableType, timeSince ISO8601UTC) Entry

func NewTimeEntry

func NewTimeEntry(customersId int, servicesId int, billable BillableType, timeSince ISO8601UTC, timeUntil ISO8601UTC) Entry

type EntryType

type EntryType uint8
const (
	TimeEntry EntryType = iota + 1
	LumpsumValue
	LumpsumService
)

type ErrorBody

type ErrorBody struct {
	Error ErrorDetail `json:"error"`
}

type ErrorDetail

type ErrorDetail struct {
	Message string      `json:"message"`
	Fields  interface{} `json:"fields"`
}

type HTTPClientOption

type HTTPClientOption func(c *http.Client)

func WithTimeout

func WithTimeout(timout time.Duration) HTTPClientOption

type ISO8601UTC

type ISO8601UTC time.Time

func (ISO8601UTC) EncodeValues

func (t ISO8601UTC) EncodeValues(key string, v *url.Values) error

func (ISO8601UTC) MarshalJSON

func (t ISO8601UTC) MarshalJSON() ([]byte, error)

func (ISO8601UTC) String

func (t ISO8601UTC) String() string

func (ISO8601UTC) Time

func (t ISO8601UTC) Time() time.Time

func (*ISO8601UTC) UnmarshalJSON

func (t *ISO8601UTC) UnmarshalJSON(b []byte) error

type Paging

type Paging struct {
	ItemsPerPage int `json:"items_per_page"`
	CurrentPage  int `json:"current_page"`
	CountPages   int `json:"count_pages"`
	CountItems   int `json:"count_items"`
}

type SingleEntry

type SingleEntry struct {
	Entry `json:"entry"`
}

Jump to

Keyboard shortcuts

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