예제 #1
0
 public function notebookList($token)
 {
     $client = new \Evernote\Client($token, $this->sandbox, null, null, $this->china);
     $notebooks = array();
     $notebooks = $client->listNotebooks();
     return $notebooks;
 }
<?php

require __DIR__ . '/../../vendor/autoload.php';
/**
 * Authorization Tokens are created by either:
 * [1] OAuth workflow: https://dev.evernote.com/doc/articles/authentication.php
 * or by creating a 
 * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken
 */
$token = '%YOUR_TOKEN%';
/** Understanding SANDBOX vs PRODUCTION Environments
 *
 * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM 
 *    - Create a sample Evernote account at https://sandbox.evernote.com
 * 
 * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM
 *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/
 * 
 * For testing, set $sandbox to true, for production, set $sandbox to false
 * 
 */
$sandbox = true;
$client = new \Evernote\Client($token, $sandbox);
$note = new \Evernote\Model\Note();
$note->title = 'Share a note';
$note->content = new \Evernote\Model\PlainTextNoteContent('Some plain text content.');
$uploaded_note = $client->uploadNote($note);
echo "\nPublic link : " . $client->shareNote($uploaded_note);
 * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken
 */
$token = '%YOUR_TOKEN%';
/** Understanding SANDBOX vs PRODUCTION vs CHINA Environments
 *
 * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM 
 *    - Create a sample Evernote account at https://sandbox.evernote.com
 * 
 * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM
 *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/
 * 
 * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM
 *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ 
 *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer 
 *      to https://dev.evernote.com/doc/articles/bootstrap.php
 *
 * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; 
 * for china service, set $sandbox to false and $china to true.
 * 
 */
$sandbox = true;
$china = false;
$client = new \Evernote\Client($token, $sandbox, null, null, $china);
$note = new \Evernote\Model\Note();
$note->title = 'Test note';
$note->content = new \Evernote\Model\PlainTextNoteContent('Some plain text content.');
$uploaded_note = $client->uploadNote($note);
$new_note = new \Evernote\Model\Note();
$new_note->title = 'New note';
$new_note->content = new \Evernote\Model\PlainTextNoteContent('Some new plain text content.');
$client->replaceNote($uploaded_note, $new_note);
 * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken
 */
$token = '%YOUR_TOKEN%';
/** Understanding SANDBOX vs PRODUCTION Environments
 *
 * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM 
 *    - Create a sample Evernote account at https://sandbox.evernote.com
 * 
 * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM
 *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/
 * 
 * For testing, set $sandbox to true, for production, set $sandbox to false
 * 
 */
$sandbox = true;
$client = new \Evernote\Client($token, $sandbox);
/**
 * You need to pass a \Evernote\Model\Note object
 * There are 2 options :
 *
 * If you already have a Note object (from the getNote method for example)
 * just pass it as is to the method.
 *
 * If you only have a note guid, instantiate an empty note and set the guid :
 *
 * $note = new \Evernote\Model\Note();
 * $note->guid = 'GUID';
 *
 */
$note = new \Evernote\Model\Note();
$note->guid = 'GUID';
예제 #5
0
 * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken
 */
$token = '%YOUR_TOKEN%';
/** Understanding SANDBOX vs PRODUCTION Environments
 *
 * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM 
 *    - Create a sample Evernote account at https://sandbox.evernote.com
 * 
 * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM
 *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/
 * 
 * For testing, set $sandbox to true, for production, set $sandbox to false
 * 
 */
$sandbox = true;
$client = new \Evernote\Client($token, $sandbox);
$note = new \Evernote\Model\Note();
$note->title = 'Move a note';
$note->content = new \Evernote\Model\PlainTextNoteContent('Some plain text content.');
$notebook = null;
$uploaded_note = $client->uploadNote($note, $notebook);
echo "\nFirst guid : " . $uploaded_note->guid;
/**
 * The second parameter $notebook is - of course - mandatory.
 *
 * You need to pass a \Evernote\Model\Notebook object
 * There are 2 options :
 *
 * If you already have a Notebook object (from the listNotebooks method for example)
 * just pass it as is to the method.
 *
 * Authorization Tokens are created by either:
 * [1] OAuth workflow: https://dev.evernote.com/doc/articles/authentication.php
 * or by creating a 
 * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken
 */
$token = '%YOUR_TOKEN%';
/** Understanding SANDBOX vs PRODUCTION Environments
 *
 * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM 
 *    - Create a sample Evernote account at https://sandbox.evernote.com
 * 
 * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM
 *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/
 * 
 * For testing, set $sandbox to true, for production, set $sandbox to false
 * 
 */
$sandbox = true;
$client = new \Evernote\Client($token, $sandbox);
$notebooks = array();
$notebooks = $client->listNotebooks();
foreach ($notebooks as $notebook) {
    echo "\n\nName : " . $notebook->name;
    echo "\nGuid : " . $notebook->guid;
    echo "\nIs Business : ";
    echo $notebook->isBusinessNotebook() ? "Y" : "N";
    echo "\nIs Default  : ";
    echo $notebook->isDefaultNotebook() ? "Y" : "N";
    echo "\nIs Linked   : ";
    echo $notebook->isLinkedNotebook() ? "Y" : "N";
}
예제 #7
0
 * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken
 */
$token = '%YOUR_TOKEN%';
/** Understanding SANDBOX vs PRODUCTION Environments
 *
 * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM 
 *    - Create a sample Evernote account at https://sandbox.evernote.com
 * 
 * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM
 *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/
 * 
 * For testing, set $sandbox to true, for production, set $sandbox to false
 * 
 */
