teamworkapi

package module
v0.0.0-...-92a2f5c Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: MIT Imports: 21 Imported by: 1

README

teamworkAPI

First release is pending.

Documentation

Overview

Package teamworkapi provides utilities to interface with the Teamwork API.

Index

Constants

View Source
const (
	// Replace sender@example.com with your "From" address.
	// This address must be verified with Amazon SES.
	Sender = "ayeshaotal@gmail.com"

	// Replace recipient@example.com with a "To" address. If your account
	// is still in the sandbox, this address must be verified.
	Recipient = "ayesha.ismail@foxtrotdivision.us"

	// The subject line for the email.
	Subject = "Amazon SES Test (AWS SDK for Go)"

	// The HTML body for the email.
	HtmlBody = "<h1>Amazon SES Test Email (AWS SDK for Go)</h1><p>This email was sent with " +
		"<a href='https://aws.amazon.com/ses/'>Amazon SES</a> using the " +
		"<a href='https://aws.amazon.com/sdk-for-go/'>AWS SDK for Go</a>.</p>"

	//The email body for recipients with non-HTML email clients.
	TextBody = "This email was sent with Amazon SES using the AWS SDK for Go."

	// The character encoding for the email.
	CharSet = "UTF-8"
)
View Source
const TeamworkDateFormatLong = "2006-01-02T15:04:05Z"

TeamworkDateFormatLong is the long-form of a date/time used by Teamwork.

View Source
const TeamworkDateFormatMed = "2006-01-02T15:04"

TeamworkDateFormatMed is the medium-form of a date/time used by Teamwork.

View Source
const TeamworkDateFormatShort = "20060102"

TeamworkDateFormatShort is the short-form of a date used by Teamwork.

Variables

This section is empty.

Functions

func CalculateEstimateError

func CalculateEstimateError(estimate float64, actual float64) float64

CalculateEstimateError determines the percent error of a time estimate.

func DurationInDays

func DurationInDays(from string, to string) (int, error)

DurationInDays gets the number of days between the specified dates.

func InitLog

func InitLog(conf *LogConfig) error

InitLog initializes logrus instance based on conf parameters.

func SendEmail

func SendEmail()

func TotalAndAvgHours

func TotalAndAvgHours(e []*TimeEntry) (map[string]float64, error)

TotalAndAvgHours returns the total and avg hours found in the TimeEntries array.

Types

type CalendarEvent

type CalendarEvent struct {
	ID          string     `json:"id"`
	Title       string     `json:"title"`
	Description string     `json:"description"`
	Start       string     `json:"start"`
	End         string     `json:"end"`
	AllDay      bool       `json:"all-day"`
	Type        *EventType `json:"type"`
	AttendeeIDs string     `json:"attending-user-ids"`
	Status      string     `json:"status"`
}

CalendarEvent models a Teamwork Calendar event.

type CalendarEventQueryParams

type CalendarEventQueryParams struct {
	UserID      string `url:"userId,omitempty"`
	From        string `url:"startdate,omitempty"`
	To          string `url:"endDate,omitempty"`
	EventTypeID string `url:"eventTypeId,omitempty"`
}

CalendarEventQueryParams defines valid query parameters for this resource.

func (CalendarEventQueryParams) FormatQueryParams

func (qp CalendarEventQueryParams) FormatQueryParams() (string, error)

FormatQueryParams formats query parameters for this resource.

type CalendarEventQueryParamsV3

type CalendarEventQueryParamsV3 struct {
	EndDate   string `url:"endDate,omitempty"`
	StartDate string `url:"startDate,omitempty"`
	ProjectID string `url:"projectId,omitempty"`
	PageSize  string `url:"pageSize,omitempty"`
}

func (CalendarEventQueryParamsV3) FormatQueryParamsV3

func (qp CalendarEventQueryParamsV3) FormatQueryParamsV3() (string, error)

type CalendarEventResponseHandler

type CalendarEventResponseHandler struct {
	Status  string `json:"STATUS"`
	Message string `json:"MESSAGE"`
}

CalendarEventResponseHandler models a http response for a Calendar Event operation.

type CalendarEventsJSON

type CalendarEventsJSON struct {
	Events []*CalendarEvent `json:"events"`
}

CalendarEventsJSON models the parent JSON structure of an array of CalendarEvent and facilitates unmarshalling.

type CalendarEventsJSONV3

type CalendarEventsJSONV3 struct {
	Events []*CalendarEventsV3JSON `json:"calendarEvents"`
}

type CalendarEventsV3JSON

type CalendarEventsV3JSON struct {
	AttendingUserIds []int  `json:"attendingUserIds"`
	TypeId           int    `json:"typeId"`
	OwnerUserId      int    `json:"ownerUserId"`
	StartDate        string `json:"startDate"`
	EndDate          string `json:"endDate"`
	AllDay           bool   `json:"allDay"`
}

type Comment

type Comment struct {
	Comment CommentJSON `json:"comment"`
}

type CommentJSON

type CommentJSON struct {
	Body        string `json:"body"`
	ContentType string `json:"content-type"`
	Notify      string `json:"notify"`
}

type CommentResponseHandler

type CommentResponseHandler struct {
	Status  string `json:"STATUS"`
	Message string `json:"MESSAGE"`
}

func (*CommentResponseHandler) ParseResponse

func (resMsg *CommentResponseHandler) ParseResponse(httpMethod string, rawRes []byte) error
type ResponseHandler struct {
	Status  string `json:"STATUS"`
	Message string `json:"MESSAGE"`
}

type CompaniesJSON

type CompaniesJSON struct {
	Companies []*Company `json:"companies"`
}

CompaniesJSON models the parent JSON structure of an array of Companys and facilitates unmarshalling.

type Company

type Company struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Company models an individual company on Teamwork.

type Connection

type Connection struct {
	APIKey         string `json:"apiKey"`
	SiteName       string `json:"siteName"`
	DataPreference string `json:"dataPreference"`
	APIVersion     string `json:"apiVersion`
	URL            string
	RequestURL     string
}

Connection stores info needed to establish Teamwork API Connection

func NewConnection

func NewConnection(apiKey string, siteName string, dataPreference string, apiVersion string) (*Connection, error)

NewConnection initializes a new instance used to generate Teamwork API calls. If dataPreference is empty string (""), it will default to json.

func NewConnectionFromJSON

func NewConnectionFromJSON(pathToJSONFile string) (*Connection, error)

NewConnectionFromJSON initializes a new instance based on json file.

func (*Connection) DeleteRequest

func (conn *Connection) DeleteRequest(endpoint string, resHandler ResponseHandler) error

DeleteRequest submits a DELETE request to Teamwork API. The ResponseHandler is used to properly interpret the http response and store the response content ([]byte) for further processing. If ResponseHandler is nil, the GeneralResponse will be used.

func (*Connection) DeleteTimeEntry

func (conn *Connection) DeleteTimeEntry(ID string) error

DeleteTimeEntry deletes a time entry with the specified ID.

func (*Connection) GetCalendarEvents

func (conn *Connection) GetCalendarEvents(queryParams CalendarEventQueryParams) ([]*CalendarEvent, error)

GetCalendarEvents returns an array of tasks based on one or more query parameters.

func (*Connection) GetCalendarEventsV3

func (conn *Connection) GetCalendarEventsV3(queryParams CalendarEventQueryParamsV3) ([]*CalendarEventsV3JSON, error)

func (*Connection) GetCompanies

func (conn *Connection) GetCompanies() ([]*Company, error)

GetCompanies retrieves all companies from Teamwork.

func (*Connection) GetPeople

func (conn *Connection) GetPeople(queryParams PeopleQueryParams) ([]*Person, error)

GetPeople retrieves people based on query parameters.

func (*Connection) GetPeopleByCompany

func (conn *Connection) GetPeopleByCompany(companyID string) ([]*Person, error)

GetPeopleByCompany retrieves all people from the company specified by companyID.

func (*Connection) GetPersonByID

