/** * Use this method, if you want to download a linked note as HTML. * * @param linkedNotebook The referenced {@link LinkedNotebook}. Its GUID and share key must not be * {@code null}. * @return An async wrapper to load a note as HTML from the Evernote service. */ public EvernoteHtmlHelper getLinkedHtmlHelper(@NonNull LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException { String key = linkedNotebook.getGuid(); EvernoteHtmlHelper htmlHelper = mLinkedHtmlHelper.get(key); if (htmlHelper == null) { String url = linkedNotebook.getNoteStoreUrl(); EvernoteNoteStoreClient client = getNoteStoreClient(url, EvernotePreconditions.checkNotEmpty(mEvernoteSession.getAuthToken())); AuthenticationResult authenticationResult = client.authenticateToSharedNotebook(linkedNotebook.getShareKey()); htmlHelper = createHtmlHelper(authenticationResult.getAuthenticationToken()); mLinkedHtmlHelper.put(key, htmlHelper); } return htmlHelper; }
protected EvernoteLinkedNotebookHelper createLinkedNotebookHelper(@NonNull LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, EDAMNotFoundException, TException { String url = linkedNotebook.getNoteStoreUrl(); EvernoteNoteStoreClient client = getNoteStoreClient(url, EvernotePreconditions.checkNotEmpty(mEvernoteSession.getAuthToken())); AuthenticationResult authenticationResult = client.authenticateToSharedNotebook(linkedNotebook.getShareKey()); client = getNoteStoreClient(url, authenticationResult.getAuthenticationToken()); return new EvernoteLinkedNotebookHelper(client, linkedNotebook, mExecutorService); }
/** * Creates a LinkedNoteStoreClient from a {@link LinkedNotebook} synchronously * * @param linkedNotebook */ public LinkedNoteStoreClient createLinkedNoteStoreClient( LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException { NoteStoreClient mainNoteStoreClient = createNoteStoreClient(); AuthenticationResult sharedAuth = mainNoteStoreClient .authenticateToSharedNotebook(linkedNotebook.getShareKey()); NoteStoreClient linkedNoteStoreClient = createStoreClient( NoteStoreClient.class, linkedNotebook.getNoteStoreUrl(), sharedAuth.getAuthenticationToken()); return new LinkedNoteStoreClient(mainNoteStoreClient, linkedNoteStoreClient, sharedAuth); }
/** * Creates a LinkedNoteStoreClient from a {@link LinkedNotebook} synchronously * * @param linkedNotebook */ public LinkedNoteStoreClient createLinkedNoteStoreClient( LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException { NoteStoreClient mainNoteStoreClient = createNoteStoreClient(); AuthenticationResult sharedAuth = mainNoteStoreClient .authenticateToSharedNotebook(linkedNotebook.getShareKey()); NoteStoreClient linkedNoteStoreClient = createStoreClient( NoteStoreClient.class, linkedNotebook.getNoteStoreUrl(), sharedAuth.getAuthenticationToken()); return new LinkedNoteStoreClient(mainNoteStoreClient, linkedNoteStoreClient, sharedAuth); }