-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Hackage documentation generation is not reliable. For up to date
--   documentation, please see:
--   <a>https://www.stackage.org/package/cookie</a>.
@package cookie
@version 0.5.1

module Web.Cookie

-- | Data type representing the key-value pair to use for a cookie, as well
--   as configuration options for it.
--   
--   <h4>Creating a SetCookie</h4>
--   
--   <a>SetCookie</a> does not export a constructor; instead, use
--   <a>defaultSetCookie</a> and override values (see
--   <a>http://www.yesodweb.com/book/settings-types</a> for details):
--   
--   <pre>
--   import Web.Cookie
--   :set -XOverloadedStrings
--   let cookie = <a>defaultSetCookie</a> { <a>setCookieName</a> = "cookieName", <a>setCookieValue</a> = "cookieValue" }
--   </pre>
--   
--   <h4>Cookie Configuration</h4>
--   
--   Cookies have several configuration options; a brief summary of each
--   option is given below. For more information, see <a>RFC 6265</a> or
--   <a>Wikipedia</a>.
data SetCookie

-- | The name of the cookie. Default value: <tt>"name"</tt>
setCookieName :: SetCookie -> ByteString

-- | The value of the cookie. Default value: <tt>"value"</tt>
setCookieValue :: SetCookie -> ByteString

-- | The URL path for which the cookie should be sent. Default value:
--   <tt>Nothing</tt> (The browser defaults to the path of the request that
--   sets the cookie).
setCookiePath :: SetCookie -> Maybe ByteString

-- | The time at which to expire the cookie. Default value:
--   <tt>Nothing</tt> (The browser will default to expiring a cookie when
--   the browser is closed).
setCookieExpires :: SetCookie -> Maybe UTCTime

-- | The maximum time to keep the cookie, in seconds. Default value:
--   <tt>Nothing</tt> (The browser defaults to expiring a cookie when the
--   browser is closed).
setCookieMaxAge :: SetCookie -> Maybe DiffTime

-- | The domain for which the cookie should be sent. Default value:
--   <tt>Nothing</tt> (The browser defaults to the current domain).
setCookieDomain :: SetCookie -> Maybe ByteString

-- | Marks the cookie as "HTTP only", i.e. not accessible from Javascript.
--   Default value: <tt>False</tt>
setCookieHttpOnly :: SetCookie -> Bool

-- | Instructs the browser to only send the cookie over HTTPS. Default
--   value: <tt>False</tt>
setCookieSecure :: SetCookie -> Bool

-- | The "same site" policy of the cookie, i.e. whether it should be sent
--   with cross-site requests. Default value: <tt>Nothing</tt>
setCookieSameSite :: SetCookie -> Maybe SameSiteOption

-- | Cookies marked Partitioned are double-keyed: by the origin that sets
--   them and the origin of the top-level page. Default value:
--   <tt>False</tt>
setCookiePartitioned :: SetCookie -> Bool

-- | Data type representing the options for a <a>SameSite cookie</a>
data SameSiteOption

-- | Directs the browser to send the cookie for <a>safe requests</a> (e.g.
--   <tt>GET</tt>), but not for unsafe ones (e.g. <tt>POST</tt>)
sameSiteLax :: SameSiteOption

-- | Directs the browser to not send the cookie for <i>any</i> cross-site
--   request, including e.g. a user clicking a link in their email to open
--   a page on your site.
sameSiteStrict :: SameSiteOption

-- | Directs the browser to send the cookie for cross-site requests.
sameSiteNone :: SameSiteOption
parseSetCookie :: ByteString -> SetCookie
renderSetCookie :: SetCookie -> Builder

renderSetCookieBS :: SetCookie -> ByteString

-- | A minimal <a>SetCookie</a>. All fields are <a>Nothing</a> or
--   <a>False</a> except <tt><a>setCookieName</a> = "name"</tt> and
--   <tt><a>setCookieValue</a> = "value"</tt>. You need this to construct a
--   <a>SetCookie</a>, because it does not export a constructor.
--   Equivalently, you may use <a>def</a>.
defaultSetCookie :: SetCookie
def :: Default a => a
type Cookies = [(ByteString, ByteString)]

-- | Decode the value of a "Cookie" request header into key/value pairs.
parseCookies :: ByteString -> Cookies
renderCookies :: Cookies -> Builder

renderCookiesBS :: Cookies -> ByteString

-- | Textual cookies. Functions assume UTF8 encoding.
type CookiesText = [(Text, Text)]
parseCookiesText :: ByteString -> CookiesText
renderCookiesText :: CookiesText -> Builder
expiresFormat :: String

-- | Format a <a>UTCTime</a> for a cookie.
formatCookieExpires :: UTCTime -> ByteString
parseCookieExpires :: ByteString -> Maybe UTCTime
instance Data.Default.Internal.Default Web.Cookie.SetCookie
instance GHC.Classes.Eq Web.Cookie.SameSiteOption
instance GHC.Classes.Eq Web.Cookie.SetCookie
instance Control.DeepSeq.NFData Web.Cookie.SameSiteOption
instance Control.DeepSeq.NFData Web.Cookie.SetCookie
instance GHC.Internal.Show.Show Web.Cookie.SameSiteOption
instance GHC.Internal.Show.Show Web.Cookie.SetCookie