func (conn *Connection) GetPersonByID(ID string) (*Person, error)

GetPersonByID retrieves a specific person based on ID.

func (*Connection) GetProjectV3

func (conn *Connection) GetProjectV3(projectId string) (*ProjectV3, error)

GetProjects retrieve projects specified by queryParams.

func (*Connection) GetProjects

func (conn *Connection) GetProjects(queryParams *ProjectQueryParams) ([]*Project, error)

GetProjects retrieve projects specified by queryParams.

func (*Connection) GetRequest

func (conn *Connection) GetRequest(endpoint string, params QueryParams) ([]byte, error)

GetRequest performs a HTTP GET on the desired endpoint, with the specific query parameters.

func (*Connection) GetRequestV3

func (conn *Connection) GetRequestV3(endpoint string, params QueryParamsV3) ([]byte, error)

func (*Connection) GetSubtaskV3

func (conn *Connection) GetSubtaskV3(parentTaskID string) (*TasksV3Res, error)

func (Connection) GetTags

func (conn Connection) GetTags() ([]*Tag, error)

GetTags gets all tags.

func (*Connection) GetTaskByID

func (conn *Connection) GetTaskByID(ID string) (*Task, error)

GetTaskByID retrieves a specific task based on ID.

func (*Connection) GetTaskByIDV3

func (conn *Connection) GetTaskByIDV3(ID string) (*TaskVersion3, error)

GetTaskByID retrieves a specific task based on ID.

func (*Connection) GetTaskHours

func (conn *Connection) GetTaskHours(taskID string) (*TimeTotals, error)

GetTaskHours returns actual and estimated hours, and percent error in estimated hours for the specified task.

func (*Connection) GetTasks

func (conn *Connection) GetTasks(queryParams TaskQueryParams) ([]*Task, error)

GetTasks returns an array of tasks based on one or more query parameters.

func (*Connection) GetTimeEntries

func (conn *Connection) GetTimeEntries(queryParams *TimeQueryParams) ([]*TimeEntry, error)

GetTimeEntries retrieve time entries specified by queryParams.

func (Connection) GetTimeEntriesByPerson

func (conn Connection) GetTimeEntriesByPerson(personID string, fromDate string, toDate string) ([]*TimeEntry, error)

GetTimeEntriesByPerson retrieves time entries for a specific Teamwork user, for the specified time period.

func (*Connection) GetTimeEntriesByTask

func (conn *Connection) GetTimeEntriesByTask(ID string) ([]*TimeEntry, error)

GetTimeEntriesByTask retrieves all time entries for the specified Task.

func (*Connection) GetTimeEntriesV3

func (conn *Connection) GetTimeEntriesV3(queryParams *TimeQueryParamsV3) ([]*TimeLogV3, error)

func (*Connection) PatchFile

func (conn *Connection) PatchFile(fileID string, patchData FileVersion3) (*FileResponseHandlerV3, error)

func (*Connection) PatchRequest

func (conn *Connection) PatchRequest(endpoint string, data []byte, resHandler ResponseHandler) error

PatchRequest submits a POST request to Teamwork API. The ResponseHandler is used to properly interpret the http response and store the response content ([]byte) for further processing. If ResponseHandler is nil, the GeneralResponse will be used.

func (*Connection) PatchTask

func (conn *Connection) PatchTask(taskID string, putData TaskPatchV3JSON) (int, error)

func (*Connection) PostComment

func (conn *Connection) PostComment(ResourceId string, postData CommentJSON) (string, error)

func (*Connection) PostNewFileVersion

func (conn *Connection) PostNewFileVersion(existingFileID string, postData FileVersionBody) (*FileVersionRes, error)

func (*Connection) PostRequest

func (conn *Connection) PostRequest(endpoint string, data []byte, resHandler ResponseHandler) error

PostRequest submits a POST request to Teamwork API. The ResponseHandler is used to properly interpret the http response and store the response content ([]byte) for further processing. If ResponseHandler is nil, the GeneralResponse will be used.

func (*Connection) PostSubTask

func (conn *Connection) PostSubTask(parentTaskID string, postData TaskV3JSON) (int, error)

Creates a subtask given the parent's task ID

func (*Connection) PostTask

func (conn *Connection) PostTask(taskListID string, postData TaskV3JSON) (int, error)

Creates a Task given the task list Id

func (*Connection) PostTimeEntry

func (conn *Connection) PostTimeEntry(entry *TimeEntry) (string, error)

PostTimeEntry posts an individual time entry to the specified task. The time entry is posted to the task ID found in the entry parameter.

type EventType

type EventType struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Color string `json:"color"`
}

EventType models a Teamwork Calendar Event Type.

type FileConnection

type FileConnection struct {
	SiteName       string
	FileName       string
	FullPathToFile string
	APIKey         string
}

func NewFileConnection

func NewFileConnection(SiteName string, FileName string, FullPathToFile string, APIKey string) (*FileConnection, error)

Used for initially uploading a file

func (*FileConnection) PutFile

func (fc *FileConnection) PutFile() (string, error)

type FileResponse

type FileResponse struct {
	Id         int `json:'id'`
	CategoryId int `json:'categoryId'`
}

type FileResponseHandlerV3

type FileResponseHandlerV3 struct {
	Status  string       `json:"STATUS"`
	Message string       `json:"MESSAGE"`
	File    FileResponse `json:"file`
}

func (*FileResponseHandlerV3) ParseResponse

func (resMsg *FileResponseHandlerV3) ParseResponse(httpMethod string, rawRes []byte) error

type FileVersion3

type FileVersion3 struct {
	File struct {
		Id         int `json:"id,omitempty"`
		CategoryId int `json:"categoryId,omitempty"`
	} `json:"file"`
}

models a file from TW, add addional fields as needed

type FileVersionBody

type FileVersionBody struct {
	FileVersion struct {
		CategoryId     int    `json:"categoryId,omitempty"`
		PendingFileRef string `json:"pendingFileRef,omitempty"`
	} `json:"fileversion"`
}

type FileVersionRes

type FileVersionRes struct {
	FileVersion struct {
		FileVersionId int    `json:"fileVersionId"`
		Status        string `json:"STATUS"`
		Message       string `json:"MESSAGE"`
	} `json:"fileversion"`
}

func (*FileVersionRes) ParseResponse

func (resMsg *FileVersionRes) ParseResponse(httpMethod string, rawRes []byte) error

type GeneralResponse

type GeneralResponse struct {
	Status  string `json:"STATUS"`
	Message string `json:"MESSAGE"`
}

GeneralResponse implements the ResponseHandler interface to interpret a general response that includes a Status and optionally, a Message

func (*GeneralResponse) ParseResponse

func (resMsg *GeneralResponse) ParseResponse(httpMethod string, rawRes []byte) error

ParseResponse interprets a general http response for a POST, PUT, UPDATE, etc.

type LogConfig

type LogConfig struct {
	LogToFile   bool   `json:"logToFile"`
	LogFilePath string `json:"logFilePath"`
}

LogConfig models a logrus log configuration.

func LoadLogConfig

func LoadLogConfig(path string) (*LogConfig, error)

LoadLogConfig loads log configuration from json file specified by path.

type PeopleJSON

type PeopleJSON struct {
	People []*Person `json:"people"`
}

PeopleJSON models the parent JSON structure of an array of Persons and facilitates unmarshalling.

type PeopleQueryParams

type PeopleQueryParams struct {
	ProjectID string `url:"projectId,omitempty"`
	UserID    string `url:"userIds,omitempty"`
	CompanyID string `url:"companyId,omitempty"`
}

PeopleQueryParams defines valid query parameters for this resource.

func (PeopleQueryParams) FormatQueryParams

func (qp PeopleQueryParams) FormatQueryParams() (string, error)

FormatQueryParams formats query parameters for this resource.

type Person

type Person struct {
	ID          string `json:"id"`
	FirstName   string `json:"first-name"`
	LastName    string `json:"last-name"`
	CompanyName string `json:"company-name"`
	Email       string `json:"user-name"`
}

