go-harvest: github.com/becoded/go-harvest/harvest Index | Files

package harvest

import "github.com/becoded/go-harvest/harvest"

Index

Package Files

client.go client_contact.go company.go date.go estimate.go estimate_item_category.go estimate_message.go expense.go expense_category.go harvest.go invoice.go invoice_item_category.go invoice_message.go invoice_payment.go project.go project_task_assignment.go project_user_assignment.go role.go strings.go task.go time.go time_entry.go user.go user_project_assignment.go

Variables

var DateParseError = errors.New(`DateParseError: should be a string formatted as "2006-01-02"`)
var TimeParseError = errors.New(`TimeParseError: should be a string formatted as "15:04"`)

func Bool Uses

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func CheckResponse Uses

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range or equal to 202 Accepted. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.

The error type will be *RateLimitError for rate limit exceeded errors, and *TwoFactorAuthError for two-factor authentication errors.

func Float64 Uses

func Float64(v float64) *float64

Float64 is a helper routine that allocates a new float64 value to store v and returns a pointer to it.

func Int Uses

func Int(v int) *int

Int is a helper routine that allocates a new int value to store v and returns a pointer to it.

func Int64 Uses

func Int64(v int64) *int64

Int64 is a helper routine that allocates a new int value to store v and returns a pointer to it.

func Ints64 Uses

func Ints64(v []int64) *[]int64

Ints64 is a helper routine that allocates a new int slice to store v and returns a pointer to it.

func String Uses

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Stringify Uses

func Stringify(message interface{}) string

Stringify attempts to create a reasonable string representation of types in the GitHub library. It does things like resolve pointers to their values and omits struct fields with nil values.

func TimeTimeP Uses

func TimeTimeP(v time.Time) *time.Time

TimeTimeP is a helper routine that allocates a new time.Time value to store v and returns a pointer to it.

type AbuseRateLimitError Uses

type AbuseRateLimitError struct {
    Response *http.Response // HTTP response that caused this error
    Message  string         `json:"message"` // error message

    // RetryAfter is provided with some abuse rate limit errors. If present,
    // it is the amount of time that the client should wait before retrying.
    // Otherwise, the client should try again later (after an unspecified amount of time).
    RetryAfter *time.Duration
}

AbuseRateLimitError occurs when Harvest returns 429 Too many requests response with the "documentation_url" field value equal to "https://help.getharvest.com/api-v2/introduction/overview/general/#rate-limiting".

func (*AbuseRateLimitError) Error Uses

func (r *AbuseRateLimitError) Error() string

type Client Uses

type Client struct {
    Id        *int64     `json:"id,omitempty"`         // Unique ID for the client.
    Name      *string    `json:"name,omitempty"`       // A textual description of the client.
    IsActive  *bool      `json:"is_active,omitempty"`  // Whether the client is active or archived.
    Address   *string    `json:"address,omitempty"`    // The physical address for the client.
    Currency  *string    `json:"currency,omitempty"`   // The currency code associated with this client.
    CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the client was created.
    UpdatedAt *time.Time `json:"updated_at,omitempty"` // Date and time the client was last updated.
}

func (Client) String Uses

func (c Client) String() string

type ClientContact Uses

type ClientContact struct {
    Id          *int64     `json:"id,omitempty"`           // Unique ID for the contact.
    Client      *Client    `json:"client,omitempty"`       // An object containing the contact’s client id and name.
    Title       *string    `json:"title,omitempty"`        // The title of the contact.
    FirstName   *string    `json:"first_name,omitempty"`   // The first name of the contact.
    LastName    *string    `json:"last_name,omitempty"`    // The last name of the contact.
    Email       *string    `json:"email,omitempty"`        // The contact’s email address.
    PhoneOffice *string    `json:"phone_office,omitempty"` // The contact’s office phone number.
    PhoneMobile *string    `json:"phone_mobile,omitempty"` // The contact’s mobile phone number.
    Fax         *string    `json:"fax,omitempty"`          // The contact’s fax number.
    CreatedAt   *time.Time `json:"created_at,omitempty"`   // Date and time the contact was created.
    UpdatedAt   *time.Time `json:"updated_at,omitempty"`   // Date and time the contact was last updated.
}

func (ClientContact) String Uses

func (p ClientContact) String() string

type ClientContactCreateRequest Uses

type ClientContactCreateRequest struct {
    ClientId    *int64  `json:"client_id"`              // required	The ID of the client associated with this contact.
    Title       *string `json:"title,omitempty"`        // optional	The title of the contact.
    FirstName   *string `json:"first_name"`             // required	The first name of the contact.
    LastName    *string `json:"last_name,omitempty"`    // optional	The last name of the contact.
    Email       *string `json:"email,omitempty"`        // optional	The contact’s email address.
    PhoneOffice *string `json:"phone_office,omitempty"` // optional	The contact’s office phone number.
    PhoneMobile *string `json:"phone_mobile,omitempty"` // optional	The contact’s mobile phone number.
    Fax         *string `json:"fax,omitempty"`          // optional	The contact’s fax number.
}

type ClientContactList Uses

type ClientContactList struct {
    ClientContacts []*ClientContact `json:"contacts"`

    Pagination
}

func (ClientContactList) String Uses

func (p ClientContactList) String() string

type ClientContactListOptions Uses

