1use pandora_api_derive::PandoraJsonRequest;
7use serde::{Deserialize, Serialize};
8
9use crate::errors::Error;
10use crate::json::{PandoraJsonApiRequest, PandoraSession};
11
12#[derive(Debug, Clone, Default, Serialize, PandoraJsonRequest)]
16#[serde(rename_all = "camelCase")]
17pub struct CheckLicensing {}
18
19impl CheckLicensing {
20 pub fn new() -> Self {
22 Self::default()
23 }
24}
25
26#[derive(Debug, Clone, Deserialize)]
30#[serde(rename_all = "camelCase")]
31pub struct CheckLicensingResponse {
32 pub is_allowed: bool,
34}
35
36pub async fn check_licensing(
38 session: &mut PandoraSession,
39) -> Result<CheckLicensingResponse, Error> {
40 CheckLicensing::default().response(session).await
41}
42
43pub struct EchoUnsupported {}
47
48#[cfg(test)]
49mod tests {
50 use super::*;
51 use crate::json::{tests::session_login, Partner};
52
53 #[tokio::test]
54 async fn licensing_check_test() {
55 let partner = Partner::default();
63 let mut session = session_login(&partner)
64 .await
65 .expect("Failed initializing login session");
66
67 let check_licensing_response = check_licensing(&mut session)
68 .await
69 .expect("Error making test.checkLicensing request");
70 log::debug!("test.checkLicensing() => {:?}", check_licensing_response);
71 }
72}