{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

Like 'GI.Gio.Objects.NetworkAddress.NetworkAddress' does with hostnames, 'GI.Gio.Objects.NetworkService.NetworkService'
provides an easy way to resolve a SRV record, and then attempt to
connect to one of the hosts that implements that service, handling
service priority\/weighting, multiple IP addresses, and multiple
address families.

See 'GI.Gio.Structs.SrvTarget.SrvTarget' for more information about SRV records, and see
'GI.Gio.Interfaces.SocketConnectable.SocketConnectable' for an example of using the connectable
interface.
-}

#define ENABLE_OVERLOADING \
       (!defined(__HADDOCK_VERSION__))

module GI.Gio.Objects.NetworkService
    ( 

-- * Exported types
    NetworkService(..)                      ,
    IsNetworkService                        ,
    toNetworkService                        ,
    noNetworkService                        ,


 -- * Methods
-- ** getDomain #method:getDomain#

#if ENABLE_OVERLOADING
    NetworkServiceGetDomainMethodInfo       ,
#endif
    networkServiceGetDomain                 ,


-- ** getProtocol #method:getProtocol#

#if ENABLE_OVERLOADING
    NetworkServiceGetProtocolMethodInfo     ,
#endif
    networkServiceGetProtocol               ,


-- ** getScheme #method:getScheme#

#if ENABLE_OVERLOADING
    NetworkServiceGetSchemeMethodInfo       ,
#endif
    networkServiceGetScheme                 ,


-- ** getService #method:getService#

#if ENABLE_OVERLOADING
    NetworkServiceGetServiceMethodInfo      ,
#endif
    networkServiceGetService                ,


-- ** new #method:new#

    networkServiceNew                       ,


-- ** setScheme #method:setScheme#

#if ENABLE_OVERLOADING
    NetworkServiceSetSchemeMethodInfo       ,
#endif
    networkServiceSetScheme                 ,




 -- * Properties
-- ** domain #attr:domain#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    NetworkServiceDomainPropertyInfo        ,
#endif
    constructNetworkServiceDomain           ,
    getNetworkServiceDomain                 ,
#if ENABLE_OVERLOADING
    networkServiceDomain                    ,
#endif


-- ** protocol #attr:protocol#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    NetworkServiceProtocolPropertyInfo      ,
#endif
    constructNetworkServiceProtocol         ,
    getNetworkServiceProtocol               ,
#if ENABLE_OVERLOADING
    networkServiceProtocol                  ,
#endif


-- ** scheme #attr:scheme#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    NetworkServiceSchemePropertyInfo        ,
#endif
    constructNetworkServiceScheme           ,
    getNetworkServiceScheme                 ,
#if ENABLE_OVERLOADING
    networkServiceScheme                    ,
#endif
    setNetworkServiceScheme                 ,


-- ** service #attr:service#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    NetworkServiceServicePropertyInfo       ,
#endif
    constructNetworkServiceService          ,
    getNetworkServiceService                ,
#if ENABLE_OVERLOADING
    networkServiceService                   ,
#endif




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.SocketConnectable as Gio.SocketConnectable

-- | Memory-managed wrapper type.
newtype NetworkService = NetworkService (ManagedPtr NetworkService)
foreign import ccall "g_network_service_get_type"
    c_g_network_service_get_type :: IO GType

instance GObject NetworkService where
    gobjectType :: NetworkService -> IO GType
gobjectType _ = IO GType
c_g_network_service_get_type
    

-- | Type class for types which can be safely cast to `NetworkService`, for instance with `toNetworkService`.
class GObject o => IsNetworkService o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError NetworkService a) =>
    IsNetworkService a
#endif
instance IsNetworkService NetworkService
instance GObject.Object.IsObject NetworkService
instance Gio.SocketConnectable.IsSocketConnectable NetworkService

