[][src]Struct wallabag_api::Client

pub struct Client { /* fields omitted */ }

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]

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 url
  • Some(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]

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]

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]

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]

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]

Get an entry by id.

pub async fn delete_entry<'_, T: Into<ID>>(
    &'_ mut self,
    id: T
) -> ClientResult<Entry>
[src]

Delete an entry by id.

pub async fn update_annotation<'_, '_>(
    &'_ mut self,
    annotation: &'_ Annotation
) -> ClientResult<Annotation>
[src]

Update an annotation.

pub async fn create_annotation<'_, '_, T: Into<ID>>(
    &'_ mut self,
    entry_id: T,
    annotation: &'_ NewAnnotation
) -> ClientResult<Annotation>
[src]

Create a new annotation on an entry.

pub async fn delete_annotation<'_, T: Into<ID>>(
    &'_ mut self,
    id: T
) -> ClientResult<Annotation>
[src]

Delete an annotation by id

pub async fn get_annotations<'_, T: Into<ID>>(
    &'_ mut self,
    id: T
) -> ClientResult<Annotations>
[src]

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]

Get all entries, filtered by filter parameters.

pub async fn get_entries_page<'_, '_>(
    &'_ mut self,
    filter: &'_ EntriesFilter,
    page_number: u32
) -> ClientResult<EntriesPage>
[src]

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]

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]

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]

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]

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]

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]

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]

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]

Register a user and create a client.

Trait Implementations

impl Debug for Client[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.