{- |
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.WebKit2.Objects.URIResponse
    ( 

-- * Exported types
    URIResponse(..)                         ,
    URIResponseK                            ,
    toURIResponse                           ,
    noURIResponse                           ,


 -- * Methods
-- ** uRIResponseGetContentLength
    uRIResponseGetContentLength             ,


-- ** uRIResponseGetHttpHeaders
    uRIResponseGetHttpHeaders               ,


-- ** uRIResponseGetMimeType
    uRIResponseGetMimeType                  ,


-- ** uRIResponseGetStatusCode
    uRIResponseGetStatusCode                ,


-- ** uRIResponseGetSuggestedFilename
    uRIResponseGetSuggestedFilename         ,


-- ** uRIResponseGetUri
    uRIResponseGetUri                       ,




 -- * Properties
-- ** ContentLength
    URIResponseContentLengthPropertyInfo    ,
    getURIResponseContentLength             ,


-- ** HttpHeaders
    URIResponseHttpHeadersPropertyInfo      ,
    getURIResponseHttpHeaders               ,


-- ** MimeType
    URIResponseMimeTypePropertyInfo         ,
    getURIResponseMimeType                  ,


-- ** StatusCode
    URIResponseStatusCodePropertyInfo       ,
    getURIResponseStatusCode                ,


-- ** SuggestedFilename
    URIResponseSuggestedFilenamePropertyInfo,
    getURIResponseSuggestedFilename         ,


-- ** Uri
    URIResponseUriPropertyInfo              ,
    getURIResponseUri                       ,




    ) 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.WebKit2.Types
import GI.WebKit2.Callbacks
import qualified GI.GObject as GObject
import qualified GI.Soup as Soup

newtype URIResponse = URIResponse (ForeignPtr URIResponse)
foreign import ccall "webkit_uri_response_get_type"
    c_webkit_uri_response_get_type :: IO GType

type instance ParentTypes URIResponse = URIResponseParentTypes
type URIResponseParentTypes = '[GObject.Object]

instance GObject URIResponse where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_uri_response_get_type
    

class GObject o => URIResponseK o
instance (GObject o, IsDescendantOf URIResponse o) => URIResponseK o

toURIResponse :: URIResponseK o => o -> IO URIResponse
toURIResponse = unsafeCastTo URIResponse

noURIResponse :: Maybe URIResponse
noURIResponse = Nothing

-- VVV Prop "content-length"
   -- Type: TBasicType TUInt64
   -- Flags: [PropertyReadable]

getURIResponseContentLength :: (MonadIO m, URIResponseK o) => o -> m Word64
getURIResponseContentLength obj = liftIO $ getObjectPropertyUInt64 obj "content-length"

data URIResponseContentLengthPropertyInfo
instance AttrInfo URIResponseContentLengthPropertyInfo where
    type AttrAllowedOps URIResponseContentLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint URIResponseContentLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint URIResponseContentLengthPropertyInfo = URIResponseK
    type AttrGetType URIResponseContentLengthPropertyInfo = Word64
    type AttrLabel URIResponseContentLengthPropertyInfo = "URIResponse::content-length"
    attrGet _ = getURIResponseContentLength
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "http-headers"
   -- Type: TInterface "Soup" "MessageHeaders"
   -- Flags: [PropertyReadable]

getURIResponseHttpHeaders :: (MonadIO m, URIResponseK o) => o -> m Soup.MessageHeaders
getURIResponseHttpHeaders obj = liftIO $ getObjectPropertyBoxed obj "http-headers" Soup.MessageHeaders

data URIResponseHttpHeadersPropertyInfo
instance AttrInfo URIResponseHttpHeadersPropertyInfo where
    type AttrAllowedOps URIResponseHttpHeadersPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint URIResponseHttpHeadersPropertyInfo = (~) ()
    type AttrBaseTypeConstraint URIResponseHttpHeadersPropertyInfo = URIResponseK
    type AttrGetType URIResponseHttpHeadersPropertyInfo = Soup.MessageHeaders
    type AttrLabel URIResponseHttpHeadersPropertyInfo = "URIResponse::http-headers"
    attrGet _ = getURIResponseHttpHeaders
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "mime-type"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]

getURIResponseMimeType :: (MonadIO m, URIResponseK o) => o -> m T.Text
getURIResponseMimeType obj = liftIO $ getObjectPropertyString obj "mime-type"

data URIResponseMimeTypePropertyInfo
instance AttrInfo URIResponseMimeTypePropertyInfo where
    type AttrAllowedOps URIResponseMimeTypePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint URIResponseMimeTypePropertyInfo = (~) ()
    type AttrBaseTypeConstraint URIResponseMimeTypePropertyInfo = URIResponseK
    type AttrGetType URIResponseMimeTypePropertyInfo = T.Text
    type AttrLabel URIResponseMimeTypePropertyInfo = "URIResponse::mime-type"
    attrGet _ = getURIResponseMimeType
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "status-code"
   -- Type: TBasicType TUInt32
   -- Flags: [PropertyReadable]

getURIResponseStatusCode :: (MonadIO m, URIResponseK o) => o -> m Word32
getURIResponseStatusCode obj = liftIO $ getObjectPropertyCUInt obj "status-code"

data URIResponseStatusCodePropertyInfo
instance AttrInfo URIResponseStatusCodePropertyInfo where
    type AttrAllowedOps URIResponseStatusCodePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint URIResponseStatusCodePropertyInfo = (~) ()
    type AttrBaseTypeConstraint URIResponseStatusCodePropertyInfo = URIResponseK
    type AttrGetType URIResponseStatusCodePropertyInfo = Word32
    type AttrLabel URIResponseStatusCodePropertyInfo = "URIResponse::status-code"
    attrGet _ = getURIResponseStatusCode
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "suggested-filename"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]

