Skip to main content

nil_payload/response/
auth.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use derive_more::{Deref, DerefMut, From, Into};
5use nil_core::player::PlayerId;
6use nil_server_types::auth::Token;
7use serde::{Deserialize, Serialize};
8
9#[cfg(feature = "axum")]
10use nil_payload_macros::IntoJsonResponse;
11
12#[cfg(feature = "typescript")]
13use ts_rs::TS;
14
15#[derive(Clone, Debug, Deref, DerefMut, From, Into, Deserialize, Serialize)]
16#[cfg_attr(feature = "axum", derive(IntoJsonResponse))]
17#[cfg_attr(feature = "typescript", derive(TS))]
18#[cfg_attr(feature = "typescript", ts(export))]
19pub struct AuthorizeResponse(pub Token);
20
21#[derive(Clone, Debug, Deref, DerefMut, From, Into, Deserialize, Serialize)]
22#[cfg_attr(feature = "axum", derive(IntoJsonResponse))]
23#[cfg_attr(feature = "typescript", derive(TS))]
24#[cfg_attr(feature = "typescript", ts(export))]
25pub struct ValidateTokenResponse(pub Option<PlayerId>);