PhoenixGenApi.Structs.Request (PhoenixGenApi v0.0.13)

View Source

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

Data from websocket api has payload like this:

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

We need to convert it to struct for internal using.

Like this:

%PhoenixGenApi.Structs.Request{
  request_id: "request_id",
  request_type: "request_type",
  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.

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

Summary

Types

t()

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

Functions

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

Types

t()

@type t() :: %PhoenixGenApi.Structs.Request{
  args: map(),
  device_id: String.t(),
  request_id: String.t(),
  request_type: String.t(),
  user_id: String.t()
}

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

Functions

decode!(params)

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