pocket

package
v0.0.0-...-9c5270f Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action represents a mutation to link

const (
	// Archive to put the link in the archived list (read list)
	Archive Action = "archive"
	// ReAdd to put the link back in the to reed list
	ReAdd Action = "readd"
)

type Client

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

Client pocket client Documention at https://getpocket.com/developer/docs/overview

func NewClient

func NewClient(consumerKey, redirectURL string) *Client

NewClient returns a new PocketClient

func (client *Client) CreateAuthLink(requestToken string) string

CreateAuthLink create authorization link to redirect the user to

func (*Client) GetAccessToken

func (client *Client) GetAccessToken(requestToken string) (accessToken string, err error)

GetAccessToken exchange request token for accesstoken

func (client *Client) GetLinks(state LinkState) (response ItemLists, err error)

GetLinks retrieve links of a given states https://getpocket.com/developer/docs/v3/retrieve

func (client *Client) ModifyLink(action Action, itemID string) (ok bool, err error)

ModifyLink change the state of the link

func (*Client) ObtainRequestToken

func (client *Client) ObtainRequestToken() (code string, err error)

ObtainRequestToken get request token to be used in the auth workflow

type Item

type Item struct {
	ItemID                 string `json:"item_id"`
	ResolvedID             string `json:"resolved_id"`
	GivenURL               string `json:"given_url"`
	GivenTitle             string `json:"given_title"`
	Favorite               string `json:"favorite"`
	Status                 string `json:"status"`
	TimeAdded              string `json:"time_added"`
	TimeUpdated            string `json:"time_updated"`
	TimeRead               string `json:"time_read"`
	TimeFavorited          string `json:"time_favorited"`
	SortID                 int    `json:"sort_id"`
	ResolvedTitle          string `json:"resolved_title"`
	ResolvedURL            string `json:"resolved_url"`
	Excerpt                string `json:"excerpt"`
	IsArticle              string `json:"is_article"`
	IsIndex                string `json:"is_index"`
	HasVideo               string `json:"has_video"`
	HasImage               string `json:"has_image"`
	WordCount              string `json:"word_count"`
	Lang                   string `json:"lang"`
	TimeToRead             int    `json:"time_to_read"`
	TopImageURL            string `json:"top_image_url"`
	ListenDurationEstimate int    `json:"listen_duration_estimate"`
}

Item represents link in pocket api

type ItemLists

type ItemLists struct {
	Status   int             `json:"status"`
	Complete int             `json:"complete"`
	List     map[string]Item `json:"list"`
	Since    int             `json:"since"`
}

ItemLists represent list of links

type LinkState

type LinkState string

LinkState represents link states to be retrieved According to the api https://getpocket.com/developer/docs/v3/retrieve there are 3 states:

1-archive
2-unread
3-all

however archive does not really well work and returns links that are in the unread list buy inspecting getpocket I found out that there is an undocumanted read state

const (
	// Read links that has been read (undocumanted)
	Read LinkState = "read"
	// Unread links has not been read
	Unread LinkState = "unread"
)

type Settings

type Settings struct {
	*cfg.Common
	// contains filtered or unexported fields
}

func NewSettingsFromYAML

func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings

type Widget

type Widget struct {
	view.ScrollableWidget
	// contains filtered or unexported fields
}

func NewWidget

func NewWidget(tviewApp *tview.Application, redrawChan chan bool, _ *tview.Pages, settings *Settings) *Widget

func (*Widget) Refresh

func (widget *Widget) Refresh()

func (*Widget) Render

func (widget *Widget) Render()

Jump to

Keyboard shortcuts

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