How to use GuiEditNoteRequest? #2

Open
opened 2024-05-29 23:32:33 +00:00 by aramrw · 2 comments
aramrw commented 2024-05-29 23:32:33 +00:00 (Migrated from gitlab.com)

I'm confused what to do next because GuiEditNoteRequest returns a ()...

  • Am I doing something wrong? or is it a bug?
  • Could you give me an example on how to update a field with data like an image and text?
pub fn update_last_anki_card(&mut self) {
        let client = AnkiClient::default();
        //let decks: Vec<String> = client.request(DeckNamesRequest {}).unwrap();

        let res: Option<usize> = match client.request(FindCardsRequest {
            query: "is:new".to_string(),
        }) {
            Ok(res) => res.last().copied(),
            Err(err) => {
                self.err_msg = Some(format!("Error Making Card: {}", err));
                return;
            }
        };

        if let Some(newest_card_id) = res {
            match client.request(GuiEditNoteRequest {
                note: newest_card_id,
            }) {
                Ok(current_note) => {
                    // update current note with 
                    // new image 
                }
                Err(err) => {
                    self.err_msg = Some(format!("Error Making Card: {}", err));
                }
            }
        }
    }
I'm confused what to do next because `GuiEditNoteRequest` returns a ()... - Am I doing something wrong? or is it a bug? - Could you give me an example on how to update a field with data like an image and text? ``` pub fn update_last_anki_card(&mut self) { let client = AnkiClient::default(); //let decks: Vec<String> = client.request(DeckNamesRequest {}).unwrap(); let res: Option<usize> = match client.request(FindCardsRequest { query: "is:new".to_string(), }) { Ok(res) => res.last().copied(), Err(err) => { self.err_msg = Some(format!("Error Making Card: {}", err)); return; } }; if let Some(newest_card_id) = res { match client.request(GuiEditNoteRequest { note: newest_card_id, }) { Ok(current_note) => { // update current note with // new image } Err(err) => { self.err_msg = Some(format!("Error Making Card: {}", err)); } } } } ```
aramrw commented 2024-05-30 00:25:45 +00:00 (Migrated from gitlab.com)

Oh I see thats my bad, it literally opens the gui. But I am still struggling to find any methods that would allow me to insert an image/text into a field...

Is it not implemented yet? https://foosoft.net/projects/anki-connect/#updateNoteFields

Oh I see thats my bad, it literally opens the gui. But I am still struggling to find any methods that would allow me to insert an image/text into a field... Is it not implemented yet? https://foosoft.net/projects/anki-connect/#updateNoteFields
kerkmann commented 2024-06-06 11:21:45 +00:00 (Migrated from gitlab.com)

Yes, you are right, this action isn't implemented yet. I am sorry. Feel free to open a MR, otherwise I would add them when I have more time. 😄

Thanks for your feedback! ❤️

Yes, you are right, this action isn't implemented yet. I am sorry. Feel free to open a MR, otherwise I would add them when I have more time. :smile: Thanks for your feedback! :heart:
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kerkmann/anki_bridge#2
No description provided.