// GENERATED — DO NOT EDIT

///|
/// [Upstream documentation](https://docs.gtk.org/gio/class.Credentials.html).
pub type Credentials

///|
pub(open) trait ICredentials {
  fn as_credentials(Self) -> Credentials
  fn is_same_user(Self, &ICredentials) -> Bool raise @glib.Error_ = _
  fn to_string(Self) -> String = _
}

///|
pub impl ICredentials for Credentials with fn as_credentials(self) {
  self
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/ctor.Credentials.new.html).
pub extern "c" fn Credentials::new() -> Credentials = "moonbit_g_credentials_new"

///|
#borrow(self_, other_credentials, error)
extern "c" fn moonbit_g_credentials_is_same_user(
  self_ : Credentials,
  other_credentials : Credentials,
  error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_credentials_is_same_user"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Credentials.is_same_user.html).
pub fn Credentials::is_same_user(
  self : Credentials,
  other_credentials : &ICredentials,
) -> Bool raise @glib.Error_ {
  let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
  let result = moonbit_g_credentials_is_same_user(
    self,
    other_credentials.as_credentials(),
    error_,
  )
  match error_.val.to_option() {
    Some(e) => raise e
    None => ()
  }
  result
}

///|
#borrow(self_)
extern "c" fn moonbit_g_credentials_to_string(self_ : Credentials) -> Bytes = "moonbit_g_credentials_to_string"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.Credentials.to_string.html).
pub fn Credentials::to_string(self : Credentials) -> String {
  @encoding/utf8.decode_lossy(moonbit_g_credentials_to_string(self))
}

///|
impl ICredentials with fn is_same_user(self, other_credentials) -> Bool raise @glib.Error_ {
  self.as_credentials().is_same_user(other_credentials)
}

///|
impl ICredentials with fn to_string(self) -> String {
  self.as_credentials().to_string()
}

///|
pub fn Credentials::as_gobject_object(self : Credentials) -> @gobject.Object = "%identity"

///|
pub impl @gobject.IObject for Credentials with fn as_object(self) {
  self.as_gobject_object()
}