Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zhashkevych/go-pocket-sdk

Unofficial getpocket.com API Golang SDK
https://github.com/zhashkevych/go-pocket-sdk

api api-client getpocket go go-api go-api-client golang golang-library golang-package golang-sdk pocket sdk

Last synced: 7 days ago
JSON representation

Unofficial getpocket.com API Golang SDK

Awesome Lists containing this project

README

        

# GetPocket API Golang SDK
## https://getpocket.com/developer/

### Example usage:

```go
package main

import (
"context"
"fmt"
pocket "github.com/zhashkevych/go-pocket-sdk"
"log"
)

func main() {
ctx := context.Background()

client := pocket.NewClient("") // you can generate key at https://getpocket.com/developer/apps/
requestToken, err := client.GetRequestToken(ctx, "http://example.com/")
if err != nil {
log.Fatalf("failed to get request token: %s", err.Error())
}

url := client.GetAuthorizationURL(requestToken, "http://example.com/")
fmt.Println(url)

authResp, err := client.Authorize(ctx, requestToken)
if err != nil {
log.Fatalf("failed to authorize: %s", err)
}

err = client.Add(ctx, pocket.AddInput{
URL: "https://github.com/zhashkevych/go-pocket-sdk",
AccessToken: authResp.AccessToken,
})
if err != nil {
log.Fatalf("failed to add item: %s", err)
}
}
```