feldera_types/license.rs
1//! License related types exchanged between license server and feldera platform.
2
3use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5use utoipa::ToSchema;
6
7/// Request to verify a license.
8/// Shared type between client and server.
9#[derive(Serialize, Deserialize, Debug)]
10pub struct LicenseCheckRequest {
11 pub account_id: String,
12 pub license_key: String,
13}
14
15#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ToSchema)]
16#[allow(dead_code)]
17pub enum DisplaySchedule {
18 /// Display it only once: after dismissal do not show it again
19 Once,
20 /// Display it again the next session if it is dismissed
21 Session,
22 /// Display it again after a certain period of time after it is dismissed
23 Every { seconds: u64 },
24 /// Always display it, do not allow it to be dismissed
25 Always,
26}
27
28#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ToSchema)]
29pub struct LicenseInformation {
30 /// Timestamp when the server responded.
31 pub current: DateTime<Utc>,
32 /// Timestamp at which point the license expires
33 pub valid_until: Option<DateTime<Utc>>,
34 /// Whether the license is a trial
35 pub is_trial: bool,
36 /// Optional description of the advantages of extending the license / upgrading from a trial
37 pub description_html: String,
38 /// URL that navigates the user to extend / upgrade their license
39 pub extension_url: Option<String>,
40 /// Timestamp from which the user should be reminded of the license expiring soon
41 pub remind_starting_at: Option<DateTime<Utc>>,
42 /// Suggested frequency of reminding the user about the license expiring soon
43 pub remind_schedule: DisplaySchedule,
44}