`get_user_by_id/2` | Makes a request to the remote `get_user_by_id` RPC. Returns `{:ok, response}` or `{:error, reason}` tuples.
`get_user_by_id!/2` | Same as above, but raises an exception if something goes wrong. The type of exception can be one of the exceptions defined in the service or `Thrift.TApplicationException`.
`get_user_by_id_with_options/3` | Allows you to pass `gen_tcp` and `GenServer` options to your client. This is useful for setting the `GenServer` timeout if you expect your RPC to take longer than the default of 5 seconds. Like `get_user_by_id/2`, this function returns `{:ok, response}` or `{:error, reason}` tuples.
`get_user_by_id_with_options!/3` | Allows you to pass `gen_tcp` and `GenServer` options and raises an exception if an error occurs.
**Note:** in the above example, the function `deleteUser` will be converted to `delete_user` to comply with Elixir's [naming conventions](http://elixir-lang.org/docs/stable/elixir/naming-conventions.html).
The client supports the following options, which are passed in as the
third argument to `start_link`:
Option name | Type | Description
-----------------|-------|-------------
`:tcp_opts` | keyword | A keyword list of tcp options (see below)
`:gen_server_opts` | keyword | A keyword list of options for the gen server (see below)
##### TCP Opts
Name | Type | Description
-----------------|------|---------------
`:timeout` | positive integer | The default timeout for reading from, writing to, and connecting to sockets.
`send_timeout` | positive integer | The amount of time in milliseconds to wait before sending data fails.
`backoff_calculator` | (int) -> int | A single argument function that takes the number of retries and returns the amount of time to wait in milliseconds before reconnecting. The default implementation waits 100, 100, 200, 300, 500, 800 and then 1000 ms. All retries after that will wait 1000ms.
##### GenServer Opts
Name | Type | Description
-----------------|------|---------------
`timeout` | A positive integer | The amount of time in milliseconds the Client's GenServer waits for a reply. After this, the GenServer will exit with `{:error, :timeout}`.
### Example of using options
```elixir
alias Thrift.Test.UserService.Clients.Binary.Framed, as: Client
...and your server is up and running. RPC calls to the server are delegated to UserServiceHandler.
Like the client, the server takes several options. They are:
Name | Type | Description
---------------|-------|-------------
`worker_count` | positive integer | The number of acceptor workers available to take requests
`name` | atom | (Optional) The name of the server. The server's pid becomes registered to this name. If not specified, the handler module's name is used.
`max_restarts` | non negative integer | The number of times to restart (see the next option)
`max_seconds` | non negative integer | The number of seconds. This is used by the supervisor to determine when to crash. If a server restarts `max_restarts` times in `max_seconds` then the supervisor crashes.
The server defines a Supervisor, which can be added to your application's supervision tree. When adding the server to your applications supervision tree, use the `supervisor` function rather than the `worker` function.
## Using the binary protocol directly
Each thrift struct, union and exception also has a `BinaryProtocol` module generated for
it. This module lets you serialize and deserialize its own type easily.
The return value of the `serialize` function is an [iodata]. You can pass it through `IO.iodata_to_binary` to convert it to a binary. You also can write the iodata directly to a file or socket without converting it.