### Class

# Gio DBusMethodInvocation

since: 2.26

#### Description

    final class Gio.DBusMethodInvocation : GObject.Object
    {
      /* No available fields */
    }

Instances of the `GDBusMethodInvocation` class are used when handling D-Bus method calls. It provides a way to asynchronously return results and errors.

The normal way to obtain a `GDBusMethodInvocation` object is to receive it as an argument to the `handle_method_call()` function in a `GDBusInterfaceVTable` that was passed to `g_dbus_connection_register_object()`.

Available since: 2.26

#### Ancestors

- GObject

#### Instance methods

###### g_dbus_method_invocation_get_connection

Gets the `GDBusConnection` the method was invoked on.

since: 2.26

###### g_dbus_method_invocation_get_interface_name

Gets the name of the D-Bus interface the method was invoked on.

since: 2.26

###### g_dbus_method_invocation_get_message

Gets the `GDBusMessage` for the method invocation. This is useful if you need to use low-level protocol features, such as UNIX file descriptor passing, that cannot be properly expressed in the `GVariant` API.

since: 2.26

###### g_dbus_method_invocation_get_method_info

Gets information about the method call, if any.

since: 2.26

###### g_dbus_method_invocation_get_method_name

Gets the name of the method that was invoked.

since: 2.26

###### g_dbus_method_invocation_get_object_path

Gets the object path the method was invoked on.

since: 2.26

###### g_dbus_method_invocation_get_parameters

Gets the parameters of the method invocation. If there are no input parameters then this will return a GVariant with 0 children rather than NULL.

since: 2.26

###### g_dbus_method_invocation_get_property_info

Gets information about the property that this method call is for, if any.

since: 2.38

###### g_dbus_method_invocation_get_sender

Gets the bus name that invoked the method.

since: 2.26

###### g_dbus_method_invocation_get_user_data

Gets the `user_data` #gpointer passed to g_dbus_connection_register_object().

since: 2.26

###### g_dbus_method_invocation_return_dbus_error

Finishes handling a D-Bus method call by returning an error.

since: 2.26

###### g_dbus_method_invocation_return_error

Finishes handling a D-Bus method call by returning an error.

since: 2.26

###### g_dbus_method_invocation_return_error_literal

Like `g_dbus_method_invocation_return_error()` but without printf()-style formatting.

since: 2.26

###### g_dbus_method_invocation_return_error_valist

Like `g_dbus_method_invocation_return_error()` but intended for language bindings.

since: 2.26

###### g_dbus_method_invocation_return_gerror

Like `g_dbus_method_invocation_return_error()` but takes a `GError` instead of the error domain, error code and message.

since: 2.26

###### g_dbus_method_invocation_return_value

Finishes handling a D-Bus method call by returning `parameters`. If the `parameters` GVariant is floating, it is consumed.

since: 2.26

###### g_dbus_method_invocation_return_value_with_unix_fd_list

Like `g_dbus_method_invocation_return_value()` but also takes a `GUnixFDList`.

since: 2.30

###### g_dbus_method_invocation_take_error

Like `g_dbus_method_invocation_return_gerror()` but takes ownership of `error` so the caller does not need to free it.

since: 2.30

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

since: 2.0