Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notes API - Note ID #29

Open
GeoDirk opened this issue Mar 29, 2023 · 4 comments
Open

Notes API - Note ID #29

GeoDirk opened this issue Mar 29, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@GeoDirk
Copy link

GeoDirk commented Mar 29, 2023

We are pushing notes to the various corpora through our plugin successfully. Ideally it would very handy when sending a new note through the API for the ID of the new note to be returned back to us. We also need a way to later send an update to the same note through the API, identifying it by the ID, to flag the note as resolved. Is this possible? Not sure how you all keep track of note objects internally.

@FoolRunning
Copy link
Contributor

The note object is returned when creating a new note. You can update that note by adding a new comment or resolving it. Is that sufficient?

@GeoDirk
Copy link
Author

GeoDirk commented Mar 29, 2023

Hey Tim,

So I looked at the plugin demos and modified the AddNote code to be:

var noteObject = m_project.AddNote(writeLock, anchor, paragraphs, assignedUser: assignee);

Looking at the noteObject variable it looks like this:

noteObject
{Paratext.Base.Plugins.CommentThreadWrapper}
    Anchor: {NEH 1:3: Ɓe mo sat nwan nne nyem ɗi mo bar mpo ɗak laatong ni kɨ mo baaso nyil ni, mo mbut njeel ɗiinaat, kɨ naashwoop hakyeng. Kɨ nne moo shirip fwang kɨ̀ bɨrni nJerusalem ni, kɨ moo caan po shyeep kɨpang kɨ̀ ni mo. [0]}
    AssignedUser: {}
    Comments: Count = 1
    IsRead: false
    IsResolved: false
    ReplyToUser: null
    cachedComments: {PtxUtils.LazyInitHelper<System.Collections.Generic.IReadOnlyList<Paratext.PluginInterfaces.IComment>>}
    thread: {Paratext.Data.ProjectComments.CommentThread}

While we certainly could save this whole object into our database, I'm not sure how we can return back to this note later on without some sort of unique ID/GUID. If this note has been modified in Paratext, we no longer will be able to match them up easily with the one stored in our database.

@FoolRunning
Copy link
Contributor

Ah, I see.
Unfortunately, that's not currently possible. It would probably be best to send in a feature request through Help > Give feedback describing exactly what you need so it can get prioritized.

If this is holding you up and you are unable to wait, you can use reflection to get at the ID through the thread object contained in the wrapper object (noteObject.thread.Id - a string). This should be considered a temporary solution since there is no guarantee that the structure won't change. SIL.Core.Reflection.ReflectionHelper (GetField and GetProperty) can help if you can import LibPalaso.

@FoolRunning FoolRunning added the enhancement New feature or request label Mar 29, 2023
@GeoDirk
Copy link
Author

GeoDirk commented Mar 30, 2023

Thanks Tim - feature request was submitted (PTXS-40134)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants