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

A 'GI.Gst.Structs.Uri.Uri' object can be used to parse and split a URI string into its
constituant parts. Two 'GI.Gst.Structs.Uri.Uri' objects can be joined to make a new 'GI.Gst.Structs.Uri.Uri'
using the algorithm described in RFC3986.
-}

module GI.Gst.Structs.Uri
    ( 

-- * Exported types
    Uri(..)                                 ,
    noUri                                   ,


 -- * Methods
-- ** appendPath #method:appendPath#
    UriAppendPathMethodInfo                 ,
    uriAppendPath                           ,


-- ** appendPathSegment #method:appendPathSegment#
    UriAppendPathSegmentMethodInfo          ,
    uriAppendPathSegment                    ,


-- ** construct #method:construct#
    uriConstruct                            ,


-- ** equal #method:equal#
    UriEqualMethodInfo                      ,
    uriEqual                                ,


-- ** fromString #method:fromString#
    uriFromString                           ,


-- ** fromStringWithBase #method:fromStringWithBase#
    UriFromStringWithBaseMethodInfo         ,
    uriFromStringWithBase                   ,


-- ** getFragment #method:getFragment#
    UriGetFragmentMethodInfo                ,
    uriGetFragment                          ,


-- ** getHost #method:getHost#
    UriGetHostMethodInfo                    ,
    uriGetHost                              ,


-- ** getLocation #method:getLocation#
    uriGetLocation                          ,


-- ** getPath #method:getPath#
    UriGetPathMethodInfo                    ,
    uriGetPath                              ,


-- ** getPathSegments #method:getPathSegments#
    UriGetPathSegmentsMethodInfo            ,
    uriGetPathSegments                      ,


-- ** getPathString #method:getPathString#
    UriGetPathStringMethodInfo              ,
    uriGetPathString                        ,


-- ** getPort #method:getPort#
    UriGetPortMethodInfo                    ,
    uriGetPort                              ,


-- ** getProtocol #method:getProtocol#
    uriGetProtocol                          ,


-- ** getQueryKeys #method:getQueryKeys#
    UriGetQueryKeysMethodInfo               ,
    uriGetQueryKeys                         ,


-- ** getQueryString #method:getQueryString#
    UriGetQueryStringMethodInfo             ,
    uriGetQueryString                       ,


-- ** getQueryTable #method:getQueryTable#
    UriGetQueryTableMethodInfo              ,
    uriGetQueryTable                        ,


-- ** getQueryValue #method:getQueryValue#
    UriGetQueryValueMethodInfo              ,
    uriGetQueryValue                        ,


-- ** getScheme #method:getScheme#
    UriGetSchemeMethodInfo                  ,
    uriGetScheme                            ,


-- ** getUserinfo #method:getUserinfo#
    UriGetUserinfoMethodInfo                ,
    uriGetUserinfo                          ,


-- ** hasProtocol #method:hasProtocol#
    uriHasProtocol                          ,


-- ** isNormalized #method:isNormalized#
    UriIsNormalizedMethodInfo               ,
    uriIsNormalized                         ,


-- ** isValid #method:isValid#
    uriIsValid                              ,


-- ** isWritable #method:isWritable#
    UriIsWritableMethodInfo                 ,
    uriIsWritable                           ,


-- ** join #method:join#
    UriJoinMethodInfo                       ,
    uriJoin                                 ,


-- ** joinStrings #method:joinStrings#
    uriJoinStrings                          ,


-- ** makeWritable #method:makeWritable#
    UriMakeWritableMethodInfo               ,
    uriMakeWritable                         ,


-- ** new #method:new#
    uriNew                                  ,


-- ** newWithBase #method:newWithBase#
    UriNewWithBaseMethodInfo                ,
    uriNewWithBase                          ,


-- ** normalize #method:normalize#
    UriNormalizeMethodInfo                  ,
    uriNormalize                            ,


-- ** protocolIsSupported #method:protocolIsSupported#
    uriProtocolIsSupported                  ,


-- ** protocolIsValid #method:protocolIsValid#
    uriProtocolIsValid                      ,


-- ** queryHasKey #method:queryHasKey#
    UriQueryHasKeyMethodInfo                ,
    uriQueryHasKey                          ,


-- ** removeQueryKey #method:removeQueryKey#
    UriRemoveQueryKeyMethodInfo             ,
    uriRemoveQueryKey                       ,


-- ** setFragment #method:setFragment#
    UriSetFragmentMethodInfo                ,
    uriSetFragment                          ,


-- ** setHost #method:setHost#
    UriSetHostMethodInfo                    ,
    uriSetHost                              ,


-- ** setPath #method:setPath#
    UriSetPathMethodInfo                    ,
    uriSetPath                              ,


-- ** setPathSegments #method:setPathSegments#
    UriSetPathSegmentsMethodInfo            ,
    uriSetPathSegments                      ,


-- ** setPathString #method:setPathString#
    UriSetPathStringMethodInfo              ,
    uriSetPathString                        ,


-- ** setPort #method:setPort#
    UriSetPortMethodInfo                    ,
    uriSetPort                              ,


-- ** setQueryString #method:setQueryString#
    UriSetQueryStringMethodInfo             ,
    uriSetQueryString                       ,


-- ** setQueryTable #method:setQueryTable#
    UriSetQueryTableMethodInfo              ,
    uriSetQueryTable                        ,


-- ** setQueryValue #method:setQueryValue#
    UriSetQueryValueMethodInfo              ,
    uriSetQueryValue                        ,


-- ** setScheme #method:setScheme#
    UriSetSchemeMethodInfo                  ,
    uriSetScheme                            ,


-- ** setUserinfo #method:setUserinfo#
    UriSetUserinfoMethodInfo                ,
    uriSetUserinfo                          ,


-- ** toString #method:toString#
    UriToStringMethodInfo                   ,
    uriToString                             ,




    ) 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.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 {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums

newtype Uri = Uri (ManagedPtr Uri)
foreign import ccall "gst_uri_get_type" c_gst_uri_get_type :: 
    IO GType

instance BoxedObject Uri where
    boxedType _ = c_gst_uri_get_type

noUri :: Maybe Uri
noUri = Nothing


instance O.HasAttributeList Uri
type instance O.AttributeList Uri = UriAttributeList
type UriAttributeList = ('[ ] :: [(Symbol, *)])

-- method Uri::new
-- method type : Constructor
-- Args : [Arg {argCName = "scheme", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The scheme for the new URI.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "userinfo", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The user-info for the new URI.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "host", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The host name for the new URI.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "port", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The port number for the new URI or %GST_URI_NO_PORT.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The path for the new URI with '/' separating path\n                     elements.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The query string for the new URI with '&' separating\n                      query elements. Elements containing '&' characters\n                      should encode them as \"%26\".", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fragment", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The fragment name for the new URI.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Uri"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_new" gst_uri_new :: 
    CString ->                              -- scheme : TBasicType TUTF8
    CString ->                              -- userinfo : TBasicType TUTF8
    CString ->                              -- host : TBasicType TUTF8
    Word32 ->                               -- port : TBasicType TUInt
    CString ->                              -- path : TBasicType TUTF8
    CString ->                              -- query : TBasicType TUTF8
    CString ->                              -- fragment : TBasicType TUTF8
    IO (Ptr Uri)

{- |
Creates a new 'GI.Gst.Structs.Uri.Uri' object with the given URI parts. The path and query
strings will be broken down into their elements. All strings should not be
escaped except where indicated.

@since 1.6
-}
uriNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    {- ^ /@scheme@/: The scheme for the new URI. -}
    -> Maybe (T.Text)
    {- ^ /@userinfo@/: The user-info for the new URI. -}
    -> Maybe (T.Text)
    {- ^ /@host@/: The host name for the new URI. -}
    -> Word32
    {- ^ /@port@/: The port number for the new URI or 'GI.Gst.Constants.URI_NO_PORT'. -}
    -> Maybe (T.Text)
    {- ^ /@path@/: The path for the new URI with \'\/\' separating path
                     elements. -}
    -> Maybe (T.Text)
    {- ^ /@query@/: The query string for the new URI with \'&\' separating
                      query elements. Elements containing \'&\' characters
                      should encode them as \"%26\". -}
    -> Maybe (T.Text)
    {- ^ /@fragment@/: The fragment name for the new URI. -}
    -> m Uri
    {- ^ __Returns:__ A new 'GI.Gst.Structs.Uri.Uri' object. -}
uriNew scheme userinfo host port path query fragment = liftIO $ do
    maybeScheme <- case scheme of
        Nothing -> return nullPtr
        Just jScheme -> do
            jScheme' <- textToCString jScheme
            return jScheme'
    maybeUserinfo <- case userinfo of
        Nothing -> return nullPtr
        Just jUserinfo -> do
            jUserinfo' <- textToCString jUserinfo
            return jUserinfo'
    maybeHost <- case host of
        Nothing -> return nullPtr
        Just jHost -> do
            jHost' <- textToCString jHost
            return jHost'
    maybePath <- case path of
        Nothing -> return nullPtr
        Just jPath -> do
            jPath' <- textToCString jPath
            return jPath'
    maybeQuery <- case query of
        Nothing -> return nullPtr
        Just jQuery -> do
            jQuery' <- textToCString jQuery
            return jQuery'
    maybeFragment <- case fragment of
        Nothing -> return nullPtr
        Just jFragment -> do
            jFragment' <- textToCString jFragment
            return jFragment'
    result <- gst_uri_new maybeScheme maybeUserinfo maybeHost port maybePath maybeQuery maybeFragment
    checkUnexpectedReturnNULL "uriNew" result
    result' <- (wrapBoxed Uri) result
    freeMem maybeScheme
    freeMem maybeUserinfo
    freeMem maybeHost
    freeMem maybePath
    freeMem maybeQuery
    freeMem maybeFragment
    return result'

-- method Uri::append_path
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "relative_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Relative path to append to the end of the current path.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_append_path" gst_uri_append_path :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- relative_path : TBasicType TUTF8
    IO CInt

{- |
Append a path onto the end of the path in the URI. The path is not
normalized, call @/gst_uri_normalize/@() to normalize the path.

@since 1.6
-}
uriAppendPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> T.Text
    {- ^ /@relativePath@/: Relative path to append to the end of the current path. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the path was appended successfully. -}
uriAppendPath uri relativePath = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    relativePath' <- textToCString relativePath
    result <- gst_uri_append_path uri' relativePath'
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem relativePath'
    return result'

data UriAppendPathMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo UriAppendPathMethodInfo Uri signature where
    overloadedMethod _ = uriAppendPath

-- method Uri::append_path_segment
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path_segment", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The path segment string to append to the URI path.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_append_path_segment" gst_uri_append_path_segment :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- path_segment : TBasicType TUTF8
    IO CInt

{- |
Append a single path segment onto the end of the URI path.

@since 1.6
-}
uriAppendPathSegment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> T.Text
    {- ^ /@pathSegment@/: The path segment string to append to the URI path. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the path was appended successfully. -}
uriAppendPathSegment uri pathSegment = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    pathSegment' <- textToCString pathSegment
    result <- gst_uri_append_path_segment uri' pathSegment'
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem pathSegment'
    return result'

data UriAppendPathSegmentMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo UriAppendPathSegmentMethodInfo Uri signature where
    overloadedMethod _ = uriAppendPathSegment

-- method Uri::equal
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "first", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "First #GstUri to compare.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "second", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Second #GstUri to compare.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_equal" gst_uri_equal :: 
    Ptr Uri ->                              -- first : TInterface (Name {namespace = "Gst", name = "Uri"})
    Ptr Uri ->                              -- second : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CInt

{- |
Compares two 'GI.Gst.Structs.Uri.Uri' objects to see if they represent the same normalized
URI.

@since 1.6
-}
uriEqual ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@first@/: First 'GI.Gst.Structs.Uri.Uri' to compare. -}
    -> Uri
    {- ^ /@second@/: Second 'GI.Gst.Structs.Uri.Uri' to compare. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the normalized versions of the two URI\'s would be equal. -}
uriEqual first second = liftIO $ do
    first' <- unsafeManagedPtrGetPtr first
    second' <- unsafeManagedPtrGetPtr second
    result <- gst_uri_equal first' second'
    let result' = (/= 0) result
    touchManagedPtr first
    touchManagedPtr second
    return result'

data UriEqualMethodInfo
instance (signature ~ (Uri -> m Bool), MonadIO m) => O.MethodInfo UriEqualMethodInfo Uri signature where
    overloadedMethod _ = uriEqual

-- method Uri::from_string_with_base
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "base", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The base URI to join the new URI with.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The URI string to parse.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Uri"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_from_string_with_base" gst_uri_from_string_with_base :: 
    Ptr Uri ->                              -- base : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- uri : TBasicType TUTF8
    IO (Ptr Uri)

{- |
Like 'GI.Gst.Functions.uriFromString' but also joins with a base URI.

@since 1.6
-}
uriFromStringWithBase ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@base@/: The base URI to join the new URI with. -}
    -> T.Text
    {- ^ /@uri@/: The URI string to parse. -}
    -> m Uri
    {- ^ __Returns:__ A new 'GI.Gst.Structs.Uri.Uri' object. -}
uriFromStringWithBase base uri = liftIO $ do
    base' <- unsafeManagedPtrGetPtr base
    uri' <- textToCString uri
    result <- gst_uri_from_string_with_base base' uri'
    checkUnexpectedReturnNULL "uriFromStringWithBase" result
    result' <- (wrapBoxed Uri) result
    touchManagedPtr base
    freeMem uri'
    return result'

data UriFromStringWithBaseMethodInfo
instance (signature ~ (T.Text -> m Uri), MonadIO m) => O.MethodInfo UriFromStringWithBaseMethodInfo Uri signature where
    overloadedMethod _ = uriFromStringWithBase

-- method Uri::get_fragment
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "This #GstUri object.", 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 "gst_uri_get_fragment" gst_uri_get_fragment :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CString

{- |
Get the fragment name from the URI or 'Nothing' if it doesn\'t exist.
If /@uri@/ is 'Nothing' then returns 'Nothing'.

@since 1.6
-}
uriGetFragment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: This 'GI.Gst.Structs.Uri.Uri' object. -}
    -> m T.Text
    {- ^ __Returns:__ The host name from the 'GI.Gst.Structs.Uri.Uri' object or 'Nothing'. -}
uriGetFragment uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_fragment uri'
    checkUnexpectedReturnNULL "uriGetFragment" result
    result' <- cstringToText result
    touchManagedPtr uri
    return result'

data UriGetFragmentMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo UriGetFragmentMethodInfo Uri signature where
    overloadedMethod _ = uriGetFragment

-- method Uri::get_host
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "This #GstUri object.", 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 "gst_uri_get_host" gst_uri_get_host :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CString

{- |
Get the host name from the URI or 'Nothing' if it doesn\'t exist.
If /@uri@/ is 'Nothing' then returns 'Nothing'.

@since 1.6
-}
uriGetHost ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: This 'GI.Gst.Structs.Uri.Uri' object. -}
    -> m T.Text
    {- ^ __Returns:__ The host name from the 'GI.Gst.Structs.Uri.Uri' object or 'Nothing'. -}
uriGetHost uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_host uri'
    checkUnexpectedReturnNULL "uriGetHost" result
    result' <- cstringToText result
    touchManagedPtr uri
    return result'

data UriGetHostMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo UriGetHostMethodInfo Uri signature where
    overloadedMethod _ = uriGetHost

-- method Uri::get_path
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to get the path from.", 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 "gst_uri_get_path" gst_uri_get_path :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CString

{- |
Extract the path string from the URI object.

@since 1.6
-}
uriGetPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to get the path from. -}
    -> m T.Text
    {- ^ __Returns:__ The path from the URI. Once finished with the
                          string should be 'GI.GLib.Functions.free'\'d. -}
uriGetPath uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_path uri'
    checkUnexpectedReturnNULL "uriGetPath" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr uri
    return result'

data UriGetPathMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo UriGetPathMethodInfo Uri signature where
    overloadedMethod _ = uriGetPath

-- method Uri::get_path_segments
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to get the path from.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_get_path_segments" gst_uri_get_path_segments :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO (Ptr (GList CString))

{- |
Get a list of path segments from the URI.

@since 1.6
-}
uriGetPathSegments ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to get the path from. -}
    -> m [T.Text]
    {- ^ __Returns:__ A 'GI.GLib.Structs.List.List' of path segment
         strings or 'Nothing' if no path segments are available. Free the list
         when no longer needed with g_list_free_full(list, g_free). -}
uriGetPathSegments uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_path_segments uri'
    result' <- unpackGList result
    result'' <- mapM cstringToText result'
    mapGList freeMem result
    g_list_free result
    touchManagedPtr uri
    return result''

data UriGetPathSegmentsMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m) => O.MethodInfo UriGetPathSegmentsMethodInfo Uri signature where
    overloadedMethod _ = uriGetPathSegments

-- method Uri::get_path_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to get the path from.", 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 "gst_uri_get_path_string" gst_uri_get_path_string :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CString

{- |
Extract the path string from the URI object as a percent encoded URI path.

@since 1.6
-}
uriGetPathString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to get the path from. -}
    -> m T.Text
    {- ^ __Returns:__ The path from the URI. Once finished with the
                          string should be 'GI.GLib.Functions.free'\'d. -}
uriGetPathString uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_path_string uri'
    checkUnexpectedReturnNULL "uriGetPathString" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr uri
    return result'

data UriGetPathStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo UriGetPathStringMethodInfo Uri signature where
    overloadedMethod _ = uriGetPathString

-- method Uri::get_port
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "This #GstUri object.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_get_port" gst_uri_get_port :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO Word32

{- |
Get the port number from the URI or 'GI.Gst.Constants.URI_NO_PORT' if it doesn\'t exist.
If /@uri@/ is 'Nothing' then returns 'GI.Gst.Constants.URI_NO_PORT'.

@since 1.6
-}
uriGetPort ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: This 'GI.Gst.Structs.Uri.Uri' object. -}
    -> m Word32
    {- ^ __Returns:__ The port number from the 'GI.Gst.Structs.Uri.Uri' object or 'GI.Gst.Constants.URI_NO_PORT'. -}
