Evernote\Client::uploadNote PHP Méthode

uploadNote() public méthode

Sends a new Note to the API
public uploadNote ( Evernote\Model\Note $note, Evernote\Model\Notebook $notebook = null ) : Evernote\Model\Note
$note Evernote\Model\Note
$notebook Evernote\Model\Notebook
Résultat Evernote\Model\Note
    public function uploadNote(Note $note, Notebook $notebook = null)
    {
        if ($this->isAppNotebookToken($this->token)) {
            $notebook = new Notebook();
        }
        if (null != $notebook && true === $note->getSaved() && $note->notebookGuid === $notebook->guid) {
            return $this->replaceNote($note, $note);
        }
        if ($note->getEdamNote()) {
            $edamNote = $note->getEdamNote();
        } else {
            $edamNote = new \EDAM\Types\Note();
        }
        $edamNote->title = $note->title;
        $edamNote->content = $note->content;
        $edamNote->attributes = $note->attributes;
        $edamNote->created = $note->created;
        $edamNote->resources = $note->resources;
        $edamNote->tagNames = $note->tagNames;
        if (null !== $notebook && null !== $notebook->guid) {
            $edamNote->notebookGuid = $notebook->guid;
        }
        try {
            $uploaded_note = $this->getUserNotestore()->createNote($this->token, $edamNote);
            $noteStore = $this->getUserNotestore();
            $token = $this->token;
        } catch (EDAMNotFoundException $e) {
            $notebook = $this->getNotebook($notebook->guid, self::LINKED_SCOPE);
            if (null === $notebook) {
                throw $e;
            }
            if ($notebook->isLinkedNotebook()) {
                $noteStore = $this->getNotestore($notebook->linkedNotebook->noteStoreUrl);
                $token = $notebook->authToken;
                $edamNote->notebookGuid = $notebook->guid;
                $uploaded_note = $noteStore->createNote($token, $edamNote);
            }
        }
        $uploaded_note->content = $note->content;
        $note = $this->getNoteInstance($uploaded_note, $noteStore, $token);
        $note->setSaved(true);
        return $note;
    }