{- |
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.
-}

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

module GI.Gst.Structs.Uri
    (

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


 -- * Methods
-- ** appendPath #method:appendPath#

#if ENABLE_OVERLOADING
    UriAppendPathMethodInfo                 ,
#endif
    uriAppendPath                           ,


-- ** appendPathSegment #method:appendPathSegment#

#if ENABLE_OVERLOADING
    UriAppendPathSegmentMethodInfo          ,
#endif
    uriAppendPathSegment                    ,


-- ** construct #method:construct#

    uriConstruct                            ,


-- ** equal #method:equal#

#if ENABLE_OVERLOADING
    UriEqualMethodInfo                      ,
#endif
    uriEqual                                ,


-- ** fromString #method:fromString#

    uriFromString                           ,


-- ** fromStringWithBase #method:fromStringWithBase#

#if ENABLE_OVERLOADING
    UriFromStringWithBaseMethodInfo         ,
#endif
    uriFromStringWithBase                   ,


-- ** getFragment #method:getFragment#

#if ENABLE_OVERLOADING
    UriGetFragmentMethodInfo                ,
#endif
    uriGetFragment                          ,


-- ** getHost #method:getHost#

#if ENABLE_OVERLOADING
    UriGetHostMethodInfo                    ,
#endif
    uriGetHost                              ,


-- ** getLocation #method:getLocation#

    uriGetLocation                          ,


-- ** getMediaFragmentTable #method:getMediaFragmentTable#

#if ENABLE_OVERLOADING
    UriGetMediaFragmentTableMethodInfo      ,
#endif
    uriGetMediaFragmentTable                ,


-- ** getPath #method:getPath#

#if ENABLE_OVERLOADING
    UriGetPathMethodInfo                    ,
#endif
    uriGetPath                              ,


-- ** getPathSegments #method:getPathSegments#

#if ENABLE_OVERLOADING
    UriGetPathSegmentsMethodInfo            ,
#endif
    uriGetPathSegments                      ,


-- ** getPathString #method:getPathString#

#if ENABLE_OVERLOADING
    UriGetPathStringMethodInfo              ,
#endif
    uriGetPathString                        ,


-- ** getPort #method:getPort#

#if ENABLE_OVERLOADING
    UriGetPortMethodInfo                    ,
#endif
    uriGetPort                              ,


-- ** getProtocol #method:getProtocol#

    uriGetProtocol                          ,


-- ** getQueryKeys #method:getQueryKeys#

#if ENABLE_OVERLOADING
    UriGetQueryKeysMethodInfo               ,
#endif
    uriGetQueryKeys                         ,


-- ** getQueryString #method:getQueryString#

#if ENABLE_OVERLOADING
    UriGetQueryStringMethodInfo             ,
#endif
    uriGetQueryString                       ,


-- ** getQueryTable #method:getQueryTable#

#if ENABLE_OVERLOADING
    UriGetQueryTableMethodInfo              ,
#endif
    uriGetQueryTable                        ,


-- ** getQueryValue #method:getQueryValue#

#if ENABLE_OVERLOADING
    UriGetQueryValueMethodInfo              ,
#endif
    uriGetQueryValue                        ,


-- ** getScheme #method:getScheme#

#if ENABLE_OVERLOADING
    UriGetSchemeMethodInfo                  ,
#endif
    uriGetScheme                            ,


-- ** getUserinfo #method:getUserinfo#

#if ENABLE_OVERLOADING
    UriGetUserinfoMethodInfo                ,
#endif
    uriGetUserinfo                          ,


-- ** hasProtocol #method:hasProtocol#

    uriHasProtocol                          ,


-- ** isNormalized #method:isNormalized#

#if ENABLE_OVERLOADING
    UriIsNormalizedMethodInfo               ,
#endif
    uriIsNormalized                         ,


-- ** isValid #method:isValid#

    uriIsValid                              ,


-- ** isWritable #method:isWritable#

#if ENABLE_OVERLOADING
    UriIsWritableMethodInfo                 ,
#endif
    uriIsWritable                           ,


-- ** join #method:join#

#if ENABLE_OVERLOADING
    UriJoinMethodInfo                       ,
#endif
    uriJoin                                 ,


-- ** joinStrings #method:joinStrings#

    uriJoinStrings                          ,


-- ** makeWritable #method:makeWritable#

#if ENABLE_OVERLOADING
    UriMakeWritableMethodInfo               ,
#endif
    uriMakeWritable                         ,


-- ** new #method:new#

    uriNew                                  ,


-- ** newWithBase #method:newWithBase#

#if ENABLE_OVERLOADING
    UriNewWithBaseMethodInfo                ,
#endif
    uriNewWithBase                          ,


-- ** normalize #method:normalize#

#if ENABLE_OVERLOADING
    UriNormalizeMethodInfo                  ,
#endif
    uriNormalize                            ,


-- ** protocolIsSupported #method:protocolIsSupported#

    uriProtocolIsSupported                  ,


-- ** protocolIsValid #method:protocolIsValid#

    uriProtocolIsValid                      ,


-- ** queryHasKey #method:queryHasKey#

#if ENABLE_OVERLOADING
    UriQueryHasKeyMethodInfo                ,
#endif
    uriQueryHasKey                          ,


-- ** removeQueryKey #method:removeQueryKey#

#if ENABLE_OVERLOADING
    UriRemoveQueryKeyMethodInfo             ,
#endif
    uriRemoveQueryKey                       ,


-- ** setFragment #method:setFragment#

#if ENABLE_OVERLOADING
    UriSetFragmentMethodInfo                ,
#endif
    uriSetFragment                          ,


-- ** setHost #method:setHost#

#if ENABLE_OVERLOADING
    UriSetHostMethodInfo                    ,
#endif
    uriSetHost                              ,


-- ** setPath #method:setPath#

#if ENABLE_OVERLOADING
    UriSetPathMethodInfo                    ,
#endif
    uriSetPath                              ,


-- ** setPathSegments #method:setPathSegments#

#if ENABLE_OVERLOADING
    UriSetPathSegmentsMethodInfo            ,
#endif
    uriSetPathSegments                      ,


-- ** setPathString #method:setPathString#

#if ENABLE_OVERLOADING
    UriSetPathStringMethodInfo              ,
#endif
    uriSetPathString                        ,


-- ** setPort #method:setPort#

#if ENABLE_OVERLOADING
    UriSetPortMethodInfo                    ,
#endif
    uriSetPort                              ,


-- ** setQueryString #method:setQueryString#

#if ENABLE_OVERLOADING
    UriSetQueryStringMethodInfo             ,
#endif
    uriSetQueryString                       ,


-- ** setQueryTable #method:setQueryTable#

#if ENABLE_OVERLOADING
    UriSetQueryTableMethodInfo              ,
#endif
    uriSetQueryTable                        ,


-- ** setQueryValue #method:setQueryValue#

#if ENABLE_OVERLOADING
    UriSetQueryValueMethodInfo              ,
#endif
    uriSetQueryValue                        ,


-- ** setScheme #method:setScheme#

#if ENABLE_OVERLOADING
    UriSetSchemeMethodInfo                  ,
#endif
    uriSetScheme                            ,


-- ** setUserinfo #method:setUserinfo#

#if ENABLE_OVERLOADING
    UriSetUserinfoMethodInfo                ,
#endif
    uriSetUserinfo                          ,


-- ** toString #method:toString#

#if ENABLE_OVERLOADING
    UriToStringMethodInfo                   ,
#endif
    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.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.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

-- | Memory-managed wrapper type.
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

-- | A convenience alias for `Nothing` :: `Maybe` `Uri`.
noUri :: Maybe Uri
noUri = Nothing


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

-- 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'

#if ENABLE_OVERLOADING
#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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 (Maybe 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'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr uri
    return maybeResult

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

#endif

-- 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 (Maybe 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'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr uri
    return maybeResult

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

#endif

-- method Uri::get_media_fragment_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 fragment 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_media_fragment_table" gst_uri_get_media_fragment_table ::
    Ptr Uri ->                              -- uri : TInterface (Name {namespace = "Gst", name = "Uri"})
    IO (Ptr (GHashTable CString CString))

{- |
Get the media fragment table from the URI, as defined by \"Media Fragments URI 1.0\".
Hash table returned by this API is a list of \"key-value\" pairs, and the each
pair is generated by splitting \"URI fragment\" per \"&\" sub-delims, then \"key\"
and \"value\" are splitted by \"=\" sub-delims. The \"key\" returned by this API may
be undefined keyword by standard.
A value may be 'Nothing' to indicate that the key should appear in the fragment
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 does not affect the fragment in the URI.

See more about Media Fragments URI 1.0 (W3C) at https:\/\/www.w3.org\/TR\/media-frags\/

/Since: 1.12/
-}
uriGetMediaFragmentTable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Uri
    {- ^ /@uri@/: The 'GI.Gst.Structs.Uri.Uri' to get the fragment table from. -}
    -> m (Maybe (Map.Map T.Text T.Text))
    {- ^ __Returns:__ The
         fragment hash table from the URI. -}
uriGetMediaFragmentTable uri = liftIO $ do
    uri' <- unsafeManagedPtrGetPtr uri
    result <- gst_uri_get_media_fragment_table uri'
    maybeResult <- convertIfNonNull result $ \result' -> do
        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'
        return result'''''''
    touchManagedPtr uri
    return maybeResult

#if ENABLE_OVERLOADING
data UriGetMediaFragmentTableMethodInfo
instance (signature ~ (m (Maybe (Map.Map T.Text T.Text))), MonadIO m) => O.MethodInfo UriGetMediaFragmentTableMethodInfo Uri signature where
    overloadedMethod _ = uriGetMediaFragmentTable

#endif

-- 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:__ (nullable): 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'

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

#endif

-- 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''

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

#endif

-- 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 (Maybe 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'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    touchManagedPtr uri
    return maybeResult

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

#endif

-- 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

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

#endif

-- 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''

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

#endif

-- 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 (Maybe 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'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    touchManagedPtr uri
    return maybeResult

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

#endif

-- 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 (Maybe (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'
    maybeResult <- convertIfNonNull result $ \result' -> do
        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'
        return result'''''''
    touchManagedPtr uri
    return maybeResult

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

#endif

-- 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 (Maybe 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'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr uri
    freeMem queryKey'
    return maybeResult

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

#endif

-- 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 (Maybe 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'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr uri
    return maybeResult

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

#endif

-- 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 (Maybe 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'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr uri
    return maybeResult

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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 (Maybe 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
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Uri) result'
        return result''
    touchManagedPtr baseUri
    whenJust refUri touchManagedPtr
    return maybeResult

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

#endif

-- 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'

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

#endif

-- 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'

#if ENABLE_OVERLOADING
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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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'

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

#endif

-- 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

{-# DEPRECATED uriConstruct ["Use GstURI instead."] #-}
{- |
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'

#if ENABLE_OVERLOADING
#endif

-- 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

#if ENABLE_OVERLOADING
#endif

-- 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 (Maybe 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'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    freeMem uri'
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- 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 (Maybe T.Text)
    {- ^ __Returns:__ The protocol for this URI. -}
uriGetProtocol uri = liftIO $ do
    uri' <- textToCString uri
    result <- gst_uri_get_protocol uri'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    freeMem uri'
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- 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'

#if ENABLE_OVERLOADING
#endif

-- 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'

#if ENABLE_OVERLOADING
#endif

-- 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'

#if ENABLE_OVERLOADING
#endif

-- 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'

#if ENABLE_OVERLOADING
#endif

-- 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'

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
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 "getMediaFragmentTable" o = UriGetMediaFragmentTableMethodInfo
    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
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif