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