raindrop

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package raindrop implements Raindrop.io API client.

API Reference: https://developer.raindrop.io/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHtmlTitle added in v0.3.5

func GetHtmlTitle(r io.Reader) (string, bool)

Types

type AccessTokenResponse added in v0.2.0

type AccessTokenResponse struct {
	AccessToken  string `json:"access_token,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
	Expires      int    `json:"expires,omitempty"`
	ExpiresIn    int    `json:"expires_in,omitempty"`
	TokenType    string `json:"token_type,omitempty"`
	Error        string `json:"error,omitempty"`
}

AccessTokenResponse represents the token exchange api response item

type Client

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

Client is a raindrop client

func NewClient

func NewClient(clientId string, clientSecret string, redirectUri string) (*Client, error)

NewClient creates Raindrop.io client

func (*Client) CreateCollection added in v0.3.2

func (c *Client) CreateCollection(accessToken string, isRoot bool, view string, title string, sort int,
	public bool, parentId uint32, cover []string) (*CreateCollectionResponse, error)

CreateCollection creates new Collection Reference: https://developer.raindrop.io/v1/collections/methods#create-collection

func (*Client) CreateSimpleRaindrop added in v0.3.5

func (c *Client) CreateSimpleRaindrop(accessToken string, link string) (*SingleRaindropResponse, error)

CreateSimpleRaindrop creates new simple unsorted Raindrop Reference: https://developer.raindrop.io/v1/raindrops/single#create-raindrop

func (*Client) GetAccessToken

func (c *Client) GetAccessToken(userCode string) (*AccessTokenResponse, error)

GetAccessToken exchanges user's authorization code to access token Reference: https://developer.raindrop.io/v1/authentication/token#step-3-the-token-exchange

func (*Client) GetAuthorizationCode added in v0.3.2

func (c *Client) GetAuthorizationCode(r *http.Request) (string, error)

GetAuthorizationCode returns authorization code or an error from raindrop's redirect request Reference: https://developer.raindrop.io/v1/authentication/token#step-2-the-redirection-to-your-application-site

func (*Client) GetAuthorizationCodeHandler added in v0.3.2

func (c *Client) GetAuthorizationCodeHandler(w http.ResponseWriter, r *http.Request)

GetAuthorizationCodeHandler handles redirect request from raindrop's authorization page

func (*Client) GetAuthorizationURL added in v0.2.0

func (c *Client) GetAuthorizationURL() (url.URL, error)

GetAuthorizationURL returns URL for user to authorize app

func (*Client) GetChildCollections added in v0.3.3

func (c *Client) GetChildCollections(accessToken string) (*GetCollectionsResponse, error)

GetChildCollections call Get child collections API. Reference: https://developer.raindrop.io/v1/collections/methods#get-child-collections

func (Client) GetCollection added in v0.3.4

func (c Client) GetCollection(accessToken string, id uint32) (*GetCollectionResponse, error)

GetCollection call Get collection API. Reference: https://developer.raindrop.io/v1/collections/methods#get-collection

func (*Client) GetRaindrops

func (c *Client) GetRaindrops(accessToken string, collectionID string, perpage int) (*MultiRaindropsResponse, error)

GetRaindrops call get raindrops API. Reference: https://developer.raindrop.io/v1/raindrops/multiple#get-raindrops

func (*Client) GetRootCollections added in v0.3.3

func (c *Client) GetRootCollections(accessToken string) (*GetCollectionsResponse, error)

GetRootCollections call Get root collections API. Reference: https://developer.raindrop.io/v1/collections/methods#get-root-collections

func (*Client) GetTaggedRaindrops

func (c *Client) GetTaggedRaindrops(accessToken string, tag string) (*MultiRaindropsResponse, error)

GetTaggedRaindrops finds raindrops with exact tags. This function calls Get raindrops API with collectionID=0 and specify given tag as a search parameter.

Reference: https://developer.raindrop.io/v1/raindrops/multiple#search-parameter

func (*Client) GetTags

func (c *Client) GetTags(accessToken string) (*Tags, error)

GetTags calls Get tags API. Reference: https://developer.raindrop.io/v1/tags#get-tags

func (*Client) RefreshAccessToken added in v0.2.0

func (c *Client) RefreshAccessToken(refreshToken string) (*AccessTokenResponse, error)

RefreshAccessToken refreshes expired token Reference: https://developer.raindrop.io/v1/authentication/token#the-access-token-refresh

type Collection

type Collection struct {
	ID         uint32   `json:"_id"`
	Access     access   `json:"access"`
	Color      string   `json:"color"`
	Count      uint32   `json:"count"`
	Cover      []string `json:"cover"`
	Created    string   `json:"created"`
	LastUpdate string   `json:"lastUpdate"`
	ParentId   int      `json:"parent_id,omitempty"`
	Expanded   bool     `json:"expanded"`
	Public     bool     `json:"public"`
	Title      string   `json:"title"`
	User       user     `json:"user"`
	View       string   `json:"view"`
}

Collection represents Raindrop.io collection type

type CreateCollectionResponse added in v0.3.2

type CreateCollectionResponse struct {
	Result       bool                    `json:"result"`
	Item         createCollectionRequest `json:"item,omitempty"`
	Error        string                  `json:"error,omitempty"`
	ErrorMessage string                  `json:"errorMessage,omitempty"`
}

CreateCollectionResponse represents create collection api response item

type GetCollectionResponse added in v0.3.4

type GetCollectionResponse struct {
	Result bool       `json:"result"`
	Item   Collection `json:"item"`
}

GetCollectionResponse represents get collection by id api response

type GetCollectionsResponse added in v0.3.3

type GetCollectionsResponse struct {
	Result bool         `json:"result"`
	Items  []Collection `json:"items"`
}

GetCollectionsResponse represents get root and child collections api response

type MultiRaindropsResponse added in v0.3.5

type MultiRaindropsResponse struct {
	Result bool       `json:"result"`
	Items  []Raindrop `json:"items"`
}

MultiRaindropsResponse represents get multiple raindrops api response

type Raindrop

type Raindrop struct {
	PleaseParse pleaseParse `json:"pleaseParse"`
	Created     string      `json:"created,omitempty"`
	LastUpdate  string      `json:"lastUpdate,omitempty"`
	Order       int         `json:"order,omitempty"`
	Tags        []string    `json:"tags,omitempty"`
	Media       []media     `json:"media,omitempty"`
	Cover       string      `json:"cover,omitempty"`
	Collection  Collection  `json:"collection,omitempty"`
	Type        string      `json:"type,omitempty"`
	HTML        string      `json:"html,omitempty"`
	Excerpt     string      `json:"excerpt,omitempty"`
	Title       string      `json:"title,omitempty"`
	Link        string      `json:"link"`
}

Raindrop represents get raindrops api response item

type SingleRaindropResponse added in v0.3.5

type SingleRaindropResponse struct {
	Result bool     `json:"result"`
	Items  Raindrop `json:"item"`
}

SingleRaindropResponse represent single raindrop api response

type Tag

type Tag struct {
	ID    string `json:"_id"`
	Count int    `json:"count"`
}

Tag represents get tags api response item

type Tags

type Tags struct {
	Result bool  `json:"result"`
	Items  []Tag `json:"items"`
}

Tags represents get tags api response

Jump to

Keyboard shortcuts

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