Skip to content

techgaun/telix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telix

Hex version Hex downloads

Telit TR50 M2M Service Interface API Client For Elixir

Introduction

Telix is an API client that talks with M2M Service Interface API of Telit M2M Service using TR50 Message Format

Installation

Add the following line in your mix.exs:

defp deps do
  [
    {:telix, "~> 0.1"}
  ]
end

Configuration

Both username/password and app token based authentications are supported. You can pass authentication related parameters while creating Telit Client. You can also choose to create client by specifying appropriate configuration as below

With application authentication:

config :telix,
  auth: %{
    thingKey: "some-thing-key",
    appId: "telit-app-id",
    appToken: System.get_env("TELIT_TOKEN")
  }

With user authentication

config :telix,
  auth: %{
    username: "some-telit-user",
    password: System.get_env("TELIT_PASSWORD")
  }

Currently, the user authentication does not support MFA.

Usage

All the API calls are made by creating new Telit Client.

:config
Telix.Client.new
|> Telix.Client.login
|> Telix.CDP.Connection.health_summary
%{
  username: "some-telit-user",
  password: "some-password"
}
|> Telix.Client.new
|> Telix.Client.login
|> Telix.CDP.Connection.health_summary

While this library provides convenience modules to call certain commands, you can also manually perform any sort of commands. This is esp. useful for sending multiple commands

client = :config |> Telix.Client.new |> Telix.Client.login

# single command with custom params
Telix.Api.do_post build_payload("some.custom.command", %{"some" => "params"}), client

# custom command params
multi_cmd = %{
  "1" => %{
    "command" => "some.custom.command",
    "params" => %{"some" => "params"}
  },
  "2" => %{
    "command" => "another.custom.command",
    "params" => %{"some" => "params"}
  }
}
Telix.Api.do_post multi_cmd, client

Author

About

Telit TR50 M2M Service Interface API Client For Elixir

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages