Documentation ¶
Index ¶
- Constants
- func GenerateAuthorizationURL(requestToken *RequestToken, redirectURL string) string
- func ObtainAccessToken(consumerKey string, requestToken *RequestToken) (string, error)
- func Post(action string, data, res interface{}) error
- type AddOption
- type Authorization
- type Client
- func (c *Client) Add(URL string) error
- func (c *Client) Archive(IDs []int) (*ModifyResult, error)
- func (c *Client) Delete(IDs []int) (*ModifyResult, error)
- func (c *Client) Retrieve(count int, sort string, search string, filter string) (*RetrieveResult, error)
- func (c *Client) RetrieveArchive(count int, sort string, search string, filter string) (*RetrieveResult, error)
- func (c *Client) Unarchive(IDs []int) (*ModifyResult, error)
- type Entry
- type Item
- type Modify
- type ModifyResult
- type RequestToken
- type RetrieveOption
- type RetrieveResult
- type Time
- type Tview
Constants ¶
View Source
const ( ContentTypeArticle = "article" ContentTypeVideo = "video" ContentTypeImage = "image" SortNewest = "newest" SortOldest = "oldest" SortTitle = "title" SortSite = "site" StateUnread = "unread" StateArchive = "archive" StateAll = "all" DetailTypeSimple = "simple" DetailTypeComplete = "complete" FavoriteFilterUnspecified = "" FavoriteFilterUnfavorited = "0" FavoriteFilterFavorited = "1" ItemStatusUnread = 0 ItemStatusArchived = 1 ItemStatusDeleted = 2 ItemMediaAttachmentNoMedia = 0 ItemMediaAttachmentHasMedia = 1 ItemMediaAttachmentIsMedia = 2 )
View Source
const ( EventDelete = "delete" EventArchive = "archive" )
View Source
const URL = "https://getpocket.com"
Variables ¶
This section is empty.
Functions ¶
func GenerateAuthorizationURL ¶
func GenerateAuthorizationURL(requestToken *RequestToken, redirectURL string) string
func ObtainAccessToken ¶
func ObtainAccessToken(consumerKey string, requestToken *RequestToken) (string, error)
Types ¶
type Authorization ¶
type Authorization struct { AccessToken string `json:"access_token"` Username string `json:"username"` }
func Auth ¶
func Auth(consumerKey string) (Authorization, error)
OAuth2 1. Send the consumer key. 2. User needs to confirm on a webpage. 3. Get a token back - save it to a file. 4. Can retrieve pocket list thanks to token.
type Client ¶
type Client struct { ConsumerKey string `json:"consumer_key"` AccessToken string `json:"access_token"` }
Client represents a Pocket client that grants OAuth access to your application
func (*Client) RetrieveArchive ¶
type Item ¶
type Item struct { ItemID int `json:"item_id,string"` ResolvedId int `json:"resolved_id,string"` GivenURL string `json:"given_url"` ResolvedURL string `json:"resolved_url"` GivenTitle string `json:"given_title"` ResolvedTitle string `json:"resolved_title"` Favorite int `json:",string"` Status int `json:",string"` Excerpt string IsArticle int `json:"is_article,string"` HasImage int `json:"has_image,string"` HasVideo int `json:"has_video,string"` WordCount int `json:"word_count,string"` // Fields for detailed response Tags map[string]map[string]interface{} Authors map[string]map[string]interface{} Images map[string]map[string]interface{} Videos map[string]map[string]interface{} // Fields that are not documented but exist SortId int `json:"sort_id"` TimeAdded Time `json:"time_added"` TimeUpdated Time `json:"time_updated"` TimeRead Time `json:"time_read"` TimeFavorited Time `json:"time_favorited"` }
type ModifyResult ¶
type RequestToken ¶
type RequestToken struct {
Code string `json:"code"`
}
func ObtainRequestToken ¶
func ObtainRequestToken(consumerKey, redirectURL string) (*RequestToken, error)
type RetrieveOption ¶
type RetrieveOption struct { State string `json:"state,omitempty"` Favorite string `json:"favorite,omitempty"` Tag string `json:"tag,omitempty"` ContentType string `json:"contentType,omitempty"` Sort string `json:"sort,omitempty"` DetailType string `json:"detailType,omitempty"` Search string `json:"search,omitempty"` Domain string `json:"domain,omitempty"` Since int64 `json:"since,omitempty"` Count int `json:"count,omitempty"` Offset int `json:"offset,omitempty"` }
RetrieveOption is the options for retrieve API.
type RetrieveResult ¶
func (RetrieveResult) FlattenList ¶
func (r RetrieveResult) FlattenList() []Item
func (*RetrieveResult) UnmarshalJSON ¶
func (r *RetrieveResult) UnmarshalJSON(data []byte) error
type Time ¶
func (*Time) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.