// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace GLib {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;
	using static GLib.AbiStructExtension;

#region Autogenerated code
	public partial class ProxyResolverPortal : GLib.Object, GLib.IProxyResolver {

		public ProxyResolverPortal (IntPtr raw) : base(raw) {}

		protected ProxyResolverPortal() : base(IntPtr.Zero)
		{
			CreateNativeObject (Array.Empty<string> (), Array.Empty<GLib.Value> ());
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;
		static public unsafe new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct (GLib.Object.class_abi.Fields);

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_proxy_resolver_portal_get_type();
		static d_g_proxy_resolver_portal_get_type g_proxy_resolver_portal_get_type = FuncLoader.LoadFunction<d_g_proxy_resolver_portal_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_proxy_resolver_portal_get_type"));

		public static new GLib.GType GType { 
			get {
				IntPtr raw_ret = g_proxy_resolver_portal_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_proxy_resolver_is_supported(IntPtr raw);
		static d_g_proxy_resolver_is_supported g_proxy_resolver_is_supported = FuncLoader.LoadFunction<d_g_proxy_resolver_is_supported>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_proxy_resolver_is_supported"));

		public bool IsSupported { 
			get {
				bool raw_ret = g_proxy_resolver_is_supported(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_proxy_resolver_lookup(IntPtr raw, IntPtr uri, IntPtr cancellable, out IntPtr error);
		static d_g_proxy_resolver_lookup g_proxy_resolver_lookup = FuncLoader.LoadFunction<d_g_proxy_resolver_lookup>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_proxy_resolver_lookup"));

		public string Lookup(string uri, GLib.Cancellable cancellable) {
			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_proxy_resolver_lookup(Handle, native_uri, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			GLib.Marshaller.Free (native_uri);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_proxy_resolver_lookup_async(IntPtr raw, IntPtr uri, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_proxy_resolver_lookup_async g_proxy_resolver_lookup_async = FuncLoader.LoadFunction<d_g_proxy_resolver_lookup_async>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_proxy_resolver_lookup_async"));

		public void LookupAsync(string uri, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_proxy_resolver_lookup_async(Handle, native_uri, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_uri);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_proxy_resolver_lookup_finish(IntPtr raw, IntPtr result, out IntPtr error);
		static d_g_proxy_resolver_lookup_finish g_proxy_resolver_lookup_finish = FuncLoader.LoadFunction<d_g_proxy_resolver_lookup_finish>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_proxy_resolver_lookup_finish"));

		public string LookupFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_proxy_resolver_lookup_finish(Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public unsafe new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (GLib.Object.abi_info.Fields);

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
