[−][src]Struct wallabag_api::Client
The main thing that provides all the methods for interacting with the Wallabag API.
Methods
impl Client
[src]
pub fn new(config: Config) -> Self
[src]
Build a new client given the configuration.
pub async fn check_urls_exist<'_, T: Into<String>>(
&'_ mut self,
urls: Vec<T>
) -> ClientResult<ExistsInfo>
[src]
&'_ mut self,
urls: Vec<T>
) -> ClientResult<ExistsInfo>
Check if a list of urls already have entries. This is more efficient if you want to batch check urls since only a single request is required. Returns a hashmap where the urls given are the keys and the values are either:
None
: no existing entry corresponding to the urlSome(ID)
: an entry exists and here's the ID
pub async fn check_url_exists<'_, T: Into<String>>(
&'_ mut self,
url: T
) -> ClientResult<Option<ID>>
[src]
&'_ mut self,
url: T
) -> ClientResult<Option<ID>>
Check if a url already has a corresponding entry. Returns None
if not existing or the ID
of the entry if it does exist.
pub async fn create_entry<'_, '_>(
&'_ mut self,
new_entry: &'_ NewEntry
) -> ClientResult<Entry>
[src]
&'_ mut self,
new_entry: &'_ NewEntry
) -> ClientResult<Entry>
Create a new entry. See docs for NewEntry
for more information.
pub async fn update_entry<'_, '_, T: Into<ID>>(
&'_ mut self,
id: T,
entry: &'_ PatchEntry
) -> ClientResult<Entry>
[src]
&'_ mut self,
id: T,
entry: &'_ PatchEntry
) -> ClientResult<Entry>
Update entry. To leave an editable field unchanged, set to None
.
pub async fn reload_entry<'_, T: Into<ID>>(
&'_ mut self,
id: T
) -> ClientResult<Entry>
[src]
&'_ mut self,
id: T
) -> ClientResult<Entry>
Reload entry. This tells the server to re-fetch content from the url (or origin url?) and use the result to refresh the entry contents.
This returns Err(ClientError::NotModified)
if the server either could
not refresh the contents, or the content does not get modified.
pub async fn get_entry<'_, T: Into<ID>>(
&'_ mut self,
id: T
) -> ClientResult<Entry>
[src]
&'_ mut self,
id: T
) -> ClientResult<Entry>
Get an entry by id.
pub async fn delete_entry<'_, T: Into<ID>>(
&'_ mut self,
id: T
) -> ClientResult<Entry>
[src]
&'_ mut self,
id: T
) -> ClientResult<Entry>
Delete an entry by id.
pub async fn update_annotation<'_, '_>(
&'_ mut self,
annotation: &'_ Annotation
) -> ClientResult<Annotation>
[src]
&'_ mut self,
annotation: &'_ Annotation
) -> ClientResult<Annotation>
Update an annotation.
pub async fn create_annotation<'_, '_, T: Into<ID>>(
&'_ mut self,
entry_id: T,
annotation: &'_ NewAnnotation
) -> ClientResult<Annotation>
[src]
&'_ mut self,
entry_id: T,
annotation: &'_ NewAnnotation
) -> ClientResult<Annotation>
Create a new annotation on an entry.
pub async fn delete_annotation<'_, T: Into<ID>>(
&'_ mut self,
id: T
) -> ClientResult<Annotation>
[src]
&'_ mut self,
id: T
) -> ClientResult<Annotation>
Delete an annotation by id
pub async fn get_annotations<'_, T: Into<ID>>(
&'_ mut self,
id: T
) -> ClientResult<Annotations>
[src]
&'_ mut self,
id: T
) -> ClientResult<Annotations>
Get all annotations for an entry (by id).
pub async fn get_entries<'_>(&'_ mut self) -> ClientResult<Entries>
[src]
Get all entries.
pub async fn get_entries_with_filter<'_, '_>(
&'_ mut self,
filter: &'_ EntriesFilter
) -> ClientResult<Entries>
[src]
&'_ mut self,
filter: &'_ EntriesFilter
) -> ClientResult<Entries>
Get all entries, filtered by filter parameters.
pub async fn get_entries_page<'_, '_>(
&'_ mut self,
filter: &'_ EntriesFilter,
page_number: u32
) -> ClientResult<EntriesPage>
[src]
&'_ mut self,
filter: &'_ EntriesFilter,
page_number: u32
) -> ClientResult<EntriesPage>
Get a page of entries, specified by page number. Useful when the expected list of results
is very large and you don't want to wait too long before getting a subset of the entries.
Will return a not found error if page_number
is out of bounds.
pub async fn export_entry<'_, T: Into<ID>>(
&'_ mut self,
entry_id: T,
fmt: Format
) -> ClientResult<String>
[src]
&'_ mut self,
entry_id: T,
fmt: Format
) -> ClientResult<String>
Get an export of an entry in a particular format.
pub async fn get_tags_for_entry<'_, T: Into<ID>>(
&'_ mut self,
entry_id: T
) -> ClientResult<Tags>
[src]
&'_ mut self,
entry_id: T
) -> ClientResult<Tags>
Get a list of all tags for an entry by entry id.
pub async fn add_tags_to_entry<'_, T: Into<ID>, U: Into<String>>(
&'_ mut self,
entry_id: T,
tags: Vec<U>
) -> ClientResult<Entry>
[src]
&'_ mut self,
entry_id: T,
tags: Vec<U>
) -> ClientResult<Entry>
Add tags to an entry by entry id. Idempotent operation. No problems if tags list is empty.
pub async fn delete_tag_from_entry<'_, T: Into<ID>, U: Into<ID>>(
&'_ mut self,
entry_id: T,
tag_id: U
) -> ClientResult<Entry>
[src]
&'_ mut self,
entry_id: T,
tag_id: U
) -> ClientResult<Entry>
Delete a tag (by id) from an entry (by id). Returns err 404 if entry or tag not found. Idempotent. Removing a tag that exists but doesn't exist on the entry completes without error.
pub async fn get_tags<'_>(&'_ mut self) -> ClientResult<Tags>
[src]
Get a list of all tags.
pub async fn delete_tag<'_, T: Into<ID>>(
&'_ mut self,
id: T
) -> ClientResult<Tag>
[src]
&'_ mut self,
id: T
) -> ClientResult<Tag>
Permanently delete a tag by id. This removes the tag from all entries. Appears to return success if attempting to delete a tag by id that exists on the server but isn't accessible to the user.
pub async fn delete_tag_by_label<'_, T: Into<String>>(
&'_ mut self,
label: T
) -> ClientResult<DeletedTag>
[src]
&'_ mut self,
label: T
) -> ClientResult<DeletedTag>
Permanently delete a tag by label (tag names). This also exhibits the privacy breaching behaviour of returning tag info of other users' tags. Also, labels aren't necessarily unique across a wallabag installation. The server should filter by tags belonging to a user in the same db query.
Note: this allows deleting a tag with a comma by label.
pub async fn delete_tags_by_label<'_>(
&'_ mut self,
tags: Vec<TagString>
) -> ClientResult<Vec<DeletedTag>>
[src]
&'_ mut self,
tags: Vec<TagString>
) -> ClientResult<Vec<DeletedTag>>
Permanently batch delete tags by labels (tag names). Returns not found if all labels not found. If at least one found, then returns ok. For some reason, (at least the framabag instance) the server returns success and the tag data on attempting to delete for innaccessible tags (tags by other users?).
This method requires that tag names not contain commas. If you need to
delete a tag containing a comma, use delete_tag_by_label
instead.
Returns a list of tags that were deleted (sans IDs). Returns 404 not found only if all tags were not found.
pub async fn get_api_version<'_>(&'_ mut self) -> ClientResult<String>
[src]
Get the API version. Probably not useful because if the version isn't v2 then this library won't work anyway.
pub async fn get_user<'_>(&'_ mut self) -> ClientResult<User>
[src]
Get the currently logged in user information.
pub async fn register_user<'_, '_>(
&'_ mut self,
info: &'_ RegisterInfo
) -> ClientResult<NewlyRegisteredInfo>
[src]
&'_ mut self,
info: &'_ RegisterInfo
) -> ClientResult<NewlyRegisteredInfo>
Register a user and create a client.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,