zabbix_api/client/
request.rs1use serde::Serialize;
2
3pub const JSON_RPC_VERSION: &str = "2.0";
4
5#[cfg(feature = "v7")]
6use super::v7::request::ZabbixApiRequest;
7
8#[cfg(feature = "v7")]
9pub fn get_api_request<T: Serialize>(
10 method: &str,
11 params: T,
12 _session: Option<String>,
13) -> ZabbixApiRequest<T> {
14 ZabbixApiRequest {
15 jsonrpc: JSON_RPC_VERSION.to_string(),
16 method: method.to_string(),
17 params,
18 id: 1,
19 }
20}
21
22#[cfg(feature = "v6")]
23use super::v6::request::ZabbixApiRequest;
24
25#[cfg(feature = "v6")]
26pub fn get_api_request<T: Serialize>(
27 method: &str,
28 params: T,
29 session: Option<String>,
30) -> ZabbixApiRequest<T> {
31 ZabbixApiRequest {
32 jsonrpc: JSON_RPC_VERSION.to_string(),
33 method: method.to_string(),
34 params,
35 id: 1,
36 auth: session,
37 }
38}