Struct wallabag_api::Client[][src]

pub struct Client { /* fields omitted */ }
Expand description

The main thing that provides all the methods for interacting with the Wallabag API.

Implementations

Build a new client given the configuration.

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

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>

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>

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>

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>

Get an entry by id.

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

Delete an entry by id.

Update an annotation.

Create a new annotation on an entry.

Delete an annotation by id

Get all annotations for an entry (by id).

Get all entries.

Get all entries, filtered by filter parameters.

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>

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>

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>

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>

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.

Get a list of all tags.

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.

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.

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.

Get the API version. Probably not useful because if the version isn’t v2 then this library won’t work anyway.

Get the currently logged in user information.

Register a user and create a client.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more