{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Represents a plain text credential.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Ggit.Objects.CredPlaintext
    ( 

-- * Exported types
    CredPlaintext(..)                       ,
    IsCredPlaintext                         ,
    toCredPlaintext                         ,
    noCredPlaintext                         ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveCredPlaintextMethod              ,
#endif


-- ** getPassword #method:getPassword#

#if defined(ENABLE_OVERLOADING)
    CredPlaintextGetPasswordMethodInfo      ,
#endif
    credPlaintextGetPassword                ,


-- ** getUsername #method:getUsername#

#if defined(ENABLE_OVERLOADING)
    CredPlaintextGetUsernameMethodInfo      ,
#endif
    credPlaintextGetUsername                ,


-- ** new #method:new#

    credPlaintextNew                        ,




 -- * Properties
-- ** password #attr:password#
-- | /No description available in the introspection data./

#if defined(ENABLE_OVERLOADING)
    CredPlaintextPasswordPropertyInfo       ,
#endif
    constructCredPlaintextPassword          ,
#if defined(ENABLE_OVERLOADING)
    credPlaintextPassword                   ,
#endif
    getCredPlaintextPassword                ,


-- ** username #attr:username#
-- | /No description available in the introspection data./

#if defined(ENABLE_OVERLOADING)
    CredPlaintextUsernamePropertyInfo       ,
#endif
    constructCredPlaintextUsername          ,
#if defined(ENABLE_OVERLOADING)
    credPlaintextUsername                   ,
#endif
    getCredPlaintextUsername                ,




    ) 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.GClosure as B.GClosure
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.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
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 GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Ggit.Objects.Cred as Ggit.Cred
import {-# SOURCE #-} qualified GI.Ggit.Objects.Native as Ggit.Native
import {-# SOURCE #-} qualified GI.Ggit.Objects.ObjectFactoryBase as Ggit.ObjectFactoryBase
import qualified GI.Gio.Interfaces.Initable as Gio.Initable

-- | Memory-managed wrapper type.
newtype CredPlaintext = CredPlaintext (ManagedPtr CredPlaintext)
    deriving (CredPlaintext -> CredPlaintext -> Bool
(CredPlaintext -> CredPlaintext -> Bool)
-> (CredPlaintext -> CredPlaintext -> Bool) -> Eq CredPlaintext
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CredPlaintext -> CredPlaintext -> Bool
$c/= :: CredPlaintext -> CredPlaintext -> Bool
== :: CredPlaintext -> CredPlaintext -> Bool
$c== :: CredPlaintext -> CredPlaintext -> Bool
Eq)
foreign import ccall "ggit_cred_plaintext_get_type"
    c_ggit_cred_plaintext_get_type :: IO GType

instance GObject CredPlaintext where
    gobjectType :: IO GType
gobjectType = IO GType
c_ggit_cred_plaintext_get_type
    

-- | Convert 'CredPlaintext' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue CredPlaintext where
    toGValue :: CredPlaintext -> IO GValue
toGValue o :: CredPlaintext
o = do
        GType
gtype <- IO GType
c_ggit_cred_plaintext_get_type
        CredPlaintext -> (Ptr CredPlaintext -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr CredPlaintext
o (GType
-> (GValue -> Ptr CredPlaintext -> IO ())
-> Ptr CredPlaintext
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr CredPlaintext -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO CredPlaintext
fromGValue gv :: GValue
gv = do
        Ptr CredPlaintext
ptr <- GValue -> IO (Ptr CredPlaintext)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr CredPlaintext)
        (ManagedPtr CredPlaintext -> CredPlaintext)
-> Ptr CredPlaintext -> IO CredPlaintext
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr CredPlaintext -> CredPlaintext
CredPlaintext Ptr CredPlaintext
ptr
        
    

-- | Type class for types which can be safely cast to `CredPlaintext`, for instance with `toCredPlaintext`.
class (GObject o, O.IsDescendantOf CredPlaintext o) => IsCredPlaintext o
instance (GObject o, O.IsDescendantOf CredPlaintext o) => IsCredPlaintext o

instance O.HasParentTypes CredPlaintext
type instance O.ParentTypes CredPlaintext = '[Ggit.Cred.Cred, Ggit.Native.Native, Ggit.ObjectFactoryBase.ObjectFactoryBase, GObject.Object.Object, Gio.Initable.Initable]

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

-- | A convenience alias for `Nothing` :: `Maybe` `CredPlaintext`.
noCredPlaintext :: Maybe CredPlaintext
noCredPlaintext :: Maybe CredPlaintext
noCredPlaintext = Maybe CredPlaintext
forall a. Maybe a
Nothing

#if defined(ENABLE_OVERLOADING)
type family ResolveCredPlaintextMethod (t :: Symbol) (o :: *) :: * where
    ResolveCredPlaintextMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveCredPlaintextMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveCredPlaintextMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveCredPlaintextMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveCredPlaintextMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveCredPlaintextMethod "init" o = Gio.Initable.InitableInitMethodInfo
    ResolveCredPlaintextMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveCredPlaintextMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveCredPlaintextMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveCredPlaintextMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveCredPlaintextMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveCredPlaintextMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveCredPlaintextMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveCredPlaintextMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveCredPlaintextMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveCredPlaintextMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveCredPlaintextMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveCredPlaintextMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveCredPlaintextMethod "getPassword" o = CredPlaintextGetPasswordMethodInfo
    ResolveCredPlaintextMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveCredPlaintextMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveCredPlaintextMethod "getUsername" o = CredPlaintextGetUsernameMethodInfo
    ResolveCredPlaintextMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveCredPlaintextMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveCredPlaintextMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveCredPlaintextMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveCredPlaintextMethod t CredPlaintext, O.MethodInfo info CredPlaintext p) => OL.IsLabel t (CredPlaintext -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif

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

-- | Get the value of the “@password@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' credPlaintext #password
-- @
getCredPlaintextPassword :: (MonadIO m, IsCredPlaintext o) => o -> m T.Text
getCredPlaintextPassword :: o -> m Text
getCredPlaintextPassword 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 "getCredPlaintextPassword" (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)
B.Properties.getObjectPropertyString o
obj "password"

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

#if defined(ENABLE_OVERLOADING)
data CredPlaintextPasswordPropertyInfo
instance AttrInfo CredPlaintextPasswordPropertyInfo where
    type AttrAllowedOps CredPlaintextPasswordPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint CredPlaintextPasswordPropertyInfo = IsCredPlaintext
    type AttrSetTypeConstraint CredPlaintextPasswordPropertyInfo = (~) T.Text
    type AttrTransferTypeConstraint CredPlaintextPasswordPropertyInfo = (~) T.Text
    type AttrTransferType CredPlaintextPasswordPropertyInfo = T.Text
    type AttrGetType CredPlaintextPasswordPropertyInfo = T.Text
    type AttrLabel CredPlaintextPasswordPropertyInfo = "password"
    type AttrOrigin CredPlaintextPasswordPropertyInfo = CredPlaintext
    attrGet = getCredPlaintextPassword
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructCredPlaintextPassword
    attrClear = undefined
#endif

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

-- | Get the value of the “@username@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' credPlaintext #username
-- @
getCredPlaintextUsername :: (MonadIO m, IsCredPlaintext o) => o -> m T.Text
getCredPlaintextUsername :: o -> m Text
getCredPlaintextUsername 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 "getCredPlaintextUsername" (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)
B.Properties.getObjectPropertyString o
obj "username"

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

#if defined(ENABLE_OVERLOADING)
data CredPlaintextUsernamePropertyInfo
instance AttrInfo CredPlaintextUsernamePropertyInfo where
    type AttrAllowedOps CredPlaintextUsernamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint CredPlaintextUsernamePropertyInfo = IsCredPlaintext
    type AttrSetTypeConstraint CredPlaintextUsernamePropertyInfo = (~) T.Text
    type AttrTransferTypeConstraint CredPlaintextUsernamePropertyInfo = (~) T.Text
    type AttrTransferType CredPlaintextUsernamePropertyInfo = T.Text
    type AttrGetType CredPlaintextUsernamePropertyInfo = T.Text
    type AttrLabel CredPlaintextUsernamePropertyInfo = "username"
    type AttrOrigin CredPlaintextUsernamePropertyInfo = CredPlaintext
    attrGet = getCredPlaintextUsername
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructCredPlaintextUsername
    attrClear = undefined
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList CredPlaintext
type instance O.AttributeList CredPlaintext = CredPlaintextAttributeList
type CredPlaintextAttributeList = ('[ '("native", Ggit.Native.NativeNativePropertyInfo), '("password", CredPlaintextPasswordPropertyInfo), '("username", CredPlaintextUsernamePropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
credPlaintextPassword :: AttrLabelProxy "password"
credPlaintextPassword = AttrLabelProxy

credPlaintextUsername :: AttrLabelProxy "username"
credPlaintextUsername = AttrLabelProxy

#endif

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

#endif

-- method CredPlaintext::new
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "username"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "password"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Ggit" , name = "CredPlaintext" })
-- throws : True
-- Skip return : False

foreign import ccall "ggit_cred_plaintext_new" ggit_cred_plaintext_new :: 
    CString ->                              -- username : TBasicType TUTF8
    CString ->                              -- password : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr CredPlaintext)

-- | /No description available in the introspection data./
credPlaintextNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -> T.Text
    -> m CredPlaintext
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
credPlaintextNew :: Text -> Text -> m CredPlaintext
credPlaintextNew username :: Text
username password :: Text
password = IO CredPlaintext -> m CredPlaintext
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CredPlaintext -> m CredPlaintext)
-> IO CredPlaintext -> m CredPlaintext
forall a b. (a -> b) -> a -> b
$ do
    CString
username' <- Text -> IO CString
textToCString Text
username
    CString
password' <- Text -> IO CString
textToCString Text
password
    IO CredPlaintext -> IO () -> IO CredPlaintext
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr CredPlaintext
result <- (Ptr (Ptr GError) -> IO (Ptr CredPlaintext))
-> IO (Ptr CredPlaintext)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr CredPlaintext))
 -> IO (Ptr CredPlaintext))
-> (Ptr (Ptr GError) -> IO (Ptr CredPlaintext))
-> IO (Ptr CredPlaintext)
forall a b. (a -> b) -> a -> b
$ CString -> CString -> Ptr (Ptr GError) -> IO (Ptr CredPlaintext)
ggit_cred_plaintext_new CString
username' CString
password'
        Text -> Ptr CredPlaintext -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "credPlaintextNew" Ptr CredPlaintext
result
        CredPlaintext
result' <- ((ManagedPtr CredPlaintext -> CredPlaintext)
-> Ptr CredPlaintext -> IO CredPlaintext
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr CredPlaintext -> CredPlaintext
CredPlaintext) Ptr CredPlaintext
result
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
username'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
password'
        CredPlaintext -> IO CredPlaintext
