EliVndb v0.2.0 EliVndb.Client
VNDB API Client Module.
EliVndb.Client
types
Global
In order to start global client use EliVndb.Client.start_link/1
or EliVndb.Client.start_link/3
without options or with :global
set to true.
Since the client registered globally, once client is started, all other API functions will become available.
As VNDB allows login only once, you need to re-create it anew in order to re-login.
You can use method EliVndb.Client.stop/0
to terminate currently running global client.
Local
In order to start local client use EliVndb.Client.start_link/1
or EliVndb.Client.start_link/3
with :global
set to false.
To use local client, you’ll need to provide its pid in all API calls.
NOTE: VNDB allows only up to 10 clients from the same API. Global client is preferable way to work with VNDB API.
Available commands
dbstats
Just retrieves statistics from VNDB.
get
Each get command requires to specify flags & filters.
Following default values are used by EliVndb:
flags = ["basic"]
filters = (id >= 1)
On success it returns
{:results, %{...}}
set
Each set command requires you to provide ID of modified object.
On success it returns {:ok, ${...}}
NOTE: For set commands successful response contains empty payload as of now. You might as well to ignore it.
Result
Each function that returns map will has keys as strings.
Summary
Functions
Retrieves VNDB stats using particular client
Performs GET command
Performs GET command with character type
Performs GET command with producer type
Performs GET command with release type
Performs GET command with staff type
Performs GET command with user type
Performs GET command with vn type
Performs GET command with vnlist type
Performs GET command with votelist
Performs GET command with wishlist type
Returns name of global client
Performs SET command
Performs SET command with votelist type
Performs SET command with votelist type
Performs SET command with votelist type
Starts VNDB API Client without authorization
Starts VNDB API Client with provided credentials
Stops global client
Stops particular client
Types
Functions
Retrieves VNDB stats using particular client.
Arguments:
pid
- Client identifier. Global is used as default.
On success returns: {:dbstats, map()}
Performs GET command.
Arguments:
options
- Keyword list of command options. See below.pid
- Client identifier. Global is used as default.
Options:
:type
- Command type. See VNDB API for possible values.:flags
- Command flags as array of strings. Possible values depends on:type
.:filters
- Command filters as string. Possible values depends on:type
.:options
- Command options as map. VNDB API allows following keys:page: integer
,results: integer
,sort: string
,reverse: boolean
Following default values are used by EliVndb:
flags = ["basic"]
filters = id >= 1
On success returns: {:results, map()}
Performs GET command with character type.
The same as EliVndb.Client.get/2
Performs GET command with producer type.
The same as EliVndb.Client.get/2
Performs GET command with release type.
The same as EliVndb.Client.get/2
Performs GET command with staff type.
The same as EliVndb.Client.get/2
Performs GET command with user type.
The same as EliVndb.Client.get/2
Performs GET command with vn type.
The same as EliVndb.Client.get/2
Performs GET command with vnlist type.
The same as EliVndb.Client.get/2
Performs GET command with votelist.
The same as EliVndb.Client.get/2
Performs GET command with wishlist type.
The same as EliVndb.Client.get/2
Performs SET command.
Arguments:
options
- Keyword list of command options. See below.pid
- Client identifier. Global is used as default.
Options:
:type
- Command type. See VNDB API for possible values.:id
- Identifier of object on which to perform SET.:fields
- Map of object’s field to its new value.
Performs SET command with votelist type.
The same as EliVndb.Client.set/2
Performs SET command with votelist type.
The same as EliVndb.Client.set/2
Performs SET command with votelist type.
The same as EliVndb.Client.set/2
Starts VNDB API Client without authorization.
Note that some VNDB APIs may require you to provide login/password.
Options:
:global
- whether to register client globally.
start_link(binary | nil, binary | nil, start_options) :: GenServer.on_start
Starts VNDB API Client with provided credentials.
Parameters:
user
- Username to use for login. To omit providenil
password
- Password to use for login. To omit providenil
Options:
:global
- whether to register client globally.
Stops particular client