-- | Cast to `NetworkService`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toNetworkService :: (MonadIO m, IsNetworkService o) => o -> m NetworkService
toNetworkService :: o -> m NetworkService
toNetworkService = IO NetworkService -> m NetworkService
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO NetworkService -> m NetworkService)
-> (o -> IO NetworkService) -> o -> m NetworkService
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr NetworkService -> NetworkService)
-> o -> IO NetworkService
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr NetworkService -> NetworkService
NetworkService

-- | A convenience alias for `Nothing` :: `Maybe` `NetworkService`.
noNetworkService :: Maybe NetworkService
noNetworkService :: Maybe NetworkService
noNetworkService = Maybe NetworkService
forall a. Maybe a
Nothing

#if ENABLE_OVERLOADING
type family ResolveNetworkServiceMethod (t :: Symbol) (o :: *) :: * where
    ResolveNetworkServiceMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveNetworkServiceMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveNetworkServiceMethod "enumerate" o = Gio.SocketConnectable.SocketConnectableEnumerateMethodInfo
    ResolveNetworkServiceMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveNetworkServiceMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveNetworkServiceMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveNetworkServiceMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveNetworkServiceMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveNetworkServiceMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveNetworkServiceMethod "proxyEnumerate" o = Gio.SocketConnectable.SocketConnectableProxyEnumerateMethodInfo
    ResolveNetworkServiceMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveNetworkServiceMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveNetworkServiceMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveNetworkServiceMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveNetworkServiceMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveNetworkServiceMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveNetworkServiceMethod "toString" o = Gio.SocketConnectable.SocketConnectableToStringMethodInfo
    ResolveNetworkServiceMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveNetworkServiceMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveNetworkServiceMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveNetworkServiceMethod "getDomain" o = NetworkServiceGetDomainMethodInfo
    ResolveNetworkServiceMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveNetworkServiceMethod "getProtocol" o = NetworkServiceGetProtocolMethodInfo
    ResolveNetworkServiceMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveNetworkServiceMethod "getScheme" o = NetworkServiceGetSchemeMethodInfo
    ResolveNetworkServiceMethod "getService" o = NetworkServiceGetServiceMethodInfo
    ResolveNetworkServiceMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveNetworkServiceMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveNetworkServiceMethod "setScheme" o = NetworkServiceSetSchemeMethodInfo
    ResolveNetworkServiceMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveNetworkServiceMethod t NetworkService, O.MethodInfo info NetworkService p) => O.IsLabelProxy t (NetworkService -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveNetworkServiceMethod t NetworkService, O.MethodInfo info NetworkService p) => O.IsLabel t (NetworkService -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

-- VVV Prop "domain"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@domain@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' networkService #domain
@
-}
getNetworkServiceDomain :: (MonadIO m, IsNetworkService o) => o -> m T.Text
getNetworkServiceDomain :: o -> m Text
getNetworkServiceDomain obj :: o
obj = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe Text) -> IO Text
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing "getNetworkServiceDomain" (IO (Maybe Text) -> IO Text) -> IO (Maybe Text) -> IO Text
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
getObjectPropertyString o
obj "domain"

{- |
Construct a `GValueConstruct` with valid value for the “@domain@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructNetworkServiceDomain :: (IsNetworkService o) => T.Text -> IO (GValueConstruct o)
constructNetworkServiceDomain :: Text -> IO (GValueConstruct o)
constructNetworkServiceDomain val :: Text
val = String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
constructObjectPropertyString "domain" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

#if ENABLE_OVERLOADING
data NetworkServiceDomainPropertyInfo
instance AttrInfo NetworkServiceDomainPropertyInfo where
    type AttrAllowedOps NetworkServiceDomainPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint NetworkServiceDomainPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint NetworkServiceDomainPropertyInfo = IsNetworkService
    type AttrGetType NetworkServiceDomainPropertyInfo = T.Text
    type AttrLabel NetworkServiceDomainPropertyInfo = "domain"
    type AttrOrigin NetworkServiceDomainPropertyInfo = NetworkService
    attrGet _ = getNetworkServiceDomain
    attrSet _ = undefined
    attrConstruct _ = constructNetworkServiceDomain
    attrClear _ = undefined
#endif

-- VVV Prop "protocol"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@protocol@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' networkService #protocol
@
-}
getNetworkServiceProtocol :: (MonadIO m, IsNetworkService o) => o -> m T.Text
getNetworkServiceProtocol :: o -> m Text
getNetworkServiceProtocol obj :: o
obj = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe Text) -> IO Text
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing "getNetworkServiceProtocol" (IO (Maybe Text) -> IO Text) -> IO (Maybe Text) -> IO Text
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
getObjectPropertyString o
obj "protocol"

