Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cybrox/inwx-domrobot-elixir
Elixir GenServer implementation of the INWX DomRobot XML-RPC API
https://github.com/cybrox/inwx-domrobot-elixir
api client elixir inwx wrapper xml-rpc
Last synced: 15 days ago
JSON representation
Elixir GenServer implementation of the INWX DomRobot XML-RPC API
- Host: GitHub
- URL: https://github.com/cybrox/inwx-domrobot-elixir
- Owner: cybrox
- Created: 2017-03-17T12:07:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-25T11:12:18.000Z (over 4 years ago)
- Last Synced: 2024-10-20T08:52:51.142Z (25 days ago)
- Topics: api, client, elixir, inwx, wrapper, xml-rpc
- Language: Elixir
- Size: 37.1 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# InwxDomrobot
[INWX](https://www.inwx.com/en/) offers a complete JSON-RPC API. The DomRobot API allows you to manage accounts, domains, name servers and much more directly from your application. This package does not wrap all possible commands but instead handles authentication and local session persistence. With this, it provides a simple, consistent interface for executing any query command listed in the [INWX API specification](https://www.inwx.com/en/help/apidoc)## Installation
Install from [hex.pm](https://hex.pm/packages/inwx_domrobot)```elixir
def deps do
[{:inwx_domrobot, "~> 0.1.0"}]
end
```## Usage
```elixir
# Start a new linked process. Can also be used as supervisor child
# The `endpoint: ` option can be passed for using a custom API endpoint.
iex(1)> {:ok, conn} = InwxDomrobot.start_link([])
{:ok, PID<0.213.0>}# Send an "account.login" request to the connection
iex(2)> InwxDomrobot.login(conn, "username", "password")
{:ok, 1000}# Send arbitrary query commands to the connection
iex(3)> InwxDomrobot.query(conn, "account.info")
{:ok, %{"code" => 1000,
...
}}iex(4)> InwxDomrobot.query(conn, "account.update", %{ firstname: "Sven" })
{:ok, %{"code" => 1001,
...
}}}# Send an "account.logout" request to the connection
iex(5)> InwxDomrobot.logout(conn)
{:ok, 1500}
```### Two-Factor Authentication
This package supports the use of two-factor authentication by providing either the secret or a current TOTP value on login
```elixir
# Using TFA with secret
iex(1)> InwxDomrobot.login(conn, "username", "password", {:secret, "mySecret"})# Using TFA with current TOTP token
iex(1)> InwxDomrobot.login(conn, "username", "password", {:totp, "000000"})
```Special thanks to [@jgelens](https://github.com/jgelens) for adding TFA support.