Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AllDataRequest = defaultParamsForAllResources([]string{"all"})
Request for all data.
var AllItemsRequest = defaultParamsForAllResources([]string{"items"})
Request for all items.
var AllProjectsAndItemsRequest = defaultParamsForAllResources([]string{"projects", "items"})
Request for all projects and items.
var UserRequest = defaultParamsForAllResources([]string{"user"})
Request for user account info.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Todoist Sync API client. Carries a token corresponding to a user's session and acts on a base API URL.
func NewDefaultClient ¶
Creates a client pointed to the default Todoist Sync API URL.
func (Client) MakeRequest ¶
func (c Client) MakeRequest(req RequestParams, res Responser) (err error)
Performs the given request, providing the response in the passed in object. Response objects must know how to parse themselves from JSON and validate. Will short-circuit and return an error if one occurred during the request.
type Item ¶
type Item struct { Id int Content string Indent int Archived int `json:"is_archived"` Deleted int `json:"is_deleted"` ProjectId int `json:"project_id"` Project *Project }
Represents an Item.
func ItemWithId ¶
Returns the item with the given id, if any.
type Project ¶
type Project struct { Id int Name string Indent int Items []*Item Archived int `json:"is_archived"` Deleted int `json:"is_deleted"` }
Represents a Project.
func ProjectWithId ¶
Returns the project with the given id, if any.
type ReadResult ¶
Represents a read request result.
func (*ReadResult) UnmarshalJson ¶
func (r *ReadResult) UnmarshalJson(bytes []byte) error
Unpacks a read result from a JSON representation. Ensures this type adheres to JsonUnmarshaler.
type RequestParams ¶
Represents a Sync API request type.
func CloseProjectRequest ¶
func CloseProjectRequest(id int) RequestParams
Request to close a project.
func CompleteItemRequest ¶
func CompleteItemRequest(id int) RequestParams
Request to complete an item.
func CreateItemRequest ¶
func CreateItemRequest(content string, projectId int) RequestParams
Request to create an item.
func CreateProjectRequest ¶
func CreateProjectRequest(name string) RequestParams
Request to create a project.
type ResponseUnmarshaler ¶
Describes a type that may be unmarshaled via JSON response data.
type ResponseValidator ¶
type ResponseValidator interface {
ValidateResponse() error
}
Describes a type that determines if the response was valid.
type Responser ¶
type Responser interface { ResponseValidator ResponseUnmarshaler }
A full response object.
type User ¶
type User struct { FullName string `json:"full_name"` Email string `json:"email"` CompletedToday int `json:"completed_today"` NextWeek int `json:"next_week"` CompletedCount int `json:"completed_count"` Karma float64 `json:"karma"` }
Represents a User.
type WriteResult ¶
Represents a write request result.
func (*WriteResult) UnmarshalJson ¶
func (r *WriteResult) UnmarshalJson(bytes []byte) error
Unpacks a write result from a JSON representation. Ensures this type adheres to JsonUnmarshaler.
func (*WriteResult) ValidateResponse ¶
func (r *WriteResult) ValidateResponse() error
Validate writes.