uriGetPort uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_port uri'
    touchManagedPtr uri
    return result

data UriGetPortMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo UriGetPortMethodInfo Uri signature where
    overloadedMethod _ = uriGetPort

-- method Uri::get_query_keys
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to examine.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_get_query_keys" gst_uri_get_query_keys :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO (Ptr (GList CString))

{- |
Get a list of the query keys from the URI.

@since 1.6
-}
uriGetQueryKeys ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to examine. -}
    -> m [T.Text]
    {- ^ __Returns:__ A list of keys from
         the URI query. Free the list with @/g_list_free()/@. -}
uriGetQueryKeys uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_query_keys uri'
    result' <- unpackGList result
    result'' <- mapM cstringToText result'
    g_list_free result
    touchManagedPtr uri
    return result''

data UriGetQueryKeysMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m) => O.MethodInfo UriGetQueryKeysMethodInfo Uri signature where
    overloadedMethod _ = uriGetQueryKeys

-- method Uri::get_query_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to get the query string from.", 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 "gst_uri_get_query_string" gst_uri_get_query_string :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CString

{- |
Get a percent encoded URI query string from the /@uri@/.

@since 1.6
-}
uriGetQueryString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to get the query string from. -}
    -> m T.Text
    {- ^ __Returns:__ A percent encoded query string. Use 'GI.GLib.Functions.free' when
         no longer needed. -}
uriGetQueryString uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_query_string uri'
    checkUnexpectedReturnNULL "uriGetQueryString" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr uri
    return result'

data UriGetQueryStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo UriGetQueryStringMethodInfo Uri signature where
    overloadedMethod _ = uriGetQueryString

-- method Uri::get_query_table
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to get the query table from.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGHash (TBasicType TUTF8) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_get_query_table" gst_uri_get_query_table :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO (Ptr (GHashTable CString CString))

{- |
Get the query table from the URI. Keys and values in the table are freed
with g_free when they are deleted. A value may be 'Nothing' to indicate that
the key should appear in the query string in the URI, but does not have a
value. Free the returned 'GI.GLib.Structs.HashTable.HashTable' with @/g_hash_table_unref/@() when it is
no longer required. Modifying this hash table will modify the query in the
URI.

@since 1.6
-}
uriGetQueryTable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to get the query table from. -}
    -> m (Map.Map T.Text T.Text)
    {- ^ __Returns:__ The query hash table
         from the URI. -}
