wrike

package module
v0.0.0-...-1db0763 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2018 License: GPL-3.0 Imports: 8 Imported by: 1

README

go-wrike [WIP]

Build Status

A Wrike API client for Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(resp *http.Response) error

CheckResponse check response returned

Types

type Client

type Client struct {
	Folders  *FolderService
	Timelogs *TimelogService
	Tasks    *TaskService
	// contains filtered or unexported fields
}

Client Wrike API client

func NewClient

func NewClient(httpClient *http.Client, token string) *Client

NewClient return client

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do execute a request

func (*Client) NewRequest

func (c *Client) NewRequest(method string, path string, params interface{}) (*http.Request, error)

NewRequest build request

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(urlStr string) error

SetBaseURL sets the base URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.

type CustomField

type CustomField struct {
	ID    string `json:"id"`
	Value string `json:"value"`
}

CustomField struct

type Dates

type Dates struct {
	Type     string `json:"type"`
	Duration int    `json:"duration"`
	Start    string `json:"start"`
	Due      string `json:"due"`
}

Dates are dates

type DetailedTask

type DetailedTask struct {
	ID               string        `json:"id"`
	AccountID        string        `json:"accountID"`
	Title            string        `json:"title"`
	Description      string        `json:"description"`
	BriefDescription string        `json:"briefDescription"`
	ParentIDs        []string      `json:"parentIds"`
	SuperParentIDs   []string      `json:"superParentIds"`
	SharedIDs        []string      `json:"sharedIds"`
	ResponsibleIDs   []string      `json:"responsibleIds"`
	Status           string        `json:"status"`
	Importance       string        `json:"importance"`
	CreatedDate      Time          `json:"createdDate"`
	UpdatedDate      Time          `json:"updatedDate"`
	Dates            Dates         `json:"dates"`
	Scope            string        `json:"scope"`
	AuthorIds        []string      `json:"authorIds"`
	CustomStatusID   string        `json:"customStatusId"`
	HasAttachments   bool          `json:"hasAttachments"`
	Permalink        string        `json:"permalink"`
	Priority         string        `json:"priority"`
	FollowedByMe     bool          `json:"followedByMe"`
	FollowerIDs      []string      `json:"followerIds"`
	SuperTaskIDs     []string      `json:"superTaskIds"`
	SubTaskIDs       []string      `json:"subTaskIds"`
	DependencyIDs    []string      `json:"dependencyIds"`
	Metadata         []Metadata    `json:"metadata"`
	CustomFields     []CustomField `json:"customFields"`
}

DetailedTask represents task return fron /tasks/{id} endpoint

type Folder

type Folder struct {
	Kind string `json:"kind"`
	Data []struct {
		ID             string        `json:"id"`
		AccountID      string        `json:"accountId"`
		Title          string        `json:"title"`
		CreatedDate    string        `json:"createdAt"`
		UpdatedDate    string        `json:"updatedAt"`
		Description    string        `json:"description"`
		SharedIds      []string      `json:"sharedIds,omitempty"`
		ParentIds      []string      `json:"parentIds,omitempty"`
		ChildIds       []string      `json:"childIds,omitempty"`
		SuperParentIds []string      `json:"superParentIds,omitempty"`
		Scope          string        `json:"scope"`
		HasAttachments bool          `json:"hasAttachments"`
		Permalink      string        `json:"permalink"`
		WorkflowID     string        `json:"workflowId"`
		Metadata       []Metadata    `json:"metadata,omitempty"`
		CustomFields   []CustomField `json:"customFields"`
		Project        Project       `json:"project"`
	} `json:"data,omitempty"`
}

Folder struct, also known as Project

type FolderService

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

FolderService endpoint, see Wrike API docs: https://developers.wrike.com/documentation/api/methods/get-folder-tree

func (*FolderService) GetFolder

func (s *FolderService) GetFolder(id string) (*Folder, *Response, error)

GetFolder from id, see Wrike API: https://developers.wrike.com/documentation/api/methods/get-folder

type GetTaskOptions

type GetTaskOptions struct {
}

GetTaskOptions represents options for /tasks/{id} endpoint

type Metadata

type Metadata struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Metadata struct

type Project

type Project struct {
	AuthorID      string   `json:"authorId"`
	OwnerIds      []string `json:"ownerIds"`
	Status        string   `json:"status"`
	StartDate     string   `json:"startDate"`
	EndDate       string   `json:"endDate"`
	CreatedDate   string   `json:"createdDate"`
	CompletedDate string   `json:"completedDate"`
}

Project struct

type QueryTasksOptions

type QueryTasksOptions struct {
	Permalink string `url:"permalink"`
	Fields    string `url:"fields"`
}

QueryTasksOptions to add params to query

type Response

type Response struct {
	*http.Response
}

Response struct

type Task

type Task struct {
	ID             string `json:"id"`
	AccountID      string `json:"accountId"`
	Title          string `json:"title"`
	Status         string `json:"status"`
	Importance     string `json:"importance"`
	CreatedDate    Time   `json:"createdDate"`
	UpdatedDate    Time   `json:"updatedDate"`
	Dates          Dates  `json:"dates"`
	Scope          string `json:"scope"`
	CustomStatusID string `json:"customStatusId"`
	Permalink      string `json:"permalink"`
	Priority       string `json:"priority"`
	Description    string `json:"description"`
}

Task is a task

type TaskResponse

type TaskResponse struct {
	Kind string         `json:"kind"`
	Data []DetailedTask `json:"data"`
}

TaskResponse represents /tasks/{id} response

type TaskService

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

TaskService is Tasks endpoint, see https://developers.wrike.com/documentation/api/methods/query-tasks

func (*TaskService) GetTask

func (t *TaskService) GetTask(id string, options GetTaskOptions) (*TaskResponse, *Response, error)

GetTask get task by id

func (*TaskService) QueryTasks

func (t *TaskService) QueryTasks(options QueryTasksOptions) (*TasksResponse, *Response, error)

QueryTasks query tasks

type TasksResponse

type TasksResponse struct {
	Kind string `json:"kind"`
	Data []Task `json:"data,omitempty"`
}

TasksResponse is Response from /tasks query

type Time

type Time struct {
	time.Time
}

Time represents time

type Timelog

type Timelog struct {
	ID          string  `json:"id"`
	TaskID      string  `json:"taskId"`
	UserID      string  `json:"userId"`
	CategoryID  string  `json:"categoryId"`
	Hours       float64 `json:"hours"`
	CreatedDate string  `json:"createdDate"`
	UpdatedDate string  `json:"updatedDate"`
	TrackedDate string  `json:"trackedDate"`
	Comment     string  `json:"comment"`
}

Timelog represents a timelog

type TimelogService

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

TimelogService is Timelog endpoint, see https://developers.wrike.com/documentation/api/methods/query-timelogs

func (*TimelogService) GetTimelogs

func (s *TimelogService) GetTimelogs(id string) (*Timelogs, *Response, error)

GetTimelogs get folder timelogs

type Timelogs

type Timelogs struct {
	Kind string    `json:"kind"`
	Data []Timelog `json:"data,omitempty"`
}

Timelogs represents /timelogs reponse

type TimelogsParams

type TimelogsParams struct {
}

TimelogsParams represents params passed to query timelogs

Jump to

Keyboard shortcuts

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