# `PhoenixGenApi.Structs.Request`
[🔗](https://github.com/ohhi-vn/phoenix_gen_api/blob/main/lib/phoenix_gen_api/structs/request.ex#L1)

Request struct for internal using, convert data map from websocket api.

Data from websocket api has payload like this:

```Elixir
%{
  "request_id" => "request_id",
  "request_type" => "request_type",
  "service" => "service",
  "user_id" => "user_id",
  "device_id" => "device_id",
  "args" => %{}
}
```

We need to convert it to struct for internal using.

Like this:

```Elixir
%PhoenixGenApi.Structs.Request{
  request_id: "request_id",
  request_type: "request_type",
  service: "service",
  user_id: "user_id",
  device_id: "device_id",
  args: %{}
}
```

Explain:
- user_id: string, user's id in system.
  User's id in system. It need to check permission.

- device_id: string, device id of current connection.
  Device id of current connection.

- request_type: string, request type.
  Request type. Using for identify function to call in system.

- request_id: string, unique id for request. Make by client.
  Unique id for request. Make by client. Using for identify response.

- service: string, service name.
  Service name. Using for identify service to call in system.

- args: map, field -> value, arguments for request.
  Arguments for request. Using for call function in system.

# `t`

```elixir
@type t() :: %PhoenixGenApi.Structs.Request{
  args: map(),
  device_id: String.t() | nil,
  request_id: String.t(),
  request_type: String.t(),
  service: String.t(),
  user_id: String.t() | nil,
  user_roles: [String.t()] | nil,
  version: String.t() | nil
}
```

Request struct for internal using, convert data map from websocket api.

# `decode!`

Create Request from params for convert data map from websocket api.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