$sandbox = true;
$client = new \Evernote\Client($token, $sandbox);
$note = new \Evernote\Model\Note();
$note->title = 'Test note';
$note->content = new \Evernote\Model\PlainTextNoteContent('Some plain text content.');
$uploaded_note = $client->uploadNote($note);
$datetime = new \DateTime('tomorrow');
// Check if the note "is" a reminder
var_dump($uploaded_note->isReminder());
// Set a reminder. The parameter is a timestamp in seconds.
$uploaded_note->setReminder($datetime->getTimestamp());
$client->uploadNote($uploaded_note);
var_dump($uploaded_note->isReminder());
var_dump($uploaded_note->getReminderTime());
// Check if the reminder has been set as done.
var_dump($uploaded_note->isDone());
$uploaded_note->setAsDone();
 * 
 * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM
 *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/
 * 
 * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM
 *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ 
 *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer 
 *      to https://dev.evernote.com/doc/articles/bootstrap.php
 *
 * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; 
 * for china service, set $sandbox to false and $china to true.
 * 
 */
$sandbox = true;
$china = false;
$client = new \Evernote\Client($token, $sandbox, null, null, $china);
$note = new \Evernote\Model\Note();
$note->title = 'Test note';
$note->content = new \Evernote\Model\PlainTextNoteContent('Some plain text content.');
$note->tagNames = array('tag1', 'tag2');
/**
 * The second parameter $notebook is optionnal.
 * If left blank or set as null, the note will be created in the default notebook
 * Or in the App Notebook if applicable.
 *
 * Otherwise, you need to pass a \Evernote\Model\Notebook object
 * There are 2 options :
 *
 * If you already have a Notebook object (from the listNotebooks method for example)
 * just pass it as is to the method.
 *
 * 
 * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM
 *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/
 * 
 * The Evernote API 'CHINA' Environment -> APP.YINXIANG.COM
 *    - Activate your Sandboxed API key for Evernote China service access at https://dev.evernote.com/support/ 
 *      or https://dev.yinxiang.com/support/. For more information about Evernote China service, please refer 
 *      to https://dev.evernote.com/doc/articles/bootstrap.php
 *
 * For testing, set $sandbox to true; for production, set $sandbox to false and $china to false; 
 * for china service, set $sandbox to false and $china to true.
 * 
 */
$sandbox = true;
$china = false;
$client = new \Evernote\Client($token, $sandbox, null, null, $china);
// Create the resource
$resource = new \Evernote\Model\Resource('enlogo.png', 'image/png', 100, 100);
// Get a preformatted enml media tag (something like '<en-media type="%mime%" hash="%hash%" />')
$enml_media_tag = $resource->getEnmlMediaTag();
// Create the note
$note = new \Evernote\Model\Note();
$note->addResource($resource);
$note->title = 'Test note';
$note->content = new \Evernote\Model\EnmlNoteContent(<<<ENML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
<en-note>{$enml_media_tag}</en-note>
ENML
);
// Upload the note
예제 #10
0
파일: auth.php 프로젝트: wake/Intersection
        return $app->redirect($app->url('api/evernote/auth'));
    }
    $client = new \Evernote\Client($token, false);
    return 'Intersection - Evernote' . '<br />' . '<br />User id: ' . $client->getAdvancedClient()->getUserStore()->getUser()->id . '<br />Auth token: ' . $token;
})->bind('api/evernote');
/**
 *
 * Evernote API test
 *
 */
$app->get('/api/evernote/test', function (Request $request) use($app) {
    $token = $app['session']->get('api/evernote/token', false);
    if (!$token) {
        return $app->redirect($app->url('api/evernote/auth'));
    }
    $client = new \Evernote\Client($token);
    $notebooks = $client->listNotebooks();
    foreach ($notebooks as $notebook) {
        echo "<br /><br />Name : " . $notebook->name;
        echo "<br />Guid : " . $notebook->guid;
        echo "<br />Is Business : ";
        echo $notebook->isBusinessNotebook() ? "Y" : "N";
        echo "<br />Is Default  : ";
        echo $notebook->isDefaultNotebook() ? "Y" : "N";
        echo "<br />Is Linked   : ";
        echo $notebook->isLinkedNotebook() ? "Y" : "N";
    }
    if (isset($notebooks[0])) {
        $filter = new \EDAM\NoteStore\NoteFilter();
        $filter->notebookGuid = $notebooks[0]->guid;
        $search = $client->getAdvancedClient()->getNoteStore()->findNotes($token, $filter, 0, 1000);
예제 #11
0
 * [2] Developer Token: https://dev.evernote.com/doc/articles/authentication.php#devtoken
 */
$token = '%TOKEN%';
/** Understanding SANDBOX vs PRODUCTION Environments
 *
 * The Evernote API 'Sandbox' environment -> SANDBOX.EVERNOTE.COM 
 *    - Create a sample Evernote account at https://sandbox.evernote.com
 * 
 * The Evernote API 'Production' Environment -> WWW.EVERNOTE.COM
 *    - Activate your Sandboxed API key for production access at https://dev.evernote.com/support/
 * 
 * For testing, set $sandbox to true, for production, set $sandbox to false
 * 
 */
$sandbox = true;
$client = new \Evernote\Client($token, $sandbox);
/**
 * The search string
 */
$search = new \Evernote\Model\Search('test');
/**
 * The notebook to search in
 */
$notebook = null;
/**
 * The scope of the search
 */
$scope = \Evernote\Client::SEARCH_SCOPE_BUSINESS;
/**
 * The order of the sort
 */