package bookaml

  1. Overview
  2. Docs

Parameters

Signature

type 'a monad = 'a Httpgetter.Monad.t

It makes sense to wrap in a monadic system such as Lwt those functions that may take some time to complete. If that is the case, then any module that implements this signature should be declared as having module type Bookaml_amazon.ENGINE with type 'a monad = 'a Lwt.t. Nevertheless, for the sake of flexibility we do not actually mandate that Lwt be used, and hence why this abstract type 'a monad exists. It is in fact possible for the implementation to use no monad-based system at all, in which case the identity monad may be declared: Bookaml_amazon.ENGINE with type 'a monad = 'a.

val find_some_books : ?page:int -> credential:credential -> criteria -> (int * int * Bookaml_book.t list) monad

Finds some of the books that match the given search criteria. The result is a 3-tuple consisting of the total number of books matching the critera, the total number of result pages, and a list of books for the current page. Note that only one page of results (consisting of a maximum of 10 books) can be obtained per invocation of this function. By default, the first page of results is returned. If you wish to obtain a different result page, then set parameter page with the corresponding page number. If you wish to obtain all books from all result pages, then consult function find_all_books.

val find_all_books : credential:credential -> criteria -> Bookaml_book.t list monad

Finds all the books that match the given search criteria. Note that if the given search criteria are not particularly stringent, this function can easily return hundreds of results and require several independent requests to Amazon's servers. If you are only interested in the most relevant results, then function find_some_books is more appropriate.

val book_from_isbn : credential:credential -> Bookaml_isbn.t -> Bookaml_book.t option monad

Returns the book that matches the given ISBN. Note that it actually returns Some book if the book was retrievable and None otherwise.

val book_from_isbn_exn : credential:credential -> Bookaml_isbn.t -> Bookaml_book.t monad

Similar to book_from_isbn, but raises an exception if the book was not found or if an error occurred during the operation.

OCaml

Innovation. Community. Security.