api.fabaccess-api/users.capnp
2022-11-04 15:54:15 +01:00

37 lines
1.2 KiB
Cap'n Proto

@0x9a05e95f65f2edda;
using CSharp = import "programming_language/csharp.capnp";
$CSharp.namespace("FabAccessAPI.Schema");
using import "user.capnp".User;
interface Users {
list @0 () -> ( users :List(User) );
addUser @1 ( username :Text, password :Text ) -> ( user :User, error :Error );
# Add a new user. If adding the user succeeds then the newly created user is returned and
# `error` is NULL / set to Error::ok. If adding the user fails `user` is NULL and `error`
# contains the reason for the failure.
removeUser @2 ( user :User );
}
struct Error {
union {
ok @0 :Void;
# This error is not actually set, i.e. the operation completed successfully.
# This field is necessary because a NULL struct pointer may be interpreted as a struct with
# default values. In that case this will appear as an `Error` with the `ok` field set.
exists @1 :Void;
# There is already an user with the requested username
usernameInvalid @2 :Void;
# The provided username is not usable, e.g. contains invalid characters, is too long, or too
# short.
passwordInvalid @3 :Void;
# The provided password is not usable, e.g. it's zero-length.
}
}