Skip to main content

nil_ffi/
lib.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4#![feature(nonpoison_mutex, sync_nonpoison)]
5#![expect(clippy::missing_safety_doc)]
6
7mod client;
8mod json;
9mod macros;
10mod queue;
11mod request;
12mod response;
13mod runtime;
14mod server;
15mod status;
16
17use crate::runtime::RUNTIME;
18use crate::server::SERVER;
19use client::{CLIENT, on_event};
20use json::serialize;
21use std::ffi::{CString, c_char};
22use std::ptr;
23use tap::TryConv;
24
25pub use request::RequestId;
26pub use response::{Response, Result};
27pub use status::Status;
28
29///////////////////////////////
30//////////// FFI //////////////
31///////////////////////////////
32
33#[unsafe(no_mangle)]
34pub unsafe extern "C" fn nil_ffi_free_str(ptr: *mut c_char) {
35  if !ptr.is_null() {
36    drop(unsafe { CString::from_raw(ptr) });
37  }
38}
39
40#[unsafe(no_mangle)]
41pub unsafe extern "C" fn nil_ffi_poll(json_out: *mut *mut c_char) -> Status {
42  if json_out.is_null() {
43    return Status::ERR_NULL_POINTER;
44  }
45
46  unsafe { *json_out = ptr::null_mut() };
47
48  match queue::poll() {
49    Some(entry) => {
50      match serialize(&entry) {
51        Ok(json) => {
52          let json = CString::new(json).unwrap();
53          unsafe { *json_out = json.into_raw() };
54          Status::OK
55        }
56        Err(_) => Status::ERR_SERIALIZATION,
57      }
58    }
59    None => Status::ERR_NOTHING_TO_POLL,
60  }
61}
62
63#[unsafe(no_mangle)]
64pub unsafe extern "C" fn nil_ffi_shutdown() {
65  queue::clear();
66}
67
68#[unsafe(no_mangle)]
69pub unsafe extern "C" fn nil_ffi_version(request_id: RequestId) {
70  push_ok!(request_id, env!("CARGO_PKG_VERSION"));
71}
72
73///////////////////////////////
74//////////// SERVER ///////////
75///////////////////////////////
76
77#[unsafe(no_mangle)]
78pub unsafe extern "C" fn nil_is_host(request_id: RequestId) {
79  async_push_ok!(request_id, SERVER.read().await.is_some());
80}
81
82/// [`nil_server::local::start`]
83#[unsafe(no_mangle)]
84pub unsafe extern "C" fn nil_start_server(request_id: RequestId, json_options: *const c_char) {
85  let f = |options| {
86    RUNTIME.spawn(async move {
87      let result = server::start_with_options(options).await;
88      queue::push_result(request_id, Result::from(result));
89    });
90  };
91
92  unsafe { json::with_ptr(request_id, json_options, f) };
93}
94
95/// [`nil_server::local::load`]
96#[unsafe(no_mangle)]
97pub unsafe extern "C" fn nil_start_server_with_savedata(
98  request_id: RequestId,
99  json_path: *const c_char,
100) {
101  let f = |path| {
102    RUNTIME.spawn(async move {
103      let result = server::start_with_savedata(path).await;
104      queue::push_result(request_id, Result::from(result));
105    });
106  };
107
108  unsafe { json::with_ptr(request_id, json_path, f) };
109}
110
111/// [`LocalServer::stop`](nil_server::local::LocalServer::stop)
112#[unsafe(no_mangle)]
113pub unsafe extern "C" fn nil_stop_server(request_id: RequestId) {
114  RUNTIME.spawn(async move {
115    server::stop().await;
116    queue::push_ok(request_id, ());
117  });
118}
119
120///////////////////////////////
121//////////// CLIENT ///////////
122///////////////////////////////
123
124#[unsafe(no_mangle)]
125pub unsafe extern "C" fn nil_client_version(request_id: RequestId) {
126  push_ok!(request_id, nil_client::VERSION);
127}
128
129/// [`Client::is_local`](nil_client::Client::is_local)
130#[unsafe(no_mangle)]
131pub unsafe extern "C" fn nil_is_local(request_id: RequestId) {
132  async_push_ok!(request_id, CLIENT.read().await.is_local());
133}
134
135/// [`Client::is_ready`](nil_client::Client::is_ready)
136#[unsafe(no_mangle)]
137pub unsafe extern "C" fn nil_is_ready(request_id: RequestId) {
138  async_push_ok!(request_id, CLIENT.read().await.is_ready().await);
139}
140
141/// [`Client::is_remote`](nil_client::Client::is_remote)
142#[unsafe(no_mangle)]
143pub unsafe extern "C" fn nil_is_remote(request_id: RequestId) {
144  async_push_ok!(request_id, CLIENT.read().await.is_remote());
145}
146
147/// [`Client::server_addr`](nil_client::Client::server_addr)
148#[unsafe(no_mangle)]
149pub unsafe extern "C" fn nil_server_addr(request_id: RequestId) {
150  async_push_ok!(request_id, CLIENT.read().await.server_addr());
151}
152
153/// [`Client::set_user_agent`](nil_client::Client::set_user_agent)
154#[unsafe(no_mangle)]
155pub unsafe extern "C" fn nil_set_user_agent(request_id: RequestId, json_user_agent: *const c_char) {
156  let f = |user_agent: String| {
157    RUNTIME.spawn(async move {
158      CLIENT
159        .write()
160        .await
161        .set_user_agent(&user_agent);
162
163      queue::push_ok(request_id, ());
164    });
165  };
166
167  unsafe { json::with_ptr(request_id, json_user_agent, f) };
168}
169
170/// [`Client::stop`](nil_client::Client::stop)
171#[unsafe(no_mangle)]
172pub unsafe extern "C" fn nil_stop_client(request_id: RequestId) {
173  RUNTIME.spawn(async move {
174    CLIENT.write().await.stop().await;
175    queue::push_ok(request_id, ());
176  });
177}
178
179/// [`Client::update`](nil_client::Client::update)
180#[unsafe(no_mangle)]
181pub unsafe extern "C" fn nil_update_client(request_id: RequestId, json_options: *const c_char) {
182  let f = |options| {
183    RUNTIME.spawn(async move {
184      let result = CLIENT
185        .write()
186        .await
187        .update(options, Some(on_event()))
188        .await;
189
190      queue::push_result(request_id, Result::from(result));
191    });
192  };
193
194  unsafe { json::with_ptr(request_id, json_options, f) };
195}
196
197/// [`Client::user_agent`](nil_client::Client::user_agent)
198#[unsafe(no_mangle)]
199pub unsafe extern "C" fn nil_user_agent(request_id: RequestId) {
200  async_push_ok!(request_id, CLIENT.read().await.user_agent().to_owned());
201}
202
203/// [`Client::world`](nil_client::Client::world)
204#[unsafe(no_mangle)]
205pub unsafe extern "C" fn nil_world(request_id: RequestId) {
206  RUNTIME.spawn(async move {
207    match CLIENT.read().await.world() {
208      Some(world) => queue::push_ok(request_id, world),
209      None => queue::push_ok(request_id, None::<&str>),
210    }
211  });
212}
213
214///////////////////////////////
215/////////// RUNTIME ///////////
216///////////////////////////////
217
218/// [`RuntimeMetrics::global_queue_depth`](tokio::runtime::RuntimeMetrics::global_queue_depth)
219#[unsafe(no_mangle)]
220pub unsafe extern "C" fn nil_runtime_global_queue_depth(request_id: RequestId) {
221  push_result!(
222    request_id,
223    RUNTIME
224      .metrics()
225      .global_queue_depth()
226      .try_conv::<u32>()
227  );
228}
229
230/// [`RuntimeMetrics::num_alive_tasks`](tokio::runtime::RuntimeMetrics::num_alive_tasks)
231#[unsafe(no_mangle)]
232pub unsafe extern "C" fn nil_runtime_num_alive_tasks(request_id: RequestId) {
233  push_result!(
234    request_id,
235    RUNTIME
236      .metrics()
237      .num_alive_tasks()
238      .try_conv::<u32>()
239  );
240}
241
242/// [`RuntimeMetrics::num_workers`](tokio::runtime::RuntimeMetrics::num_workers)
243#[unsafe(no_mangle)]
244pub unsafe extern "C" fn nil_runtime_num_workers(request_id: RequestId) {
245  push_result!(
246    request_id,
247    RUNTIME
248      .metrics()
249      .num_workers()
250      .try_conv::<u32>()
251  );
252}
253
254///////////////////////////////
255////////// ENDPOINTS //////////
256///////////////////////////////
257
258/// [`Client::add_academy_recruit_order`](nil_client::Client::add_academy_recruit_order)
259#[unsafe(no_mangle)]
260pub unsafe extern "C" fn nil_add_academy_recruit_order(
261  request_id: RequestId,
262  json_req: *const c_char,
263) {
264  send!(request_id, add_academy_recruit_order, json_req);
265}
266
267/// [`Client::add_prefecture_build_order`](nil_client::Client::add_prefecture_build_order)
268#[unsafe(no_mangle)]
269pub unsafe extern "C" fn nil_add_prefecture_build_order(
270  request_id: RequestId,
271  json_req: *const c_char,
272) {
273  send!(request_id, add_prefecture_build_order, json_req);
274}
275
276/// [`Client::add_stable_recruit_order`](nil_client::Client::add_stable_recruit_order)
277#[unsafe(no_mangle)]
278pub unsafe extern "C" fn nil_add_stable_recruit_order(
279  request_id: RequestId,
280  json_req: *const c_char,
281) {
282  send!(request_id, add_stable_recruit_order, json_req);
283}
284
285/// [`Client::add_workshop_recruit_order`](nil_client::Client::add_workshop_recruit_order)
286#[unsafe(no_mangle)]
287pub unsafe extern "C" fn nil_add_workshop_recruit_order(
288  request_id: RequestId,
289  json_req: *const c_char,
290) {
291  send!(request_id, add_workshop_recruit_order, json_req);
292}
293
294/// [`Client::authorize`](nil_client::Client::authorize)
295#[unsafe(no_mangle)]
296pub unsafe extern "C" fn nil_authorize(request_id: RequestId, json_req: *const c_char) {
297  send!(request_id, authorize, json_req);
298}
299
300/// [`Client::buy_resources`](nil_client::Client::buy_resources)
301#[unsafe(no_mangle)]
302pub unsafe extern "C" fn nil_buy_resources(request_id: RequestId, json_req: *const c_char) {
303  send!(request_id, buy_resources, json_req);
304}
305
306/// [`Client::cancel_academy_recruit_order`](nil_client::Client::cancel_academy_recruit_order)
307#[unsafe(no_mangle)]
308pub unsafe extern "C" fn nil_cancel_academy_recruit_order(
309  request_id: RequestId,
310  json_req: *const c_char,
311) {
312  send!(request_id, cancel_academy_recruit_order, json_req);
313}
314
315/// [`Client::cancel_maneuver`](nil_client::Client::cancel_maneuver)
316#[unsafe(no_mangle)]
317pub unsafe extern "C" fn nil_cancel_maneuver(request_id: RequestId, json_req: *const c_char) {
318  send!(request_id, cancel_maneuver, json_req);
319}
320
321/// [`Client::cancel_prefecture_build_order`](nil_client::Client::cancel_prefecture_build_order)
322#[unsafe(no_mangle)]
323pub unsafe extern "C" fn nil_cancel_prefecture_build_order(
324  request_id: RequestId,
325  json_req: *const c_char,
326) {
327  send!(request_id, cancel_prefecture_build_order, json_req);
328}
329
330/// [`Client::cancel_stable_recruit_order`](nil_client::Client::cancel_stable_recruit_order)
331#[unsafe(no_mangle)]
332pub unsafe extern "C" fn nil_cancel_stable_recruit_order(
333  request_id: RequestId,
334  json_req: *const c_char,
335) {
336  send!(request_id, cancel_stable_recruit_order, json_req);
337}
338
339/// [`Client::cancel_workshop_recruit_order`](nil_client::Client::cancel_workshop_recruit_order)
340#[unsafe(no_mangle)]
341pub unsafe extern "C" fn nil_cancel_workshop_recruit_order(
342  request_id: RequestId,
343  json_req: *const c_char,
344) {
345  send!(request_id, cancel_workshop_recruit_order, json_req);
346}
347
348/// [`Client::cheat_fill_world`](nil_client::Client::cheat_fill_world)
349#[unsafe(no_mangle)]
350pub unsafe extern "C" fn nil_cheat_fill_world(request_id: RequestId, json_req: *const c_char) {
351  send!(request_id, cheat_fill_world, json_req);
352}
353
354/// [`Client::cheat_get_academy_recruit_queue`](nil_client::Client::cheat_get_academy_recruit_queue)
355#[unsafe(no_mangle)]
356pub unsafe extern "C" fn nil_cheat_get_academy_recruit_queue(
357  request_id: RequestId,
358  json_req: *const c_char,
359) {
360  send!(request_id, cheat_get_academy_recruit_queue, json_req);
361}
362
363/// [`Client::cheat_get_academy_recruit_queues`](nil_client::Client::cheat_get_academy_recruit_queues)
364#[unsafe(no_mangle)]
365pub unsafe extern "C" fn nil_cheat_get_academy_recruit_queues(
366  request_id: RequestId,
367  json_req: *const c_char,
368) {
369  send!(request_id, cheat_get_academy_recruit_queues, json_req);
370}
371
372/// [`Client::cheat_get_all_academy_recruit_queues`](nil_client::Client::cheat_get_all_academy_recruit_queues)
373#[unsafe(no_mangle)]
374pub unsafe extern "C" fn nil_cheat_get_all_academy_recruit_queues(
375  request_id: RequestId,
376  json_req: *const c_char,
377) {
378  send!(request_id, cheat_get_all_academy_recruit_queues, json_req);
379}
380
381/// [`Client::cheat_get_all_prefecture_build_queues`](nil_client::Client::cheat_get_all_prefecture_build_queues)
382#[unsafe(no_mangle)]
383pub unsafe extern "C" fn nil_cheat_get_all_prefecture_build_queues(
384  request_id: RequestId,
385  json_req: *const c_char,
386) {
387  send!(request_id, cheat_get_all_prefecture_build_queues, json_req);
388}
389
390/// [`Client::cheat_get_all_stable_recruit_queues`](nil_client::Client::cheat_get_all_stable_recruit_queues)
391#[unsafe(no_mangle)]
392pub unsafe extern "C" fn nil_cheat_get_all_stable_recruit_queues(
393  request_id: RequestId,
394  json_req: *const c_char,
395) {
396  send!(request_id, cheat_get_all_stable_recruit_queues, json_req);
397}
398
399/// [`Client::cheat_get_build_steps`](nil_client::Client::cheat_get_build_steps)
400#[unsafe(no_mangle)]
401pub unsafe extern "C" fn nil_cheat_get_build_steps(request_id: RequestId, json_req: *const c_char) {
402  send!(request_id, cheat_get_build_steps, json_req);
403}
404
405/// [`Client::cheat_get_cities`](nil_client::Client::cheat_get_cities)
406#[unsafe(no_mangle)]
407pub unsafe extern "C" fn nil_cheat_get_cities(request_id: RequestId, json_req: *const c_char) {
408  send!(request_id, cheat_get_cities, json_req);
409}
410
411/// [`Client::cheat_get_city`](nil_client::Client::cheat_get_city)
412#[unsafe(no_mangle)]
413pub unsafe extern "C" fn nil_cheat_get_city(request_id: RequestId, json_req: *const c_char) {
414  send!(request_id, cheat_get_city, json_req);
415}
416
417/// [`Client::cheat_get_ethics`](nil_client::Client::cheat_get_ethics)
418#[unsafe(no_mangle)]
419pub unsafe extern "C" fn nil_cheat_get_ethics(request_id: RequestId, json_req: *const c_char) {
420  send!(request_id, cheat_get_ethics, json_req);
421}
422
423/// [`Client::cheat_get_idle_armies_at`](nil_client::Client::cheat_get_idle_armies_at)
424#[unsafe(no_mangle)]
425pub unsafe extern "C" fn nil_cheat_get_idle_armies_at(
426  request_id: RequestId,
427  json_req: *const c_char,
428) {
429  send!(request_id, cheat_get_idle_armies_at, json_req);
430}
431
432/// [`Client::cheat_get_idle_personnel_at`](nil_client::Client::cheat_get_idle_personnel_at)
433#[unsafe(no_mangle)]
434pub unsafe extern "C" fn nil_cheat_get_idle_personnel_at(
435  request_id: RequestId,
436  json_req: *const c_char,
437) {
438  send!(request_id, cheat_get_idle_personnel_at, json_req);
439}
440
441/// [`Client::cheat_get_influence`](nil_client::Client::cheat_get_influence)
442#[unsafe(no_mangle)]
443pub unsafe extern "C" fn nil_cheat_get_influence(request_id: RequestId, json_req: *const c_char) {
444  send!(request_id, cheat_get_influence, json_req);
445}
446
447/// [`Client::cheat_get_infrastructure`](nil_client::Client::cheat_get_infrastructure)
448#[unsafe(no_mangle)]
449pub unsafe extern "C" fn nil_cheat_get_infrastructure(
450  request_id: RequestId,
451  json_req: *const c_char,
452) {
453  send!(request_id, cheat_get_infrastructure, json_req);
454}
455
456/// [`Client::cheat_get_maneuvers`](nil_client::Client::cheat_get_maneuvers)
457#[unsafe(no_mangle)]
458pub unsafe extern "C" fn nil_cheat_get_maneuvers(request_id: RequestId, json_req: *const c_char) {
459  send!(request_id, cheat_get_maneuvers, json_req);
460}
461
462/// [`Client::cheat_get_maneuvers_of`](nil_client::Client::cheat_get_maneuvers_of)
463#[unsafe(no_mangle)]
464pub unsafe extern "C" fn nil_cheat_get_maneuvers_of(
465  request_id: RequestId,
466  json_req: *const c_char,
467) {
468  send!(request_id, cheat_get_maneuvers_of, json_req);
469}
470
471/// [`Client::cheat_get_player`](nil_client::Client::cheat_get_player)
472#[unsafe(no_mangle)]
473pub unsafe extern "C" fn nil_cheat_get_player(request_id: RequestId, json_req: *const c_char) {
474  send!(request_id, cheat_get_player, json_req);
475}
476
477/// [`Client::cheat_get_players`](nil_client::Client::cheat_get_players)
478#[unsafe(no_mangle)]
479pub unsafe extern "C" fn nil_cheat_get_players(request_id: RequestId, json_req: *const c_char) {
480  send!(request_id, cheat_get_players, json_req);
481}
482
483/// [`Client::cheat_get_prefecture_build_queue`](nil_client::Client::cheat_get_prefecture_build_queue)
484#[unsafe(no_mangle)]
485pub unsafe extern "C" fn nil_cheat_get_prefecture_build_queue(
486  request_id: RequestId,
487  json_req: *const c_char,
488) {
489  send!(request_id, cheat_get_prefecture_build_queue, json_req);
490}
491
492/// [`Client::cheat_get_prefecture_build_queues`](nil_client::Client::cheat_get_prefecture_build_queues)
493#[unsafe(no_mangle)]
494pub unsafe extern "C" fn nil_cheat_get_prefecture_build_queues(
495  request_id: RequestId,
496  json_req: *const c_char,
497) {
498  send!(request_id, cheat_get_prefecture_build_queues, json_req);
499}
500
501/// [`Client::cheat_get_resources`](nil_client::Client::cheat_get_resources)
502#[unsafe(no_mangle)]
503pub unsafe extern "C" fn nil_cheat_get_resources(request_id: RequestId, json_req: *const c_char) {
504  send!(request_id, cheat_get_resources, json_req);
505}
506
507/// [`Client::cheat_get_stable_recruit_queue`](nil_client::Client::cheat_get_stable_recruit_queue)
508#[unsafe(no_mangle)]
509pub unsafe extern "C" fn nil_cheat_get_stable_recruit_queue(
510  request_id: RequestId,
511  json_req: *const c_char,
512) {
513  send!(request_id, cheat_get_stable_recruit_queue, json_req);
514}
515
516/// [`Client::cheat_get_stable_recruit_queues`](nil_client::Client::cheat_get_stable_recruit_queues)
517#[unsafe(no_mangle)]
518pub unsafe extern "C" fn nil_cheat_get_stable_recruit_queues(
519  request_id: RequestId,
520  json_req: *const c_char,
521) {
522  send!(request_id, cheat_get_stable_recruit_queues, json_req);
523}
524
525/// [`Client::cheat_get_storage_capacity`](nil_client::Client::cheat_get_storage_capacity)
526#[unsafe(no_mangle)]
527pub unsafe extern "C" fn nil_cheat_get_storage_capacity(
528  request_id: RequestId,
529  json_req: *const c_char,
530) {
531  send!(request_id, cheat_get_storage_capacity, json_req);
532}
533
534/// [`Client::cheat_set_bot_ethics`](nil_client::Client::cheat_set_bot_ethics)
535#[unsafe(no_mangle)]
536pub unsafe extern "C" fn nil_cheat_set_bot_ethics(request_id: RequestId, json_req: *const c_char) {
537  send!(request_id, cheat_set_bot_ethics, json_req);
538}
539
540/// [`Client::cheat_set_building_level`](nil_client::Client::cheat_set_building_level)
541#[unsafe(no_mangle)]
542pub unsafe extern "C" fn nil_cheat_set_building_level(
543  request_id: RequestId,
544  json_req: *const c_char,
545) {
546  send!(request_id, cheat_set_building_level, json_req);
547}
548
549/// [`Client::cheat_set_food`](nil_client::Client::cheat_set_food)
550#[unsafe(no_mangle)]
551pub unsafe extern "C" fn nil_cheat_set_food(request_id: RequestId, json_req: *const c_char) {
552  send!(request_id, cheat_set_food, json_req);
553}
554
555/// [`Client::cheat_set_influence`](nil_client::Client::cheat_set_influence)
556#[unsafe(no_mangle)]
557pub unsafe extern "C" fn nil_cheat_set_influence(request_id: RequestId, json_req: *const c_char) {
558  send!(request_id, cheat_set_influence, json_req);
559}
560
561/// [`Client::cheat_set_iron`](nil_client::Client::cheat_set_iron)
562#[unsafe(no_mangle)]
563pub unsafe extern "C" fn nil_cheat_set_iron(request_id: RequestId, json_req: *const c_char) {
564  send!(request_id, cheat_set_iron, json_req);
565}
566
567/// [`Client::cheat_set_market_fee`](nil_client::Client::cheat_set_market_fee)
568#[unsafe(no_mangle)]
569pub unsafe extern "C" fn nil_cheat_set_market_fee(request_id: RequestId, json_req: *const c_char) {
570  send!(request_id, cheat_set_market_fee, json_req);
571}
572
573/// [`Client::cheat_set_market_vault_resources`](nil_client::Client::cheat_set_market_vault_resources)
574#[unsafe(no_mangle)]
575pub unsafe extern "C" fn nil_cheat_set_market_vault_resources(
576  request_id: RequestId,
577  json_req: *const c_char,
578) {
579  send!(request_id, cheat_set_market_vault_resources, json_req);
580}
581
582/// [`Client::cheat_set_max_food`](nil_client::Client::cheat_set_max_food)
583#[unsafe(no_mangle)]
584pub unsafe extern "C" fn nil_cheat_set_max_food(request_id: RequestId, json_req: *const c_char) {
585  send!(request_id, cheat_set_max_food, json_req);
586}
587
588/// [`Client::cheat_set_max_infrastructure`](nil_client::Client::cheat_set_max_infrastructure)
589#[unsafe(no_mangle)]
590pub unsafe extern "C" fn nil_cheat_set_max_infrastructure(
591  request_id: RequestId,
592  json_req: *const c_char,
593) {
594  send!(request_id, cheat_set_max_infrastructure, json_req);
595}
596
597/// [`Client::cheat_set_max_iron`](nil_client::Client::cheat_set_max_iron)
598#[unsafe(no_mangle)]
599pub unsafe extern "C" fn nil_cheat_set_max_iron(request_id: RequestId, json_req: *const c_char) {
600  send!(request_id, cheat_set_max_iron, json_req);
601}
602
603/// [`Client::cheat_set_max_resources`](nil_client::Client::cheat_set_max_resources)
604#[unsafe(no_mangle)]
605pub unsafe extern "C" fn nil_cheat_set_max_resources(
606  request_id: RequestId,
607  json_req: *const c_char,
608) {
609  send!(request_id, cheat_set_max_resources, json_req);
610}
611
612/// [`Client::cheat_set_max_silo_resources`](nil_client::Client::cheat_set_max_silo_resources)
613#[unsafe(no_mangle)]
614pub unsafe extern "C" fn nil_cheat_set_max_silo_resources(
615  request_id: RequestId,
616  json_req: *const c_char,
617) {
618  send!(request_id, cheat_set_max_silo_resources, json_req);
619}
620
621/// [`Client::cheat_set_max_stone`](nil_client::Client::cheat_set_max_stone)
622#[unsafe(no_mangle)]
623pub unsafe extern "C" fn nil_cheat_set_max_stone(request_id: RequestId, json_req: *const c_char) {
624  send!(request_id, cheat_set_max_stone, json_req);
625}
626
627/// [`Client::cheat_set_max_warehouse_resources`](nil_client::Client::cheat_set_max_warehouse_resources)
628#[unsafe(no_mangle)]
629pub unsafe extern "C" fn nil_cheat_set_max_warehouse_resources(
630  request_id: RequestId,
631  json_req: *const c_char,
632) {
633  send!(request_id, cheat_set_max_warehouse_resources, json_req);
634}
635
636/// [`Client::cheat_set_max_wood`](nil_client::Client::cheat_set_max_wood)
637#[unsafe(no_mangle)]
638pub unsafe extern "C" fn nil_cheat_set_max_wood(request_id: RequestId, json_req: *const c_char) {
639  send!(request_id, cheat_set_max_wood, json_req);
640}
641
642/// [`Client::cheat_set_resources`](nil_client::Client::cheat_set_resources)
643#[unsafe(no_mangle)]
644pub unsafe extern "C" fn nil_cheat_set_resources(request_id: RequestId, json_req: *const c_char) {
645  send!(request_id, cheat_set_resources, json_req);
646}
647
648/// [`Client::cheat_set_stability`](nil_client::Client::cheat_set_stability)
649#[unsafe(no_mangle)]
650pub unsafe extern "C" fn nil_cheat_set_stability(request_id: RequestId, json_req: *const c_char) {
651  send!(request_id, cheat_set_stability, json_req);
652}
653
654/// [`Client::cheat_set_stone`](nil_client::Client::cheat_set_stone)
655#[unsafe(no_mangle)]
656pub unsafe extern "C" fn nil_cheat_set_stone(request_id: RequestId, json_req: *const c_char) {
657  send!(request_id, cheat_set_stone, json_req);
658}
659
660/// [`Client::cheat_set_wood`](nil_client::Client::cheat_set_wood)
661#[unsafe(no_mangle)]
662pub unsafe extern "C" fn nil_cheat_set_wood(request_id: RequestId, json_req: *const c_char) {
663  send!(request_id, cheat_set_wood, json_req);
664}
665
666/// [`Client::cheat_skip_round`](nil_client::Client::cheat_skip_round)
667#[unsafe(no_mangle)]
668pub unsafe extern "C" fn nil_cheat_skip_round(request_id: RequestId, json_req: *const c_char) {
669  send!(request_id, cheat_skip_round, json_req);
670}
671
672/// [`Client::cheat_spawn_bot`](nil_client::Client::cheat_spawn_bot)
673#[unsafe(no_mangle)]
674pub unsafe extern "C" fn nil_cheat_spawn_bot(request_id: RequestId, json_req: *const c_char) {
675  send!(request_id, cheat_spawn_bot, json_req);
676}
677
678/// [`Client::cheat_spawn_city`](nil_client::Client::cheat_spawn_city)
679#[unsafe(no_mangle)]
680pub unsafe extern "C" fn nil_cheat_spawn_city(request_id: RequestId, json_req: *const c_char) {
681  send!(request_id, cheat_spawn_city, json_req);
682}
683
684/// [`Client::cheat_spawn_personnel`](nil_client::Client::cheat_spawn_personnel)
685#[unsafe(no_mangle)]
686pub unsafe extern "C" fn nil_cheat_spawn_personnel(request_id: RequestId, json_req: *const c_char) {
687  send!(request_id, cheat_spawn_personnel, json_req);
688}
689
690/// [`Client::create_remote_world`](nil_client::Client::create_remote_world)
691#[unsafe(no_mangle)]
692pub unsafe extern "C" fn nil_create_remote_world(request_id: RequestId, json_req: *const c_char) {
693  send!(request_id, create_remote_world, json_req);
694}
695
696/// [`Client::create_user`](nil_client::Client::create_user)
697#[unsafe(no_mangle)]
698pub unsafe extern "C" fn nil_create_user(request_id: RequestId, json_req: *const c_char) {
699  send!(request_id, create_user, json_req);
700}
701
702/// [`Client::delete_remote_world`](nil_client::Client::delete_remote_world)
703#[unsafe(no_mangle)]
704pub unsafe extern "C" fn nil_delete_remote_world(request_id: RequestId, json_req: *const c_char) {
705  send!(request_id, delete_remote_world, json_req);
706}
707
708/// [`Client::forward_report`](nil_client::Client::forward_report)
709#[unsafe(no_mangle)]
710pub unsafe extern "C" fn nil_forward_report(request_id: RequestId, json_req: *const c_char) {
711  send!(request_id, forward_report, json_req);
712}
713
714/// [`Client::get_academy_recruit_catalog`](nil_client::Client::get_academy_recruit_catalog)
715#[unsafe(no_mangle)]
716pub unsafe extern "C" fn nil_get_academy_recruit_catalog(
717  request_id: RequestId,
718  json_req: *const c_char,
719) {
720  send!(request_id, get_academy_recruit_catalog, json_req);
721}
722
723/// [`Client::get_armies`](nil_client::Client::get_armies)
724#[unsafe(no_mangle)]
725pub unsafe extern "C" fn nil_get_armies(request_id: RequestId, json_req: *const c_char) {
726  send!(request_id, get_armies, json_req);
727}
728
729/// [`Client::get_army`](nil_client::Client::get_army)
730#[unsafe(no_mangle)]
731pub unsafe extern "C" fn nil_get_army(request_id: RequestId, json_req: *const c_char) {
732  send!(request_id, get_army, json_req);
733}
734
735/// [`Client::get_army_owner`](nil_client::Client::get_army_owner)
736#[unsafe(no_mangle)]
737pub unsafe extern "C" fn nil_get_army_owner(request_id: RequestId, json_req: *const c_char) {
738  send!(request_id, get_army_owner, json_req);
739}
740
741/// [`Client::get_bot_coords`](nil_client::Client::get_bot_coords)
742#[unsafe(no_mangle)]
743pub unsafe extern "C" fn nil_get_bot_coords(request_id: RequestId, json_req: *const c_char) {
744  send!(request_id, get_bot_coords, json_req);
745}
746
747/// [`Client::get_chat_history`](nil_client::Client::get_chat_history)
748#[unsafe(no_mangle)]
749pub unsafe extern "C" fn nil_get_chat_history(request_id: RequestId, json_req: *const c_char) {
750  send!(request_id, get_chat_history, json_req);
751}
752
753/// [`Client::get_cities`](nil_client::Client::get_cities)
754#[unsafe(no_mangle)]
755pub unsafe extern "C" fn nil_get_cities(request_id: RequestId, json_req: *const c_char) {
756  send!(request_id, get_cities, json_req);
757}
758
759/// [`Client::get_city`](nil_client::Client::get_city)
760#[unsafe(no_mangle)]
761pub unsafe extern "C" fn nil_get_city(request_id: RequestId, json_req: *const c_char) {
762  send!(request_id, get_city, json_req);
763}
764
765/// [`Client::get_city_limit`](nil_client::Client::get_city_limit)
766#[unsafe(no_mangle)]
767pub unsafe extern "C" fn nil_get_city_limit(request_id: RequestId, json_req: *const c_char) {
768  send!(request_id, get_city_limit, json_req);
769}
770
771/// [`Client::get_city_score`](nil_client::Client::get_city_score)
772#[unsafe(no_mangle)]
773pub unsafe extern "C" fn nil_get_city_score(request_id: RequestId, json_req: *const c_char) {
774  send!(request_id, get_city_score, json_req);
775}
776
777/// [`Client::get_continent_size`](nil_client::Client::get_continent_size)
778#[unsafe(no_mangle)]
779pub unsafe extern "C" fn nil_get_continent_size(request_id: RequestId, json_req: *const c_char) {
780  send!(request_id, get_continent_size, json_req);
781}
782
783/// [`Client::get_idle_armies_at`](nil_client::Client::get_idle_armies_at)
784#[unsafe(no_mangle)]
785pub unsafe extern "C" fn nil_get_idle_armies_at(request_id: RequestId, json_req: *const c_char) {
786  send!(request_id, get_idle_armies_at, json_req);
787}
788
789/// [`Client::get_idle_armies_coords`](nil_client::Client::get_idle_armies_coords)
790#[unsafe(no_mangle)]
791pub unsafe extern "C" fn nil_get_idle_armies_coords(
792  request_id: RequestId,
793  json_req: *const c_char,
794) {
795  send!(request_id, get_idle_armies_coords, json_req);
796}
797
798/// [`Client::get_maneuver`](nil_client::Client::get_maneuver)
799#[unsafe(no_mangle)]
800pub unsafe extern "C" fn nil_get_maneuver(request_id: RequestId, json_req: *const c_char) {
801  send!(request_id, get_maneuver, json_req);
802}
803
804/// [`Client::get_market`](nil_client::Client::get_market)
805#[unsafe(no_mangle)]
806pub unsafe extern "C" fn nil_get_market(request_id: RequestId, json_req: *const c_char) {
807  send!(request_id, get_market, json_req);
808}
809
810/// [`Client::get_market_fee`](nil_client::Client::get_market_fee)
811#[unsafe(no_mangle)]
812pub unsafe extern "C" fn nil_get_market_fee(request_id: RequestId, json_req: *const c_char) {
813  send!(request_id, get_market_fee, json_req);
814}
815
816/// [`Client::get_player`](nil_client::Client::get_player)
817#[unsafe(no_mangle)]
818pub unsafe extern "C" fn nil_get_player(request_id: RequestId, json_req: *const c_char) {
819  send!(request_id, get_player, json_req);
820}
821
822/// [`Client::get_player_coords`](nil_client::Client::get_player_coords)
823#[unsafe(no_mangle)]
824pub unsafe extern "C" fn nil_get_player_coords(request_id: RequestId, json_req: *const c_char) {
825  send!(request_id, get_player_coords, json_req);
826}
827
828/// [`Client::get_player_ids`](nil_client::Client::get_player_ids)
829#[unsafe(no_mangle)]
830pub unsafe extern "C" fn nil_get_player_ids(request_id: RequestId, json_req: *const c_char) {
831  send!(request_id, get_player_ids, json_req);
832}
833
834/// [`Client::get_player_maintenance`](nil_client::Client::get_player_maintenance)
835#[unsafe(no_mangle)]
836pub unsafe extern "C" fn nil_get_player_maintenance(
837  request_id: RequestId,
838  json_req: *const c_char,
839) {
840  send!(request_id, get_player_maintenance, json_req);
841}
842
843/// [`Client::get_player_military`](nil_client::Client::get_player_military)
844#[unsafe(no_mangle)]
845pub unsafe extern "C" fn nil_get_player_military(request_id: RequestId, json_req: *const c_char) {
846  send!(request_id, get_player_military, json_req);
847}
848
849/// [`Client::get_player_status`](nil_client::Client::get_player_status)
850#[unsafe(no_mangle)]
851pub unsafe extern "C" fn nil_get_player_status(request_id: RequestId, json_req: *const c_char) {
852  send!(request_id, get_player_status, json_req);
853}
854
855/// [`Client::get_player_storage_capacity`](nil_client::Client::get_player_storage_capacity)
856#[unsafe(no_mangle)]
857pub unsafe extern "C" fn nil_get_player_storage_capacity(
858  request_id: RequestId,
859  json_req: *const c_char,
860) {
861  send!(request_id, get_player_storage_capacity, json_req);
862}
863
864/// [`Client::get_player_worlds`](nil_client::Client::get_player_worlds)
865#[unsafe(no_mangle)]
866pub unsafe extern "C" fn nil_get_player_worlds(request_id: RequestId, json_req: *const c_char) {
867  send!(request_id, get_player_worlds, json_req);
868}
869
870/// [`Client::get_precursor_coords`](nil_client::Client::get_precursor_coords)
871#[unsafe(no_mangle)]
872pub unsafe extern "C" fn nil_get_precursor_coords(request_id: RequestId, json_req: *const c_char) {
873  send!(request_id, get_precursor_coords, json_req);
874}
875
876/// [`Client::get_prefecture_build_catalog`](nil_client::Client::get_prefecture_build_catalog)
877#[unsafe(no_mangle)]
878pub unsafe extern "C" fn nil_get_prefecture_build_catalog(
879  request_id: RequestId,
880  json_req: *const c_char,
881) {
882  send!(request_id, get_prefecture_build_catalog, json_req);
883}
884
885/// [`Client::get_public_bot`](nil_client::Client::get_public_bot)
886#[unsafe(no_mangle)]
887pub unsafe extern "C" fn nil_get_public_bot(request_id: RequestId, json_req: *const c_char) {
888  send!(request_id, get_public_bot, json_req);
889}
890
891/// [`Client::get_public_bots`](nil_client::Client::get_public_bots)
892#[unsafe(no_mangle)]
893pub unsafe extern "C" fn nil_get_public_bots(request_id: RequestId, json_req: *const c_char) {
894  send!(request_id, get_public_bots, json_req);
895}
896
897/// [`Client::get_public_cities`](nil_client::Client::get_public_cities)
898#[unsafe(no_mangle)]
899pub unsafe extern "C" fn nil_get_public_cities(request_id: RequestId, json_req: *const c_char) {
900  send!(request_id, get_public_cities, json_req);
901}
902
903/// [`Client::get_public_city`](nil_client::Client::get_public_city)
904#[unsafe(no_mangle)]
905pub unsafe extern "C" fn nil_get_public_city(request_id: RequestId, json_req: *const c_char) {
906  send!(request_id, get_public_city, json_req);
907}
908
909/// [`Client::get_public_field`](nil_client::Client::get_public_field)
910#[unsafe(no_mangle)]
911pub unsafe extern "C" fn nil_get_public_field(request_id: RequestId, json_req: *const c_char) {
912  send!(request_id, get_public_field, json_req);
913}
914
915/// [`Client::get_public_fields`](nil_client::Client::get_public_fields)
916#[unsafe(no_mangle)]
917pub unsafe extern "C" fn nil_get_public_fields(request_id: RequestId, json_req: *const c_char) {
918  send!(request_id, get_public_fields, json_req);
919}
920
921/// [`Client::get_public_player`](nil_client::Client::get_public_player)
922#[unsafe(no_mangle)]
923pub unsafe extern "C" fn nil_get_public_player(request_id: RequestId, json_req: *const c_char) {
924  send!(request_id, get_public_player, json_req);
925}
926
927/// [`Client::get_public_players`](nil_client::Client::get_public_players)
928#[unsafe(no_mangle)]
929pub unsafe extern "C" fn nil_get_public_players(request_id: RequestId, json_req: *const c_char) {
930  send!(request_id, get_public_players, json_req);
931}
932
933/// [`Client::get_public_precursor`](nil_client::Client::get_public_precursor)
934#[unsafe(no_mangle)]
935pub unsafe extern "C" fn nil_get_public_precursor(request_id: RequestId, json_req: *const c_char) {
936  send!(request_id, get_public_precursor, json_req);
937}
938
939/// [`Client::get_public_precursors`](nil_client::Client::get_public_precursors)
940#[unsafe(no_mangle)]
941pub unsafe extern "C" fn nil_get_public_precursors(request_id: RequestId, json_req: *const c_char) {
942  send!(request_id, get_public_precursors, json_req);
943}
944
945/// [`Client::get_rank`](nil_client::Client::get_rank)
946#[unsafe(no_mangle)]
947pub unsafe extern "C" fn nil_get_rank(request_id: RequestId, json_req: *const c_char) {
948  send!(request_id, get_rank, json_req);
949}
950
951/// [`Client::get_ranking`](nil_client::Client::get_ranking)
952#[unsafe(no_mangle)]
953pub unsafe extern "C" fn nil_get_ranking(request_id: RequestId, json_req: *const c_char) {
954  send!(request_id, get_ranking, json_req);
955}
956
957/// [`Client::get_remote_world`](nil_client::Client::get_remote_world)
958#[unsafe(no_mangle)]
959pub unsafe extern "C" fn nil_get_remote_world(request_id: RequestId, json_req: *const c_char) {
960  send!(request_id, get_remote_world, json_req);
961}
962
963/// [`Client::get_remote_world_limit`](nil_client::Client::get_remote_world_limit)
964#[unsafe(no_mangle)]
965pub unsafe extern "C" fn nil_get_remote_world_limit(request_id: RequestId) {
966  send!(request_id, get_remote_world_limit);
967}
968
969/// [`Client::get_remote_world_limit_per_user`](nil_client::Client::get_remote_world_limit_per_user)
970#[unsafe(no_mangle)]
971pub unsafe extern "C" fn nil_get_remote_world_limit_per_user(request_id: RequestId) {
972  send!(request_id, get_remote_world_limit_per_user);
973}
974
975/// [`Client::get_remote_worlds`](nil_client::Client::get_remote_worlds)
976#[unsafe(no_mangle)]
977pub unsafe extern "C" fn nil_get_remote_worlds(request_id: RequestId) {
978  send!(request_id, get_remote_worlds);
979}
980
981/// [`Client::get_round`](nil_client::Client::get_round)
982#[unsafe(no_mangle)]
983pub unsafe extern "C" fn nil_get_round(request_id: RequestId, json_req: *const c_char) {
984  send!(request_id, get_round, json_req);
985}
986
987/// [`Client::get_server_kind`](nil_client::Client::get_server_kind)
988#[unsafe(no_mangle)]
989pub unsafe extern "C" fn nil_get_server_kind(request_id: RequestId) {
990  send!(request_id, get_server_kind);
991}
992
993/// [`Client::get_stable_recruit_catalog`](nil_client::Client::get_stable_recruit_catalog)
994#[unsafe(no_mangle)]
995pub unsafe extern "C" fn nil_get_stable_recruit_catalog(
996  request_id: RequestId,
997  json_req: *const c_char,
998) {
999  send!(request_id, get_stable_recruit_catalog, json_req);
1000}
1001
1002/// [`Client::get_workshop_recruit_catalog`](nil_client::Client::get_workshop_recruit_catalog)
1003#[unsafe(no_mangle)]
1004pub unsafe extern "C" fn nil_get_workshop_recruit_catalog(
1005  request_id: RequestId,
1006  json_req: *const c_char,
1007) {
1008  send!(request_id, get_workshop_recruit_catalog, json_req);
1009}
1010
1011/// [`Client::get_world_bots`](nil_client::Client::get_world_bots)
1012#[unsafe(no_mangle)]
1013pub unsafe extern "C" fn nil_get_world_bots(request_id: RequestId, json_req: *const c_char) {
1014  send!(request_id, get_world_bots, json_req);
1015}
1016
1017/// [`Client::get_world_config`](nil_client::Client::get_world_config)
1018#[unsafe(no_mangle)]
1019pub unsafe extern "C" fn nil_get_world_config(request_id: RequestId, json_req: *const c_char) {
1020  send!(request_id, get_world_config, json_req);
1021}
1022
1023/// [`Client::get_world_personnel`](nil_client::Client::get_world_personnel)
1024#[unsafe(no_mangle)]
1025pub unsafe extern "C" fn nil_get_world_personnel(request_id: RequestId, json_req: *const c_char) {
1026  send!(request_id, get_world_personnel, json_req);
1027}
1028
1029/// [`Client::get_world_players`](nil_client::Client::get_world_players)
1030#[unsafe(no_mangle)]
1031pub unsafe extern "C" fn nil_get_world_players(request_id: RequestId, json_req: *const c_char) {
1032  send!(request_id, get_world_players, json_req);
1033}
1034
1035/// [`Client::get_world_precursors`](nil_client::Client::get_world_precursors)
1036#[unsafe(no_mangle)]
1037pub unsafe extern "C" fn nil_get_world_precursors(request_id: RequestId, json_req: *const c_char) {
1038  send!(request_id, get_world_precursors, json_req);
1039}
1040
1041/// [`Client::get_world_rulers`](nil_client::Client::get_world_rulers)
1042#[unsafe(no_mangle)]
1043pub unsafe extern "C" fn nil_get_world_rulers(request_id: RequestId, json_req: *const c_char) {
1044  send!(request_id, get_world_rulers, json_req);
1045}
1046
1047/// [`Client::get_world_stats`](nil_client::Client::get_world_stats)
1048#[unsafe(no_mangle)]
1049pub unsafe extern "C" fn nil_get_world_stats(request_id: RequestId, json_req: *const c_char) {
1050  send!(request_id, get_world_stats, json_req);
1051}
1052
1053/// [`Client::player_exists`](nil_client::Client::player_exists)
1054#[unsafe(no_mangle)]
1055pub unsafe extern "C" fn nil_player_exists(request_id: RequestId, json_req: *const c_char) {
1056  send!(request_id, player_exists, json_req);
1057}
1058
1059/// [`Client::push_chat_message`](nil_client::Client::push_chat_message)
1060#[unsafe(no_mangle)]
1061pub unsafe extern "C" fn nil_push_chat_message(request_id: RequestId, json_req: *const c_char) {
1062  send!(request_id, push_chat_message, json_req);
1063}
1064
1065/// [`Client::rename_city`](nil_client::Client::rename_city)
1066#[unsafe(no_mangle)]
1067pub unsafe extern "C" fn nil_rename_city(request_id: RequestId, json_req: *const c_char) {
1068  send!(request_id, rename_city, json_req);
1069}
1070
1071/// [`Client::request_maneuver`](nil_client::Client::request_maneuver)
1072#[unsafe(no_mangle)]
1073pub unsafe extern "C" fn nil_request_maneuver(request_id: RequestId, json_req: *const c_char) {
1074  send!(request_id, request_maneuver, json_req);
1075}
1076
1077/// [`Client::save_local_world`](nil_client::Client::save_local_world)
1078#[unsafe(no_mangle)]
1079pub unsafe extern "C" fn nil_save_local_world(request_id: RequestId, json_req: *const c_char) {
1080  send!(request_id, save_local_world, json_req);
1081}
1082
1083/// [`Client::search_city`](nil_client::Client::search_city)
1084#[unsafe(no_mangle)]
1085pub unsafe extern "C" fn nil_search_city(request_id: RequestId, json_req: *const c_char) {
1086  send!(request_id, search_city, json_req);
1087}
1088
1089/// [`Client::search_public_city`](nil_client::Client::search_public_city)
1090#[unsafe(no_mangle)]
1091pub unsafe extern "C" fn nil_search_public_city(request_id: RequestId, json_req: *const c_char) {
1092  send!(request_id, search_public_city, json_req);
1093}
1094
1095/// [`Client::sell_resources`](nil_client::Client::sell_resources)
1096#[unsafe(no_mangle)]
1097pub unsafe extern "C" fn nil_sell_resources(request_id: RequestId, json_req: *const c_char) {
1098  send!(request_id, sell_resources, json_req);
1099}
1100
1101/// [`Client::send_resources`](nil_client::Client::send_resources)
1102#[unsafe(no_mangle)]
1103pub unsafe extern "C" fn nil_send_resources(request_id: RequestId, json_req: *const c_char) {
1104  send!(request_id, send_resources, json_req);
1105}
1106
1107/// [`Client::version`](nil_client::Client::version)
1108#[unsafe(no_mangle)]
1109pub unsafe extern "C" fn nil_server_version(request_id: RequestId) {
1110  send!(request_id, version);
1111}
1112
1113/// [`Client::set_player_ready`](nil_client::Client::set_player_ready)
1114#[unsafe(no_mangle)]
1115pub unsafe extern "C" fn nil_set_player_ready(request_id: RequestId, json_req: *const c_char) {
1116  send!(request_id, set_player_ready, json_req);
1117}
1118
1119/// [`Client::set_player_status`](nil_client::Client::set_player_status)
1120#[unsafe(no_mangle)]
1121pub unsafe extern "C" fn nil_set_player_status(request_id: RequestId, json_req: *const c_char) {
1122  send!(request_id, set_player_status, json_req);
1123}
1124
1125/// [`Client::simulate_battle`](nil_client::Client::simulate_battle)
1126#[unsafe(no_mangle)]
1127pub unsafe extern "C" fn nil_simulate_battle(request_id: RequestId, json_req: *const c_char) {
1128  send!(request_id, simulate_battle, json_req);
1129}
1130
1131/// [`Client::spawn_player`](nil_client::Client::spawn_player)
1132#[unsafe(no_mangle)]
1133pub unsafe extern "C" fn nil_spawn_player(request_id: RequestId, json_req: *const c_char) {
1134  send!(request_id, spawn_player, json_req);
1135}
1136
1137/// [`Client::start_round`](nil_client::Client::start_round)
1138#[unsafe(no_mangle)]
1139pub unsafe extern "C" fn nil_start_round(request_id: RequestId, json_req: *const c_char) {
1140  send!(request_id, start_round, json_req);
1141}
1142
1143/// [`Client::toggle_building`](nil_client::Client::toggle_building)
1144#[unsafe(no_mangle)]
1145pub unsafe extern "C" fn nil_toggle_building(request_id: RequestId, json_req: *const c_char) {
1146  send!(request_id, toggle_building, json_req);
1147}
1148
1149/// [`Client::user_exists`](nil_client::Client::user_exists)
1150#[unsafe(no_mangle)]
1151pub unsafe extern "C" fn nil_user_exists(request_id: RequestId, json_req: *const c_char) {
1152  send!(request_id, user_exists, json_req);
1153}
1154
1155/// [`Client::validate_token`](nil_client::Client::validate_token)
1156#[unsafe(no_mangle)]
1157pub unsafe extern "C" fn nil_validate_token(request_id: RequestId, json_req: *const c_char) {
1158  send!(request_id, validate_token, json_req);
1159}