GithubHelp home page GithubHelp logo

telix's Introduction

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

telix's People

Contributors

techgaun avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.