<?xml version="1.0" encoding="utf-8"?>
<KScriptSetting>
  <Name>cookie</Name>
  <Description>Set cookie value</Description>
  <Example><![CDATA[
    <script engine="kscript">

    // 30 days cookie.
    k.cookie.set("cookiename", "cookievalue", 30);

    // default one day cookie.
    k.cookie.set("cookiename", "cookie value");

    //Expires in minutes, 4 hours cookie
    k.cookie.setByMinutes("cookiename", "value", 240);

    // get cookie
    k.cookie.get("cookiename");

    </script>
	]]></Example>
  <Props>
    <Property>
      <Name>keys</Name>
      <Description>keys</Description>
      <Type>array</Type>
    </Property>
    <Property>
      <Name>values</Name>
      <Description>values</Description>
      <Type>array</Type>
    </Property>
    <Property>
      <Name>length</Name>
      <Description>length</Description>
      <Type>number</Type>
    </Property>
    <Property>
      <Name>item</Name>
      <Description>item</Description>
      <Type>string</Type>
    </Property>
  </Props>
  <Methods>
    <Method>
      <Name>set</Name>
      <Description>set a cookie with defined expiration days</Description>
      <Example>

        // 30 days cookie.
        k.cookie.set("cookiename", "cookievalue", 30);

      </Example>
      <Params>
        <Param>
          <Name>name</Name>
          <Description>name</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>value</Name>
          <Description>value</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>days</Name>
          <Description>expiration days</Description>
          <Type>number</Type>
        </Param>
      </Params>
    </Method>
    <Method>
      <Name>setByMinutes</Name>
      <Description>set the cookie with an expiration time in minutes.</Description>
      <Example>
        //Expires in minutes, 4 hours cookie
        k.cookie.setByMinutes("cookiename", "value", 240);
      </Example>
      <Params>
        <Param>
          <Name>name</Name>
          <Description>name</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>value</Name>
          <Description>value</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>mins</Name>
          <Description>Minutes</Description>
          <Type>number</Type>
        </Param>
      </Params>
    </Method>
    <Method>
      <Name>set</Name>
      <Description>set a cookie that expires in 1 day. </Description>
      <Example>
        // default one day cookie.
        k.cookie.set("cookiename", "cookie value");
      </Example>
      <Params>
        <Param>
          <Name>name</Name>
          <Description>name</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>value</Name>
          <Description>value</Description>
          <Type>string</Type>
        </Param>
      </Params>
    </Method>
    <Method>
      <Name>get</Name>
      <Description>Get the cookie value by name</Description>
      <Example>
        // get cookie
       var cookievalue =  k.cookie.get("cookiename");
      </Example>
      <Params>
        <Param>
          <Name>name</Name>
          <Description>name</Description>
          <Type>string</Type>
        </Param>
      </Params>
      <ReturnType>string</ReturnType>
    </Method>
    <Method>
      <Name>containsKey</Name>
      <Description>check whether cookie has the key or not.</Description>
      <Example>
	  if (k.cookie.containsKey("key"))
      {
         //has value
      }
	  </Example>
      <Params>
        <Param>
          <Name>key</Name>
          <Description>key</Description>
          <Type>string</Type>
        </Param>
      </Params>
      <ReturnType>boolean</ReturnType>
    </Method>
    <Method>
      <Name>remove</Name>
      <Description>Remove item from cookie by session key.</Description>
      <Example>
	  k.cookie.remove("key"); 
	  </Example>
      <Params>
        <Param>
          <Name>key</Name>
          <Description>key</Description>
          <Type>string</Type>
        </Param>
      </Params>
      <ReturnType>boolean</ReturnType>
    </Method>
    <Method>
      <Name>clear</Name>
      <Description>remove all items from cookie</Description>
      <Example>
	  k.cookie.clear(); 
	  </Example>
      <Params />
    </Method>
 
  </Methods>
</KScriptSetting>