<?xml version="1.0" encoding="utf-8"?>
<KScriptSetting>
  <Name>RoutableTextRepository</Name>
  <Description>The repository that contains Objects that have Url route and Text body.</Description>
  <Example> <![CDATA[
  <script engine="kscript"> 
      var page = k.site.pages.getByUrl("/pagename");
      k.site.pages.updateBody(page.id, "new page body"); 
    </script>
	]]> 
  </Example>
  <Props />
  <Methods>
    <Method>
      <Name>getByUrl</Name>
      <Description>get the SiteObject by Url</Description>
      <Example>
        <![CDATA[
  <script engine="kscript"> 
      var page = k.site.pages.getByUrl("/pagename");
      var style = k.site.styles.getByUrl("/style.css"); 
    </script>
	]]>

      </Example>
      <Params>
        <Param>
          <Name>url</Name>
          <Description>url</Description>
          <Type>string</Type>
        </Param>
      </Params>
      <ReturnType>SiteObject</ReturnType>
    </Method>

    <Method>
      <Name>getUrl</Name>
      <Description>get the relative Url of this object</Description>
      <Example>
        <![CDATA[
  <script engine="kscript"> 
      var page = k.site.pages.getByUrl("/pagename");
      var url = k.site.pages.getUrl(page.id); 
    </script>
	]]>

      </Example>
      <Params>
        <Param>
          <Name>id</Name>
          <Description>object id</Description>
          <Type>object</Type>
        </Param>
      </Params>
      <ReturnType>SiteObject</ReturnType>
    </Method>
    
    
    

    <Method>
      <Name>all</Name>
      <Description>Return an array of the SiteObjects</Description>
      <Example>

        <![CDATA[
  <script engine="kscript">

      var allitems = k.site.styles.all(); 

    </script>
	]]>

      </Example>
      <Params />
      <ReturnType>array</ReturnType>
    </Method>
    <Method>
      <Name>updateBody</Name>
      <Description>Update the text value of the body property</Description>
      <Example>
        <![CDATA[
  <script engine="kscript">

      var style = k.site.styles.getByUrl("/a.css"); 
      k.site.styles.updateBody(style.Id, ".newcls{}");

    </script>
	]]>
      </Example>
      <Params>
        <Param>
          <Name>nameOrId</Name>
          <Description>NameOrId</Description>
          <Type>object</Type>
        </Param>
        <Param>
          <Name>newbody</Name>
          <Description>New body text</Description>
          <Type>string</Type>
        </Param>
      </Params>
    </Method>
    <Method>
      <Name>get</Name>
      <Description>Get an item based on Name or Id</Description>
      <Example>
        <![CDATA[
<script engine="kscript">
     
   var view = k.site.views.get("viewname"); 
  
</script> 
	]]>
      </Example>
      <Params>
        <Param>
          <Name>nameOrId</Name>
          <Description>nameOrId</Description>
          <Type>object</Type>
        </Param>
      </Params>
      <ReturnType>SiteObject</ReturnType>
    </Method>


    <Method>
      <Name>update</Name>
      <Description>update the text object</Description>
      <Example>
        <![CDATA[
<script engine="kscript">
     
    var style = k.site.styles.getByUrl("/a.css"); 
    style.body = ".sample {}"; 
    k.site.styles.update(style);   
    
</script> 
	]]>
      </Example>
      <Params>
        <Param>
          <Name>siteObject</Name>
          <Description>Update the SiteOject property values</Description>
          <Type>SiteObject</Type>
        </Param>
      </Params>
    </Method>

    <Method>
      <Name>delete</Name>
      <Description>Delete an item</Description>
      <Example>
        <![CDATA[
<script engine="kscript"> 

    var page = k.site.pages.getByUrl("/pagename"); 
    if (page)
    {
     k.site.pages.delete(page.id);
    } 
</script> 
	]]>

      </Example>
      <Params>
        <Param>
          <Name>nameOrId</Name>
          <Description>nameOrId</Description>
          <Type>object</Type>
        </Param>
      </Params>
    </Method>


    <Method>
      <Name>add</Name>
      <Description>add an item</Description>
      <Example>
        <![CDATA[
<script engine="kscript">
  var page = {};
  page.name = "pagename";
  page.body = "new  body";
  page.url = "/myurl"
  k.site.pages.add(page);
</script>
	]]>

      </Example>
      <Params>
        <Param>
          <Name>object</Name>
          <Description>The SiteOject values</Description>
          <Type>object</Type>
        </Param>
      </Params>
    </Method>



  </Methods>
</KScriptSetting>