Unofficial SDK for Evernote. According official Evernote-thrift 1.29
go get -u github.com/dreampuf/evernote-sdk-golang/...
- Apply your evernote developer key and developer token (an oauth access token for simply testing). More information: https://dev.evernote.com/doc/
- Clone the library
$ git clone https://github.com/dreampuf/evernote-sdk-golang.git
- Run the test cases with your credentials
$ cd evernote-sdk-golang
$ KEY=YOUR_KEY SECRET=YOUR_SECRET TOKEN="YOUR_DEVERLOPER_TOKEN" go test ./...
ok github.com/dreampuf/evernote-sdk-golang/client 1.556s
? github.com/dreampuf/evernote-sdk-golang/edam [no test files]
? github.com/dreampuf/evernote-sdk-golang/edam/note_store-remote [no test files]
? github.com/dreampuf/evernote-sdk-golang/edam/user_store-remote [no test files]
Referring to client_test.go
ctx, _ := context.WithTimeout(context.Background(), time.Duration(15) * time.Second)
c := NewClient(EvernoteKey, EvernoteSecret, SANDBOX)
us, err := c.GetUserStore()
if err != nil {
t.Fatal(err)
}
userUrls, err := us.GetUserUrls(ctx, EvernoteAuthorToken)
if err != nil {
t.Fatal(err)
}
ns, err := c.GetNoteStoreWithURL(userUrls.GetNoteStoreUrl())
if err != nil {
t.Fatal(err)
}
notebook, err := ns.GetDefaultNotebook(ctx, EvernoteAuthorToken)
if err != nil {
t.Fatal(err)
}
if notebook == nil {
t.Fatal("Invalid Note")
}
// optional tag filter
filterTags := []edam.GUID{}
tags, err := ns.ListTags(ctx, EvernoteAuthorToken)
if err != nil {
t.Fatal(err)
}
for _, tag := range tags {
filterTags = append(filterTags, tag.GetGUID())
}
noteMetadataList, err := ns.FindNotesMetadata(ctx, EvernoteAuthorToken, &edam.NoteFilter{
//Ascending: &yes,
//TagGuids: filterTags,
}, 0, 1000, &edam.NotesMetadataResultSpec{
IncludeTitle: &yes,
IncludeContentLength: &yes,
IncludeCreated: &yes,
IncludeUpdated: &yes,
IncludeTagGuids: &yes,
})
if err != nil {
t.Fatal(err)
}
t.Logf("total note: %d\n", noteMetadataList.GetTotalNotes())
for n, noteMate := range noteMetadataList.GetNotes() {
t.Logf("%d - %s - %s\n", n, time.Unix(int64(noteMate.GetCreated())/1000, 0), noteMate.GetTitle())
}
-
Install the latest Thrift. (
brew install thrift
if you are using MacOS) -
Clone evernote-thrift repo
https://github.com/evernote/evernote-thrift
-
Generate golang version specs through this command:
thrift -strict -nowarn \ --allow-64bit-consts \ --allow-neg-keys \ --gen go:package_prefix=github.com/dreampuf/evernote-sdk-golang/,thrift_import=github.com/apache/thrift/lib/thrift \ -strict -nowarn --allow-64bit-consts \ --allow-neg-keys \ --gen go:package_prefix=github.com/dreampuf/evernote-sdk-golang/,thrift_import=github.com/apache/thrift/lib/go/thrift \ -I src/ -r \ --out github.com/dreampuf/evernote-sdk-golang src/UserStore.thrift
-
There are some minor type convert issues you need to do a manually fix. I found Evernote internally has a Golang version SDK and here is what their suggestion.
MIT