{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) Represents a plain text credential. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Ggit.Objects.CredPlaintext ( -- * Exported types CredPlaintext(..) , IsCredPlaintext , toCredPlaintext , noCredPlaintext , -- * Methods -- ** getPassword #method:getPassword# #if ENABLE_OVERLOADING CredPlaintextGetPasswordMethodInfo , #endif credPlaintextGetPassword , -- ** getUsername #method:getUsername# #if ENABLE_OVERLOADING CredPlaintextGetUsernameMethodInfo , #endif credPlaintextGetUsername , -- ** new #method:new# credPlaintextNew , -- * Properties -- ** password #attr:password# {- | /No description available in the introspection data./ -} #if ENABLE_OVERLOADING CredPlaintextPasswordPropertyInfo , #endif constructCredPlaintextPassword , #if ENABLE_OVERLOADING credPlaintextPassword , #endif getCredPlaintextPassword , -- ** username #attr:username# {- | /No description available in the introspection data./ -} #if ENABLE_OVERLOADING CredPlaintextUsernamePropertyInfo , #endif constructCredPlaintextUsername , #if 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.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) foreign import ccall "ggit_cred_plaintext_get_type" c_ggit_cred_plaintext_get_type :: IO GType instance GObject CredPlaintext where gobjectType = c_ggit_cred_plaintext_get_type -- | 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 = liftIO . unsafeCastTo CredPlaintext -- | A convenience alias for `Nothing` :: `Maybe` `CredPlaintext`. noCredPlaintext :: Maybe CredPlaintext noCredPlaintext = Nothing #if 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 "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 (O.MethodProxy :: O.MethodProxy info) #else fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy 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 is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' credPlaintext #password @ -} getCredPlaintextPassword :: (MonadIO m, IsCredPlaintext o) => o -> m T.Text getCredPlaintextPassword obj = liftIO $ checkUnexpectedNothing "getCredPlaintextPassword" $ B.Properties.getObjectPropertyString 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 val = B.Properties.constructObjectPropertyString "password" (Just val) #if ENABLE_OVERLOADING data CredPlaintextPasswordPropertyInfo instance AttrInfo CredPlaintextPasswordPropertyInfo where type AttrAllowedOps CredPlaintextPasswordPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear] type AttrSetTypeConstraint CredPlaintextPasswordPropertyInfo = (~) T.Text type AttrBaseTypeConstraint CredPlaintextPasswordPropertyInfo = IsCredPlaintext type AttrGetType CredPlaintextPasswordPropertyInfo = T.Text type AttrLabel CredPlaintextPasswordPropertyInfo = "password" type AttrOrigin CredPlaintextPasswordPropertyInfo = CredPlaintext attrGet _ = getCredPlaintextPassword attrSet _ = undefined 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 is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' credPlaintext #username @ -} getCredPlaintextUsername :: (MonadIO m, IsCredPlaintext o) => o -> m T.Text getCredPlaintextUsername obj = liftIO $ checkUnexpectedNothing "getCredPlaintextUsername" $ B.Properties.getObjectPropertyString 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 val = B.Properties.constructObjectPropertyString "username" (Just val) #if ENABLE_OVERLOADING data CredPlaintextUsernamePropertyInfo instance AttrInfo CredPlaintextUsernamePropertyInfo where type AttrAllowedOps CredPlaintextUsernamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear] type AttrSetTypeConstraint CredPlaintextUsernamePropertyInfo = (~) T.Text type AttrBaseTypeConstraint CredPlaintextUsernamePropertyInfo = IsCredPlaintext type AttrGetType CredPlaintextUsernamePropertyInfo = T.Text type AttrLabel CredPlaintextUsernamePropertyInfo = "username" type AttrOrigin CredPlaintextUsernamePropertyInfo = CredPlaintext attrGet _ = getCredPlaintextUsername attrSet _ = undefined attrConstruct _ = constructCredPlaintextUsername attrClear _ = undefined #endif #if 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 ENABLE_OVERLOADING credPlaintextPassword :: AttrLabelProxy "password" credPlaintextPassword = AttrLabelProxy credPlaintextUsername :: AttrLabelProxy "username" credPlaintextUsername = AttrLabelProxy #endif #if 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 username password = liftIO $ do username' <- textToCString username password' <- textToCString password onException (do result <- propagateGError $ ggit_cred_plaintext_new username' password' checkUnexpectedReturnNULL "credPlaintextNew" result result' <- (wrapObject CredPlaintext) result freeMem username' freeMem password' return result' ) (do freeMem username' freeMem password' ) #if 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 cred = liftIO $ do cred' <- unsafeManagedPtrCastPtr cred result <- ggit_cred_plaintext_get_password cred' checkUnexpectedReturnNULL "credPlaintextGetPassword" result result' <- cstringToText result touchManagedPtr cred return result' #if 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 cred = liftIO $ do cred' <- unsafeManagedPtrCastPtr cred result <- ggit_cred_plaintext_get_username cred' checkUnexpectedReturnNULL "credPlaintextGetUsername" result result' <- cstringToText result touchManagedPtr cred return result' #if ENABLE_OVERLOADING data CredPlaintextGetUsernameMethodInfo instance (signature ~ (m T.Text), MonadIO m, IsCredPlaintext a) => O.MethodInfo CredPlaintextGetUsernameMethodInfo a signature where overloadedMethod _ = credPlaintextGetUsername #endif