{- |
Construct a `GValueConstruct` with valid value for the “@protocol@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructNetworkServiceProtocol :: (IsNetworkService o) => T.Text -> IO (GValueConstruct o)
constructNetworkServiceProtocol :: Text -> IO (GValueConstruct o)
constructNetworkServiceProtocol val :: Text
val = String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
constructObjectPropertyString "protocol" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

#if ENABLE_OVERLOADING
data NetworkServiceProtocolPropertyInfo
instance AttrInfo NetworkServiceProtocolPropertyInfo where
    type AttrAllowedOps NetworkServiceProtocolPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint NetworkServiceProtocolPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint NetworkServiceProtocolPropertyInfo = IsNetworkService
    type AttrGetType NetworkServiceProtocolPropertyInfo = T.Text
    type AttrLabel NetworkServiceProtocolPropertyInfo = "protocol"
    type AttrOrigin NetworkServiceProtocolPropertyInfo = NetworkService
    attrGet _ = getNetworkServiceProtocol
    attrSet _ = undefined
    attrConstruct _ = constructNetworkServiceProtocol
    attrClear _ = undefined
#endif

-- VVV Prop "scheme"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

{- |
Get the value of the “@scheme@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' networkService #scheme
@
-}
getNetworkServiceScheme :: (MonadIO m, IsNetworkService o) => o -> m T.Text
getNetworkServiceScheme :: o -> m Text
getNetworkServiceScheme obj :: o
obj = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe Text) -> IO Text
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing "getNetworkServiceScheme" (IO (Maybe Text) -> IO Text) -> IO (Maybe Text) -> IO Text
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
getObjectPropertyString o
obj "scheme"

{- |
Set the value of the “@scheme@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' networkService [ #scheme 'Data.GI.Base.Attributes.:=' value ]
@
-}
setNetworkServiceScheme :: (MonadIO m, IsNetworkService o) => o -> T.Text -> m ()
setNetworkServiceScheme :: o -> Text -> m ()
setNetworkServiceScheme obj :: o
obj val :: Text
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Text -> IO ()
forall a. GObject a => a -> String -> Maybe Text -> IO ()
setObjectPropertyString o
obj "scheme" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

{- |
Construct a `GValueConstruct` with valid value for the “@scheme@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructNetworkServiceScheme :: (IsNetworkService o) => T.Text -> IO (GValueConstruct o)
constructNetworkServiceScheme :: Text -> IO (GValueConstruct o)
constructNetworkServiceScheme val :: Text
val = String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
constructObjectPropertyString "scheme" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

#if ENABLE_OVERLOADING
data NetworkServiceSchemePropertyInfo
instance AttrInfo NetworkServiceSchemePropertyInfo where
    type AttrAllowedOps NetworkServiceSchemePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint NetworkServiceSchemePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint NetworkServiceSchemePropertyInfo = IsNetworkService
    type AttrGetType NetworkServiceSchemePropertyInfo = T.Text
    type AttrLabel NetworkServiceSchemePropertyInfo = "scheme"
    type AttrOrigin NetworkServiceSchemePropertyInfo = NetworkService
    attrGet _ = getNetworkServiceScheme
    attrSet _ = setNetworkServiceScheme
    attrConstruct _ = constructNetworkServiceScheme
    attrClear _ = undefined
#endif

-- VVV Prop "service"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@service@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' networkService #service
@
-}
getNetworkServiceService :: (MonadIO m, IsNetworkService o) => o -> m T.Text
getNetworkServiceService :: o -> m Text
getNetworkServiceService obj :: o
obj = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe Text) -> IO Text
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing "getNetworkServiceService" (IO (Maybe Text) -> IO Text) -> IO (Maybe Text) -> IO Text
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe Text)
forall a. GObject a => a -> String -> IO (Maybe Text)
getObjectPropertyString o
obj "service"