forall (m :: * -> *) a. Monad m => a -> m a
return CredPlaintext
result'
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
username'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
password'
     )

#if defined(ENABLE_OVERLOADING)
#endif

-- method CredPlaintext::get_password
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "cred"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "CredPlaintext" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , 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 "ggit_cred_plaintext_get_password" ggit_cred_plaintext_get_password :: 
    Ptr CredPlaintext ->                    -- cred : TInterface (Name {namespace = "Ggit", name = "CredPlaintext"})
    IO CString

-- | /No description available in the introspection data./
credPlaintextGetPassword ::
    (B.CallStack.HasCallStack, MonadIO m, IsCredPlaintext a) =>
    a
    -> m T.Text
credPlaintextGetPassword :: a -> m Text
credPlaintextGetPassword cred :: a
cred = 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 CredPlaintext
cred' <- a -> IO (Ptr CredPlaintext)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cred
    CString
result <- Ptr CredPlaintext -> IO CString
ggit_cred_plaintext_get_password Ptr CredPlaintext
cred'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "credPlaintextGetPassword" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cred
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data CredPlaintextGetPasswordMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsCredPlaintext a) => O.MethodInfo CredPlaintextGetPasswordMethodInfo a signature where
    overloadedMethod = credPlaintextGetPassword

#endif

-- method CredPlaintext::get_username
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "cred"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "CredPlaintext" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , 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 "ggit_cred_plaintext_get_username" ggit_cred_plaintext_get_username :: 
    Ptr CredPlaintext ->                    -- cred : TInterface (Name {namespace = "Ggit", name = "CredPlaintext"})
    IO CString

-- | /No description available in the introspection data./
credPlaintextGetUsername ::
    (B.CallStack.HasCallStack, MonadIO m, IsCredPlaintext a) =>
    a
    -> m T.Text
credPlaintextGetUsername :: a -> m Text
credPlaintextGetUsername cred :: a
cred = 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 CredPlaintext
cred' <- a -> IO (Ptr CredPlaintext)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cred
    CString
result <- Ptr CredPlaintext -> IO CString
ggit_cred_plaintext_get_username Ptr CredPlaintext
cred'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "credPlaintextGetUsername" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cred
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data CredPlaintextGetUsernameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsCredPlaintext a) => O.MethodInfo CredPlaintextGetUsernameMethodInfo a signature where
    overloadedMethod = credPlaintextGetUsername

#endif