// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IDBusMethodInvocation {
  fn as_dbus_method_invocation(Self) -> DBusMethodInvocation
  fn get_connection(Self) -> DBusConnection = _
  fn get_interface_name(Self) -> String? = _
  fn get_message(Self) -> DBusMessage = _
  fn get_method_name(Self) -> String = _
  fn get_object_path(Self) -> String = _
  fn get_parameters(Self) -> @glib.Variant = _
  fn get_sender(Self) -> String? = _
  fn return_dbus_error(Self, String, String) -> Unit = _
  fn return_error_literal(Self, UInt, Int, String) -> Unit = _
  fn return_value(Self, &@glib.IVariant?) -> Unit = _
  fn return_value_with_unix_fd_list(Self, &@glib.IVariant?, &IUnixFDList?) -> Unit = _
}

///|
pub impl IDBusMethodInvocation for DBusMethodInvocation with fn as_dbus_method_invocation(
  self,
) {
  self
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DBusMethodInvocation.get_connection.html).
#borrow(self)
pub extern "c" fn DBusMethodInvocation::get_connection(
  self : DBusMethodInvocation,
) -> DBusConnection = "moonbit_g_dbus_method_invocation_get_connection"

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DBusMethodInvocation.get_message.html).
#borrow(self)
pub extern "c" fn DBusMethodInvocation::get_message(
  self : DBusMethodInvocation,
) -> DBusMessage = "moonbit_g_dbus_method_invocation_get_message"

///|
#borrow(self_)
extern "c" fn moonbit_g_dbus_method_invocation_get_method_name(
  self_ : DBusMethodInvocation,
) -> Bytes = "moonbit_g_dbus_method_invocation_get_method_name"

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

///|
#borrow(self_)
extern "c" fn moonbit_g_dbus_method_invocation_get_object_path(
  self_ : DBusMethodInvocation,
) -> Bytes = "moonbit_g_dbus_method_invocation_get_object_path"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DBusMethodInvocation.get_parameters.html).
#borrow(self)
pub extern "c" fn DBusMethodInvocation::get_parameters(
  self : DBusMethodInvocation,
) -> @glib.Variant = "moonbit_g_dbus_method_invocation_get_parameters"

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

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

///|
#borrow(self_, error_name, error_message)
extern "c" fn moonbit_g_dbus_method_invocation_return_dbus_error(
  self_ : DBusMethodInvocation,
  error_name : Bytes,
  error_message : Bytes,
) = "moonbit_g_dbus_method_invocation_return_dbus_error"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DBusMethodInvocation.return_dbus_error.html).
pub fn DBusMethodInvocation::return_dbus_error(
  self : DBusMethodInvocation,
  error_name : String,
  error_message : String,
) -> Unit {
  moonbit_g_dbus_method_invocation_return_dbus_error(
    self,
    @encoding/utf8.encode(error_name),
    @encoding/utf8.encode(error_message),
  )
}

///|
#borrow(self_, message)
extern "c" fn moonbit_g_dbus_method_invocation_return_error_literal(
  self_ : DBusMethodInvocation,
  domain : UInt,
  code : Int,
  message : Bytes,
) = "moonbit_g_dbus_method_invocation_return_error_literal"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DBusMethodInvocation.return_error_literal.html).
pub fn DBusMethodInvocation::return_error_literal(
  self : DBusMethodInvocation,
  domain : UInt,
  code : Int,
  message : String,
) -> Unit {
  moonbit_g_dbus_method_invocation_return_error_literal(
    self,
    domain,
    code,
    @encoding/utf8.encode(message),
  )
}

///|
#borrow(self_, parameters)
extern "c" fn moonbit_g_dbus_method_invocation_return_value(
  self_ : DBusMethodInvocation,
  parameters : @glib.Nullable[@glib.Variant],
) = "moonbit_g_dbus_method_invocation_return_value"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DBusMethodInvocation.return_value.html).
pub fn DBusMethodInvocation::return_value(
  self : DBusMethodInvocation,
  parameters : &@glib.IVariant?,
) -> Unit {
  moonbit_g_dbus_method_invocation_return_value(
    self,
    match parameters {
      Some(v) => @glib.Nullable::some(v.as_variant())
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(self_, parameters, fd_list)
extern "c" fn moonbit_g_dbus_method_invocation_return_value_with_unix_fd_list(
  self_ : DBusMethodInvocation,
  parameters : @glib.Nullable[@glib.Variant],
  fd_list : @glib.Nullable[UnixFDList],
) = "moonbit_g_dbus_method_invocation_return_value_with_unix_fd_list"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DBusMethodInvocation.return_value_with_unix_fd_list.html).
pub fn DBusMethodInvocation::return_value_with_unix_fd_list(
  self : DBusMethodInvocation,
  parameters : &@glib.IVariant?,
  fd_list : &IUnixFDList?,
) -> Unit {
  moonbit_g_dbus_method_invocation_return_value_with_unix_fd_list(
    self,
    match parameters {
      Some(v) => @glib.Nullable::some(v.as_variant())
      None => @glib.Nullable::null()
    },
    match fd_list {
      Some(v) => @glib.Nullable::some(v.as_unix_fd_list())
      None => @glib.Nullable::null()
    },
  )
}

///|
impl IDBusMethodInvocation with fn get_connection(self) -> DBusConnection {
  self.as_dbus_method_invocation().get_connection()
}

///|
impl IDBusMethodInvocation with fn get_interface_name(self) -> String? {
  self.as_dbus_method_invocation().get_interface_name()
}

///|
impl IDBusMethodInvocation with fn get_message(self) -> DBusMessage {
  self.as_dbus_method_invocation().get_message()
}

///|
impl IDBusMethodInvocation with fn get_method_name(self) -> String {
  self.as_dbus_method_invocation().get_method_name()
}

///|
impl IDBusMethodInvocation with fn get_object_path(self) -> String {
  self.as_dbus_method_invocation().get_object_path()
}

///|
impl IDBusMethodInvocation with fn get_parameters(self) -> @glib.Variant {
  self.as_dbus_method_invocation().get_parameters()
}

///|
impl IDBusMethodInvocation with fn get_sender(self) -> String? {
  self.as_dbus_method_invocation().get_sender()
}

///|
impl IDBusMethodInvocation with fn return_dbus_error(
  self,
  error_name,
  error_message,
) -> Unit {
  self.as_dbus_method_invocation().return_dbus_error(error_name, error_message)
}

///|
impl IDBusMethodInvocation with fn return_error_literal(
  self,
  domain,
  code,
  message,
) -> Unit {
  self.as_dbus_method_invocation().return_error_literal(domain, code, message)
}

///|
impl IDBusMethodInvocation with fn return_value(self, parameters) -> Unit {
  self.as_dbus_method_invocation().return_value(parameters)
}

///|
impl IDBusMethodInvocation with fn return_value_with_unix_fd_list(
  self,
  parameters,
  fd_list,
) -> Unit {
  self
  .as_dbus_method_invocation()
  .return_value_with_unix_fd_list(parameters, fd_list)
}

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

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