## e-book-async

e-book-async — Handles asynchronous interactions with the EBook.

## Synopsis

    void        (*EBookCallback)                (EBook *book,
                                                 EBookStatus status,
                                                 gpointer closure);
    void        (*EBookOpenProgressCallback)    (EBook *book,
                                                 const char *status_message,
                                                 short           percent,
                                                 gpointer closure);
    void        (*EBookIdCallback)              (EBook *book,
                                                 EBookStatus status,
                                                 const char *id,
                                                 gpointer closure);
    void        (*EBookContactCallback)         (EBook *book,
                                                 EBookStatus status,
                                                 EContact *contact,
                                                 gpointer closure);
    void        (*EBookBookViewCallback)        (EBook *book,
                                                 EBookStatus status,
                                                 EBookView *book_view,
                                                 gpointer closure);
    guint       e_book_async_get_supported_fields
                                                (EBook *book,
                                                 EBookEListCallback cb,
                                                 gpointer closure);
    guint       e_book_async_get_supported_auth_methods
                                                (EBook *book,
                                                 EBookEListCallback cb,
                                                 gpointer closure);
    guint       e_book_async_authenticate_user  (EBook *book,
                                                 const char *user,
                                                 const char *passwd,
                                                 const char *auth_method,
                                                 EBookCallback cb,
                                                 gpointer closure);
    guint       e_book_async_get_contact        (EBook *book,
                                                 const char *id,
                                                 EBookContactCallback cb,
                                                 gpointer closure);
    guint       e_book_async_get_contacts       (EBook *book,
                                                 EBookQuery *query,
                                                 EBookListCallback cb,
                                                 gpointer closure);
    guint       e_book_async_remove_contact     (EBook *book,
                                                 EContact *contact,
                                                 EBookCallback cb,
                                                 gpointer closure);
    guint       e_book_async_remove_contact_by_id
                                                (EBook *book,
                                                 const char *id,
                                                 EBookCallback cb,
                                                 gpointer closure);
    guint       e_book_async_remove_contacts    (EBook *book,
                                                 GList *id_list,
                                                 EBookCallback cb,
                                                 gpointer closure);
    gboolean    e_book_async_add_contact        (EBook *book,
                                                 EContact *contact,
                                                 EBookIdCallback cb,
                                                 gpointer closure);
    guint       e_book_async_commit_contact     (EBook *book,
                                                 EContact *contact,
                                                 EBookCallback cb,
                                                 gpointer closure);
    guint       e_book_async_get_book_view      (EBook *book,
                                                 EBookQuery *query,
                                                 GList *requested_fields,
                                                 int max_results,
                                                 EBookBookViewCallback cb,
                                                 gpointer closure);

## Description

## Details

### EBookCallback ()

    void        (*EBookCallback)                (EBook *book,
                                                 EBookStatus status,
                                                 gpointer closure);

`book` : |
`status` : |
`closure` : |

### EBookOpenProgressCallback ()

    void        (*EBookOpenProgressCallback)    (EBook *book,
                                                 const char *status_message,
                                                 short           percent,
                                                 gpointer closure);

`book` : |
`status_message` : |
`Param3` : |
`closure` : |

### EBookIdCallback ()

    void        (*EBookIdCallback)              (EBook *book,
                                                 EBookStatus status,
                                                 const char *id,
                                                 gpointer closure);

`book` : |
`status` : |
`id` : |
`closure` : |

### EBookContactCallback ()

    void        (*EBookContactCallback)         (EBook *book,
                                                 EBookStatus status,
                                                 EContact *contact,
                                                 gpointer closure);

`book` : |
`status` : |
`contact` : |
`closure` : |

### EBookBookViewCallback ()

    void        (*EBookBookViewCallback)        (EBook *book,
                                                 EBookStatus status,
                                                 EBookView *book_view,
                                                 gpointer closure);

`book` : |
`status` : |
`book_view` : |
`closure` : |

### e_book_async_get_supported_fields ()

    guint       e_book_async_get_supported_fields
                                                (EBook *book,
                                                 EBookEListCallback cb,
                                                 gpointer closure);

Gets a list of fields that can be stored for contacts in this `book`. Other fields may be discarded. This function does not block.

`book` : | an EBook
`cb` : | function to call when the operation finishes
`closure` : | data to pass to callback function
Returns : | `TRUE` if successful, `FALSE` otherwise.

### e_book_async_get_supported_auth_methods ()

    guint       e_book_async_get_supported_auth_methods
                                                (EBook *book,
                                                 EBookEListCallback cb,
                                                 gpointer closure);

Queries `book` for the list of authentication methods it supports. This function does not block.

`book` : | an EBook
`cb` : | function to call when the operation finishes
`closure` : | data to pass to callback function
Returns : | `TRUE` if successful, `FALSE` otherwise.

### e_book_async_authenticate_user ()

    guint       e_book_async_authenticate_user  (EBook *book,
                                                 const char *user,
                                                 const char *passwd,
                                                 const char *auth_method,
                                                 EBookCallback cb,
                                                 gpointer closure);

Authenticate `user` with `passwd`, using the auth method `auth_method`. `auth_method` must be one of the authentication methods returned using e_book_get_supported_auth_methods. This function does not block.

`book` : | an EBook
`user` : | user name
`passwd` : | password
`auth_method` : | string indicating authentication method
`cb` : | function to call when the operation finishes
`closure` : | data to pass to callback function
Returns : | `FALSE` if successful, `TRUE` otherwise.

### e_book_async_get_contact ()

    guint       e_book_async_get_contact        (EBook *book,
                                                 const char *id,
                                                 EBookContactCallback cb,
                                                 gpointer closure);

Retrieves a contact specified by `id` from `book`.

`book` : | an EBook
`id` : | a unique string ID specifying the contact
`cb` : | function to call when operation finishes
`closure` : | data to pass to callback function
Returns : | `FALSE` if successful, `TRUE` otherwise

### e_book_async_get_contacts ()

    guint       e_book_async_get_contacts       (EBook *book,
                                                 EBookQuery *query,
                                                 EBookListCallback cb,
                                                 gpointer closure);

Query `book` with `query`.

`book` : | an EBook
`query` : | an EBookQuery
`cb` : | a function to call when the operation finishes
`closure` : | data to pass to callback function
Returns : | `FALSE` on success, `TRUE` otherwise

### e_book_async_remove_contact ()

    guint       e_book_async_remove_contact     (EBook *book,
                                                 EContact *contact,
                                                 EBookCallback cb,
                                                 gpointer closure);

Removes `contact` from `book`.

`book` : | an EBook
`contact` : | an EContact
`cb` : | a function to call when the operation finishes
`closure` : | data to pass to callback function
Returns : | `TRUE` if successful, `FALSE` otherwise

### e_book_async_remove_contact_by_id ()

    guint       e_book_async_remove_contact_by_id
                                                (EBook *book,
                                                 const char *id,
                                                 EBookCallback cb,
                                                 gpointer closure);

Removes the contact with id `id` from `book`.

`book` : | an EBook
`id` : | a unique ID string specifying the contact
`cb` : | a function to call when the operation finishes
`closure` : | data to pass to callback function
Returns : | `TRUE` if successful, `FALSE` otherwise

### e_book_async_remove_contacts ()

    guint       e_book_async_remove_contacts    (EBook *book,
                                                 GList *id_list,
                                                 EBookCallback cb,
                                                 gpointer closure);

Removes the contacts with ids from the list `ids` from `book`. This is always more efficient than calling e_book_remove_contact_by_id if you have more than one id to remove, as some backends can implement it as a batch request.

`book` : | an EBook
`id_list` : |
`cb` : | a function to call when the operation finishes
`closure` : | data to pass to callback function
Returns : | `TRUE` if successful, `FALSE` otherwise

### e_book_async_add_contact ()

    gboolean    e_book_async_add_contact        (EBook *book,
                                                 EContact *contact,
                                                 EBookIdCallback cb,
                                                 gpointer closure);

Adds `contact` to `book` without blocking.

`book` : | an EBook
`contact` : | an EContact
`cb` : | function to call when the operation finishes
`closure` : | data to pass to callback function
Returns : | `TRUE` if the operation was started, `FALSE` otherwise.

### e_book_async_commit_contact ()

    guint       e_book_async_commit_contact     (EBook *book,
                                                 EContact *contact,
                                                 EBookCallback cb,
                                                 gpointer closure);

Applies the changes made to `contact` to the stored version in `book` without blocking.

`book` : | an EBook
`contact` : | an EContact
`cb` : | function to call when the operation finishes
`closure` : | data to pass to callback function
Returns : | `TRUE` if the operation was started, `FALSE` otherwise.

### e_book_async_get_book_view ()

    guint       e_book_async_get_book_view      (EBook *book,
                                                 EBookQuery *query,
                                                 GList *requested_fields,
                                                 int max_results,
                                                 EBookBookViewCallback cb,
                                                 gpointer closure);

Query `book` with `query`, creating a EBookView with the fields specified by `requested_fields` and limited at `max_results` records.

`book` : | an EBook
`query` : | an EBookQuery
`requested_fields` : | a GList containing the names of fields to return, or NULL for all
`max_results` : | the maximum number of contacts to show (or 0 for all)
`cb` : | a function to call when the operation finishes
`closure` : | data to pass to callback function
Returns : | `FALSE` if successful, `TRUE` otherwise