evt

package
v0.0.0-...-36962eb Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements the evt.Eventer methods using HTTP requests.

func New

func New(authorizationToken string) *Client

New generates a Client pointer instance.

func (*Client) Convert

func (c *Client) Convert(ctx context.Context, data []byte) (*tbl.Row, error)

Convert implements the evt.Eventer.Convert interface method.

type ConvertError

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

ConvertError wraps errors returned b helper method calls in the evt.Eventer.Convert method.

func (*ConvertError) Error

func (e *ConvertError) Error() string

type Event

type Event struct {
	EventName string    `json:"event_name"`
	EventData Item      `json:"event_data"`
	Initiator initiator `json:"initiator"`
}

Event represents a raw Todoist event.

type Eventer

type Eventer interface {
	Convert(ctx context.Context, data []byte) (*tbl.Row, error)
}

Eventer defines methods for processing raw Todoist webhook events into table-formatted data.

type Item

type Item struct {
	ID            int     `json:"id"`
	UserID        int     `json:"user_id"`
	ProjectID     int     `json:"project_id"`
	Content       string  `json:"content"`
	Description   string  `json:"description"`
	Priority      int     `json:"priority"`
	ParentID      *int    `json:"parent_id,omitempty"`
	SectionID     *int    `json:"section_id,omitempty"`
	Labels        []int   `json:"labels"`
	Checked       int     `json:"checked"`
	DateAdded     string  `json:"date_added"`
	DateCompleted *string `json:"date_completed,omitempty"`
}

Item item represents an Item unmarshaled from the "event_data" field of a raw Todoist event.

Note that only Item is being provided for the initial structure since these are the only events of interest.

Jump to

Keyboard shortcuts

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