comline/core/tests/idl/simple.ids

49 lines
1 KiB
Plaintext
Raw Normal View History

// Simple Schema
2023-08-28 14:09:31 -05:00
namespace tests::idl::simple
2023-08-28 14:09:31 -05:00
import std::validators::string_bounds::StringBounds
const POWER: u8 = 1
const DEFAULT_NAME: str = f"flower power: {POWER}"
settings Test {
forbid_indexing=True
forbid_optional_indexing=True
}
2023-08-28 14:09:31 -05:00
enum EncryptionAlgorithm {
Bad
Medium
}
enum EncryptionMode {
2023-08-28 14:09:31 -05:00
None
Encrypt
}
/// A message that can be sent through the mail protocol
struct Message {
2023-08-28 14:09:31 -05:00
name: str = DEFAULT_NAME
encryption_mode: EncryptionMode = default
@validators=[StringBounds(min_chars=3 max_chars=12)]
2023-08-28 14:09:31 -05:00
optional recipient: str = "bee"
}
/// Throw when sending a message to a missing recipient
error RecipientNotFoundError {
message = "Recipient with name {self.recipient} not found"
@validators=[StringBounds(min_chars=8 max_chars=16)]
2023-08-28 14:09:31 -05:00
recipient: str
}
/// Mail API for receiving and sending emails
@provider=Any
protocol Mail {
@timeout_ms=1000
2023-08-28 14:09:31 -05:00
function send_message(message: Message) -> str
! RecipientNotFoundError(function.message.recipient)
}