[][src]Struct rememberthemilk::API

pub struct API { /* fields omitted */ }

The rememberthemilk API object. All rememberthemilk operations are done using methods on here.

Methods

impl API[src]

pub fn new(api_key: String, api_secret: String) -> API[src]

Create a new rememberthemilk API instance, with no user associated.

A user will need to authenticate; see API::start_auth.

The api_key and api_secret are for authenticating the application. They can be requested from rememberthemilk.

pub fn from_config(config: RTMConfig) -> API[src]

Create a new rememberthemilk API instance from saved configuration.

The configuration may or may not include a valid user authentication token. If not, then the next step is callnig API::start_auth.

The config will usually be generated from a previous session, where API::to_config was used to save the session state.

pub fn to_config(&self) -> RTMConfig[src]

Extract a copy of the rememberthemilk API state.

If a user has been authenticated in this session (or a previous one one and restored) then this will include a user authentication token as well as the API key and secret. This can be serialised and used next time avoiding having to go through the authentication procedure every time.

Note that this contains app and user secrets, so should not be stored anywhere where other users may be able to access.

pub async fn start_auth<'_>(&'_ self, perm: Perms) -> Result<AuthState, Error>[src]

Begin user authentication.

If this call is successful (which requires a valid API key and secret, and a successful interaction with the rememberthemilk API) then the returned AuthState contains a URL which a user should open (e.g. by a web view or separate web browser instance, redirect, etc. depending on the type of application).

After the user has logged in and authorised the application, you can use API::check_auth to verify that this was successful.

pub async fn check_auth<'_, '_>(
    &'_ mut self,
    auth: &'_ AuthState
) -> Result<bool, Error>
[src]

Check whether a user authentication attempt was successful.

This should be called after the user has had a chance to visit the URL returned by API::start_auth. It can be called multiple times to poll.

If authentication has been successful then a user auth token will be available (and retrievable using API::to_config) and true will be returned. Other API calls can be made.

pub async fn has_token<'_>(&'_ self, perm: Perms) -> Result<bool, Error>[src]

Check whether we have a valid user token with the provided permission level.

Returns true if so, false if none, and an error if the token is not valid (e.g. expired). API::start_auth will be needed if not successful to re-authenticate the user.

pub async fn get_all_tasks<'_>(&'_ self) -> Result<RTMTasks, Error>[src]

Retrieve a list of all tasks.

This may be a lot of tasks if the user has been using rememberthemilk for some time, and is usually not needed unless exporting or backing up the whole thing.

Requires a valid user authentication token.

pub async fn get_tasks_filtered<'_, '_>(
    &'_ self,
    filter: &'_ str
) -> Result<RTMTasks, Error>
[src]

Retrieve a filtered list of tasks.

The filter is a string in the format used by rememberthemilk, for example to retrieve tasks which have not yet been completed and are due today or in the past, you could use:

"status:incomplete AND (dueBefore:today OR due:today)"

Requires a valid user authentication token.

pub async fn get_lists<'_>(&'_ self) -> Result<Vec<RTMList>, Error>[src]

Request a list of rememberthemilk lists.

Requires a valid user authentication token.

pub async fn get_timeline<'_>(&'_ self) -> Result<RTMTimeline, Error>[src]

Request a fresh remember timeline.

A timeline is required for any request which modifies data on the server.

Requires a valid user authentication token.

pub async fn add_tag<'_, '_, '_, '_, '_, '_, '_>(
    &'_ self,
    timeline: &'_ RTMTimeline,
    list: &'_ RTMLists,
    taskseries: &'_ TaskSeries,
    task: &'_ Task,
    tags: &'_ [&'_ str]
) -> Result<(), Error>
[src]

Add one or more tags to a task.

  • timeline: a timeline as retrieved using API::get_timeline
  • list, taskseries and task identify the task to tag.
  • tags is a slice of tags to add to this task.

Requires a valid user authentication token.

pub async fn add_task<'_, '_, '_, '_, '_, '_>(
    &'_ self,
    timeline: &'_ RTMTimeline,
    name: &'_ str,
    list: Option<&'_ RTMLists>,
    parent: Option<&'_ Task>,
    external_id: Option<&'_ str>
) -> Result<(), Error>
[src]

Add a new task

  • timeline: a timeline as retrieved using API::get_timeline
  • name: the new task's name
  • list: the optional list into which the task should go
  • parent: If specified, the parent task for the new task (pro accounts only)
  • external_id: An id which can be attached to this task.

Requires a valid user authentication token.

Auto Trait Implementations

impl RefUnwindSafe for API

impl Send for API

impl Sync for API

impl Unpin for API

impl UnwindSafe for API

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.