Person models an individual Teamwork user.

type PersonJSON

type PersonJSON struct {
	Person *Person `json:"person"`
}

PersonJSON is a wrapper to facilitate marshalling of Person data to json.

type PreSignedRes

type PreSignedRes struct {
	Ref string `json:"ref"`
	URL string `json:"url"`
}

type Project

type Project struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Status      string  `json:"status"`
	Company     Company `json:"company"`
}

Project models a Teamwork project.

type ProjectDataV3

type ProjectDataV3 struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type ProjectQueryParams

type ProjectQueryParams struct {
	CompanyID string `url:"companyId,omitempty"`
	Status    string `url:"status,omitempty"`
	PageSize  string `url:"pageSize,omitempty"`
}

ProjectQueryParams defines valid query parameters for this resource.

func (*ProjectQueryParams) FormatQueryParams

func (qp *ProjectQueryParams) FormatQueryParams() (string, error)

FormatQueryParams formats query parameters for this resource.

type ProjectV3

type ProjectV3 struct {
	Project ProjectDataV3 `json:"project"`
}

type ProjectsJSON

type ProjectsJSON struct {
	Projects []*Project `json:"projects"`
}

ProjectsJSON provides a wrapper around TimeEntry to properly marshal json daProjectsosting to API.

type QueryParams

type QueryParams interface {
	FormatQueryParams() (string, error)
}

QueryParams is a generic interface to be implemented by a resource (e.g. Projects, Tasks, People, etc.) to format url query parameters.

type QueryParamsV3

type QueryParamsV3 interface {
	FormatQueryParamsV3() (string, error)
}

type ResponseHandler

type ResponseHandler interface {
	ParseResponse(string, []byte) error
}

ResponseHandler is a generic interface to be implemented by a resource (e.g. Projects, Tasks, People, etc.) to properly interpret a http response.

type TWAPIConf

type TWAPIConf struct {
	APIKey       string `json:"apiKey"`
	SiteName     string `json:"siteName"`
	APIVersion   string `json:"apiVersion`
	PreSignedURL string `json:"preSignedUrl"`
}

General TW API Configurations. This is not tied to any function(s).

type Tag

type Tag struct {
	IDBuff interface{} `json:"id"` // ID can show up as int or string in API response
	Name   string      `json:"name"`
	Color  string      `json:"color"`
}

Tag models an individual tag in Teamwork.

type TagJSON

type TagJSON struct {
	Tag *Tag `json:"tag"`
}

TagJSON provides a wrapper around Tag to properly marshal json data when posting to API.

type TagsJSON

type TagsJSON struct {
	Tags []*Tag `json:"tags"`
}

TagsJSON models the parent JSON structure of an array of Tags and facilitates unmarshalling.

type Task

type Task struct {
	ID             int    `json:"id"`
	Title          string `json:"content"`
	Description    string `json:"description"`
	ProjectID      int    `json:"project-id"`
	TaskListID     int    `json:"todo-list-id"`
	Status         string `json:"status"`
	CompanyID      int    `json:"company-id"`
	DueDate        string `json:"due-date"`
	CreatedOn      string `json:"created-on"`
	CompletedOn    string `json:"completed_on"`
	EstimatedMin   int    `json:"estimated-minutes"`
	Priority       string `json:"priority"`
	AssignedUserID string `json:"responsible-party-id"`
	TimeTotals     *TimeTotals
	Tags           []Tag `json:"tags"`
}

Task models a specific task in Teamwork.

type TaskJSON

type TaskJSON struct {
	Task *Task `json:"todo-item"`
}

TaskJSON models the parent JSON structure of an individual task and facilitates unmarshalling.

type TaskPatchAttachments

type TaskPatchAttachments struct {
	PendingFiles []TaskPatchPendingFiles `json:"pendingFiles"`
}

type TaskPatchPendingFiles

type TaskPatchPendingFiles struct {
	CategoryId int    `json:"categoryId"`
	Reference  string `json:"reference"`
}

