-
Notifications
You must be signed in to change notification settings - Fork 2
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
Impossible access to items #1
Comments
Hi @ademasi , Thank you for your issue and welcome to the Rust community 🦀. You should try something like this : extern crate zotero;
use zotero::ZoteroInit;
use zotero::Get;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let z = ZoteroInit::set_user("ID", "API_KEY");
let items = z.get_items(None)?;
for item in items.iter() {
println!("{:?}", item);
}
Ok(())
} The problem with your code is that extern crate zotero;
use zotero::ZoteroInit;
use zotero::Get;
use std::error::Error;
fn main() {
let z = ZoteroInit::set_user("ID", "API_KEY");
let items = z.get_items(None);
let items = z.get_items(None);
match items {
Ok(zotero_items) => println!("{:?}", zotero_items),
Err(_) => panic!("API Error")
}
} If you want to check your API key privileges you should take a look at the doc. let z = ZoteroInit::set_user("ID", "API_KEY");
let key_info = z.get_api_key_info("API_KEY");
println!("{:?}", key_info); While looking to fix your issue I noticed other issues with my crate. Zotero API slightly change since I implemented it and I'm facing Derialization issues 😞. I need more time to fix this see #2. Best regards |
Hi @Eonm , Thank you for taking the time to reply to my issue. Indeed, I was expecting something closer to what I am used to in Python or Java. I need to read the rust book ... Err(
Error("invalid type: map, expected a string", line: 0, column: 0),
) What would be the first step to hep with with #2 ? Regards, Alex. |
I take a closer look at this deserialization issue this afternoon. I can provide a hot fix, but more work needs to be done. I need to implement proper unit test and add more documentation, maybe this week end. Can you replace the zotero dependencies entry with the following in
I won't touch anything on this branch for not braking your code. Regards, |
I didn't notice but the first code you used was in the documentation. It's my fault. The documentation is wrong. |
Hi,
Thank you for your work. I wanted to start playing with Zotero and Rust via your crate.
But I am having some issues, I am using my own key generated on https://www.zotero.org/settings/keys to access my items. Nothing get printed at all, looks like my username/password are not working.
Did I miss something ? (I am totally new to rust)
Regards, Alex.
The text was updated successfully, but these errors were encountered: