tg_client v0.1.2 TgClient.Session

Worker for dealing with telegram-cli session.

Summary

Functions

Put confirmation code to stdio

Return current session status

Put password to stdio

Send request to TCP connection

Starts a session with phone

Types

state :: %TgClient.Session.State{phone: non_neg_integer | nil, port: non_neg_integer | nil, proc: %Porcelain.Process{err: term, out: term, pid: term} | nil, socket: port | nil, status: :init | :waiting_for_confirmation | :waiting_for_password | :connected}

Functions

confirm(phone, code)

Specs

confirm(non_neg_integer, non_neg_integer) :: atom

Put confirmation code to stdio

current_status(phone)

Specs

current_status(non_neg_integer) :: {:ok, atom}

Return current session status

put_password(phone, password)

Specs

put_password(non_neg_integer, non_neg_integer) :: atom

Put password to stdio

send_command(phone, command, params)

Specs

send_command(non_neg_integer, String.t, List.t) ::
  {:ok, String.t} |
  {:error, atom}

Send request to TCP connection

start_link(phone)

Specs

start_link(non_neg_integer) :: GenServer.on_start

Starts a session with phone