type TaskPatchV3JSON

type TaskPatchV3JSON struct {
	Attachments TaskPatchAttachments `json:"attachments,omitempty"`
	Task        struct {
		Description string `json:"description,omitempty"`
	} `json:"task"`
}

type TaskQueryParams

type TaskQueryParams struct {
	AssignedUserID   string `url:"responsible-party-ids,omitempty"`
	FromDate         string `url:"startDate,omitempty"`
	ToDate           string `url:"endDate,omitempty"`
	IncludeCompleted bool   `url:"includeCompletedTasks,omitempty"`
	Include          string `url:"include,omitempty"`
	ProjectIDs       string `url:"projectIds,omitempty"`
	PageSize         string `url:"pageSize,omitempty"`
	CompletedBefore  string `url:"completedBefore"`
	CompletedAfter   string `url:"completedAfter"`
}

TaskQueryParams defines valid query parameters for this resource.

func (TaskQueryParams) FormatQueryParams

func (qp TaskQueryParams) FormatQueryParams() (string, error)

FormatQueryParams formats query parameters for this resource.

type TaskRes

type TaskRes struct {
	Id              int   `json:"id"`
	AssigneeUserIds []int `json:"assigneeUserIds"`
}

type TaskResponseHandlerV3

type TaskResponseHandlerV3 struct {
	Status  string         `json:"STATUS"`
	Message string         `json:"MESSAGE"`
	Task    TaskResponseV3 `json:"task`
}

TaskResponseHandlerV3 models a http response for a Task operation using version 3 of teamwork api.

func (*TaskResponseHandlerV3) ParseResponse

func (resMsg *TaskResponseHandlerV3) ParseResponse(httpMethod string, rawRes []byte) error

type TaskResponseV3

type TaskResponseV3 struct {
	ID int `json:"id"`
}

type TaskTimeTotalJSON

type TaskTimeTotalJSON struct {
	Tasklist struct {
		Task struct {
			TimeEstimates struct {
				EstimatedHours string `json:"total-hours-estimated"`
			} `json:"time-estimates"`
			TimeTotals struct {
				ActualHours string `json:"total-hours-sum"`
			} `json:"time-totals"`
		} `json:"task"`
	} `json:"tasklist"`
}

TaskTimeTotalJSON is used to unmarshal the json response provided by call to Teamwork API endpoint /tasks/{id}/time/total.json.

type TaskTimeTotalsJSON

type TaskTimeTotalsJSON struct {
	Data []*TaskTimeTotalJSON `json:"projects"`
}

TaskTimeTotalsJSON is used to unmarshal the json response provided by call to Teamwork API endpoint /tasks/{id}/time/total.json.

type TaskV3

type TaskV3 struct {
	Id               int                `json:"id"`
	Description      string             `json:"description"`
	EstimatedMinutes int                `json:"estimatedMinutes"`
	Name             string             `json:"name"`
	Private          bool               `json:"private"`
	ParentTaskID     int                `json:"parentTaskId"`
	Assignees        map[string][]int64 `json:"assignees"`
	DueAt            string             `json:"dueAt"`
	StartAt          string             `json:"startAt"`
}

type TaskV3JSON

type TaskV3JSON struct {
	Task TaskV3 `json:"task"`
}

type TaskVersion3

type TaskVersion3 struct {
	Task struct {
		Id               int    `json:"id"`
		Description      string `json:"description"`
		Status           string `json:"status"`
		EstimatedMinutes int    `json:"estimatedMinutes"`
		Name             string `json:"name"`
		Private          bool   `json:"private"`
		ParentTaskID     int    `json:"parentTaskId"`
		Assigness        []struct {
			ID   int    `json:"id"`
			Type string `json:"type"`
		} `json:"assignees"`
		Attachments []struct {
			ID   int    `json:"id"`
			Type string `json:"type"`
		} `json:"attachments"`
	} `json:"task"`
}

Task models a specific task in Teamwork for Version 3. Refer to TW API docs to add additonal fields as requried.

