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

module GI.Atk.Interfaces.StreamableContent
    ( 

-- * Exported types
    StreamableContent(..)                   ,
    noStreamableContent                     ,
    StreamableContentK                      ,


 -- * Methods
-- ** streamableContentGetMimeType
    streamableContentGetMimeType            ,


-- ** streamableContentGetNMimeTypes
    streamableContentGetNMimeTypes          ,


-- ** streamableContentGetStream
    streamableContentGetStream              ,


-- ** streamableContentGetUri
    streamableContentGetUri                 ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Atk.Types
import GI.Atk.Callbacks
import qualified GI.GLib as GLib

-- interface StreamableContent 

newtype StreamableContent = StreamableContent (ForeignPtr StreamableContent)
noStreamableContent :: Maybe StreamableContent
noStreamableContent = Nothing

type instance AttributeList StreamableContent = StreamableContentAttributeList
type StreamableContentAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList StreamableContent = StreamableContentSignalList
type StreamableContentSignalList = ('[ ] :: [(Symbol, *)])

class ForeignPtrNewtype a => StreamableContentK a
instance (ForeignPtrNewtype o, IsDescendantOf StreamableContent o) => StreamableContentK o
type instance ParentTypes StreamableContent = StreamableContentParentTypes
type StreamableContentParentTypes = '[]

-- method StreamableContent::get_mime_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "StreamableContent", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "StreamableContent", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "atk_streamable_content_get_mime_type" atk_streamable_content_get_mime_type :: 
    Ptr StreamableContent ->                -- _obj : TInterface "Atk" "StreamableContent"
    Int32 ->                                -- i : TBasicType TInt32
    IO CString


streamableContentGetMimeType ::
    (MonadIO m, StreamableContentK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- i
    m T.Text
streamableContentGetMimeType _obj i = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_streamable_content_get_mime_type _obj' i
    checkUnexpectedReturnNULL "atk_streamable_content_get_mime_type" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method StreamableContent::get_n_mime_types
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "StreamableContent", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "StreamableContent", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False

foreign import ccall "atk_streamable_content_get_n_mime_types" atk_streamable_content_get_n_mime_types :: 
    Ptr StreamableContent ->                -- _obj : TInterface "Atk" "StreamableContent"
    IO Int32


streamableContentGetNMimeTypes ::
    (MonadIO m, StreamableContentK a) =>
    a ->                                    -- _obj
    m Int32
streamableContentGetNMimeTypes _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_streamable_content_get_n_mime_types _obj'
    touchManagedPtr _obj
    return result

-- method StreamableContent::get_stream
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "StreamableContent", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mime_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "StreamableContent", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mime_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GLib" "IOChannel"
-- throws : False
-- Skip return : False

foreign import ccall "atk_streamable_content_get_stream" atk_streamable_content_get_stream :: 
    Ptr StreamableContent ->                -- _obj : TInterface "Atk" "StreamableContent"
    CString ->                              -- mime_type : TBasicType TUTF8
    IO (Ptr GLib.IOChannel)


streamableContentGetStream ::
    (MonadIO m, StreamableContentK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- mime_type
    m GLib.IOChannel
streamableContentGetStream _obj mime_type = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    mime_type' <- textToCString mime_type
    result <- atk_streamable_content_get_stream _obj' mime_type'
    checkUnexpectedReturnNULL "atk_streamable_content_get_stream" result
    result' <- (wrapBoxed GLib.IOChannel) result
    touchManagedPtr _obj
    freeMem mime_type'
    return result'

-- method StreamableContent::get_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "StreamableContent", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mime_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "StreamableContent", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mime_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "atk_streamable_content_get_uri" atk_streamable_content_get_uri :: 
    Ptr StreamableContent ->                -- _obj : TInterface "Atk" "StreamableContent"
    CString ->                              -- mime_type : TBasicType TUTF8
    IO CString


streamableContentGetUri ::
    (MonadIO m, StreamableContentK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- mime_type
    m T.Text
streamableContentGetUri _obj mime_type = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    mime_type' <- textToCString mime_type
    result <- atk_streamable_content_get_uri _obj' mime_type'
    checkUnexpectedReturnNULL "atk_streamable_content_get_uri" result
    result' <- cstringToText result
    touchManagedPtr _obj
    freeMem mime_type'
    return result'