getURIResponseSuggestedFilename :: (MonadIO m, URIResponseK o) => o -> m T.Text
getURIResponseSuggestedFilename obj = liftIO $ getObjectPropertyString obj "suggested-filename"

data URIResponseSuggestedFilenamePropertyInfo
instance AttrInfo URIResponseSuggestedFilenamePropertyInfo where
    type AttrAllowedOps URIResponseSuggestedFilenamePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint URIResponseSuggestedFilenamePropertyInfo = (~) ()
    type AttrBaseTypeConstraint URIResponseSuggestedFilenamePropertyInfo = URIResponseK
    type AttrGetType URIResponseSuggestedFilenamePropertyInfo = T.Text
    type AttrLabel URIResponseSuggestedFilenamePropertyInfo = "URIResponse::suggested-filename"
    attrGet _ = getURIResponseSuggestedFilename
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "uri"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]

getURIResponseUri :: (MonadIO m, URIResponseK o) => o -> m T.Text
getURIResponseUri obj = liftIO $ getObjectPropertyString obj "uri"

data URIResponseUriPropertyInfo
instance AttrInfo URIResponseUriPropertyInfo where
    type AttrAllowedOps URIResponseUriPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint URIResponseUriPropertyInfo = (~) ()
    type AttrBaseTypeConstraint URIResponseUriPropertyInfo = URIResponseK
    type AttrGetType URIResponseUriPropertyInfo = T.Text
    type AttrLabel URIResponseUriPropertyInfo = "URIResponse::uri"
    attrGet _ = getURIResponseUri
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList URIResponse = URIResponseAttributeList
type URIResponseAttributeList = ('[ '("content-length", URIResponseContentLengthPropertyInfo), '("http-headers", URIResponseHttpHeadersPropertyInfo), '("mime-type", URIResponseMimeTypePropertyInfo), '("status-code", URIResponseStatusCodePropertyInfo), '("suggested-filename", URIResponseSuggestedFilenamePropertyInfo), '("uri", URIResponseUriPropertyInfo)] :: [(Symbol, *)])

type instance SignalList URIResponse = URIResponseSignalList
type URIResponseSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

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

foreign import ccall "webkit_uri_response_get_content_length" webkit_uri_response_get_content_length :: 
    Ptr URIResponse ->                      -- _obj : TInterface "WebKit2" "URIResponse"
    IO Word64


uRIResponseGetContentLength ::
    (MonadIO m, URIResponseK a) =>
    a ->                                    -- _obj
    m Word64
uRIResponseGetContentLength _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_uri_response_get_content_length _obj'
    touchManagedPtr _obj
    return result

-- method URIResponse::get_http_headers
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2" "URIResponse", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2" "URIResponse", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Soup" "MessageHeaders"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_uri_response_get_http_headers" webkit_uri_response_get_http_headers :: 
    Ptr URIResponse ->                      -- _obj : TInterface "WebKit2" "URIResponse"
    IO (Ptr Soup.MessageHeaders)


uRIResponseGetHttpHeaders ::
    (MonadIO m, URIResponseK a) =>
    a ->                                    -- _obj
    m Soup.MessageHeaders
uRIResponseGetHttpHeaders _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_uri_response_get_http_headers _obj'
    checkUnexpectedReturnNULL "webkit_uri_response_get_http_headers" result
    result' <- (newBoxed Soup.MessageHeaders) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_uri_response_get_mime_type" webkit_uri_response_get_mime_type :: 
    Ptr URIResponse ->                      -- _obj : TInterface "WebKit2" "URIResponse"
    IO CString


uRIResponseGetMimeType ::
    (MonadIO m, URIResponseK a) =>
    a ->                                    -- _obj
    m T.Text
uRIResponseGetMimeType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_uri_response_get_mime_type _obj'
    checkUnexpectedReturnNULL "webkit_uri_response_get_mime_type" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_uri_response_get_status_code" webkit_uri_response_get_status_code :: 
    Ptr URIResponse ->                      -- _obj : TInterface "WebKit2" "URIResponse"
    IO Word32


uRIResponseGetStatusCode ::
    (MonadIO m, URIResponseK a) =>
    a ->                                    -- _obj
    m Word32
uRIResponseGetStatusCode _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_uri_response_get_status_code _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "webkit_uri_response_get_suggested_filename" webkit_uri_response_get_suggested_filename :: 
    Ptr URIResponse ->                      -- _obj : TInterface "WebKit2" "URIResponse"
    IO CString


uRIResponseGetSuggestedFilename ::
    (MonadIO m, URIResponseK a) =>
    a ->                                    -- _obj
    m T.Text
uRIResponseGetSuggestedFilename _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_uri_response_get_suggested_filename _obj'
    checkUnexpectedReturnNULL "webkit_uri_response_get_suggested_filename" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_uri_response_get_uri" webkit_uri_response_get_uri :: 
    Ptr URIResponse ->                      -- _obj : TInterface "WebKit2" "URIResponse"
    IO CString


uRIResponseGetUri ::
    (MonadIO m, URIResponseK a) =>
    a ->                                    -- _obj
    m T.Text
uRIResponseGetUri _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_uri_response_get_uri _obj'
    checkUnexpectedReturnNULL "webkit_uri_response_get_uri" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'