// GENERATED — DO NOT EDIT

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

///|
pub(open) trait ITestDBus {
  fn as_test_dbus(Self) -> TestDBus
  fn add_service_dir(Self, String) -> Unit = _
  fn down(Self) -> Unit = _
  fn get_bus_address(Self) -> String? = _
  fn get_flags(Self) -> TestDBusFlags = _
  fn stop(Self) -> Unit = _
  fn up(Self) -> Unit = _
}

///|
pub impl ITestDBus for TestDBus with fn as_test_dbus(self) {
  self
}

///|
extern "c" fn moonbit_g_test_dbus_new(flags : Int) -> TestDBus = "moonbit_g_test_dbus_new"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/ctor.TestDBus.new.html).
pub fn TestDBus::new(flags : TestDBusFlags) -> TestDBus {
  moonbit_g_test_dbus_new(flags.to_int())
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/type_func.TestDBus.unset.html).
pub extern "c" fn TestDBus::unset() -> Unit = "moonbit_g_test_dbus_unset"

///|
#borrow(self_, path)
extern "c" fn moonbit_g_test_dbus_add_service_dir(
  self_ : TestDBus,
  path : Bytes,
) = "moonbit_g_test_dbus_add_service_dir"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TestDBus.add_service_dir.html).
pub fn TestDBus::add_service_dir(self : TestDBus, path : String) -> Unit {
  moonbit_g_test_dbus_add_service_dir(self, @encoding/utf8.encode(path))
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TestDBus.down.html).
#borrow(self)
pub extern "c" fn TestDBus::down(self : TestDBus) = "moonbit_g_test_dbus_down"

///|
#borrow(self_)
extern "c" fn moonbit_g_test_dbus_get_bus_address(
  self_ : TestDBus,
) -> @glib.Nullable[Bytes] = "moonbit_g_test_dbus_get_bus_address"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TestDBus.get_bus_address.html).
pub fn TestDBus::get_bus_address(self : TestDBus) -> String? {
  let result = moonbit_g_test_dbus_get_bus_address(self)
  match result.to_option() {
    Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
    None => None
  }
}

///|
#borrow(self_)
extern "c" fn moonbit_g_test_dbus_get_flags(self_ : TestDBus) -> Int = "moonbit_g_test_dbus_get_flags"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TestDBus.get_flags.html).
pub fn TestDBus::get_flags(self : TestDBus) -> TestDBusFlags {
  TestDBusFlags::from_int(moonbit_g_test_dbus_get_flags(self))
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TestDBus.stop.html).
#borrow(self)
pub extern "c" fn TestDBus::stop(self : TestDBus) = "moonbit_g_test_dbus_stop"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TestDBus.up.html).
#borrow(self)
pub extern "c" fn TestDBus::up(self : TestDBus) = "moonbit_g_test_dbus_up"

///|
impl ITestDBus with fn add_service_dir(self, path) -> Unit {
  self.as_test_dbus().add_service_dir(path)
}

///|
impl ITestDBus with fn down(self) -> Unit {
  self.as_test_dbus().down()
}

///|
impl ITestDBus with fn get_bus_address(self) -> String? {
  self.as_test_dbus().get_bus_address()
}

///|
impl ITestDBus with fn get_flags(self) -> TestDBusFlags {
  self.as_test_dbus().get_flags()
}

///|
impl ITestDBus with fn stop(self) -> Unit {
  self.as_test_dbus().stop()
}

///|
impl ITestDBus with fn up(self) -> Unit {
  self.as_test_dbus().up()
}

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

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