/*This file is automatically generated by pkg.deepin.io/dbus-generator. Don't edit it*/
package networkmanager

import "pkg.deepin.io/lib/dbus"
import "pkg.deepin.io/lib/dbus/property"
import "reflect"
import "sync"
import "runtime"
import "fmt"
import "errors"

/*prevent compile error*/
var _ = fmt.Println
var _ = runtime.SetFinalizer
var _ = sync.NewCond
var _ = reflect.TypeOf
var _ = property.BaseObserver{}

type SecretAgent struct {
	Path     dbus.ObjectPath
	DestName string
	core     *dbus.Object
}

func (obj *SecretAgent) GetSecrets(connection map[string]map[string]dbus.Variant, connection_path dbus.ObjectPath, setting_name string, hints []string, flags uint32) (secrets map[string]map[string]dbus.Variant, _err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.SecretAgent.GetSecrets", 0, connection, connection_path, setting_name, hints, flags).Store(&secrets)
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *SecretAgent) CancelGetSecrets(connection_path dbus.ObjectPath, setting_name string) (_err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.SecretAgent.CancelGetSecrets", 0, connection_path, setting_name).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *SecretAgent) SaveSecrets(connection map[string]map[string]dbus.Variant, connection_path dbus.ObjectPath) (_err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.SecretAgent.SaveSecrets", 0, connection, connection_path).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func (obj *SecretAgent) DeleteSecrets(connection map[string]map[string]dbus.Variant, connection_path dbus.ObjectPath) (_err error) {
	_err = obj.core.Call("org.freedesktop.NetworkManager.SecretAgent.DeleteSecrets", 0, connection, connection_path).Store()
	if _err != nil {
		fmt.Println(_err)
	}
	return
}

func NewSecretAgent(destName string, path dbus.ObjectPath) (*SecretAgent, error) {
	if !path.IsValid() {
		return nil, errors.New("The path of '" + string(path) + "' is invalid.")
	}

	core := getBus().Object(destName, path)

	obj := &SecretAgent{Path: path, DestName: destName, core: core}

	return obj, nil
}
