# Gateway

* Responsible for direct communication with the real world
* Must be configured as an interface
* It should only serve to communicate and never **business logic, domain logic, etc.**.

```csharp
public interface IHttpClientGateway
{
    // Return json object from server using newtonsoft json
    public UniTask<TResponse> RequestAsync<TRequest, TResponse>(string url, TRequest requestData);
}
```

```csharp
public class HttpClientGateway : IHttpClientGateway
{
    public async UniTask<TResponse> RequestAsync<TRequest, TResponse>(string url, TRequest requestData)
    {
        string jsonRequest = JsonConvert.SerializeObject(requestData); // 직렬화
        string jsonResponse = "{}"; // 서버에서 받은 JSON 응답
        await UniTask.Delay(1000); // 서버 통신 대신 1초 대기
        return JsonConvert.DeserializeObject<TResponse>(jsonResponse); // 역직렬화
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kwanjoong-dev.gitbook.io/unity-ui-storyboard/en/readme/undefined-1/ui/gateway.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