{- |
Construct a `GValueConstruct` with valid value for the “@service@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructNetworkServiceService :: (IsNetworkService o) => T.Text -> IO (GValueConstruct o)
constructNetworkServiceService :: Text -> IO (GValueConstruct o)
constructNetworkServiceService val :: Text
val = String -> Maybe Text -> IO (GValueConstruct o)
forall o. String -> Maybe Text -> IO (GValueConstruct o)
constructObjectPropertyString "service" (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
val)

#if ENABLE_OVERLOADING
data NetworkServiceServicePropertyInfo
instance AttrInfo NetworkServiceServicePropertyInfo where
    type AttrAllowedOps NetworkServiceServicePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint NetworkServiceServicePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint NetworkServiceServicePropertyInfo = IsNetworkService
    type AttrGetType NetworkServiceServicePropertyInfo = T.Text
    type AttrLabel NetworkServiceServicePropertyInfo = "service"
    type AttrOrigin NetworkServiceServicePropertyInfo = NetworkService
    attrGet _ = getNetworkServiceService
    attrSet _ = undefined
    attrConstruct _ = constructNetworkServiceService
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList NetworkService
type instance O.AttributeList NetworkService = NetworkServiceAttributeList
type NetworkServiceAttributeList = ('[ '("domain", NetworkServiceDomainPropertyInfo), '("protocol", NetworkServiceProtocolPropertyInfo), '("scheme", NetworkServiceSchemePropertyInfo), '("service", NetworkServiceServicePropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
networkServiceDomain :: AttrLabelProxy "domain"
networkServiceDomain = AttrLabelProxy

networkServiceProtocol :: AttrLabelProxy "protocol"
networkServiceProtocol = AttrLabelProxy

networkServiceScheme :: AttrLabelProxy "scheme"
networkServiceScheme = AttrLabelProxy

networkServiceService :: AttrLabelProxy "service"
networkServiceService = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList NetworkService = NetworkServiceSignalList
type NetworkServiceSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method NetworkService::new
-- method type : Constructor
-- Args : [Arg {argCName = "service", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the service type to look up (eg, \"ldap\")", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "protocol", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the networking protocol to use for @service (eg, \"tcp\")", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "domain", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the DNS domain to look up the service in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "NetworkService"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_network_service_new" g_network_service_new :: 
    CString ->                              -- service : TBasicType TUTF8
    CString ->                              -- protocol : TBasicType TUTF8
    CString ->                              -- domain : TBasicType TUTF8
    IO (Ptr NetworkService)

{- |
Creates a new 'GI.Gio.Objects.NetworkService.NetworkService' representing the given /@service@/,
/@protocol@/, and /@domain@/. This will initially be unresolved; use the
'GI.Gio.Interfaces.SocketConnectable.SocketConnectable' interface to resolve it.

/Since: 2.22/
-}
networkServiceNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@service@/: the service type to look up (eg, \"ldap\") -}
    -> T.Text
    {- ^ /@protocol@/: the networking protocol to use for /@service@/ (eg, \"tcp\") -}
    -> T.Text
    {- ^ /@domain@/: the DNS domain to look up the service in -}
    -> m NetworkService
    {- ^ __Returns:__ a new 'GI.Gio.Objects.NetworkService.NetworkService' -}
networkServiceNew :: Text -> Text -> Text -> m NetworkService
networkServiceNew service :: Text
service protocol :: Text
protocol domain :: Text
domain = IO NetworkService -> m NetworkService
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO NetworkService -> m NetworkService)
-> IO NetworkService -> m NetworkService
forall a b. (a -> b) -> a -> b
$ do
    CString
service' <- Text -> IO CString
textToCString Text
service
    CString
protocol' <- Text -> IO CString
textToCString Text
protocol
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr NetworkService
result <- CString -> CString -> CString -> IO (Ptr NetworkService)
g_network_service_new CString
service' CString
protocol' CString
domain'
    Text -> Ptr NetworkService -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "networkServiceNew" Ptr NetworkService
result
    NetworkService
result' <- ((ManagedPtr NetworkService -> NetworkService)
-> Ptr NetworkService -> IO NetworkService
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr NetworkService -> NetworkService
NetworkService) Ptr NetworkService
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
service'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
protocol'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    NetworkService -> IO NetworkService
forall (m :: * -> *) a. Monad m => a -> m a
return NetworkService
result'

#if ENABLE_OVERLOADING
#endif

-- method NetworkService::get_domain
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "srv", argType = TInterface (Name {namespace = "Gio", name = "NetworkService"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GNetworkService", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_network_service_get_domain" g_network_service_get_domain :: 
    Ptr NetworkService ->                   -- srv : TInterface (Name {namespace = "Gio", name = "NetworkService"})
    IO CString

{- |
Gets the domain that /@srv@/ serves. This might be either UTF-8 or
ASCII-encoded, depending on what /@srv@/ was created with.

/Since: 2.22/
-}
networkServiceGetDomain ::
    (B.CallStack.HasCallStack, MonadIO m, IsNetworkService a) =>
    a
    {- ^ /@srv@/: a 'GI.Gio.Objects.NetworkService.NetworkService' -}
    -> m T.Text
    {- ^ __Returns:__ /@srv@/\'s domain name -}
networkServiceGetDomain :: a -> m Text
networkServiceGetDomain srv :: a
srv = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr NetworkService
srv' <- a -> IO (Ptr NetworkService)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
srv
    CString
result <- Ptr NetworkService -> IO CString
g_network_service_get_domain Ptr NetworkService
srv'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "networkServiceGetDomain" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
srv
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if ENABLE_OVERLOADING
data NetworkServiceGetDomainMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsNetworkService a) => O.MethodInfo NetworkServiceGetDomainMethodInfo a signature where
    overloadedMethod _ = networkServiceGetDomain

#endif

-- method NetworkService::get_protocol
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "srv", argType = TInterface (Name {namespace = "Gio", name = "NetworkService"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GNetworkService", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_network_service_get_protocol" g_network_service_get_protocol :: 
    Ptr NetworkService ->                   -- srv : TInterface (Name {namespace = "Gio", name = "NetworkService"})
    IO CString

{- |
Gets /@srv@/\'s protocol name (eg, \"tcp\").

/Since: 2.22/
-}
networkServiceGetProtocol ::
    (B.CallStack.HasCallStack, MonadIO m, IsNetworkService a) =>
    a
    {- ^ /@srv@/: a 'GI.Gio.Objects.NetworkService.NetworkService' -}
    -> m T.Text
    {- ^ __Returns:__ /@srv@/\'s protocol name -}
networkServiceGetProtocol :: a -> m Text
networkServiceGetProtocol srv :: a
srv = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr NetworkService
srv' <- a -> IO (Ptr NetworkService)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
srv
    CString
result <- Ptr NetworkService -> IO CString
g_network_service_get_protocol Ptr NetworkService
srv'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "networkServiceGetProtocol" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
srv
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if ENABLE_OVERLOADING
data NetworkServiceGetProtocolMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsNetworkService a) => O.MethodInfo NetworkServiceGetProtocolMethodInfo a signature where
    overloadedMethod _ = networkServiceGetProtocol

#endif

-- method NetworkService::get_scheme
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "srv", argType = TInterface (Name {namespace = "Gio", name = "NetworkService"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GNetworkService", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_network_service_get_scheme" g_network_service_get_scheme :: 
    Ptr NetworkService ->                   -- srv : TInterface (Name {namespace = "Gio", name = "NetworkService"})
    IO CString

{- |
Get\'s the URI scheme used to resolve proxies. By default, the service name
is used as scheme.

/Since: 2.26/
-}
networkServiceGetScheme ::
    (B.CallStack.HasCallStack, MonadIO m, IsNetworkService a) =>
    a
    {- ^ /@srv@/: a 'GI.Gio.Objects.NetworkService.NetworkService' -}
    -> m T.Text
    {- ^ __Returns:__ /@srv@/\'s scheme name -}
networkServiceGetScheme :: a -> m Text
networkServiceGetScheme srv :: a
srv = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr NetworkService
srv' <- a -> IO (Ptr NetworkService)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
srv
    CString
result <- Ptr NetworkService -> IO CString
g_network_service_get_scheme Ptr NetworkService
srv'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "networkServiceGetScheme" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
srv
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if ENABLE_OVERLOADING
data NetworkServiceGetSchemeMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsNetworkService a) => O.MethodInfo NetworkServiceGetSchemeMethodInfo a signature where
    overloadedMethod _ = networkServiceGetScheme

#endif

-- method NetworkService::get_service
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "srv", argType = TInterface (Name {namespace = "Gio", name = "NetworkService"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GNetworkService", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_network_service_get_service" g_network_service_get_service :: 
    Ptr NetworkService ->                   -- srv : TInterface (Name {namespace = "Gio", name = "NetworkService"})
    IO CString

{- |
Gets /@srv@/\'s service name (eg, \"ldap\").

/Since: 2.22/
-}
networkServiceGetService ::
    (B.CallStack.HasCallStack, MonadIO m, IsNetworkService a) =>
    a
    {- ^ /@srv@/: a 'GI.Gio.Objects.NetworkService.NetworkService' -}
    -> m T.Text
    {- ^ __Returns:__ /@srv@/\'s service name -}
networkServiceGetService :: a -> m Text
networkServiceGetService srv :: a
srv = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr NetworkService
srv' <- a -> IO (Ptr NetworkService)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
srv
    CString
result <- Ptr NetworkService -> IO CString
g_network_service_get_service Ptr NetworkService
srv'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "networkServiceGetService" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
srv
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if ENABLE_OVERLOADING
data NetworkServiceGetServiceMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsNetworkService a) => O.MethodInfo NetworkServiceGetServiceMethodInfo a signature where
    overloadedMethod _ = networkServiceGetService

#endif

-- method NetworkService::set_scheme
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "srv", argType = TInterface (Name {namespace = "Gio", name = "NetworkService"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GNetworkService", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "scheme", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a URI scheme", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_network_service_set_scheme" g_network_service_set_scheme :: 
    Ptr NetworkService ->                   -- srv : TInterface (Name {namespace = "Gio", name = "NetworkService"})
    CString ->                              -- scheme : TBasicType TUTF8
    IO ()

{- |
Set\'s the URI scheme used to resolve proxies. By default, the service name
is used as scheme.

/Since: 2.26/
-}
networkServiceSetScheme ::
    (B.CallStack.HasCallStack, MonadIO m, IsNetworkService a) =>
    a
    {- ^ /@srv@/: a 'GI.Gio.Objects.NetworkService.NetworkService' -}
    -> T.Text
    {- ^ /@scheme@/: a URI scheme -}
    -> m ()
networkServiceSetScheme :: a -> Text -> m ()
networkServiceSetScheme srv :: a
srv scheme :: Text
scheme = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr NetworkService
srv' <- a -> IO (Ptr NetworkService)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
srv
    CString
scheme' <- Text -> IO CString
textToCString Text
scheme
    Ptr NetworkService -> CString -> IO ()
g_network_service_set_scheme Ptr NetworkService
srv' CString
scheme'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
srv
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
scheme'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if ENABLE_OVERLOADING
data NetworkServiceSetSchemeMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsNetworkService a) => O.MethodInfo NetworkServiceSetSchemeMethodInfo a signature where
    overloadedMethod _ = networkServiceSetScheme

#endif