Documentation ¶
Overview ¶
Package raindrop implements Raindrop.io API client.
API Reference: https://developer.raindrop.io/
Index ¶
- func GetHtmlTitle(r io.Reader) (string, bool)
- type AccessTokenResponse
- type Client
- func (c *Client) CreateCollection(accessToken string, isRoot bool, view string, title string, sort int, ...) (*CreateCollectionResponse, error)
- func (c *Client) CreateSimpleRaindrop(accessToken string, link string, ctx context.Context) (*SingleRaindropResponse, error)
- func (c *Client) DeleteTags(accessToken string, ctx context.Context, tagIDs []string) error
- func (c *Client) GetAccessToken(userCode string, ctx context.Context) (*AccessTokenResponse, error)
- func (c *Client) GetAuthorizationCode(r *http.Request) (string, error)
- func (c *Client) GetAuthorizationCodeHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) GetAuthorizationURL() (url.URL, error)
- func (c *Client) GetChildCollections(accessToken string, ctx context.Context) (*GetCollectionsResponse, error)
- func (c Client) GetCollection(accessToken string, id uint32, ctx context.Context) (*GetCollectionResponse, error)
- func (c *Client) GetRaindrops(accessToken string, collectionID string, perpage int, ctx context.Context) (*MultiRaindropsResponse, error)
- func (c *Client) GetRootCollections(accessToken string, ctx context.Context) (*GetCollectionsResponse, error)
- func (c *Client) GetTaggedRaindrops(accessToken string, tag string, ctx context.Context) (*MultiRaindropsResponse, error)
- func (c *Client) GetTags(accessToken string, ctx context.Context) (*Tags, error)
- func (c *Client) RefreshAccessToken(refreshToken string, ctx context.Context) (*AccessTokenResponse, error)
- type Collection
- type CreateCollectionResponse
- type DeleteTagsResponse
- type GetCollectionResponse
- type GetCollectionsResponse
- type MultiRaindropsResponse
- type Raindrop
- type SingleRaindropResponse
- type Tag
- type Tags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessTokenResponse ¶
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"` ErrorMessage string `json:"errorMessage,omitempty"` Result bool `json:"result"` Status int `json:"status"` }
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 (*Client) CreateCollection ¶
func (c *Client) CreateCollection(accessToken string, isRoot bool, view string, title string, sort int, public bool, parentId uint32, cover []string, ctx context.Context) (*CreateCollectionResponse, error)
CreateCollection creates new Collection Reference: https://developer.raindrop.io/v1/collections/methods#create-collection
func (*Client) CreateSimpleRaindrop ¶
func (c *Client) CreateSimpleRaindrop(accessToken string, link string, ctx context.Context) (*SingleRaindropResponse, error)
CreateSimpleRaindrop creates new simple unsorted Raindrop Reference: https://developer.raindrop.io/v1/raindrops/single#create-raindrop
func (*Client) DeleteTags ¶
DeleteTags calls Delete tags API. Reference: https://developer.raindrop.io/v1/tags#remove-tag-s
func (*Client) GetAccessToken ¶
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 ¶
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 ¶
func (c *Client) GetAuthorizationCodeHandler(w http.ResponseWriter, r *http.Request)
GetAuthorizationCodeHandler handles redirect request from raindrop's authorization page
func (*Client) GetAuthorizationURL ¶
GetAuthorizationURL returns URL for user to authorize app
func (*Client) GetChildCollections ¶
func (c *Client) GetChildCollections(accessToken string, ctx context.Context) (*GetCollectionsResponse, error)
GetChildCollections call Get child collections API. Reference: https://developer.raindrop.io/v1/collections/methods#get-child-collections
func (Client) GetCollection ¶
func (c Client) GetCollection(accessToken string, id uint32, ctx context.Context) (*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, ctx context.Context) (*MultiRaindropsResponse, error)
GetRaindrops call get raindrops API. Reference: https://developer.raindrop.io/v1/raindrops/multiple#get-raindrops
func (*Client) GetRootCollections ¶
func (c *Client) GetRootCollections(accessToken string, ctx context.Context) (*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, ctx context.Context) (*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 ¶
GetTags calls Get tags API. Reference: https://developer.raindrop.io/v1/tags#get-tags
func (*Client) RefreshAccessToken ¶
func (c *Client) RefreshAccessToken(refreshToken string, ctx context.Context) (*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 ¶
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 DeleteTagsResponse ¶
type DeleteTagsResponse struct {
Result bool `json:"result"`
}
type GetCollectionResponse ¶
type GetCollectionResponse struct { Result bool `json:"result"` Item Collection `json:"item"` }
GetCollectionResponse represents get collection by id api response
type GetCollectionsResponse ¶
type GetCollectionsResponse struct { Result bool `json:"result"` Items []Collection `json:"items"` }
GetCollectionsResponse represents get root and child collections api response
type MultiRaindropsResponse ¶
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 ¶
SingleRaindropResponse represent single raindrop api response