type ClientContactListOptions struct {
    // Only return contacts belonging to the client with the given ID.
    ClientId int64 `url:"client_id,omitempty"`
    // Only return contacts that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type ClientContactUpdateRequest Uses

type ClientContactUpdateRequest struct {
    ClientId    *int64  `json:"client_id,omitempty"`    // required	The ID of the client associated with this contact.
    Title       *string `json:"title,omitempty"`        // optional	The title of the contact.
    FirstName   *string `json:"first_name,omitempty"`   // required	The first name of the contact.
    LastName    *string `json:"last_name,omitempty"`    // optional	The last name of the contact.
    Email       *string `json:"email,omitempty"`        // optional	The contact’s email address.
    PhoneOffice *string `json:"phone_office,omitempty"` // optional	The contact’s office phone number.
    PhoneMobile *string `json:"phone_mobile,omitempty"` // optional	The contact’s mobile phone number.
    Fax         *string `json:"fax,omitempty"`          // optional	The contact’s fax number.
}

type ClientCreateRequest Uses

type ClientCreateRequest struct {
    Name     *string `json:"name"`                // required	A textual description of the client.
    IsActive *bool   `json:"is_active,omitempty"` // optional	Whether the client is active, or archived. Defaults to true.
    Address  *string `json:"address,omitempty"`   // optional	A textual representation of the client’s physical address. May include new line characters.
    Currency *string `json:"currency,omitempty"`  // optional	The currency used by the client. If not provided, the company’s currency will be used. See a list of supported currencies
}

type ClientList Uses

type ClientList struct {
    Clients []*Client `json:"clients"`

    Pagination
}

func (ClientList) String Uses

func (c ClientList) String() string

type ClientListOptions Uses

type ClientListOptions struct {
    // Pass true to only return active projects and false to return inactive projects.
    IsActive bool `url:"is_active,omitempty"`
    // Only return projects that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type ClientService Uses

type ClientService service

ClientService handles communication with the client related methods of the Harvest API.

Harvest API docs: https://help.getharvest.com/api-v2/clients-api/clients/clients/

func (*ClientService) Create Uses

func (s *ClientService) Create(ctx context.Context, data *ClientCreateRequest) (*Client, *http.Response, error)

Create creates a new client object. Returns a client object and a 201 Created response code if the call succeeded.

func (*ClientService) CreateClientContact Uses

func (s *ClientService) CreateClientContact(ctx context.Context, data *ClientContactCreateRequest) (*ClientContact, *http.Response, error)

func (*ClientService) Delete Uses

func (s *ClientService) Delete(ctx context.Context, clientId int64) (*http.Response, error)

Delete deletes a specific client. Deleting a client is only possible if it has no projects, invoices, or estimates associated with it. Returns a 200 OK response code if the call succeeded.

func (*ClientService) DeleteClientContact Uses

func (s *ClientService) DeleteClientContact(ctx context.Context, contactId int64) (*http.Response, error)

func (*ClientService) Get Uses

func (s *ClientService) Get(ctx context.Context, clientId int64) (*Client, *http.Response, error)

Get retrieves the client with the given ID. Returns a client object and a 200 OK response code if a valid identifier was provided.

func (*ClientService) GetContact Uses

func (s *ClientService) GetContact(ctx context.Context, clientContactId int64) (*ClientContact, *http.Response, error)

func (*ClientService) List Uses

func (s *ClientService) List(ctx context.Context, opt *ClientListOptions) (*ClientList, *http.Response, error)

List returns a list of your clients. The clients are returned sorted by creation date, with the most recently created clients appearing first.

func (*ClientService) ListContacts Uses

func (s *ClientService) ListContacts(ctx context.Context, opt *ClientContactListOptions) (*ClientContactList, *http.Response, error)

func (*ClientService) Update Uses

func (s *ClientService) Update(ctx context.Context, clientId int64, data *ClientUpdateRequest) (*Client, *http.Response, error)

Update updates the specific client by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Returns a client object and a 200 OK response code if the call succeeded.

func (*ClientService) UpdateClientContact Uses

func (s *ClientService) UpdateClientContact(ctx context.Context, contactId int64, data *ClientContactUpdateRequest) (*ClientContact, *http.Response, error)

type ClientUpdateRequest Uses

type ClientUpdateRequest struct {
    Name     *string `json:"name,omitempty"`      // A textual description of the client.
    IsActive *bool   `json:"is_active,omitempty"` // Whether the client is active, or archived. Defaults to true.
    Address  *string `json:"address,omitempty"`   // A textual representation of the client’s physical address. May include new line characters.
    Currency *string `json:"currency,omitempty"`  // The currency used by the client. If not provided, the company’s currency will be used. See a list of supported currencies
}

type Company Uses

type Company struct {
    BaseUri              *string `json:"base_uri,omitempty"`               // The Harvest URL for the company.
    FullDomain           *string `json:"full_domain,omitempty"`            // The Harvest domain for the company.
    Name                 *string `json:"name,omitempty"`                   // The name of the company.
    IsActive             *bool   `json:"is_active,omitempty"`              // Whether the company is active or archived.
    WeekStartDay         *string `json:"week_start_day,omitempty"`         // The week day used as the start of the week. Returns one of: Saturday, Sunday, or Monday.
    WantsTimestampTimers *bool   `json:"wants_timestamp_timers,omitempty"` // Whether time is tracked via duration or start and end times.
    TimeFormat           *string `json:"time_format,omitempty"`            // The format used to display time in Harvest. Returns either decimal or hours_minutes.
    PlanType             *string `json:"plan_type,omitempty"`              // The type of plan the company is on. Examples: trial, free, or simple-v4
    Clock                *string `json:"clock,omitempty"`                  // Used to represent whether the company is using a 12-hour or 24-hour clock. Returns either 12h or 24h.
    DecimalSymbol        *string `json:"decimal_symbol,omitempty"`         // Symbol *used `json:"Symbol,omitempty"` //when *formatting `json:"when,omitempty"` //decimals.
    ThousandsSeparator   *string `json:"thousands_separator,omitempty"`    // Separator *used `json:"Separator,omitempty"` //when formatting numbers.
    ColorScheme          *string `json:"color_scheme,omitempty"`           // The color scheme being used in the Harvest web client.
    ExpenseFeature       *bool   `json:"expense_feature,omitempty"`        // Whether the expense module is enabled.
    InvoiceFeature       *bool   `json:"invoice_feature,omitempty"`        // Whether the invoice module is enabled.
    EstimateFeature      *bool   `json:"estimate_feature,omitempty"`       // Whether the estimate module is enabled.
    ApprovalFeature      *bool   `json:"approval_feature,omitempty"`       // Whether *the `json:"Whether,omitempty"` //approval module is enabled.
}

func (Company) String Uses

func (c Company) String() string

type CompanyService Uses

type CompanyService service

CompanyService handles communication with the company related methods of the Harvest API.

Harvest API docs: https://help.getharvest.com/api-v2/company-api/company/company/

func (*CompanyService) Get Uses

func (s *CompanyService) Get(ctx context.Context) (*Company, *http.Response, error)

type Date Uses

type Date struct {
    time.Time
}

func DateP Uses

func DateP(v Date) *Date

DateP is a helper routine that allocates a new Date value to store v and returns a pointer to it.

func (*Date) EncodeValues Uses

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

func (Date) Equal Uses

func (t Date) Equal(u Date) bool

Equal reports whether t and u are equal based on time.Equal

func (Date) String Uses

func (t Date) String() string

func (*Date) UnmarshalJSON Uses

func (t *Date) UnmarshalJSON(data []byte) (err error)

type Error Uses

type Error struct {
    Resource string `json:"resource"` // resource on which the error occurred
    Field    string `json:"field"`    // field on which the error occurred
    Code     string `json:"code"`     // validation error code
    Message  string `json:"message"`  // Message describing the error. Errors with Code == "custom" will always have this set.
}

An Error reports more details on an individual error in an ErrorResponse.

func (*Error) Error Uses

func (e *Error) Error() string

type ErrorResponse Uses

type ErrorResponse struct {
    Response *http.Response // HTTP response that caused this error
    Message  string         `json:"message"` // error message
    Errors   []Error        `json:"errors"`  // more detail on individual errors

    Block *struct {
        Reason string `json:"reason,omitempty"`
    }   `json:"block,omitempty"`

    DocumentationURL string `json:"documentation_url,omitempty"`
}

An ErrorResponse reports one or more errors caused by an API request.

func (*ErrorResponse) Error Uses

func (r *ErrorResponse) Error() string

type Estimate Uses

type Estimate struct {
    Id             *int64              `json:"id,omitempty"`              // Unique ID for the estimate.
    Client         *Client             `json:"client,omitempty"`          // An object containing estimate’s client id and name.
    LineItems      *[]EstimateLineItem `json:"line_items,omitempty"`      // Array of estimate line items.
    Creator        *User               `json:"creator,omitempty"`         // An object containing the id and name of the person that created the estimate.
    ClientKey      *string             `json:"client_key,omitempty"`      // Used to build a URL to the public web invoice for your client: https://{ACCOUNT_SUBDOMAIN}.harvestapp.com/client/invoices/abc123456
    Number         *string             `json:"number,omitempty"`          // If no value is set, the number will be automatically generated.
    PurchaseOrder  *string             `json:"purchase_order,omitempty"`  // The purchase order number.
    Amount         *float64            `json:"amount,omitempty"`          // The total amount for the estimate, including any discounts and taxes.
    Tax            *float64            `json:"tax,omitempty"`             // This percentage is applied to the subtotal, including line items and discounts.
    TaxAmount      *float64            `json:"tax_amount,omitempty"`      // The first amount of tax included, calculated from tax. If no tax is defined, this value will be null.
    Tax2           *float64            `json:"tax2,omitempty"`            // This percentage is applied to the subtotal, including line items and discounts.
    Tax2Amount     *float64            `json:"tax2_amount,omitempty"`     // The amount calculated from tax2.
    Discount       *float64            `json:"discount,omitempty"`        // This percentage is subtracted from the subtotal.
    DiscountAmount *float64            `json:"discount_amount,omitempty"` // The amount calcuated from discount.
    Subject        *string             `json:"subject,omitempty"`         // The estimate subject.
    Notes          *string             `json:"notes,omitempty"`           // Any additional notes included on the estimate.
    Currency       *string             `json:"currency,omitempty"`        // The currency code associated with this estimate.
    IssueDate      *Date               `json:"issue_date,omitempty"`      // Date the estimate was issued.
    SentAt         *time.Time          `json:"sent_at,omitempty"`         // Date and time the estimate was sent.
    AcceptedAt     *time.Time          `json:"accepted_at,omitempty"`     // Date and time the estimate was accepted.
    DeclinedAt     *time.Time          `json:"declined_at,omitempty"`     // Date and time the estimate was declined.
    CreatedAt      *time.Time          `json:"created_at,omitempty"`      // Date and time the estimate was created.
    UpdatedAt      *time.Time          `json:"updated_at,omitempty"`      // Date and time the estimate was last updated.
}

func (Estimate) String Uses

func (p Estimate) String() string

type EstimateEventTypeRequest Uses

type EstimateEventTypeRequest struct {
    EventType string `json:"event_type"`
}

type EstimateItemCategory Uses

type EstimateItemCategory struct {
    Id        *int64     `json:"id,omitempty"`         // Unique ID for the estimate item category.
    Name      *string    `json:"name,omitempty"`       // The name of the estimate item category.
    CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the estimate item category was created.
    UpdatedAt *time.Time `json:"updated_at,omitempty"` // Date and time the estimate item category was last updated.
}

func (EstimateItemCategory) String Uses

func (p EstimateItemCategory) String() string

type EstimateItemCategoryList Uses

type EstimateItemCategoryList struct {
    EstimateItemCategories []*EstimateItemCategory `json:"estimate_item_categories"`

    Pagination
}

func (EstimateItemCategoryList) String Uses

func (p EstimateItemCategoryList) String() string

type EstimateItemCategoryListOptions Uses

type EstimateItemCategoryListOptions struct {
    // Only return estimate item categories that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type EstimateItemCategoryRequest Uses

type EstimateItemCategoryRequest struct {
    Name *string `json:"name,omitempty"` // required	The name of the estimate item category.
}

type EstimateLineItem Uses

type EstimateLineItem struct {
    Id          *int64   `json:"id,omitempty"`          // Unique ID for the line item.
    Kind        *string  `json:"kind,omitempty"`        // The name of an estimate item category.
    Description *string  `json:"description,omitempty"` // Text description of the line item.
    Quantity    *int64   `json:"quantity,omitempty"`    // The unit quantity of the item.
    UnitPrice   *float64 `json:"unit_price,omitempty"`  // The individual price per unit.
    Amount      *float64 `json:"amount,omitempty"`      // The line item subtotal (quantity * unit_price).
    Taxed       *bool    `json:"taxed,omitempty"`       // Whether the estimate’s tax percentage applies to this line item.
    Taxed2      *bool    `json:"taxed2,omitempty"`      // Whether the estimate’s tax2 percentage applies to this line item.
}

type EstimateList Uses

type EstimateList struct {
    Estimates []*Estimate `json:"estimates"`

    Pagination
}

func (EstimateList) String Uses

func (p EstimateList) String() string

type EstimateListOptions Uses

type EstimateListOptions struct {
    // Only return estimates belonging to the client with the given ID.
    ClientId int64 `url:"client_id,omitempty"`
    // Only return estimates that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type EstimateMessage Uses

type EstimateMessage struct {
    Id            *int64                      `json:"id,omitempty"`              // Unique ID for the message.
    SentBy        *string                     `json:"sent_by,omitempty"`         // Name of the user that created the message.
    SentByEmail   *string                     `json:"sent_by_email,omitempty"`   // Email of the user that created the message.
    SentFrom      *string                     `json:"sent_from,omitempty"`       // Name of the user that the message was sent from.
    SentFromEmail *string                     `json:"sent_from_email,omitempty"` // Email of the user that message was sent from.
    Recipients    *[]EstimateMessageRecipient `json:"recipients,omitempty"`      // Array of estimate message recipients.
    Subject       *string                     `json:"subject,omitempty"`         // The message subject.
    Body          *string                     `json:"body,omitempty"`            // The message body.
    SendMeACopy   *bool                       `json:"send_me_a_copy,omitempty"`  // Whether to email a copy of the message to the current user.
    EventType     *bool                       `json:"event_type,omitempty"`      // The type of estimate event that occurred with the message: send, accept, decline, re-open, view, or invoice.
    CreatedAt     *time.Time                  `json:"created_at,omitempty"`      // Date and time the message was created.
    UpdatedAt     *time.Time                  `json:"updated_at,omitempty"`      // Date and time the message was last updated.
}

func (EstimateMessage) String Uses

func (p EstimateMessage) String() string

type EstimateMessageCreateRequest Uses

type EstimateMessageCreateRequest struct {
    Recipients  *[]EstimateMessageRecipientCreateRequest `json:"recipients,omitempty"`     // required	Array of recipient parameters. See below for details.
    Subject     *string                                  `json:"subject,omitempty"`        // optional	The message subject.
    Body        *string                                  `json:"body,omitempty"`           // optional	The message body.
    SendMeACopy *bool                                    `json:"send_me_a_copy,omitempty"` // optional	If set to true, a copy of the message email will be sent to the current user. Defaults to false.
    EventType   *string                                  `json:"event_type,omitempty"`     // optional	If provided, runs an event against the estimate. Options: “accept”, “decline”, “re-open”, or “send”.
}

type EstimateMessageList Uses

type EstimateMessageList struct {
    Estimates []*Estimate `json:"estimates"`

    Pagination
}

func (EstimateMessageList) String Uses

func (p EstimateMessageList) String() string

type EstimateMessageListOptions Uses

type EstimateMessageListOptions struct {
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type EstimateMessageRecipient Uses

type EstimateMessageRecipient struct {
    Name  *string `json:"name,omitempty"`  // Name of the message recipient.
    Email *string `json:"email,omitempty"` // Email of the message recipient.
}

type EstimateMessageRecipientCreateRequest Uses

type EstimateMessageRecipientCreateRequest struct {
    Name  *string `json:"name,omitempty"` // optional	Name of the message recipient.
    Email *string `json:"email"`          // required	Email of the message recipient.
}

type EstimateService Uses

type EstimateService service

EstimateService handles communication with the issue related methods of the Harvest API.

Harvest API docs: https://help.getharvest.com/api-v2/estimates-api/estimates/estimates/

func (*EstimateService) CreateEstimateMessage Uses

func (s *EstimateService) CreateEstimateMessage(ctx context.Context, data *EstimateMessageCreateRequest) (*EstimateMessage, *http.Response, error)

func (*EstimateService) CreateItemCategory Uses

func (s *EstimateService) CreateItemCategory(ctx context.Context, data *EstimateItemCategoryRequest) (*EstimateItemCategory, *http.Response, error)

func (*EstimateService) DeleteEstimateMessage Uses

func (s *EstimateService) DeleteEstimateMessage(ctx context.Context, estimateId, estimateMessageId int64) (*http.Response, error)

func (*EstimateService) DeleteItemCategory Uses

func (s *EstimateService) DeleteItemCategory(ctx context.Context, estimateItemCategoryId int64) (*http.Response, error)

func (*EstimateService) Get Uses

func (s *EstimateService) Get(ctx context.Context, estimateId int64) (*Estimate, *http.Response, error)

func (*EstimateService) GetItemCategory Uses

func (s *EstimateService) GetItemCategory(ctx context.Context, estimateItemCategoryId int64) (*EstimateItemCategory, *http.Response, error)

func (*EstimateService) List Uses

func (s *EstimateService) List(ctx context.Context, opt *EstimateListOptions) (*EstimateList, *http.Response, error)

func (*EstimateService) ListEstimateMessages Uses

func (s *EstimateService) ListEstimateMessages(ctx context.Context, estimateId int64, opt *EstimateMessageListOptions) (*EstimateList, *http.Response, error)

func (*EstimateService) ListItemCategories Uses

func (s *EstimateService) ListItemCategories(ctx context.Context, opt *EstimateItemCategoryListOptions) (*EstimateItemCategoryList, *http.Response, error)

func (*EstimateService) MarkAsAccepted Uses

func (s *EstimateService) MarkAsAccepted(ctx context.Context, estimateId int64) (*EstimateMessage, *http.Response, error)

func (*EstimateService) MarkAsDeclined Uses

func (s *EstimateService) MarkAsDeclined(ctx context.Context, estimateId int64) (*EstimateMessage, *http.Response, error)

func (*EstimateService) MarkAsReopen Uses

func (s *EstimateService) MarkAsReopen(ctx context.Context, estimateId int64) (*EstimateMessage, *http.Response, error)

func (*EstimateService) MarkAsSent Uses

func (s *EstimateService) MarkAsSent(ctx context.Context, estimateId int64) (*EstimateMessage, *http.Response, error)

func (*EstimateService) SendEvent Uses

func (s *EstimateService) SendEvent(ctx context.Context, estimateId int64, data *EstimateEventTypeRequest) (*EstimateMessage, *http.Response, error)

func (*EstimateService) UpdateItemCategory Uses

func (s *EstimateService) UpdateItemCategory(ctx context.Context, estimateItemCategoryId int64, data *EstimateItemCategoryRequest) (*EstimateItemCategory, *http.Response, error)

type EventTypeRequest Uses

type EventTypeRequest struct {
    EventType string `json:"event_type"`
}

type Expense Uses

type Expense struct {
    Id              *int64                 `json:"id,omitempty"`               // Unique ID for the expense.
    Client          *Client                `json:"client,omitempty"`           // An object containing the expense’s client id, name, and currency.
    Project         *Project               `json:"project,omitempty"`          // An object containing the expense’s project id, name, and code.
    ExpenseCategory *ExpenseCategory       `json:"expense_category,omitempty"` // An object containing the expense’s expense category id, name, unit_price, and unit_name.
    User            *User                  `json:"user,omitempty"`             // An object containing the id and name of the user that recorded the expense.
    UserAssignment  *ProjectUserAssignment `json:"user_assignment,omitempty"`  // A user assignment object of the user that recorded the expense.
    Receipt         *Receipt               `json:"receipt,omitempty"`          // An object containing the expense’s receipt URL and file name.
    Invoice         *Invoice               `json:"invoice,omitempty"`          // Once the expense has been invoiced, this field will include the associated invoice’s id and number.
    Notes           *string                `json:"notes,omitempty"`            // Textual notes used to describe the expense.
    Billable        *bool                  `json:"billable,omitempty"`         // Whether the expense is billable or not.
    IsClosed        *bool                  `json:"is_closed,omitempty"`        // Whether the expense has been approved or closed for some other reason.
    IsLocked        *bool                  `json:"is_locked,omitempty"`        // Whether the expense has been been invoiced, approved, or the project or person related to the expense is archived.
    IsBilled        *bool                  `json:"is_billed,omitempty"`        // Whether or not the expense has been marked as invoiced.
    LockedReason    *string                `json:"locked_reason,omitempty"`    // An explanation of why the expense has been locked.
    SpentDate       *Date                  `json:"spent_date,omitempty"`       // Date the expense occurred.
    CreatedAt       *time.Time             `json:"created_at,omitempty"`       // Date and time the expense was created.
    UpdatedAt       *time.Time             `json:"updated_at,omitempty"`       // Date and time the expense was last updated.
}

func (Expense) String Uses

func (p Expense) String() string

type ExpenseCategory Uses

type ExpenseCategory struct {
    Id        *int64     `json:"id,omitempty"`         // Unique ID for the expense category.
    Name      *string    `json:"name,omitempty"`       // The name of the expense category.
    UnitName  *string    `json:"unit_name,omitempty"`  // The unit name of the expense category.
    UnitPrice *float64   `json:"unit_price,omitempty"` // The unit price of the expense category.
    IsActive  *bool      `json:"is_active,omitempty"`  // Whether the expense category is active or archived.
    CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the expense category was created.
    UpdatedAt *time.Time `json:"updated_at,omitempty"` // Date and time the expense category was last updated.
}

func (ExpenseCategory) String Uses

func (p ExpenseCategory) String() string

type ExpenseCategoryList Uses

type ExpenseCategoryList struct {
    ExpenseCategories []*ExpenseCategory `json:"invoice_item_categories"`

    Pagination
}

func (ExpenseCategoryList) String Uses

func (p ExpenseCategoryList) String() string

type ExpenseCategoryListOptions Uses

type ExpenseCategoryListOptions struct {
    IsActive     *bool      `url:"is_active,omitempty"`     // Pass true to only return active expense categories and false to return inactive expense categories.
    UpdatedSince *time.Time `url:"updated_since,omitempty"` // Only return expense categories that have been updated since the given date and time.

    ListOptions
}

type ExpenseCategoryRequest Uses

type ExpenseCategoryRequest struct {
    Name      *string  `json:"name,omitempty"`       // required	The name of the expense category.
    UnitName  *string  `json:"unit_name,omitempty"`  // optional	The unit name of the expense category.
    UnitPrice *float64 `json:"unit_price,omitempty"` // optional	The unit price of the expense category.
    IsActive  *bool    `json:"is_active,omitempty"`  // optional	Whether the expense category is active or archived. Defaults to true.
}

type ExpenseCreateRequest Uses

type ExpenseCreateRequest struct {
    UserId            *int64   `json:"user_id,omitempty"`    // optional	The ID of the user associated with this expense. Defaults to the ID of the currently authenticated user.
    ProjectId         *int64   `json:"project_id"`           // required	The ID of the project associated with this expense.
    ExpenseCategoryId *int64   `json:"expense_category_id"`  // required	The ID of the expense category this expense is being tracked against.
    SpentDate         *Date    `json:"spent_date"`           // required	Date the expense occurred.
    Units             *int64   `json:"units,omitempty"`      // *optional	The quantity of units to use in calculating the total_cost of the expense.
    TotalCost         *float64 `json:"total_cost,omitempty"` // *optional	The total amount of the expense.
    Notes             *string  `json:"notes,omitempty"`      // optional	Textual notes used to describe the expense.
    Billable          *bool    `json:"billable,omitempty"`   // optional	Whether this expense is billable or not. Defaults to true.

}

type ExpenseList Uses

type ExpenseList struct {
    Expenses []*Expense `json:"expenses"`

    Pagination
}

func (ExpenseList) String Uses

func (p ExpenseList) String() string

type ExpenseListOptions Uses

type ExpenseListOptions struct {
    UserId       *int64     `url:"user_id,omitempty"`       // Only return expenses belonging to the user with the given ID.
    ClientId     *int64     `url:"client_id,omitempty"`     // Only return expenses belonging to the client with the given ID.
    ProjectId    *int64     `url:"project_id,omitempty"`    // Only return expenses belonging to the project with the given ID.
    IsBilled     *bool      `url:"is_billed,omitempty"`     // Pass true to only return expenses that have been invoiced and false to return expenses that have not been invoiced.
    UpdatedSince *time.Time `url:"updated_since,omitempty"` // Only return expenses that have been updated since the given date and time.
    From         *Date      `url:"from,omitempty"`          // Only return expenses with a spent_date on or after the given date.
    To           *Date      `url:"to,omitempty"`            // Only return expenses with a spent_date on or before the given date.

    ListOptions
}

type ExpenseService Uses

type ExpenseService service

ExpenseService handles communication with the issue related methods of the Harvest API.

Harvest API docs: https://help.getharvest.com/api-v2/expenses-api/expenses/expenses/

func (*ExpenseService) Create Uses

func (s *ExpenseService) Create(ctx context.Context, data *ExpenseCreateRequest) (*Expense, *http.Response, error)

func (*ExpenseService) CreateExpenseCategory Uses

func (s *ExpenseService) CreateExpenseCategory(ctx context.Context, data *ExpenseCategoryRequest) (*ExpenseCategory, *http.Response, error)

func (*ExpenseService) Delete Uses

func (s *ExpenseService) Delete(ctx context.Context, expenseId int64) (*http.Response, error)

func (*ExpenseService) DeleteExpenseCategory Uses

func (s *ExpenseService) DeleteExpenseCategory(ctx context.Context, expenseCategoryId int64) (*http.Response, error)

func (*ExpenseService) Get Uses

func (s *ExpenseService) Get(ctx context.Context, expenseId int64) (*Expense, *http.Response, error)

func (*ExpenseService) GetExpenseCategory Uses

func (s *ExpenseService) GetExpenseCategory(ctx context.Context, expenseCategoryId int64) (*ExpenseCategory, *http.Response, error)

func (*ExpenseService) List Uses

func (s *ExpenseService) List(ctx context.Context, opt *ExpenseListOptions) (*ExpenseList, *http.Response, error)

func (*ExpenseService) ListExpenseCategories Uses

func (s *ExpenseService) ListExpenseCategories(ctx context.Context, opt *ExpenseCategoryListOptions) (*ExpenseCategoryList, *http.Response, error)

func (*ExpenseService) Update Uses

func (s *ExpenseService) Update(ctx context.Context, expenseId int64, data *ExpenseUpdateRequest) (*Expense, *http.Response, error)

func (*ExpenseService) UpdateExpenseCategory Uses

func (s *ExpenseService) UpdateExpenseCategory(ctx context.Context, expenseCategoryId int64, data *ExpenseCategoryRequest) (*ExpenseCategory, *http.Response, error)

type ExpenseUpdateRequest Uses

type ExpenseUpdateRequest struct {
    ProjectId         *int64   `json:"project_id,omitempty"`          // The ID of the project associated with this expense.
    ExpenseCategoryId *int64   `json:"expense_category_id,omitempty"` // The ID of the expense category this expense is being tracked against.
    Spent_date        *Date    `json:"spent_date,omitempty"`          // Date the expense occurred.
    Units             *int64   `json:"units,omitempty"`               // The quantity of units to use in calculating the total_cost of the expense.
    TotalCost         *float64 `json:"total_cost,omitempty"`          // The total amount of the expense.
    Notes             *string  `json:"notes,omitempty"`               // Textual notes used to describe the expense.
    Billable          *bool    `json:"billable,omitempty"`            // Whether this expense is billable or not. Defaults to true.
    //TODO add receipt file
    // Receipt *file `json:"receipt,omitempty"` // A receipt file to attach to the expense. If including a receipt, you must submit a multipart/form-data request.
    DeleteReceipt *bool `json:"delete_receipt,omitempty"` // Whether an attached expense receipt should be deleted. Pass true to delete the expense receipt.
}

type ExternalReference Uses

type ExternalReference struct {
    Id             *string `json:"id,omitempty"`
    GroupId        *string `json:"group_id,omitempty"`
    Permalink      *string `json:"permalink,omitempty"`
    Service        *string `json:"service,omitempty"`
    ServiceIconUrl *string `json:"service_icon_url,omitempty"`
}

type HarvestClient Uses

type HarvestClient struct {

    // Base URL for API requests. Defaults to the public Harvest API.
    // BaseURL should always be specified with a trailing slash.
    BaseURL *url.URL

    AccountId string

    // User agent used when communicating with the Harvest API.
    UserAgent string

    // Services used for talking to different parts of the Harvest API.
    Client    *ClientService
    Company   *CompanyService
    Project   *ProjectService
    Task      *TaskService
    User      *UserService
    Estimate  *EstimateService
    Invoice   *InvoiceService
    Timesheet *TimesheetService
    Role      *RoleService
    // contains filtered or unexported fields
}

A HarvestClient manages communication with the Harvest API.

func NewHarvestClient Uses

func NewHarvestClient(httpClient *http.Client) *HarvestClient

NewHarvestClient returns a new Harvest API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the golang.org/x/oauth2 library).

func (*HarvestClient) Do Uses

func (c *HarvestClient) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it. If rate limit is exceeded and reset time is in the future, Do returns *RateLimitError immediately without making a network API call.

The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned.

func (*HarvestClient) NewRequest Uses

func (c *HarvestClient) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

type Invoice Uses

type Invoice struct {
    Id        *int64             `json:"id,omitempty"`         // Unique ID for the invoice.
    Client    *Client            `json:"client,omitempty"`     // An object containing invoice’s client id and name.
    LineItems *[]InvoiceLineItem `json:"line_items,omitempty"` // Array of invoice line items.
    Estimate  *Estimate          `json:"estimate,omitempty"`   // An object containing the associated estimate’s id.
    //retainer *object `json:"retainer,omitempty"` // An object containing the associated retainer’s id.
    Creator        *User      `json:"creator,omitempty"`         // An object containing the id and name of the person that created the invoice.
    ClientKey      *string    `json:"client_key,omitempty"`      // Used to build a URL to the public web invoice for your client: https://{ACCOUNT_SUBDOMAIN}.harvestapp.com/client/invoices/abc123456
    Number         *string    `json:"number,omitempty"`          // If no value is set, the number will be automatically generated.
    PurchaseOrder  *string    `json:"purchase_order,omitempty"`  // The purchase order number.
    Amount         *float64   `json:"amount,omitempty"`          // The total amount for the invoice, including any discounts and taxes.
    DueAmount      *float64   `json:"due_amount,omitempty"`      // The total amount due at this time for this invoice.
    Tax            *float64   `json:"tax,omitempty"`             // This percentage is applied to the subtotal, including line items and discounts.
    TaxAmount      *float64   `json:"tax_amount,omitempty"`      // The first amount of tax included, calculated from tax. If no tax is defined, this value will be null.
    Tax2           *float64   `json:"tax2,omitempty"`            // This percentage is applied to the subtotal, including line items and discounts.
    Tax2Amount     *float64   `json:"tax2_amount,omitempty"`     // The amount calculated from tax2.
    Discount       *float64   `json:"discount,omitempty"`        // This percentage is subtracted from the subtotal.
    DiscountAmount *float64   `json:"discount_amount,omitempty"` // The amount calcuated from discount.
    Subject        *string    `json:"subject,omitempty"`         // The invoice subject.
    Notes          *string    `json:"notes,omitempty"`           // Any additional notes included on the invoice.
    Currency       *string    `json:"currency,omitempty"`        // The currency code associated with this invoice.
    PeriodStart    *Date      `json:"period_start,omitempty"`    // Start of the period during which time entries and expenses were added to this invoice.
    PeriodEnd      *Date      `json:"period_end,omitempty"`      // End of the period during which time entries and expenses were added to this invoice.
    IssueDate      *Date      `json:"issue_date,omitempty"`      // Date the invoice was issued.
    DueDate        *Date      `json:"due_date,omitempty"`        // Date the invoice is due.
    SentAt         *time.Time `json:"sent_at,omitempty"`         // Date and time the invoice was sent.
    PaidAt         *time.Time `json:"paid_at,omitempty"`         // Date and time the invoice was paid.
    ClosedAt       *time.Time `json:"closed_at,omitempty"`       // Date and time the invoice was closed.
    CreatedAt      *time.Time `json:"created_at,omitempty"`      // Date and time the invoice was created.
    UpdatedAt      *time.Time `json:"updated_at,omitempty"`      // Date and time the invoice was last updated.
}

func (Invoice) String Uses

func (p Invoice) String() string

type InvoiceCreateRequest Uses

type InvoiceCreateRequest struct {
    ClientId        *int64                          `json:"client_id"`                   // required	The ID of the client this invoice belongs to.
    RetainerId      *int64                          `json:"retainer_id,omitempty"`       // optional	The ID of the retainer associated with this invoice.
    EstimateId      *int64                          `json:"estimate_id,omitempty"`       // optional	The ID of the estimate associated with this invoice.
    Number          *string                         `json:"number,omitempty"`            // optional	If no value is set, the number will be automatically generated.
    PurchaseOrder   *string                         `json:"purchase_order,omitempty"`    // optional	The purchase order number.
    Tax             *float64                        `json:"tax,omitempty"`               // optional	This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.
    Tax2            *float64                        `json:"tax2,omitempty"`              // optional	This percentage is applied to the subtotal, including line items and discounts. Example: use 10.0 for 10.0%.
    Discount        *float64                        `json:"discount,omitempty"`          // optional	This percentage is subtracted from the subtotal. Example: use 10.0 for 10.0%.
    Subject         *string                         `json:"subject,omitempty"`           // optional	The invoice subject.
    Notes           *string                         `json:"notes,omitempty"`             // optional	Any additional notes to include on the invoice.
    Currency        *string                         `json:"currency,omitempty"`          // optional	The currency used by the invoice. If not provided, the client’s currency will be used. See a list of supported currencies
    IssueDate       *Date                           `json:"issue_date,omitempty"`        // optional	Date the invoice was issued. Defaults to today’s date.
    DueDate         *Date                           `json:"due_date,omitempty"`          // optional	Date the invoice is due. Defaults to the issue_date.
    LineItems       *[]InvoiceLineItemRequest       `json:"line_items,omitempty"`        // optional	Array of line item parameters
    LineItemsImport *[]InvoiceLineItemImportRequest `json:"line_items_import,omitempty"` // optional	An line items import object
}

type InvoiceItemCategory Uses

type InvoiceItemCategory struct {
    Id           *int64     `json:"id,omitempty"`             // Unique ID for the invoice item category.
    Name         *string    `json:"name,omitempty"`           // The name of the invoice item category.
    UseAsService *bool      `json:"use_as_service,omitempty"` // Whether this invoice item category is used for billable hours when generating an invoice.
    UseAsExpense *bool      `json:"use_as_expense,omitempty"` // Whether this invoice item category is used for expenses when generating an invoice.
    CreatedAt    *time.Time `json:"created_at,omitempty"`     // Date and time the invoice item category was created.
    UpdatedAt    *time.Time `json:"updated_at,omitempty"`     // Date and time the invoice item category was last updated.
}

func (InvoiceItemCategory) String Uses

func (p InvoiceItemCategory) String() string

type InvoiceItemCategoryList Uses

type InvoiceItemCategoryList struct {
    InvoiceItemCategories []*InvoiceItemCategory `json:"invoice_item_categories"`

    Pagination
}

func (InvoiceItemCategoryList) String Uses

func (p InvoiceItemCategoryList) String() string

type InvoiceItemCategoryListOptions Uses

type InvoiceItemCategoryListOptions struct {
    // Only return invoice item categories that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type InvoiceItemCategoryRequest Uses

type InvoiceItemCategoryRequest struct {
    Name *string `json:"name,omitempty"` // required	The name of the invoice item category.
}

type InvoiceLineItem Uses

type InvoiceLineItem struct {
    Id          *int64   `json:"id,omitempty"`          // Unique ID for the line item.
    Project     *Project `json:"project,omitempty"`     // An object containing the associated project’s id, name, and code.
    Kind        *string  `json:"kind,omitempty"`        // The name of an invoice item category.
    Description *string  `json:"description,omitempty"` // Text description of the line item.
    Quantity    *int16   `json:"quantity,omitempty"`    // The unit quantity of the item.
    UnitPrice   *float64 `json:"unit_price,omitempty"`  // The individual price per unit.
    Amount      *float64 `json:"amount,omitempty"`      // The line item subtotal (quantity * unit_price).
    Taxed       *bool    `json:"taxed,omitempty"`       // Whether the invoice’s tax percentage applies to this line item.
    Taxed2      *bool    `json:"taxed2,omitempty"`      // Whether the invoice’s tax2 percentage applies to this line item.
}

type InvoiceLineItemImportExpenseRequest Uses

type InvoiceLineItemImportExpenseRequest struct {
    Summary_type  *string `json:"summary_type"`             // required	How to summarize the expenses per line item. Options: project, category, people, or detailed.
    From          *Date   `json:"from,omitempty"`           // optional	Start date for included expenses. Must be provided if to is present. If neither from or to are provided, all unbilled expenses will be included.
    To            *Date   `json:"to,omitempty"`             // optional	End date for included expenses. Must be provided if from is present. If neither from or to are provided, all unbilled expenses will be included.
    AttachReceipt *bool   `json:"attach_receipt,omitempty"` // optional	If set to true, a PDF containing an expense report with receipts will be attached to the invoice. Defaults to false.
}

type InvoiceLineItemImportRequest Uses

type InvoiceLineItemImportRequest struct {
    ProjectIds *[]int64                             `json:"project_ids"`        // required	An array of the client’s project IDs you’d like to include time/expenses from.
    Time       *InvoiceLineItemImportTimeRequest    `json:"time,omitempty"`     // optional	A time import object.
    Expenses   *InvoiceLineItemImportExpenseRequest `json:"expenses,omitempty"` // optional	An expense import object.
}

type InvoiceLineItemImportTimeRequest Uses

type InvoiceLineItemImportTimeRequest struct {
    Summary_type *string `json:"summary_type"`   // required	How to summarize the time entries per line item. Options: project, task, people, or detailed.
    From         *Date   `json:"from,omitempty"` // optional	Start date for included time entries. Must be provided if to is present. If neither from or to are provided, all unbilled time entries will be included.
    To           *Date   `json:"to,omitempty"`   // optional	End date for included time entries. Must be provided if from is present. If neither from or to are provided, all unbilled time entries will be included.
}

type InvoiceLineItemRequest Uses

type InvoiceLineItemRequest struct {
    Id          *int64   `json:"id,omitempty"`          // Unique ID for the line item.
    ProjectId   *int64   `json:"project_id,omitempty"`  // optional	The ID of the project associated with this line item.
    Kind        *string  `json:"kind"`                  // required	The name of an invoice item category.
    Description *string  `json:"description,omitempty"` // optional	Text description of the line item.
    Quantity    *int64   `json:"quantity,omitempty"`    // optional	The unit quantity of the item. Defaults to 1.
    UnitPrice   *float64 `json:"unit_price"`            // required	The individual price per unit.
    Taxed       *bool    `json:"taxed,omitempty"`       // optional	Whether the invoice’s tax percentage applies to this line item. Defaults to false.
    Taxed2      *bool    `json:"taxed2,omitempty"`      // optional	Whether the invoice’s tax2 percentage applies to this line item. Defaults to false.
    Destroy     *bool    `json:"_destroy,omitempty"`    // optional	Delete an invoice line item
}

type InvoiceList Uses

type InvoiceList struct {
    Invoices []*Invoice `json:"invoices"`

    Pagination
}

func (InvoiceList) String Uses

func (p InvoiceList) String() string

type InvoiceListOptions Uses

type InvoiceListOptions struct {
    // Only return invoices belonging to the client with the given ID.
    ClientId int64 `url:"client_id,omitempty"`
    //Only return invoices associated with the project with the given ID.
    ProjectId int64 `url:"project_id,omitempty"`
    // Only return invoices that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type InvoiceMessage Uses

type InvoiceMessage struct {
    Id                         *int64                     `json:"id,omitempty"`                             // Unique ID for the message.
    SentBy                     *string                    `json:"sent_by,omitempty"`                        // Name of the user that created the message.
    SentByEmail                *string                    `json:"sent_by_email,omitempty"`                  // Email of the user that created the message.
    SentFrom                   *string                    `json:"sent_from,omitempty"`                      // Name of the user that the message was sent from.
    SentFromEmail              *string                    `json:"sent_from_email,omitempty"`                // Email of the user that message was sent from.
    Recipients                 *[]InvoiceMessageRecipient `json:"recipients,omitempty"`                     // Array of invoice message recipients.
    Subject                    *string                    `json:"subject,omitempty"`                        // The message subject.
    Body                       *string                    `json:"body,omitempty"`                           // The message body.
    IncludeLinkToClientInvoice *bool                      `json:"include_link_to_client_invoice,omitempty"` // Whether to include a link to the client invoice in the message body. Not used when thank_you is true.
    AttachPdf                  *bool                      `json:"attach_pdf,omitempty"`                     // Whether to attach the invoice PDF to the message email.
    SendMeACopy                *bool                      `json:"send_me_a_copy,omitempty"`                 // Whether to email a copy of the message to the current user.
    ThankYou                   *bool                      `json:"thank_you,omitempty"`                      // Whether this is a thank you message.
    EventType                  *bool                      `json:"event_type,omitempty"`                     // The type of invoice event that occurred with the message: send, close, draft, re-open, or view.
    Reminder                   *bool                      `json:"reminder,omitempty"`                       // Whether this is a reminder message.
    SendReminderOn             *Date                      `json:"send_reminder_on,omitempty"`               // The date the reminder email will be sent.
    CreatedAt                  *time.Time                 `json:"created_at,omitempty"`                     // Date and time the message was created.
    UpdatedAt                  *time.Time                 `json:"updated_at,omitempty"`                     // Date and time the message was last updated.
}

func (InvoiceMessage) String Uses

func (p InvoiceMessage) String() string

type InvoiceMessageCreateRequest Uses

type InvoiceMessageCreateRequest struct {
    Recipients                 *[]InvoiceMessageRecipient `json:"recipients"`                               // required	Array of recipient parameters. See below for details.
    Subject                    *string                    `json:"subject,omitempty"`                        // optional	The message subject.
    Body                       *string                    `json:"body,omitempty"`                           // optional	The message body.
    IncludeLinkToClientInvoice *bool                      `json:"include_link_to_client_invoice,omitempty"` // optional	If set to true, a link to the client invoice URL will be included in the message email. Defaults to false. Ignored when thank_you is set to true.
    AttachPdf                  *bool                      `json:"attach_pdf,omitempty"`                     // optional	If set to true, a PDF of the invoice will be attached to the message email. Defaults to false.
    SendMeACopy                *bool                      `json:"send_me_a_copy,omitempty"`                 // optional	If set to true, a copy of the message email will be sent to the current user. Defaults to false.
    ThankYou                   *bool                      `json:"thank_you,omitempty"`                      // optional	If set to true, a thank you message email will be sent. Defaults to false.
    EventType                  *bool                      `json:"event_type,omitempty"`                     // optional	If provided, runs an event against the invoice. Options: close, draft, re-open, or send.
}

type InvoiceMessageList Uses

type InvoiceMessageList struct {
    Invoices []*Invoice `json:"invoices"`

    Pagination
}

func (InvoiceMessageList) String Uses

func (p InvoiceMessageList) String() string

type InvoiceMessageListOptions Uses

type InvoiceMessageListOptions struct {
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type InvoiceMessageRecipient Uses

type InvoiceMessageRecipient struct {
    Name  *string `json:"name,omitempty"` // Name of the message recipient.
    Email *string `json:"email"`          // Email of the message recipient.
}

type InvoicePayment Uses

type InvoicePayment struct {
    Id              *int64          `json:"id,omitempty"`                // Unique ID for the payment.
    Amount          *string         `json:"amount,omitempty"`            // The amount of the payment.
    PaidAt          *time.Time      `json:"paid_at,omitempty"`           // Date and time the payment was made.
    RecordedBy      *string         `json:"recorded_by,omitempty"`       // The name of the person who recorded the payment.
    RecordedByEmail *string         `json:"recorded_by_email,omitempty"` // The email of the person who recorded the payment.
    Notes           *string         `json:"notes,omitempty"`             // Any notes associated with the payment.
    TransactionId   *string         `json:"transaction_id,omitempty"`    // Either the card authorization or PayPal transaction ID.
    PaymentGateway  *PaymentGateway `json:"payment_gateway,omitempty"`   // The payment gateway id and name used to process the payment.
    CreatedAt       *time.Time      `json:"created_at,omitempty"`        // Date and time the payment was recorded.
    UpdatedAt       *time.Time      `json:"updated_at,omitempty"`        // Date and time the payment was last updated.
}

func (InvoicePayment) String Uses

func (p InvoicePayment) String() string

type InvoicePaymentList Uses

type InvoicePaymentList struct {
    InvoicePayments []*InvoicePayment `json:"invoice_payments"`

    Pagination
}

func (InvoicePaymentList) String Uses

func (p InvoicePaymentList) String() string

type InvoicePaymentListOptions Uses

type InvoicePaymentListOptions struct {
    // Only return invoice payments that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type InvoicePaymentRequest Uses

type InvoicePaymentRequest struct {
    Amount   *float64   `json:"amount"`              // required The amount of the payment.
    PaidAt   *time.Time `json:"paid_at,omitempty"`   // optional Date and time the payment was made. Pass either paid_at or paid_date, but not both.
    PaidDate *Date      `json:"paid_date,omitempty"` // optional	Date the payment was made. Pass either paid_at or paid_date, but not both.
    Notes    *string    `json:"notes,omitempty"`     // optional Any notes to be associated with the payment.
}

type InvoiceService Uses

type InvoiceService service

InvoiceService handles communication with the issue related methods of the Harvest API.

Harvest API docs: https://help.getharvest.com/api-v2/invoices-api/invoices/invoices/

func (*InvoiceService) Create Uses

func (s *InvoiceService) Create(ctx context.Context, data *InvoiceCreateRequest) (*Invoice, *http.Response, error)

func (*InvoiceService) CreateInvoiceMessage Uses

func (s *InvoiceService) CreateInvoiceMessage(ctx context.Context, invoiceId int64, data *InvoiceMessageCreateRequest) (*InvoiceMessage, *http.Response, error)

func (*InvoiceService) CreateItemCategory Uses

func (s *InvoiceService) CreateItemCategory(ctx context.Context, data *InvoiceItemCategoryRequest) (*InvoiceItemCategory, *http.Response, error)

func (*InvoiceService) CreatePayment Uses

func (s *InvoiceService) CreatePayment(ctx context.Context, invoiceId int64, data *InvoicePaymentRequest) (*InvoicePayment, *http.Response, error)

func (*InvoiceService) Delete Uses

func (s *InvoiceService) Delete(ctx context.Context, invoiceId int64) (*http.Response, error)

func (*InvoiceService) DeleteInvoiceMessage Uses

func (s *InvoiceService) DeleteInvoiceMessage(ctx context.Context, invoiceId, invoiceMessageId int64) (*http.Response, error)

func (*InvoiceService) DeleteInvoicePayment Uses

func (s *InvoiceService) DeleteInvoicePayment(ctx context.Context, invoiceId, invoicePaymentId int64) (*http.Response, error)

func (*InvoiceService) DeleteItemCategory Uses

func (s *InvoiceService) DeleteItemCategory(ctx context.Context, invoiceItemCategoryId int64) (*http.Response, error)

func (*InvoiceService) Get Uses

func (s *InvoiceService) Get(ctx context.Context, invoiceId int64) (*Invoice, *http.Response, error)

func (*InvoiceService) GetItemCategory Uses

func (s *InvoiceService) GetItemCategory(ctx context.Context, invoiceItemCategoryId int64) (*InvoiceItemCategory, *http.Response, error)

func (*InvoiceService) List Uses

func (s *InvoiceService) List(ctx context.Context, opt *InvoiceListOptions) (*InvoiceList, *http.Response, error)

func (*InvoiceService) ListInvoiceMessages Uses

func (s *InvoiceService) ListInvoiceMessages(ctx context.Context, invoiceId int64, opt *InvoiceMessageListOptions) (*InvoiceList, *http.Response, error)

func (*InvoiceService) ListItemCategories Uses

func (s *InvoiceService) ListItemCategories(ctx context.Context, opt *InvoiceItemCategoryListOptions) (*InvoiceItemCategoryList, *http.Response, error)

func (*InvoiceService) ListPayments Uses

func (s *InvoiceService) ListPayments(ctx context.Context, invoiceId int64, opt *InvoicePaymentListOptions) (*InvoicePaymentList, *http.Response, error)

func (*InvoiceService) MarkAsClosed Uses

func (s *InvoiceService) MarkAsClosed(ctx context.Context, invoiceId int64) (*InvoiceMessage, *http.Response, error)

func (*InvoiceService) MarkAsDraft Uses

func (s *InvoiceService) MarkAsDraft(ctx context.Context, invoiceId int64) (*InvoiceMessage, *http.Response, error)

func (*InvoiceService) MarkAsReopen Uses

func (s *InvoiceService) MarkAsReopen(ctx context.Context, invoiceId int64) (*InvoiceMessage, *http.Response, error)

func (*InvoiceService) MarkAsSent Uses

func (s *InvoiceService) MarkAsSent(ctx context.Context, invoiceId int64) (*InvoiceMessage, *http.Response, error)

func (*InvoiceService) SendEvent Uses

func (s *InvoiceService) SendEvent(ctx context.Context, invoiceId int64, data *EventTypeRequest) (*InvoiceMessage, *http.Response, error)

func (*InvoiceService) Update Uses

func (s *InvoiceService) Update(ctx context.Context, invoiceId int64, data *InvoiceUpdateRequest) (*Invoice, *http.Response, error)

func (*InvoiceService) UpdateItemCategory Uses

func (s *InvoiceService) UpdateItemCategory(ctx context.Context, invoiceItemCategoryId int64, data *InvoiceItemCategoryRequest) (*InvoiceItemCategory, *http.Response, error)

type InvoiceUpdateRequest Uses

type InvoiceUpdateRequest struct {
    ClientId      *int64                    `json:"client_id,omitempty"`      // The ID of the client this invoice belongs to.
    RetainerId    *int64                    `json:"retainer_id,omitempty"`    // The ID of the retainer associated with this invoice.
    EstimateId    *int64                    `json:"estimate_id,omitempty"`    // The ID of the estimate associated with this invoice.
    Number        *string                   `json:"number,omitempty"`         // If no value is set, the number will be automatically generated.
    PurchaseOrder *string                   `json:"purchase_order,omitempty"` // The *purchase `json:"The,omitempty"` // order number.
    Tax           *float64                  `json:"tax,omitempty"`            // This percentage is applied to the subtotal, including line items and discounts.Example: use 10.0 for 10.0%.
    Tax2          *float64                  `json:"tax2,omitempty"`           // This percentage is applied to the subtotal, including line items and discounts.Example: use 10.0 for 10.0%.
    Discount      *float64                  `json:"discount,omitempty"`       // This percentage is subtracted from the subtotal.Example: use 10.0 for 10.0%.
    Subject       *string                   `json:"subject,omitempty"`        // The *invoice `json:"The,omitempty"` // subject.
    Notes         *string                   `json:"notes,omitempty"`          // Any additional notes to include on the invoice.
    Currency      *string                   `json:"currency,omitempty"`       // The currency used by the invoice.If not provided, the client’s currency will be used.See a list of supported currencies
    IssueDate     *Date                     `json:"issue_date,omitempty"`     // Date the invoice was issued.
    DueDate       *Date                     `json:"due_date,omitempty"`       // Date the invoice is due.
    LineItems     *[]InvoiceLineItemRequest `json:"line_items,omitempty"`     // Array of line item parameters
}

type ListOptions Uses

type ListOptions struct {
    // For paginated result sets, page of results to retrieve.
    Page int `url:"page,omitempty"`

    // For paginated result sets, the number of results to include per page.
    // The number of records to return per page. Can range between 1 and 100. (Default: 100)
    PerPage int `url:"per_page,omitempty"`
}

ListOptions specifies the optional parameters to various List methods that support pagination.

type MyProjectAssignmentListOptions Uses

type MyProjectAssignmentListOptions struct {
    ListOptions
}
type PageLinks struct {
    First    *string `json:"first,omitempty"`
    Next     *string `json:"next,omitempty"`
    Previous *string `json:"previous,omitempty"`
    Last     *string `json:"last,omitempty"`
}

type Pagination Uses

type Pagination struct {
    PerPage      *int       `json:"per_page,omitempty"`
    TotalPages   *int       `json:"total_pages,omitempty"`
    TotalEntries *int       `json:"total_entries,omitempty"`
    NextPage     *int       `json:"next_page,omitempty"`
    PreviousPage *int       `json:"previous_page,omitempty"`
    Page         *int       `json:"page,omitempty"`
    Links        *PageLinks `json:"links,omitempty"`
}

type PaymentGateway Uses

type PaymentGateway struct {
    Id   *int64  `json:"id,omitempty"`
    Name *string `json:"name,omitempty"`
}

func (PaymentGateway) String Uses

func (p PaymentGateway) String() string

type Project Uses

type Project struct {
    Id                               *int64     `json:"id,omitempty"`                                  //Unique ID for the project.
    Client                           *Client    `json:"client,omitempty"`                              //An object containing the project’s client id, name, and currency.
    Name                             *string    `json:"name,omitempty"`                                //Unique name for the project.
    Code                             *string    `json:"code,omitempty"`                                //The code associated with the project.
    IsActive                         *bool      `json:"is_active,omitempty"`                           //Whether the project is active or archived.
    IsBillable                       *bool      `json:"is_billable,omitempty"`                         //Whether the project is billable or not.
    IsFixedFee                       *bool      `json:"is_fixed_fee,omitempty"`                        //Whether the project is a fixed-fee project or not.
    BillBy                           *string    `json:"bill_by,omitempty"`                             //The method by which the project is invoiced.
    HourlyRate                       *float64   `json:"hourly_rate,omitempty"`                         //Rate for projects billed by Project Hourly Rate.
    Budget                           *float64   `json:"budget,omitempty"`                              //The budget in hours for the project when budgeting by time.
    BudgetBy                         *string    `json:"budget_by,omitempty"`                           //The method by which the project is budgeted.
    NotifyWhenOverBudget             *bool      `json:"notify_when_over_budget,omitempty"`             //Whether project managers should be notified when the project goes over budget.
    OverBudgetNotificationPercentage *float64   `json:"over_budget_notification_percentage,omitempty"` //Percentage value used to trigger over budget email alerts.
    OverBudgetNotificationDate       *Date      `json:"over_budget_notification_date,omitempty"`       //Date of last over budget notification. If none have been sent, this will be null.
    ShowBudgetToAll                  *bool      `json:"show_budget_to_all,omitempty"`                  //Option to show project budget to all employees. Does not apply to Total Project Fee projects.
    CostBudget                       *float64   `json:"cost_budget,omitempty"`                         //The monetary budget for the project when budgeting by money.
    CostBudgetIncludeExpenses        *bool      `json:"cost_budget_include_expenses,omitempty"`        //Option for budget of Total Project Fees projects to include tracked expenses.
    Fee                              *float64   `json:"fee,omitempty"`                                 //The amount you plan to invoice for the project. Only used by fixed-fee projects.
    Notes                            *string    `json:"notes,omitempty"`                               //Project notes.
    StartsOn                         *Date      `json:"starts_on,omitempty"`                           //Date the project was started.
    EndsOn                           *Date      `json:"ends_on,omitempty"`                             //Date the project will end.
    CreatedAt                        *time.Time `json:"created_at,omitempty"`                          //Date and time the project was created.
    UpdatedAt                        *time.Time `json:"updated_at,omitempty"`                          //Date and time the project was last updated.
}

func (Project) String Uses

func (p Project) String() string

type ProjectList Uses

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

    Pagination
}

func (ProjectList) String Uses

func (p ProjectList) String() string

type ProjectListOptions Uses

type ProjectListOptions struct {
    // Pass true to only return active projects and false to return inactive projects.
    IsActive bool `url:"is_active,omitempty"`
    // Only return projects belonging to the client with the given ID.
    ClientId int64 `url:"client_id,omitempty"`
    // Only return projects that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type ProjectService Uses

type ProjectService service

ProjectService handles communication with the issue related methods of the Harvest API.

Harvest API docs: https://help.getharvest.com/api-v2/projects-api/projects/projects/

func (*ProjectService) CreateTaskAssignment Uses

func (s *ProjectService) CreateTaskAssignment(ctx context.Context, projectId int64, data *ProjectTaskAssignmentCreateRequest) (*ProjectTaskAssignment, *http.Response, error)

func (*ProjectService) Get Uses

func (s *ProjectService) Get(ctx context.Context, projectId int64) (*Project, *http.Response, error)

func (*ProjectService) GetMyProjectAssignments Uses

func (s *ProjectService) GetMyProjectAssignments(ctx context.Context, opt *MyProjectAssignmentListOptions) (*UserProjectAssignmentList, *http.Response, error)

func (*ProjectService) GetTaskAssignment Uses

func (s *ProjectService) GetTaskAssignment(ctx context.Context, projectId int64, taskAssignmentId int64) (*ProjectTaskAssignment, *http.Response, error)

func (*ProjectService) GetUserAssignment Uses

func (s *ProjectService) GetUserAssignment(ctx context.Context, projectId int64, userAssignmentId int64) (*ProjectUserAssignment, *http.Response, error)

func (*ProjectService) List Uses

func (s *ProjectService) List(ctx context.Context, opt *ProjectListOptions) (*ProjectList, *http.Response, error)

func (*ProjectService) ListProjectAssignments Uses

func (s *ProjectService) ListProjectAssignments(ctx context.Context, userId int64, opt *UserProjectAssignmentListOptions) (*UserProjectAssignmentList, *http.Response, error)

func (*ProjectService) ListTaskAssignments Uses

func (s *ProjectService) ListTaskAssignments(ctx context.Context, projectId int64, opt *ProjectTaskAssignmentListOptions) (*ProjectTaskAssignmentList, *http.Response, error)

func (*ProjectService) ListUserAssignments Uses

func (s *ProjectService) ListUserAssignments(ctx context.Context, projectId int64, opt *ProjectUserAssignmentListOptions) (*ProjectUserAssignmentList, *http.Response, error)

type ProjectTaskAssignment Uses

type ProjectTaskAssignment struct {
    Id         *int64     `json:"id,omitempty"`          // Unique ID for the task assignment.
    Task       *Task      `json:"task,omitempty"`        // An object containing the id and name of the associated task.
    IsActive   *bool      `json:"is_active,omitempty"`   // Whether the task assignment is active or archived.
    Billable   *bool      `json:"billable,omitempty"`    // Whether the task assignment is billable or not. For example: if set to true, all time tracked on this project for the associated task will be marked as billable.
    HourlyRate *float64   `json:"hourly_rate,omitempty"` // Rate used when the project’s bill_by is Tasks.
    Budget     *float64   `json:"budget,omitempty"`      // Budget used when the project’s budget_by is task or task_fees.
    CreatedAt  *time.Time `json:"created_at,omitempty"`  // Date and time the task assignment was created.
    UpdatedAt  *time.Time `json:"updated_at,omitempty"`  // Date and time the task assignment was last updated.
}

func (ProjectTaskAssignment) String Uses

func (p ProjectTaskAssignment) String() string

type ProjectTaskAssignmentCreateRequest Uses

type ProjectTaskAssignmentCreateRequest struct {
    TaskId     *int64   `json:"task_id"`               // required The ID of the task to associate with the project.
    IsActive   *bool    `json:"is_active,omitempty"`   // optional Whether the task assignment is active or archived. Defaults to true
    Billable   *bool    `json:"billable,omitempty"`    // optional Whether the task assignment is billable or not. Defaults to false.
    HourlyRate *float64 `json:"hourly_rate,omitempty"` // optional Rate used when the project’s bill_by is Tasks. Defaults to null when billing by task hourly rate, otherwise 0.
    Budget     *float64 `json:"budget,omitempty"`      // optional Budget used when the project’s budget_by is task or task_fees.
}

type ProjectTaskAssignmentList Uses

type ProjectTaskAssignmentList struct {
    TaskAssignments []*ProjectTaskAssignment `json:"task_assignments"`

    Pagination
}

func (ProjectTaskAssignmentList) String Uses

func (p ProjectTaskAssignmentList) String() string

type ProjectTaskAssignmentListOptions Uses

type ProjectTaskAssignmentListOptions struct {
    // Pass true to only return active projects and false to return inactive projects.
    IsActive bool `url:"is_active,omitempty"`
    // Only return projects belonging to the client with the given ID.
    ClientId int64 `url:"client_id,omitempty"`
    // Only return projects that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type ProjectUserAssignment Uses

type ProjectUserAssignment struct {
    Id               *int64     `json:"id,omitempty"`                 // Unique ID for the user assignment.
    User             *User      `json:"user,omitempty"`               // An object containing the id and name of the associated user.
    IsActive         *bool      `json:"is_active,omitempty"`          // Whether the user assignment is active or archived.
    IsProjectManager *bool      `json:"is_project_manager,omitempty"` // Determines if the user has project manager permissions for the project.
    HourlyRate       *float64   `json:"hourly_rate,omitempty"`        // Rate used when the project’s bill_by is People.
    Budget           *float64   `json:"budget,omitempty"`             // Budget used when the project’s budget_by is person.
    CreatedAt        *time.Time `json:"created_at,omitempty"`         // Date and time the user assignment was created.
    UpdatedAt        *time.Time `json:"updated_at,omitempty"`         // Date and time the user assignment was last updated.
}

func (ProjectUserAssignment) String Uses

func (p ProjectUserAssignment) String() string

type ProjectUserAssignmentList Uses

type ProjectUserAssignmentList struct {
    UserAssignments []*ProjectUserAssignment `json:"user_assignments"`

    Pagination
}

func (ProjectUserAssignmentList) String Uses

func (p ProjectUserAssignmentList) String() string

type ProjectUserAssignmentListOptions Uses

type ProjectUserAssignmentListOptions struct {
    // Pass true to only return active projects and false to return inactive projects.
    IsActive bool `url:"is_active,omitempty"`
    // Only return projects belonging to the client with the given ID.
    ClientId int64 `url:"client_id,omitempty"`
    // Only return projects that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type Rate Uses

type Rate struct {
    // The number of requests per hour the client is currently limited to.
    Limit int `json:"limit"`

    // The number of remaining requests the client can make this hour.
    Remaining int `json:"remaining"`
}

Rate represents the rate limit for the current client.

func (Rate) String Uses

func (r Rate) String() string

type RateLimitError Uses

type RateLimitError struct {
    Rate     Rate           // Rate specifies last known rate limit for the client
    Response *http.Response // HTTP response that caused this error
    Message  string         `json:"message"` // error message
}

RateLimitError occurs when Harvest returns 429 Forbidden response with a rate limit remaining value of 0, and error message starts with "API rate limit exceeded for ".

func (*RateLimitError) Error Uses

func (r *RateLimitError) Error() string

type RateLimits Uses

type RateLimits struct {
    // 100 requests per 15 seconds
    // Harvest API docs: https://help.getharvest.com/api-v2/introduction/overview/general/#rate-limiting
    Core *Rate `json:"core"`
}

RateLimits represents the rate limits for the current client.

func (RateLimits) String Uses

func (r RateLimits) String() string

type Receipt Uses

type Receipt struct {
    Url         *string `json:"url,omitempty"`
    FileName    *string `json:"file_name,omitempty"`
    FileSize    *int64  `json:"file_size,omitempty"`
    ContentType *string `json:"content_type,omitempty"`
}

func (Receipt) String Uses

func (p Receipt) String() string

type Role Uses

type Role struct {
    Id        *int64     `json:"id,omitempty"`         // Unique ID for the role.
    Name      *string    `json:"name,omitempty"`       // The name of the role.
    UserIds   *[]int64   `json:"user_ids,omitempty"`   // of integers	The IDs of the users assigned to this role.
    CreatedAt *time.Time `json:"created_at,omitempty"` // Date and time the role was created.
    UpdatedAt *time.Time `json:"updated_at,omitempty"` // Date and time the role was last updated.
}

func (Role) String Uses

func (p Role) String() string

type RoleCreateRequest Uses

type RoleCreateRequest struct {
    Name    *string  `json:"name"`               // required	The name of the role.
    UserIds *[]int64 `json:"user_ids,omitempty"` // The IDs of the users assigned to this role.
}

type RoleList Uses

type RoleList struct {
    Roles []*Role `json:"roles"`

    Pagination
}

func (RoleList) String Uses

func (p RoleList) String() string

type RoleListOptions Uses

type RoleListOptions struct {
    ListOptions
}

type RoleService Uses

type RoleService service

RoleService handles communication with the issue related methods of the Harvest API.

Harvest API docs: https://help.getharvest.com/api-v2/roles-api/roles/roles/

func (*RoleService) Create Uses

func (s *RoleService) Create(ctx context.Context, data *RoleCreateRequest) (*Role, *http.Response, error)

func (*RoleService) Delete Uses

func (s *RoleService) Delete(ctx context.Context, roleId int64) (*http.Response, error)

func (*RoleService) Get Uses

func (s *RoleService) Get(ctx context.Context, roleId int64) (*Role, *http.Response, error)

func (*RoleService) List Uses

func (s *RoleService) List(ctx context.Context, opt *RoleListOptions) (*RoleList, *http.Response, error)

func (*RoleService) Update Uses

func (s *RoleService) Update(ctx context.Context, roleId int64, data *RoleUpdateRequest) (*Role, *http.Response, error)

type RoleUpdateRequest Uses

type RoleUpdateRequest struct {
    Name    *string  `json:"name,omitempty"`     // The name of the role.
    UserIds *[]int64 `json:"user_ids,omitempty"` // The IDs of the users assigned to this role.
}

type Task Uses

type Task struct {
    Id                *int64     `json:"id,omitempty"`                  // Unique ID for the task.
    Name              *string    `json:"name,omitempty"`                // The name of the task.
    BillableByDefault *bool      `json:"billable_by_default,omitempty"` // Used in determining whether default tasks should be marked billable when creating a new project.
    DefaultHourlyRate *float64   `json:"default_hourly_rate,omitempty"` // The hourly rate to use for this task when it is added to a project.
    IsDefault         *bool      `json:"is_default,omitempty"`          // Whether this task should be automatically added to future projects.
    IsActive          *bool      `json:"is_active,omitempty"`           // Whether this task is active or archived.
    CreatedAt         *time.Time `json:"created_at,omitempty"`          // Date and time the task was created.
    UpdatedAt         *time.Time `json:"updated_at,omitempty"`          // Date and time the task was last updated.
}

func (Task) String Uses

func (c Task) String() string

type TaskCreateRequest Uses

type TaskCreateRequest struct {
    Name              *string  `json:"name"`                          // required	The name of the task.
    BillableByDefault *bool    `json:"billable_by_default,omitempty"` // optional	Used in determining whether default tasks should be marked billable when creating a new project. Defaults to true.
    DefaultHourlyRate *float64 `json:"default_hourly_rate,omitempty"` // optional	The default hourly rate to use for this task when it is added to a project. Defaults to 0.
    IsDefault         *bool    `json:"is_default,omitempty"`          // optional	Whether this task should be automatically added to future projects. Defaults to false.
    IsActive          *bool    `json:"is_active,omitempty"`           // optional	Whether this task is active or archived. Defaults to true.
}

type TaskList Uses

type TaskList struct {
    Tasks []*Task `json:"tasks"`

    Pagination
}

func (TaskList) String Uses

func (c TaskList) String() string

type TaskListOptions Uses

type TaskListOptions struct {
    // Pass true to only return active projects and false to return inactive projects.
    IsActive bool `url:"is_active,omitempty"`
    // Only return projects that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type TaskService Uses

type TaskService service

TaskService handles communication with the task related methods of the Harvest API.

Harvest API docs: https://help.getharvest.com/api-v2/tasks-api/tasks/tasks/

func (*TaskService) Create Uses

func (s *TaskService) Create(ctx context.Context, data *TaskCreateRequest) (*Task, *http.Response, error)

func (*TaskService) Delete Uses

func (s *TaskService) Delete(ctx context.Context, taskId int64) (*http.Response, error)

func (*TaskService) Get Uses

func (s *TaskService) Get(ctx context.Context, taskId int64) (*Task, *http.Response, error)

func (*TaskService) List Uses

func (s *TaskService) List(ctx context.Context, opt *TaskListOptions) (*TaskList, *http.Response, error)

func (*TaskService) Update Uses

func (s *TaskService) Update(ctx context.Context, taskId int64, data *TaskUpdateRequest) (*Task, *http.Response, error)

type TaskUpdateRequest Uses

type TaskUpdateRequest struct {
    Name              *string  `json:"name,omitempty"`                // The name of the task.
    BillableByDefault *bool    `json:"billable_by_default,omitempty"` // Used in determining whether default tasks should be marked billable when creating a new project.
    DefaultHourlyRate *float64 `json:"default_hourly_rate,omitempty"` // The default hourly rate to use for this task when it is added to a project.
    IsDefault         *bool    `json:"is_default,omitempty"`          // Whether this task should be automatically added to future projects.
    IsActive          *bool    `json:"is_active,omitempty"`           // Whether this task is active or archived.
}

type Time Uses

type Time struct {
    time.Time
}

func TimeP Uses

func TimeP(v Time) *Time

TimeP is a helper routine that allocates a new Time value to store v and returns a pointer to it.

func (*Time) EncodeValues Uses

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

func (Time) Equal Uses

func (t Time) Equal(u Time) bool

Equal reports whether t and u are equal based on time.Equal

func (*Time) MarshalJSON Uses

func (t *Time) MarshalJSON() ([]byte, error)

func (Time) String Uses

func (t Time) String() string

func (*Time) UnmarshalJSON Uses

func (t *Time) UnmarshalJSON(data []byte) (err error)

type TimeEntry Uses

type TimeEntry struct {
    Id                *int64                 `json:"id,omitempty"`                 // Unique ID for the time entry.
    SpentDate         *Date                  `json:"spent_date,omitempty"`         // Date of the time entry.
    User              *User                  `json:"user,omitempty"`               // An object containing the id and name of the associated user.
    UserAssignment    *ProjectUserAssignment `json:"user_assignment,omitempty"`    // A user assignment object of the associated user.
    Client            *Client                `json:"client,omitempty"`             // An object containing the id and name of the associated client.
    Project           *Project               `json:"project,omitempty"`            // An object containing the id and name of the associated project.
    Task              *Task                  `json:"task,omitempty"`               // An object containing the id and name of the associated task.
    TaskAssignment    *ProjectTaskAssignment `json:"task_assignment,omitempty"`    // A task assignment object of the associated task.
    ExternalReference *ExternalReference     `json:"external_reference,omitempty"` // An object containing the id, group_id, permalink, service, and service_icon_url of the associated external reference.
    Invoice           *Invoice               `json:"invoice,omitempty"`            // Once the time entry has been invoiced, this field will include the associated invoice’s id and number.
    Hours             *float64               `json:"hours,omitempty"`              // Number of (decimal time) hours tracked in this time entry.
    RoundedHours      *float64               `json:"rounded_hours,omitempty"`      // Number of (decimal time) hours tracked in this time entry used in summary reports and invoices. This value is rounded according to the Time Rounding setting in your Preferences.
    Notes             *string                `json:"notes,omitempty"`              // Notes attached to the time entry.
    IsLocked          *bool                  `json:"is_locked,omitempty"`          // Whether or not the time entry has been locked.
    LockedReason      *string                `json:"locked_reason,omitempty"`      // Why the time entry has been locked.
    IsClosed          *bool                  `json:"is_closed,omitempty"`          // Whether or not the time entry has been approved via Timesheet Approval.
    IsBilled          *bool                  `json:"is_billed,omitempty"`          // Whether or not the time entry has been marked as invoiced.
    TimerStartedAt    *time.Time             `json:"timer_started_at,omitempty"`   // Date and time the timer was started (if tracking by duration).
    StartedTime       *Time                  `json:"started_time,omitempty"`       // Time the time entry was started (if tracking by start/end times).
    EndedTime         *Time                  `json:"ended_time,omitempty"`         // Time the time entry was ended (if tracking by start/end times).
    IsRunning         *bool                  `json:"is_running,omitempty"`         // Whether or not the time entry is currently running.
    Billable          *bool                  `json:"billable,omitempty"`           // Whether or not the time entry is billable.
    Budgeted          *bool                  `json:"budgeted,omitempty"`           // Whether or not the time entry counts towards the project budget.
    BillableRate      *float64               `json:"billable_rate,omitempty"`      // The billable rate for the time entry.
    CostRate          *float64               `json:"cost_rate,omitempty"`          // The cost rate for the time entry.
    CreatedAt         *time.Time             `json:"created_at,omitempty"`         // Date and time the time entry was created.
    UpdatedAt         *time.Time             `json:"updated_at,omitempty"`         // Date and time the time entry was last updated.
}

func (TimeEntry) String Uses

func (p TimeEntry) String() string

type TimeEntryCreateViaDuration Uses

type TimeEntryCreateViaDuration struct {
    UserId    *int64   `json:"user_id,omitempty"` // optional	The ID of the user to associate with the time entry. Defaults to the currently authenticated user’s ID.
    ProjectId *int64   `json:"project_id"`        // required	The ID of the project to associate with the time entry.
    TaskId    *int64   `json:"task_id"`           // required	The ID of the task to associate with the time entry.
    SpentDate *Date    `json:"spent_date"`        // required	The ISO 8601 formatted date the time entry was spent.
    Hours     *float64 `json:"hours,omitempty"`   // optional	The current amount of time tracked. If provided, the time entry will be created with the specified hours and is_running will be set to false. If not provided, hours will be set to 0.0 and is_running will be set to true.
    Notes     *string  `json:"notes,omitempty"`   // optional	Any notes to be associated with the time entry.

}

type TimeEntryCreateViaStartEndTime Uses

type TimeEntryCreateViaStartEndTime struct {
    UserId      *int64  `json:"user_id,omitempty"`      // optional	The ID of the user to associate with the time entry. Defaults to the currently authenticated user’s ID.
    ProjectId   *int64  `json:"project_id"`             // required	The ID of the project to associate with the time entry.
    TaskId      *int64  `json:"task_id"`                // required	The ID of the task to associate with the time entry.
    SpentDate   *Date   `json:"spent_date"`             // required	The ISO 8601 formatted date the time entry was spent.
    StartedTime *Time   `json:"started_time,omitempty"` // optional	The time the entry started. Defaults to the current time. Example: “8:00am”.
    EndedTime   *Time   `json:"ended_time,omitempty"`   // optional	The time the entry ended. If provided, is_running will be set to false. If not provided, is_running will be set to true.
    Notes       *string `json:"notes,omitempty"`        // optional	Any notes to be associated with the time entry.

}

type TimeEntryList Uses

type TimeEntryList struct {
    TimeEntries []*TimeEntry `json:"time_entries"`

    Pagination
}

func (TimeEntryList) String Uses

func (p TimeEntryList) String() string

type TimeEntryListOptions Uses

type TimeEntryListOptions struct {
    UserId       *int64     `url:"user_id,omitempty"`       // Only return time entries belonging to the user with the given ID.
    ClientId     *int64     `url:"client_id,omitempty"`     // Only return time entries belonging to the client with the given ID.
    ProjectId    *int64     `url:"project_id,omitempty"`    // Only return time entries belonging to the project with the given ID.
    IsBilled     *bool      `url:"is_billed,omitempty"`     // Pass true to only return time entries that have been invoiced and false to return time entries that have not been invoiced.
    IsRunning    *bool      `url:"is_running,omitempty"`    // Pass true to only return running time entries and false to return non-running time entries.
    UpdatedSince *time.Time `url:"updated_since,omitempty"` // Only return time entries that have been updated since the given date and time.*/
    From         *Date      `url:"from,omitempty"`          // Only return time entries with a spent_date on or after the given date.
    To           *Date      `url:"to,omitempty"`            // Only return time entries with a spent_date on or before the given date.

    ListOptions
}

type TimeEntryUpdate Uses

type TimeEntryUpdate struct {
    ProjectId   *int64   `json:"project_id"`             // required	The ID of the project to associate with the time entry.
    TaskId      *int64   `json:"task_id"`                // required	The ID of the task to associate with the time entry.
    SpentDate   *Date    `json:"spent_date"`             // required	The ISO 8601 formatted date the time entry was spent.
    StartedTime *Time    `json:"started_time,omitempty"` // optional	The time the entry started. Defaults to the current time. Example: “8:00am”.
    EndedTime   *Time    `json:"ended_time,omitempty"`   // optional	The time the entry ended. If provided, is_running will be set to false. If not provided, is_running will be set to true.
    Hours       *float64 `json:"hours,omitempty"`        // optional	The current amount of time tracked. If provided, the time entry will be created with the specified hours and is_running will be set to false. If not provided, hours will be set to 0.0 and is_running will be set to true.
    Notes       *string  `json:"notes,omitempty"`        // optional	Any notes to be associated with the time entry.

}

type TimesheetService Uses

type TimesheetService service

TimeEntryService handles communication with the issue related methods of the Harvest API.

Harvest API docs: https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/

func (*TimesheetService) CreateTimeEntryViaDuration Uses

func (s *TimesheetService) CreateTimeEntryViaDuration(ctx context.Context, data *TimeEntryCreateViaDuration) (*TimeEntry, *http.Response, error)

func (*TimesheetService) CreateTimeEntryViaStartEndTime Uses

func (s *TimesheetService) CreateTimeEntryViaStartEndTime(ctx context.Context, data *TimeEntryCreateViaStartEndTime) (*TimeEntry, *http.Response, error)

func (*TimesheetService) DeleteTimeEntry Uses

func (s *TimesheetService) DeleteTimeEntry(ctx context.Context, timeEntryId int64) (*http.Response, error)

func (*TimesheetService) Get Uses

func (s *TimesheetService) Get(ctx context.Context, timeEntryId int64) (*TimeEntry, *http.Response, error)

func (*TimesheetService) List Uses

func (s *TimesheetService) List(ctx context.Context, opt *TimeEntryListOptions) (*TimeEntryList, *http.Response, error)

func (*TimesheetService) RestartTimeEntry Uses

func (s *TimesheetService) RestartTimeEntry(ctx context.Context, timeEntryId int64) (*TimeEntry, *http.Response, error)

func (*TimesheetService) StopTimeEntry Uses

func (s *TimesheetService) StopTimeEntry(ctx context.Context, timeEntryId int64) (*TimeEntry, *http.Response, error)

func (*TimesheetService) UpdateTimeEntry Uses

func (s *TimesheetService) UpdateTimeEntry(ctx context.Context, timeEntryId int64, data *TimeEntryUpdate) (*TimeEntry, *http.Response, error)

type User Uses

type User struct {
    Id                           *int64     `json:"id,omitempty"`                                // Unique ID for the user.
    FirstName                    *string    `json:"first_name,omitempty"`                        // The first name of the user.
    LastName                     *string    `json:"last_name,omitempty"`                         // The last name of the user.
    Email                        *string    `json:"email,omitempty"`                             // The email address of the user.
    Telephone                    *string    `json:"telephone,omitempty"`                         // The telephone number for the user.
    Timezone                     *string    `json:"timezone,omitempty"`                          // The user's timezone.
    HasAccessToAllFutureProjects *bool      `json:"has_access_to_all_future_projects,omitempty"` // Whether the user should be automatically added to future projects.
    IsContractor                 *bool      `json:"is_contractor,omitempty"`                     // Whether the user is a contractor or an employee.
    IsAdmin                      *bool      `json:"is_admin,omitempty"`                          // Whether the user has admin permissions.
    IsProjectManager             *bool      `json:"is_project_manager,omitempty"`                // Whether the user has project manager permissions.
    CanSeeRates                  *bool      `json:"can_see_rates,omitempty"`                     // Whether the user can see billable rates on projects. Only applicable to project managers.
    CanCreateProjects            *bool      `json:"can_create_projects,omitempty"`               // Whether the user can create projects. Only applicable to project managers.
    CanCreateInvoices            *bool      `json:"can_create_invoices,omitempty"`               // Whether the user can create invoices. Only applicable to project managers.
    IsActive                     *bool      `json:"is_active,omitempty"`                         // Whether the user is active or archived.
    WeeklyCapacity               *int       `json:"weekly_capacity,omitempty"`                   // The number of hours per week this person is available to work in seconds. For example, if a person's capacity is 35 hours, the API will return 126000 seconds.
    DefaultHourlyRate            *float64   `json:"default_hourly_rate,omitempty"`               // The billable rate to use for this user when they are added to a project.
    CostRate                     *float64   `json:"cost_rate,omitempty"`                         // The cost rate to use for this user when calculating a project's costs vs billable amount.
    Roles                        *[]string  `json:"roles,omitempty"`                             // of strings	The role names assigned to this person.
    AvatarUrl                    *string    `json:"avatar_url,omitempty"`                        // The URL to the user's avatar image.
    CreatedAt                    *time.Time `json:"created_at,omitempty"`                        // Date and time the user was created.
    UpdatedAt                    *time.Time `json:"updated_at,omitempty"`                        // Date and time the user was last updated.
}

func (User) String Uses

func (c User) String() string

type UserCreateRequest Uses

type UserCreateRequest struct {
    FirstName                    *string   `json:"first_name"`                                  // required	The first name of the user.
    LastName                     *string   `json:"last_name"`                                   // required	The last name of the user.
    Email                        *string   `json:"email"`                                       // required	The email address of the user.
    Telephone                    *string   `json:"telephone,omitempty"`                         // optional	The telephone number for the user.
    Timezone                     *string   `json:"timezone,omitempty"`                          // optional	The user's timezone. Defaults to the company's timezone. See a list of supported time zones.
    HasAccessToAllFutureProjects *bool     `json:"has_access_to_all_future_projects,omitempty"` // optional	Whether the user should be automatically added to future projects. Defaults to false.
    IsContractor                 *bool     `json:"is_contractor,omitempty"`                     // optional	Whether the user is a contractor or an employee. Defaults to false.
    IsAdmin                      *bool     `json:"is_admin,omitempty"`                          // optional	Whether the user has admin permissions. Defaults to false.
    IsProjectManager             *bool     `json:"is_project_manager,omitempty"`                // optional	Whether the user has project manager permissions. Defaults to false.
    CanSeeRates                  *bool     `json:"can_see_rates,omitempty"`                     // optional	Whether the user can see billable rates on projects. Only applicable to project managers. Defaults to false.
    CanCreateProjects            *bool     `json:"can_create_projects,omitempty"`               // optional	Whether the user can create projects. Only applicable to project managers. Defaults to false.
    CanCreateInvoices            *bool     `json:"can_create_invoices,omitempty"`               // optional	Whether the user can create invoices. Only applicable to project managers. Defaults to false.
    IsActive                     *bool     `json:"is_active,omitempty"`                         // optional	Whether the user is active or archived. Defaults to true.
    WeeklyCapacity               *int      `json:"weekly_capacity,omitempty"`                   // optional	The number of hours per week this person is available to work in seconds. Defaults to 126000 seconds (35 hours).
    DefaultHourlyRate            *float64  `json:"default_hourly_rate,omitempty"`               // optional	The billable rate to use for this user when they are added to a project. Defaults to 0.
    CostRate                     *float64  `json:"cost_rate,omitempty"`                         // optional	The cost rate to use for this user when calculating a project's costs vs billable amount. Defaults to 0.
    Roles                        []*string `json:"roles,omitempty"`                             // of strings	optional	The role names assigned to this person.
}

type UserList Uses

type UserList struct {
    Users []*User `json:"users"`

    Pagination
}

func (UserList) String Uses

func (c UserList) String() string

type UserListOptions Uses

type UserListOptions struct {
    // Pass true to only return active projects and false to return inactive projects.
    IsActive bool `url:"is_active,omitempty"`
    // Only return projects that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type UserProjectAssignment Uses

type UserProjectAssignment struct {
    Id               *int64                   `json:"id,omitempty"`                 // Unique ID for the project assignment.
    IsActive         *bool                    `json:"is_active,omitempty"`          // Whether the project assignment is active or archived.
    IsProjectManager *bool                    `json:"is_project_manager,omitempty"` // Determines if the user has project manager permissions for the project.
    HourlyRate       *float64                 `json:"hourly_rate,omitempty"`        // Rate used when the project’s bill_by is People.
    Budget           *float64                 `json:"budget,omitempty"`             // Budget used when the project’s budget_by is person.
    CreatedAt        *time.Time               `json:"created_at,omitempty"`         // Date and time the project assignment was created.
    UpdatedAt        *time.Time               `json:"updated_at,omitempty"`         // Date and time the project assignment was last updated.
    Project          *Project                 `json:"project,omitempty"`            // An object containing the assigned project id, name, and code.
    Client           *Client                  `json:"client,omitempty"`             // An object containing the project’s client id and name.
    TaskAssignments  *[]ProjectTaskAssignment `json:"task_assignments,omitempty"`   // Array of task assignment objects associated with the project.
}

func (UserProjectAssignment) String Uses

func (p UserProjectAssignment) String() string

type UserProjectAssignmentList Uses

type UserProjectAssignmentList struct {
    UserAssignments []*UserProjectAssignment `json:"project_assignments"`

    Pagination
}

func (UserProjectAssignmentList) String Uses

func (p UserProjectAssignmentList) String() string

type UserProjectAssignmentListOptions Uses

type UserProjectAssignmentListOptions struct {
    // Only return projects that have been updated since the given date and time.
    UpdatedSince time.Time `url:"updated_since,omitempty"`

    ListOptions
}

type UserService Uses

type UserService service

UserService handles communication with the user related methods of the Harvest API.

Harvest API docs: https://help.getharvest.com/api-v2/users-api/users/users/

func (*UserService) Create Uses

func (s *UserService) Create(ctx context.Context, data *UserCreateRequest) (*User, *http.Response, error)

func (*UserService) Current Uses

func (s *UserService) Current(ctx context.Context) (*User, *http.Response, error)

func (*UserService) Delete Uses

func (s *UserService) Delete(ctx context.Context, userId int64) (*http.Response, error)

func (*UserService) Get Uses

func (s *UserService) Get(ctx context.Context, userId int64) (*User, *http.Response, error)

func (*UserService) List Uses

func (s *UserService) List(ctx context.Context, opt *UserListOptions) (*UserList, *http.Response, error)

func (*UserService) Update Uses

func (s *UserService) Update(ctx context.Context, userId int64, data *UserUpdateRequest) (*User, *http.Response, error)

type UserUpdateRequest Uses

type UserUpdateRequest struct {
    FirstName                    *string   `json:"first_name,omitempty"`                        // The first name of the user. Can't be updated if the user is inactive.
    LastName                     *string   `json:"last_name,omitempty"`                         // The last name of the user. Can't be updated if the user is inactive.
    Email                        *string   `json:"email,omitempty"`                             // The email address of the user. Can't be updated if the user is inactive.
    Telephone                    *string   `json:"telephone,omitempty"`                         // The telephone number for the user.
    Timezone                     *string   `json:"timezone,omitempty"`                          // The user's timezone. Defaults to the company's timezone. See a list of supported time zones.
    HasAccessToAllFutureProjects *bool     `json:"has_access_to_all_future_projects,omitempty"` // Whether the user should be automatically added to future projects.
    IsContractor                 *bool     `json:"is_contractor,omitempty"`                     // Whether the user is a contractor or an employee.
    IsAdmin                      *bool     `json:"is_admin,omitempty"`                          // Whether the user has admin permissions.
    IsProjectManager             *bool     `json:"is_project_manager,omitempty"`                // Whether the user has project manager permissions.
    CanSeeRates                  *bool     `json:"can_see_rates,omitempty"`                     // Whether the user can see billable rates on projects. Only applicable to project managers.
    CanCreateProjects            *bool     `json:"can_create_projects,omitempty"`               // Whether the user can create projects. Only applicable to project managers.
    CanCreateInvoices            *bool     `json:"can_create_invoices,omitempty"`               // Whether the user can create invoices. Only applicable to project managers.
    IsActive                     *bool     `json:"is_active,omitempty"`                         // Whether the user is active or archived.
    WeeklyCapacity               *int      `json:"weekly_capacity,omitempty"`                   // The number of hours per week this person is available to work in seconds.
    DefaultHourlyRate            *float64  `json:"default_hourly_rate,omitempty"`               // The billable rate to use for this user when they are added to a project.
    CostRate                     *float64  `json:"cost_rate,omitempty"`                         // The cost rate to use for this user when calculating a project's costs vs billable amount.
    Roles                        []*string `json:"roles,omitempty"`                             // of strings	The role names assigned to this person.
}

Package harvest imports 15 packages (graph). Updated 2020-10-20. Refresh now. Tools for package owners.