Skip to main content

nil_client/client/infrastructure/
workshop.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use crate::client::Client;
5use crate::error::Result;
6use crate::http;
7use nil_core::infrastructure::building::workshop::recruit_catalog::WorkshopRecruitCatalog;
8use nil_payload::infrastructure::workshop::*;
9
10impl Client {
11  pub async fn add_workshop_recruit_order(
12    &self,
13    req: AddWorkshopRecruitOrderRequest,
14  ) -> Result<()> {
15    http::post("add-workshop-recruit-order")
16      .body(req)
17      .server(self.server)
18      .maybe_authorization(self.authorization.as_ref())
19      .user_agent(&self.user_agent)
20      .send()
21      .await
22  }
23
24  pub async fn cancel_workshop_recruit_order(
25    &self,
26    req: CancelWorkshopRecruitOrderRequest,
27  ) -> Result<()> {
28    http::post("cancel-workshop-recruit-order")
29      .body(req)
30      .server(self.server)
31      .maybe_authorization(self.authorization.as_ref())
32      .user_agent(&self.user_agent)
33      .send()
34      .await
35  }
36
37  pub async fn get_workshop_recruit_catalog(
38    &self,
39    req: GetWorkshopRecruitCatalogRequest,
40  ) -> Result<WorkshopRecruitCatalog> {
41    http::json_post("get-workshop-recruit-catalog")
42      .body(req)
43      .server(self.server)
44      .maybe_authorization(self.authorization.as_ref())
45      .user_agent(&self.user_agent)
46      .send()
47      .await
48  }
49}