nil-client 0.5.3

Multiplayer strategy game
Documentation
// Copyright (C) Call of Nil contributors
// SPDX-License-Identifier: AGPL-3.0-only

use super::Client;
use crate::error::Result;
use crate::http;
use nil_payload::request::chat::*;
use nil_payload::response::chat::*;

impl Client {
  pub async fn get_chat_history(
    &self,
    req: GetChatHistoryRequest,
  ) -> Result<GetChatHistoryResponse> {
    http::json_put("get-chat-history")
      .body(req)
      .server(self.server)
      .maybe_authorization(self.authorization.as_ref())
      .circuit_breaker(self.circuit_breaker())
      .retry(&self.retry)
      .user_agent(&self.user_agent)
      .send()
      .await
  }

  pub async fn push_chat_message(
    &self,
    req: PushChatMessageRequest,
  ) -> Result<PushChatMessageResponse> {
    http::json_post("push-chat-message")
      .body(req)
      .server(self.server)
      .maybe_authorization(self.authorization.as_ref())
      .circuit_breaker(self.circuit_breaker())
      .user_agent(&self.user_agent)
      .send()
      .await
  }
}