uriGetQueryTable uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_query_table uri'
    checkUnexpectedReturnNULL "uriGetQueryTable" result
    result' <- unpackGHashTable result
    let result'' = mapFirst cstringUnpackPtr result'
    result''' <- mapFirstA cstringToText result''
    let result'''' = mapSecond cstringUnpackPtr result'''
    result''''' <- mapSecondA cstringToText result''''
    let result'''''' = Map.fromList result'''''
    unrefGHashTable result
    touchManagedPtr uri
    return result''''''

data UriGetQueryTableMethodInfo
instance (signature ~ (m (Map.Map T.Text T.Text)), MonadIO m) => O.MethodInfo UriGetQueryTableMethodInfo Uri signature where
    overloadedMethod _ = uriGetQueryTable

-- method Uri::get_query_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to examine.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query_key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The key to lookup.", 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 "gst_uri_get_query_value" gst_uri_get_query_value :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- query_key : TBasicType TUTF8
    IO CString

{- |
Get the value associated with the /@queryKey@/ key. Will return 'Nothing' if the
key has no value or if the key does not exist in the URI query table. Because
'Nothing' is returned for both missing keys and keys with no value, you should
use 'GI.Gst.Structs.Uri.uriQueryHasKey' to determine if a key is present in the URI
query.

@since 1.6
-}
uriGetQueryValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to examine. -}
    -> T.Text
    {- ^ /@queryKey@/: The key to lookup. -}
    -> m T.Text
    {- ^ __Returns:__ The value for the given key, or 'Nothing' if not found. -}
uriGetQueryValue uri queryKey = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    queryKey' <- textToCString queryKey
    result <- gst_uri_get_query_value uri' queryKey'
    checkUnexpectedReturnNULL "uriGetQueryValue" result
    result' <- cstringToText result
    touchManagedPtr uri
    freeMem queryKey'
    return result'

data UriGetQueryValueMethodInfo
instance (signature ~ (T.Text -> m T.Text), MonadIO m) => O.MethodInfo UriGetQueryValueMethodInfo Uri signature where
    overloadedMethod _ = uriGetQueryValue

-- method Uri::get_scheme
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "This #GstUri object.", 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 "gst_uri_get_scheme" gst_uri_get_scheme :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CString

{- |
Get the scheme name from the URI or 'Nothing' if it doesn\'t exist.
If /@uri@/ is 'Nothing' then returns 'Nothing'.
-}
uriGetScheme ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: This 'GI.Gst.Structs.Uri.Uri' object. -}
    -> m T.Text
    {- ^ __Returns:__ The scheme from the 'GI.Gst.Structs.Uri.Uri' object or 'Nothing'. -}
uriGetScheme uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_scheme uri'
    checkUnexpectedReturnNULL "uriGetScheme" result
    result' <- cstringToText result
    touchManagedPtr uri
    return result'

data UriGetSchemeMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo UriGetSchemeMethodInfo Uri signature where
    overloadedMethod _ = uriGetScheme

-- method Uri::get_userinfo
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "This #GstUri object.", 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 "gst_uri_get_userinfo" gst_uri_get_userinfo :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CString

{- |
Get the userinfo (usually in the form \"username:password\") from the URI
or 'Nothing' if it doesn\'t exist. If /@uri@/ is 'Nothing' then returns 'Nothing'.

@since 1.6
-}
uriGetUserinfo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: This 'GI.Gst.Structs.Uri.Uri' object. -}
    -> m T.Text
    {- ^ __Returns:__ The userinfo from the 'GI.Gst.Structs.Uri.Uri' object or 'Nothing'. -}
uriGetUserinfo uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_userinfo uri'
    checkUnexpectedReturnNULL "uriGetUserinfo" result
    result' <- cstringToText result
    touchManagedPtr uri
    return result'

data UriGetUserinfoMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo UriGetUserinfoMethodInfo Uri signature where
    overloadedMethod _ = uriGetUserinfo

-- method Uri::is_normalized
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to test to see if it is normalized.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_is_normalized" gst_uri_is_normalized :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CInt

{- |
Tests the /@uri@/ to see if it is normalized. A 'Nothing' /@uri@/ is considered to be
normalized.

@since 1.6
-}
uriIsNormalized ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to test to see if it is normalized. -}
    -> m Bool
    {- ^ __Returns:__ TRUE if the URI is normalized or is 'Nothing'. -}
uriIsNormalized uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_is_normalized uri'
    let result' = (/= 0) result
    touchManagedPtr uri
    return result'

data UriIsNormalizedMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo UriIsNormalizedMethodInfo Uri signature where
    overloadedMethod _ = uriIsNormalized

-- method Uri::is_writable
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri object to test.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_is_writable" gst_uri_is_writable :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CInt

{- |
Check if it is safe to write to this 'GI.Gst.Structs.Uri.Uri'.

Check if the refcount of /@uri@/ is exactly 1, meaning that no other
reference exists to the 'GI.Gst.Structs.Uri.Uri' and that the 'GI.Gst.Structs.Uri.Uri' is therefore writable.

Modification of a 'GI.Gst.Structs.Uri.Uri' should only be done after verifying that it is
writable.

@since 1.6
-}
uriIsWritable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' object to test. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if it is safe to write to the object. -}
uriIsWritable uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_is_writable uri'
    let result' = (/= 0) result
    touchManagedPtr uri
    return result'

data UriIsWritableMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo UriIsWritableMethodInfo Uri signature where
    overloadedMethod _ = uriIsWritable

-- method Uri::join
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "base_uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The base URI to join another to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ref_uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The reference URI to join onto the\n                                       base URI.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Uri"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_join" gst_uri_join :: 
    Ptr Uri ->                              -- base_uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    Ptr Uri ->                              -- ref_uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO (Ptr Uri)

{- |
Join a reference URI onto a base URI using the method from RFC 3986.
If either URI is 'Nothing' then the other URI will be returned with the ref count
increased.

@since 1.6
-}
uriJoin ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@baseUri@/: The base URI to join another to. -}
    -> Maybe (Uri)
    {- ^ /@refUri@/: The reference URI to join onto the
                                       base URI. -}
    -> m Uri
    {- ^ __Returns:__ A 'GI.Gst.Structs.Uri.Uri' which represents the base with the
                          reference URI joined on. -}
uriJoin baseUri refUri = liftIO $ do
    baseUri' <- unsafeManagedPtrGetPtr baseUri
    maybeRefUri <- case refUri of
        Nothing -> return nullPtr
        Just jRefUri -> do
            jRefUri' <- unsafeManagedPtrGetPtr jRefUri
            return jRefUri'
    result <- gst_uri_join baseUri' maybeRefUri
    checkUnexpectedReturnNULL "uriJoin" result
    result' <- (wrapBoxed Uri) result
    touchManagedPtr baseUri
    whenJust refUri touchManagedPtr
    return result'

data UriJoinMethodInfo
instance (signature ~ (Maybe (Uri) -> m Uri), MonadIO m) => O.MethodInfo UriJoinMethodInfo Uri signature where
    overloadedMethod _ = uriJoin

-- method Uri::make_writable
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri object to make writable.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Uri"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_make_writable" gst_uri_make_writable :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO (Ptr Uri)

{- |
Make the 'GI.Gst.Structs.Uri.Uri' writable.

Checks if /@uri@/ is writable, and if so the original object is returned. If
not, then a writable copy is made and returned. This gives away the
reference to /@uri@/ and returns a reference to the new 'GI.Gst.Structs.Uri.Uri'.
If /@uri@/ is 'Nothing' then 'Nothing' is returned.

@since 1.6
-}
uriMakeWritable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' object to make writable. -}
    -> m Uri
    {- ^ __Returns:__ A writable version of /@uri@/. -}
uriMakeWritable uri = liftIO $ do
    uri' <- B.ManagedPtr.disownBoxed uri
    result <- gst_uri_make_writable uri'
    checkUnexpectedReturnNULL "uriMakeWritable" result
    result' <- (wrapBoxed Uri) result
    touchManagedPtr uri
    return result'

data UriMakeWritableMethodInfo
instance (signature ~ (m Uri), MonadIO m) => O.MethodInfo UriMakeWritableMethodInfo Uri signature where
    overloadedMethod _ = uriMakeWritable

-- method Uri::new_with_base
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "base", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The base URI to join the new URI to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "scheme", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The scheme for the new URI.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "userinfo", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The user-info for the new URI.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "host", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The host name for the new URI.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "port", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The port number for the new URI or %GST_URI_NO_PORT.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The path for the new URI with '/' separating path\n                     elements.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The query string for the new URI with '&' separating\n                      query elements. Elements containing '&' characters\n                      should encode them as \"&percnt;26\".", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fragment", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The fragment name for the new URI.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Uri"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_new_with_base" gst_uri_new_with_base :: 
    Ptr Uri ->                              -- base : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- scheme : TBasicType TUTF8
    CString ->                              -- userinfo : TBasicType TUTF8
    CString ->                              -- host : TBasicType TUTF8
    Word32 ->                               -- port : TBasicType TUInt
    CString ->                              -- path : TBasicType TUTF8
    CString ->                              -- query : TBasicType TUTF8
    CString ->                              -- fragment : TBasicType TUTF8
    IO (Ptr Uri)

{- |
Like 'GI.Gst.Structs.Uri.uriNew', but joins the new URI onto a base URI.

@since 1.6
-}
uriNewWithBase ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@base@/: The base URI to join the new URI to. -}
    -> Maybe (T.Text)
    {- ^ /@scheme@/: The scheme for the new URI. -}
    -> Maybe (T.Text)
    {- ^ /@userinfo@/: The user-info for the new URI. -}
    -> Maybe (T.Text)
    {- ^ /@host@/: The host name for the new URI. -}
    -> Word32
    {- ^ /@port@/: The port number for the new URI or 'GI.Gst.Constants.URI_NO_PORT'. -}
    -> Maybe (T.Text)
    {- ^ /@path@/: The path for the new URI with \'\/\' separating path
                     elements. -}
    -> Maybe (T.Text)
    {- ^ /@query@/: The query string for the new URI with \'&\' separating
                      query elements. Elements containing \'&\' characters
                      should encode them as \"&percnt;26\". -}
    -> Maybe (T.Text)
    {- ^ /@fragment@/: The fragment name for the new URI. -}
    -> m Uri
    {- ^ __Returns:__ The new URI joined onto /@base@/. -}
uriNewWithBase base scheme userinfo host port path query fragment = liftIO $ do
    base' <- unsafeManagedPtrGetPtr base
    maybeScheme <- case scheme of
        Nothing -> return nullPtr
        Just jScheme -> do
            jScheme' <- textToCString jScheme
            return jScheme'
    maybeUserinfo <- case userinfo of
        Nothing -> return nullPtr
        Just jUserinfo -> do
            jUserinfo' <- textToCString jUserinfo
            return jUserinfo'
    maybeHost <- case host of
        Nothing -> return nullPtr
        Just jHost -> do
            jHost' <- textToCString jHost
            return jHost'
    maybePath <- case path of
        Nothing -> return nullPtr
        Just jPath -> do
            jPath' <- textToCString jPath
            return jPath'
    maybeQuery <- case query of
        Nothing -> return nullPtr
        Just jQuery -> do
            jQuery' <- textToCString jQuery
            return jQuery'
    maybeFragment <- case fragment of
        Nothing -> return nullPtr
        Just jFragment -> do
            jFragment' <- textToCString jFragment
            return jFragment'
    result <- gst_uri_new_with_base base' maybeScheme maybeUserinfo maybeHost port maybePath maybeQuery maybeFragment
    checkUnexpectedReturnNULL "uriNewWithBase" result
    result' <- (wrapBoxed Uri) result
    touchManagedPtr base
    freeMem maybeScheme
    freeMem maybeUserinfo
    freeMem maybeHost
    freeMem maybePath
    freeMem maybeQuery
    freeMem maybeFragment
    return result'

data UriNewWithBaseMethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (T.Text) -> Maybe (T.Text) -> Word32 -> Maybe (T.Text) -> Maybe (T.Text) -> Maybe (T.Text) -> m Uri), MonadIO m) => O.MethodInfo UriNewWithBaseMethodInfo Uri signature where
    overloadedMethod _ = uriNewWithBase

-- method Uri::normalize
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to normalize.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_normalize" gst_uri_normalize :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CInt

{- |
Normalization will remove extra path segments (\".\" and \"..\") from the URI. It
will also convert the scheme and host name to lower case and any
percent-encoded values to uppercase.

The 'GI.Gst.Structs.Uri.Uri' object must be writable. Check with 'GI.Gst.Structs.Uri.uriIsWritable' or use
'GI.Gst.Structs.Uri.uriMakeWritable' first.

@since 1.6
-}
uriNormalize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to normalize. -}
    -> m Bool
    {- ^ __Returns:__ TRUE if the URI was modified. -}
uriNormalize uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_normalize uri'
    let result' = (/= 0) result
    touchManagedPtr uri
    return result'

data UriNormalizeMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo UriNormalizeMethodInfo Uri signature where
    overloadedMethod _ = uriNormalize

-- method Uri::query_has_key
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to examine.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query_key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The key to lookup.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_query_has_key" gst_uri_query_has_key :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- query_key : TBasicType TUTF8
    IO CInt

{- |
Check if there is a query table entry for the /@queryKey@/ key.

@since 1.6
-}
uriQueryHasKey ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to examine. -}
    -> T.Text
    {- ^ /@queryKey@/: The key to lookup. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@queryKey@/ exists in the URI query table. -}
uriQueryHasKey uri queryKey = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    queryKey' <- textToCString queryKey
    result <- gst_uri_query_has_key uri' queryKey'
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem queryKey'
    return result'

data UriQueryHasKeyMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo UriQueryHasKeyMethodInfo Uri signature where
    overloadedMethod _ = uriQueryHasKey

-- method Uri::remove_query_key
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query_key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The key to remove.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_remove_query_key" gst_uri_remove_query_key :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- query_key : TBasicType TUTF8
    IO CInt

{- |
Remove an entry from the query table by key.

@since 1.6
-}
uriRemoveQueryKey ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> T.Text
    {- ^ /@queryKey@/: The key to remove. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the key existed in the table and was removed. -}
uriRemoveQueryKey uri queryKey = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    queryKey' <- textToCString queryKey
    result <- gst_uri_remove_query_key uri' queryKey'
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem queryKey'
    return result'

data UriRemoveQueryKeyMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo UriRemoveQueryKeyMethodInfo Uri signature where
    overloadedMethod _ = uriRemoveQueryKey

-- method Uri::set_fragment
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fragment", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The fragment string to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_set_fragment" gst_uri_set_fragment :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- fragment : TBasicType TUTF8
    IO CInt

{- |
Sets the fragment string in the URI. Use a value of 'Nothing' in /@fragment@/ to
unset the fragment string.

@since 1.6
-}
uriSetFragment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> Maybe (T.Text)
    {- ^ /@fragment@/: The fragment string to set. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the fragment was set\/unset successfully. -}
uriSetFragment uri fragment = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    maybeFragment <- case fragment of
        Nothing -> return nullPtr
        Just jFragment -> do
            jFragment' <- textToCString jFragment
            return jFragment'
    result <- gst_uri_set_fragment uri' maybeFragment
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem maybeFragment
    return result'

data UriSetFragmentMethodInfo
instance (signature ~ (Maybe (T.Text) -> m Bool), MonadIO m) => O.MethodInfo UriSetFragmentMethodInfo Uri signature where
    overloadedMethod _ = uriSetFragment

-- method Uri::set_host
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "host", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The new host string to set or %NULL to unset.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_set_host" gst_uri_set_host :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- host : TBasicType TUTF8
    IO CInt

{- |
Set or unset the host for the URI.

@since 1.6
-}
uriSetHost ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> T.Text
    {- ^ /@host@/: The new host string to set or 'Nothing' to unset. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the host was set\/unset successfully. -}
uriSetHost uri host = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    host' <- textToCString host
    result <- gst_uri_set_host uri' host'
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem host'
    return result'

data UriSetHostMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo UriSetHostMethodInfo Uri signature where
    overloadedMethod _ = uriSetHost

-- method Uri::set_path
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The new path to set with path segments separated by '/', or use %NULL\n       to unset the path.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_set_path" gst_uri_set_path :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- path : TBasicType TUTF8
    IO CInt

{- |
Sets or unsets the path in the URI.

@since 1.6
-}
uriSetPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> T.Text
    {- ^ /@path@/: The new path to set with path segments separated by \'\/\', or use 'Nothing'
       to unset the path. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the path was set successfully. -}
uriSetPath uri path = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    path' <- textToCString path
    result <- gst_uri_set_path uri' path'
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem path'
    return result'

data UriSetPathMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo UriSetPathMethodInfo Uri signature where
    overloadedMethod _ = uriSetPath

-- method Uri::set_path_segments
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path_segments", argType = TGList (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The new\n                path list to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_set_path_segments" gst_uri_set_path_segments :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    Ptr (GList CString) ->                  -- path_segments : TGList (TBasicType TUTF8)
    IO CInt

{- |
Replace the path segments list in the URI.

@since 1.6
-}
uriSetPathSegments ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> [T.Text]
    {- ^ /@pathSegments@/: The new
                path list to set. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the path segments were set successfully. -}
uriSetPathSegments uri pathSegments = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    pathSegments' <- mapM textToCString pathSegments
    pathSegments'' <- packGList pathSegments'
    result <- gst_uri_set_path_segments uri' pathSegments''
    let result' = (/= 0) result
    touchManagedPtr uri
    return result'

data UriSetPathSegmentsMethodInfo
instance (signature ~ ([T.Text] -> m Bool), MonadIO m) => O.MethodInfo UriSetPathSegmentsMethodInfo Uri signature where
    overloadedMethod _ = uriSetPathSegments

-- method Uri::set_path_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The new percent encoded path to set with path segments separated by\n'/', or use %NULL to unset the path.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_set_path_string" gst_uri_set_path_string :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- path : TBasicType TUTF8
    IO CInt

{- |
Sets or unsets the path in the URI.

@since 1.6
-}
uriSetPathString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> T.Text
    {- ^ /@path@/: The new percent encoded path to set with path segments separated by
\'\/\', or use 'Nothing' to unset the path. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the path was set successfully. -}
uriSetPathString uri path = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    path' <- textToCString path
    result <- gst_uri_set_path_string uri' path'
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem path'
    return result'

data UriSetPathStringMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo UriSetPathStringMethodInfo Uri signature where
    overloadedMethod _ = uriSetPathString

-- method Uri::set_port
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "port", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The new port number to set or %GST_URI_NO_PORT to unset.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_set_port" gst_uri_set_port :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    Word32 ->                               -- port : TBasicType TUInt
    IO CInt

{- |
Set or unset the port number for the URI.

@since 1.6
-}
uriSetPort ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> Word32
    {- ^ /@port@/: The new port number to set or 'GI.Gst.Constants.URI_NO_PORT' to unset. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the port number was set\/unset successfully. -}
uriSetPort uri port = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_set_port uri' port
    let result' = (/= 0) result
    touchManagedPtr uri
    return result'

data UriSetPortMethodInfo
instance (signature ~ (Word32 -> m Bool), MonadIO m) => O.MethodInfo UriSetPortMethodInfo Uri signature where
    overloadedMethod _ = uriSetPort

-- method Uri::set_query_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The new percent encoded query string to use to populate the query\n       table, or use %NULL to unset the query table.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_set_query_string" gst_uri_set_query_string :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- query : TBasicType TUTF8
    IO CInt

{- |
Sets or unsets the query table in the URI.

@since 1.6
-}
uriSetQueryString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> T.Text
    {- ^ /@query@/: The new percent encoded query string to use to populate the query
       table, or use 'Nothing' to unset the query table. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the query table was set successfully. -}
uriSetQueryString uri query = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    query' <- textToCString query
    result <- gst_uri_set_query_string uri' query'
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem query'
    return result'

data UriSetQueryStringMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo UriSetQueryStringMethodInfo Uri signature where
    overloadedMethod _ = uriSetQueryString

-- method Uri::set_query_table
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query_table", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The new\n              query table to use.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_set_query_table" gst_uri_set_query_table :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    Ptr (GHashTable CString CString) ->     -- query_table : TGHash (TBasicType TUTF8) (TBasicType TUTF8)
    IO CInt

{- |
Set the query table to use in the URI. The old table is unreferenced and a
reference to the new one is used instead. A value if 'Nothing' for /@queryTable@/
will remove the query string from the URI.

@since 1.6
-}
uriSetQueryTable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> Maybe (Map.Map T.Text T.Text)
    {- ^ /@queryTable@/: The new
              query table to use. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the new table was sucessfully used for the query table. -}
uriSetQueryTable uri queryTable = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    maybeQueryTable <- case queryTable of
        Nothing -> return nullPtr
        Just jQueryTable -> do
            let jQueryTable' = Map.toList jQueryTable
            jQueryTable'' <- mapFirstA textToCString jQueryTable'
            jQueryTable''' <- mapSecondA textToCString jQueryTable''
            let jQueryTable'''' = mapFirst cstringPackPtr jQueryTable'''
            let jQueryTable''''' = mapSecond cstringPackPtr jQueryTable''''
            jQueryTable'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) jQueryTable'''''
            return jQueryTable''''''
    result <- gst_uri_set_query_table uri' maybeQueryTable
    let result' = (/= 0) result
    touchManagedPtr uri
    unrefGHashTable maybeQueryTable
    return result'

data UriSetQueryTableMethodInfo
instance (signature ~ (Maybe (Map.Map T.Text T.Text) -> m Bool), MonadIO m) => O.MethodInfo UriSetQueryTableMethodInfo Uri signature where
    overloadedMethod _ = uriSetQueryTable

-- method Uri::set_query_value
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query_key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The key for the query entry.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "query_value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The value for the key.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_set_query_value" gst_uri_set_query_value :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- query_key : TBasicType TUTF8
    CString ->                              -- query_value : TBasicType TUTF8
    IO CInt

{- |
This inserts or replaces a key in the query table. A /@queryValue@/ of 'Nothing'
indicates that the key has no associated value, but will still be present in
the query string.

@since 1.6
-}
uriSetQueryValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> T.Text
    {- ^ /@queryKey@/: The key for the query entry. -}
    -> Maybe (T.Text)
    {- ^ /@queryValue@/: The value for the key. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the query table was sucessfully updated. -}
uriSetQueryValue uri queryKey queryValue = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    queryKey' <- textToCString queryKey
    maybeQueryValue <- case queryValue of
        Nothing -> return nullPtr
        Just jQueryValue -> do
            jQueryValue' <- textToCString jQueryValue
            return jQueryValue'
    result <- gst_uri_set_query_value uri' queryKey' maybeQueryValue
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem queryKey'
    freeMem maybeQueryValue
    return result'

data UriSetQueryValueMethodInfo
instance (signature ~ (T.Text -> Maybe (T.Text) -> m Bool), MonadIO m) => O.MethodInfo UriSetQueryValueMethodInfo Uri signature where
    overloadedMethod _ = uriSetQueryValue

-- method Uri::set_scheme
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", 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 "The new scheme to set or %NULL to unset the scheme.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_set_scheme" gst_uri_set_scheme :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- scheme : TBasicType TUTF8
    IO CInt

{- |
Set or unset the scheme for the URI.

@since 1.6
-}
uriSetScheme ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> T.Text
    {- ^ /@scheme@/: The new scheme to set or 'Nothing' to unset the scheme. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the scheme was set\/unset successfully. -}
uriSetScheme uri scheme = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    scheme' <- textToCString scheme
    result <- gst_uri_set_scheme uri' scheme'
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem scheme'
    return result'

data UriSetSchemeMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo UriSetSchemeMethodInfo Uri signature where
    overloadedMethod _ = uriSetScheme

-- method Uri::set_userinfo
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstUri to modify.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "userinfo", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The new user-information string to set or %NULL to unset.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_set_userinfo" gst_uri_set_userinfo :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    CString ->                              -- userinfo : TBasicType TUTF8
    IO CInt

{- |
Set or unset the user information for the URI.

@since 1.6
-}
uriSetUserinfo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to modify. -}
    -> T.Text
    {- ^ /@userinfo@/: The new user-information string to set or 'Nothing' to unset. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the user information was set\/unset successfully. -}
uriSetUserinfo uri userinfo = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    userinfo' <- textToCString userinfo
    result <- gst_uri_set_userinfo uri' userinfo'
    let result' = (/= 0) result
    touchManagedPtr uri
    freeMem userinfo'
    return result'

data UriSetUserinfoMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo UriSetUserinfoMethodInfo Uri signature where
    overloadedMethod _ = uriSetUserinfo

-- method Uri::to_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "uri", argType = TInterface (Name {namespace = "Gst", name = "Uri"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "This #GstUri to convert to a string.", 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 "gst_uri_to_string" gst_uri_to_string :: 
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO CString

{- |
Convert the URI to a string.

Returns the URI as held in this object as a @/gchar/@* nul-terminated string.
The caller should 'GI.GLib.Functions.free' the string once they are finished with it.
The string is put together as described in RFC 3986.

@since 1.6
-}
uriToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: This 'GI.Gst.Structs.Uri.Uri' to convert to a string. -}
    -> m T.Text
    {- ^ __Returns:__ The string version of the URI. -}
uriToString uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_to_string uri'
    checkUnexpectedReturnNULL "uriToString" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr uri
    return result'

data UriToStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo UriToStringMethodInfo Uri signature where
    overloadedMethod _ = uriToString

-- method Uri::construct
-- method type : MemberFunction
-- Args : [Arg {argCName = "protocol", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Protocol for URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "location", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Location for URI", 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 "gst_uri_construct" gst_uri_construct :: 
    CString ->                              -- protocol : TBasicType TUTF8
    CString ->                              -- location : TBasicType TUTF8
    IO CString

{- |
Constructs a URI for a given valid protocol and location.

Free-function: g_free
-}
uriConstruct ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@protocol@/: Protocol for URI -}
    -> T.Text
    {- ^ /@location@/: Location for URI -}
    -> m T.Text
    {- ^ __Returns:__ a new string for this URI. Returns 'Nothing' if the
    given URI protocol is not valid, or the given location is 'Nothing'. -}
uriConstruct protocol location = liftIO $ do
    protocol' <- textToCString protocol
    location' <- textToCString location
    result <- gst_uri_construct protocol' location'
    checkUnexpectedReturnNULL "uriConstruct" result
    result' <- cstringToText result
    freeMem result
    freeMem protocol'
    freeMem location'
    return result'

-- method Uri::from_string
-- method type : MemberFunction
-- Args : [Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The URI string to parse.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Uri"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_from_string" gst_uri_from_string :: 
    CString ->                              -- uri : TBasicType TUTF8
    IO (Ptr Uri)

{- |
Parses a URI string into a new 'GI.Gst.Structs.Uri.Uri' object. Will return NULL if the URI
cannot be parsed.

@since 1.6
-}
uriFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@uri@/: The URI string to parse. -}
    -> m (Maybe Uri)
    {- ^ __Returns:__ A new 'GI.Gst.Structs.Uri.Uri' object, or NULL. -}
uriFromString uri = liftIO $ do
    uri' <- textToCString uri
    result <- gst_uri_from_string uri'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Uri) result'
        return result''
    freeMem uri'
    return maybeResult

-- method Uri::get_location
-- method type : MemberFunction
-- Args : [Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A URI string", 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 "gst_uri_get_location" gst_uri_get_location :: 
    CString ->                              -- uri : TBasicType TUTF8
    IO CString

{- |
Extracts the location out of a given valid URI, ie. the protocol and \":\/\/\"
are stripped from the URI, which means that the location returned includes
the hostname if one is specified. The returned string must be freed using
'GI.GLib.Functions.free'.

Free-function: g_free
-}
uriGetLocation ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@uri@/: A URI string -}
    -> m T.Text
    {- ^ __Returns:__ the location for this URI. Returns 'Nothing' if the
    URI isn\'t valid. If the URI does not contain a location, an empty
    string is returned. -}
uriGetLocation uri = liftIO $ do
    uri' <- textToCString uri
    result <- gst_uri_get_location uri'
    checkUnexpectedReturnNULL "uriGetLocation" result
    result' <- cstringToText result
    freeMem result
    freeMem uri'
    return result'

-- method Uri::get_protocol
-- method type : MemberFunction
-- Args : [Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A URI string", 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 "gst_uri_get_protocol" gst_uri_get_protocol :: 
    CString ->                              -- uri : TBasicType TUTF8
    IO CString

{- |
Extracts the protocol out of a given valid URI. The returned string must be
freed using 'GI.GLib.Functions.free'.
-}
uriGetProtocol ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@uri@/: A URI string -}
    -> m T.Text
    {- ^ __Returns:__ The protocol for this URI. -}
uriGetProtocol uri = liftIO $ do
    uri' <- textToCString uri
    result <- gst_uri_get_protocol uri'
    checkUnexpectedReturnNULL "uriGetProtocol" result
    result' <- cstringToText result
    freeMem result
    freeMem uri'
    return result'

-- method Uri::has_protocol
-- method type : MemberFunction
-- Args : [Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a URI string", 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 "a protocol string (e.g. \"http\")", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_has_protocol" gst_uri_has_protocol :: 
    CString ->                              -- uri : TBasicType TUTF8
    CString ->                              -- protocol : TBasicType TUTF8
    IO CInt

{- |
Checks if the protocol of a given valid URI matches /@protocol@/.
-}
uriHasProtocol ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@uri@/: a URI string -}
    -> T.Text
    {- ^ /@protocol@/: a protocol string (e.g. \"http\") -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the protocol matches. -}
uriHasProtocol uri protocol = liftIO $ do
    uri' <- textToCString uri
    protocol' <- textToCString protocol
    result <- gst_uri_has_protocol uri' protocol'
    let result' = (/= 0) result
    freeMem uri'
    freeMem protocol'
    return result'

-- method Uri::is_valid
-- method type : MemberFunction
-- Args : [Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A URI string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_is_valid" gst_uri_is_valid :: 
    CString ->                              -- uri : TBasicType TUTF8
    IO CInt

{- |
Tests if the given string is a valid URI identifier. URIs start with a valid
scheme followed by \":\" and maybe a string identifying the location.
-}
uriIsValid ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@uri@/: A URI string -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the string is a valid URI -}
uriIsValid uri = liftIO $ do
    uri' <- textToCString uri
    result <- gst_uri_is_valid uri'
    let result' = (/= 0) result
    freeMem uri'
    return result'

-- method Uri::join_strings
-- method type : MemberFunction
-- Args : [Arg {argCName = "base_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The percent-encoded base URI.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ref_uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The percent-encoded reference URI to join to the @base_uri.", 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 "gst_uri_join_strings" gst_uri_join_strings :: 
    CString ->                              -- base_uri : TBasicType TUTF8
    CString ->                              -- ref_uri : TBasicType TUTF8
    IO CString

{- |
This is a convenience function to join two URI strings and return the result.
The returned string should be 'GI.GLib.Functions.free'\'d after use.

@since 1.6
-}
uriJoinStrings ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@baseUri@/: The percent-encoded base URI. -}
    -> T.Text
    {- ^ /@refUri@/: The percent-encoded reference URI to join to the /@baseUri@/. -}
    -> m T.Text
    {- ^ __Returns:__ A string representing the percent-encoded join of
         the two URIs. -}
uriJoinStrings baseUri refUri = liftIO $ do
    baseUri' <- textToCString baseUri
    refUri' <- textToCString refUri
    result <- gst_uri_join_strings baseUri' refUri'
    checkUnexpectedReturnNULL "uriJoinStrings" result
    result' <- cstringToText result
    freeMem result
    freeMem baseUri'
    freeMem refUri'
    return result'

-- method Uri::protocol_is_supported
-- method type : MemberFunction
-- Args : [Arg {argCName = "type", argType = TInterface (Name {namespace = "Gst", name = "URIType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Whether to check for a source or a sink", 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 "Protocol that should be checked for (e.g. \"http\" or \"smb\")", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_protocol_is_supported" gst_uri_protocol_is_supported :: 
    CUInt ->                                -- type : TInterface (Name {namespace = "Gst", name = "URIType"})
    CString ->                              -- protocol : TBasicType TUTF8
    IO CInt

{- |
Checks if an element exists that supports the given URI protocol. Note
that a positive return value does not imply that a subsequent call to
'GI.Gst.Objects.Element.elementMakeFromUri' is guaranteed to work.
-}
uriProtocolIsSupported ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.URIType
    {- ^ /@type@/: Whether to check for a source or a sink -}
    -> T.Text
    {- ^ /@protocol@/: Protocol that should be checked for (e.g. \"http\" or \"smb\") -}
    -> m Bool
    {- ^ __Returns:__ 'True' -}
uriProtocolIsSupported type_ protocol = liftIO $ do
    let type_' = (fromIntegral . fromEnum) type_
    protocol' <- textToCString protocol
    result <- gst_uri_protocol_is_supported type_' protocol'
    let result' = (/= 0) result
    freeMem protocol'
    return result'

-- method Uri::protocol_is_valid
-- method type : MemberFunction
-- Args : [Arg {argCName = "protocol", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_uri_protocol_is_valid" gst_uri_protocol_is_valid :: 
    CString ->                              -- protocol : TBasicType TUTF8
    IO CInt

{- |
Tests if the given string is a valid protocol identifier. Protocols
must consist of alphanumeric characters, \'+\', \'-\' and \'.\' and must
start with a alphabetic character. See RFC 3986 Section 3.1.
-}
uriProtocolIsValid ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@protocol@/: A string -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the string is a valid protocol identifier, 'False' otherwise. -}
uriProtocolIsValid protocol = liftIO $ do
    protocol' <- textToCString protocol
    result <- gst_uri_protocol_is_valid protocol'
    let result' = (/= 0) result
    freeMem protocol'
    return result'

type family ResolveUriMethod (t :: Symbol) (o :: *) :: * where
    ResolveUriMethod "appendPath" o = UriAppendPathMethodInfo
    ResolveUriMethod "appendPathSegment" o = UriAppendPathSegmentMethodInfo
    ResolveUriMethod "equal" o = UriEqualMethodInfo
    ResolveUriMethod "fromStringWithBase" o = UriFromStringWithBaseMethodInfo
    ResolveUriMethod "isNormalized" o = UriIsNormalizedMethodInfo
    ResolveUriMethod "isWritable" o = UriIsWritableMethodInfo
    ResolveUriMethod "join" o = UriJoinMethodInfo
    ResolveUriMethod "makeWritable" o = UriMakeWritableMethodInfo
    ResolveUriMethod "newWithBase" o = UriNewWithBaseMethodInfo
    ResolveUriMethod "normalize" o = UriNormalizeMethodInfo
    ResolveUriMethod "queryHasKey" o = UriQueryHasKeyMethodInfo
    ResolveUriMethod "removeQueryKey" o = UriRemoveQueryKeyMethodInfo
    ResolveUriMethod "toString" o = UriToStringMethodInfo
    ResolveUriMethod "getFragment" o = UriGetFragmentMethodInfo
    ResolveUriMethod "getHost" o = UriGetHostMethodInfo
    ResolveUriMethod "getPath" o = UriGetPathMethodInfo
    ResolveUriMethod "getPathSegments" o = UriGetPathSegmentsMethodInfo
    ResolveUriMethod "getPathString" o = UriGetPathStringMethodInfo
    ResolveUriMethod "getPort" o = UriGetPortMethodInfo
    ResolveUriMethod "getQueryKeys" o = UriGetQueryKeysMethodInfo
    ResolveUriMethod "getQueryString" o = UriGetQueryStringMethodInfo
    ResolveUriMethod "getQueryTable" o = UriGetQueryTableMethodInfo
    ResolveUriMethod "getQueryValue" o = UriGetQueryValueMethodInfo
    ResolveUriMethod "getScheme" o = UriGetSchemeMethodInfo
    ResolveUriMethod "getUserinfo" o = UriGetUserinfoMethodInfo
    ResolveUriMethod "setFragment" o = UriSetFragmentMethodInfo
    ResolveUriMethod "setHost" o = UriSetHostMethodInfo
    ResolveUriMethod "setPath" o = UriSetPathMethodInfo
    ResolveUriMethod "setPathSegments" o = UriSetPathSegmentsMethodInfo
    ResolveUriMethod "setPathString" o = UriSetPathStringMethodInfo
    ResolveUriMethod "setPort" o = UriSetPortMethodInfo
    ResolveUriMethod "setQueryString" o = UriSetQueryStringMethodInfo
    ResolveUriMethod "setQueryTable" o = UriSetQueryTableMethodInfo
    ResolveUriMethod "setQueryValue" o = UriSetQueryValueMethodInfo
    ResolveUriMethod "setScheme" o = UriSetSchemeMethodInfo
    ResolveUriMethod "setUserinfo" o = UriSetUserinfoMethodInfo
    ResolveUriMethod l o = O.MethodResolutionFailed l o

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

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