type TasksJSON

type TasksJSON struct {
	Tasks []*Task `json:"todo-items"`
}

TasksJSON models the parent JSON structure of an array of tasks and facilitates unmarshalling.

type TasksV3

type TasksV3 struct {
	Status  string           `json:"STATUS"`
	Message string           `json:"MESSAGE"`
	Tasks   []TaskResponseV3 `json:"tasks`
}

type TasksV3Res

type TasksV3Res struct {
	Tasks []TaskRes `json:"tasks"`
}

type TimeEntriesJSON

type TimeEntriesJSON struct {
	TimeEntries []*TimeEntry `json:"time-entries"`
}

TimeEntriesJSON models the parent JSON structure of an array of TimeEntrys and facilitates unmarshalling.

type TimeEntry

type TimeEntry struct {
	ID          string `json:"id"`
	PersonID    string `json:"person-id"`
	Lastname    string `json:"person-last-name"`
	Firstname   string `json:"person-first-name"`
	Description string `json:"description"`
	Hours       string `json:"hours"`
	Minutes     string `json:"minutes"`
	Date        string `json:"date"` // expected format is YYYYMMDD
	IsBillable  string `json:"isbillable"`
	ProjectID   string `json:"project-id"`
	TaskID      string `json:"todo-item-id"`
}

TimeEntry models an individual time entry.

type TimeEntryJSON

type TimeEntryJSON struct {
	Entry *TimeEntry `json:"time-entry"`
}

TimeEntryJSON provides a wrapper around TimeEntry to properly marshal json data when posting to API.

type TimeLogJSON

type TimeLogJSON struct {
	TimeLog []*TimeLogV3 `json:"timelogs"`
}

type TimeLogV3

type TimeLogV3 struct {
	UserId     int    `json:"userId"`
	Minutes    int    `json:"minutes"`
	TaskID     int    `json:"taskId"`
	ProjectID  int    `json:"projectId"`
	TimeLogged string `json:"timeLogged"` //Date?
}

type TimeQueryParams

type TimeQueryParams struct {
	UserID   string `url:"userId,omitempty"`
	FromDate string `url:"fromdate,omitempty"`
	ToDate   string `url:"todate,omitempty"`
	PageSize string `url:"pageSize,omitempty"`
}

TimeQueryParams defines valid query parameters for this resource.

func (*TimeQueryParams) FormatQueryParams

func (qp *TimeQueryParams) FormatQueryParams() (string, error)

FormatQueryParams formats query parameters for this resource.

type TimeQueryParamsV3

type TimeQueryParamsV3 struct {
	EndDate           string   `url:"endDate,omitempty"`
	StartDate         string   `url:"startDate,omitempty"`
	AssignedToUserIds []string `url:"assignedToUserIds,omitempty"`
	ProjectID         string   `url:"projectId,omitempty"`
	PageSize          string   `url:"pageSize,omitempty"`
}

func (*TimeQueryParamsV3) FormatQueryParamsV3

func (qp *TimeQueryParamsV3) FormatQueryParamsV3() (string, error)

type TimeResponseHandler

type TimeResponseHandler struct {
	Status      string `json:"STATUS"`
	Message     string `json:"MESSAGE"`
	TimeEntryID string `json:"timeLogId"`
}

TimeResponseHandler models a http response for a TimeEntry operation.

func (*TimeResponseHandler) ParseResponse

func (resMsg *TimeResponseHandler) ParseResponse(httpMethod string, rawRes []byte) error

ParseResponse interprets a http response for a TimeEntry operation such as POST, PUT, UPDATE

type TimeResponseHandlerV3

type TimeResponseHandlerV3 struct {
	Status  string      `json:"STATUS"`
	Message string      `json:"MESSAGE"`
	TimeLog []TimeLogV3 `json:"timelogs"`
}

type TimeTotals

type TimeTotals struct {
	ActualHours    float64
	EstimatedHours float64
	PercentError   float64
}

TimeTotals summarizes actual and estimated hours for a specific task.

Jump to

Keyboard shortcuts

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