comline/examples/simple.ids

75 lines
1.3 KiB
Plaintext
Raw Normal View History

2023-06-15 07:10:20 -05:00
namespace examples.thing.simple
const AGREEMENT_KEY: string = "agreement_key"
@min_chars=16 max_chars=60
validator PasswordCheck {
assert_valid(
self.parameters.0,
StringBounds(min_chars=params.min_chars max_chars=params.max_chars
)
2023-06-15 07:10:20 -05:00
}
2023-06-15 07:10:20 -05:00
@settings(versioned=False validate_fields=False)
struct Credentials {
2023-06-15 07:10:20 -05:00
@validators([StringBounds(min_chars=8 max_chars=16)])
1# username: str = "test"
@validators=[PasswordCheck]
2023-06-15 07:10:20 -05:00
2# password: str
}
2023-06-15 07:10:20 -05:00
struct CredentialsOther {
@parameters.0.validators=[StringBounds(min_chars=8 max_chars=16]
#1 username: union(str null) = "test" | null
@validators=([PasswordCheck()])
#2 password: str
2023-06-15 07:10:20 -05:00
}
2023-06-15 07:10:20 -05:00
enum RegisterStatus {
Ok
UsernameTaken
}
error TellBackError {
message = "Could not get the provider to tell \"{self.back}\" back"
1# back: str
2023-06-15 07:10:20 -05:00
}
@provider=Server
protocol Registry {
2023-06-15 07:10:20 -05:00
@argument.0.username.validate=true
#timeout_ms=100
#cooldown_ms=200
function register(Credentials) returns RegisterStatus
@return.0.validators=[StringBounds(min_chars=8)]
function my_username() returns str
@return.0.validators=[StringBounds(min_chars=8)]
function tell_back(str = "back") returns str throws TellBackError
}
2023-06-15 07:10:20 -05:00
struct TellBackResponse {
}
@provider=Server
protocol Events {
2023-06-15 07:10:20 -05:00
async function poke()
}