Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/aksiksi/everexport

A note export API for Scala and JS based on the Evernote SDK.
https://github.com/aksiksi/everexport

evernote evernote-sdk exporter javascript jdk8 scala scalajs

Last synced: 3 months ago
JSON representation

A note export API for Scala and JS based on the Evernote SDK.

Awesome Lists containing this project

README

        

# EverExport

[![Build Status](https://travis-ci.org/aksiksi/everexport.svg?branch=master)](https://travis-ci.org/aksiksi/everexport)

A note export API written in Scala based on the [Evernote SDK](https://github.com/evernote/evernote-sdk-java). Compiles to both the JVM and JS (via [Scala.js](https://www.scala-js.org/)) backends. Currently supports both 2.11.x and 2.12.x.

## Install

### Scala

In your `build.sbt`:

```scala
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
libraryDependencies += "me.assil" %% "everexport" % "0.3-SNAPSHOT"
```

### NPM

```bash
npm install everexport
```

## Examples

On the JVM (Scala):

```scala
import me.assil.everexport.{EverExport, Note, Notebook}

import scala.concurrent.{Await, Future}
import scala.concurrent.duration._
import scala.util.Try

// Global EC for executing Futures
import scala.concurrent.ExecutionContext.Implicits.global

object QuickStart extends App {
// https://dev.evernote.com/doc/articles/dev_tokens.php
val token: String = ???
val exporter = new EverExport(token, sandbox = true)

// Get all notebooks in user's account
val notebooksFuture: Future[Vector[Notebook]] = exporter.listNotebooks

// Return all note titles for the *first* notebook
val noteTitlesFuture: Future[Vector[String]] =
for (
notebooks <- notebooksFuture;
titles <- exporter.getNoteTitles(notebooks(0).guid)
) yield titles

// Export all notes from *second* notebook (assuming it exists!)
val notesFuture: Future[Vector[Try[Note]]] =
for (
notebooks <- notebooksFuture;
notes <- exporter.exportNotebook(notebooks(1).guid)
) yield notes

// Wait 5 seconds for last Future to complete
val notes = Await.result(notesFuture, 5.seconds)

// Display notes exported from second notebook
println(notes)
}
```

In JS:

```javascript 1.6
const everexport = require('everexport')

const token = process.env.EVERNOTE_TOKEN // Same token as above
const exporter = new everexport.EverExport(token, true)

// Fetch all notebooks in user's account
exporter.listNotebooks()
// Then fetch all notes in *first* notebook
.then(notebooks => {
const n = notebooks[0]
return exporter.exportNotebook(n.guid)
})
// Then display each note's title and creation time
.then(notes => {
notes.forEach(note => {
console.log('Title: ' + note.title + ', Created on: ' + note.created)
});
})
```

## Build

First, make sure you have `sbt` 1.x installed.

### Scala

Run `sbt everexportJVM/package`. JAR in `jvm/target/scala-2.12`.

### JS

Run `sbt everexportJS/fullOptJS`. Optimized JS in `js/target/scala-2.12/scalajs-bundler/main`.