NoteStore.findRelated
function that independent developers and partners can use. As the name of the function suggests, it allows customers to request notes, notepads and tags that are somehow related to the source data (such input data can be either the identifier of another note, or plain text).
findRelated
. The code below is taken from this application, so if you wish, you can go directly to it.
findRelated
: RelatedQuery
and RelatedResultSpec
.
parameter
argument, which can be either a note or a string. When defining a RelatedQuery
, if we have a note as the source data, we will use its GUID. Then, as the first parameter when calling a function (which in our example is called “ parameter
), we will pass an object of type Note, and specify this GUID as the noteGuid
attribute of the noteGuid
object. If the parameter is not a note, then we consider that it is just a string, and assign its value to the plainText
attribute of the plainText
object.
plainText
or noteGuid
; you cannot use them at the same time or do not use any at all - the server in this case will throw an exception.
RelatedQuery
is in the API Help .
RelatedResultSpec
allows us to control the type and number of results returned by the Evernote Cloud API when we call findRelated
. We can specify one or more of the following parameters:
maxNotes
maxNotebooks
maxTags
maxNotes
, we get the corresponding (or fewer) number of notes. Similarly, it works with notebooks and tags. If you do not specify a value for a particular parameter, you will not get the results of the corresponding type.
maxNotes
. This means that our RelatedResult RelatedResult
, returned by findRelated
, will not contain notebooks or labels.
RelatedResultSpec
is in the API Help .
findRelated
in our web clippers for browsers to show users notes from their account that can be thematically linked to the webpage being viewed. The function is also used in “guessing” tags and notebooks when creating a new note from a fragment of a web page.
findRelated
will be useful for quickly viewing notes on meetings similar to the current document. Using findRelated
will be appropriate in many cases, and you will be able to significantly increase the usefulness of your application with relatively little effort.
RelatedResult
object, in our case with 1-3 related notes. These are Note objects, so you can request their name, GUID, metadata, and so on.
findRelated
function findRelated
can be found in our API documentation .
Source: https://habr.com/ru/post/159423/