forked from djmmts/b0000ks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bookshelf.rs
35 lines (29 loc) · 910 Bytes
/
bookshelf.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use std::{collections::HashSet, sync::Arc};
use crate::cardano::api::CardanoApi;
use super::book::{BookId, BookListItem};
pub struct Bookshelf {
api: Arc<Box<dyn CardanoApi>>,
stake_address: String,
}
impl Bookshelf {
pub fn new(api: Arc<Box<dyn CardanoApi>>, stake_address: String) -> Self {
Bookshelf { api, stake_address }
}
/**
* Gets the collection of books available on this bookshelf.
*/
pub async fn get_books(
&self,
policy_ids: HashSet<String>,
) -> anyhow::Result<Vec<BookListItem>> {
todo!()
}
/**
* Returns true if the book exists on the bookshelf and false otherwise.
*/
pub async fn has_book(&self, id: &BookId) -> bool {
// bonus points if you can implement this more efficiently than just
// calling get_books and seeing if the BookId exists in that set.
todo!()
}
}