<?xml version="1.0" encoding="utf-8"?>
<KScriptSetting>
  <Name>BinaryRepository</Name>
  <Description>The repository that contains binary objects such as image or file</Description>
  <Example>
    <![CDATA[
  <script engine="kscript">

      var image = k.site.images.getByUrl("/kooboo.png");
        
  </script>
	]]>

  </Example>
  <Props />

  <Methods>
    <Method>
      <Name>all</Name>
      <Description>Return an array of the SiteObjects</Description>
      <Example> 
   <![CDATA[
  <script engine="kscript"> 
      var allitems = k.site.images.all();  
    </script>
	]]> </Example>
      <Params />
      <ReturnType>array</ReturnType>
    </Method>
    <Method>
      <Name>updateBinary</Name>
      <Description>Update the binary content</Description>
      <Example>
        <![CDATA[
  <script engine="kscript"> 
   if (k.request.files.length>0)
   {
         var image = k.site.images.getByUrl("/kooboo.png");
         k.site.images.updateBinary(image.id, k.request.files[0].bytes); 
   }  
    </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 the unique Guid</Description>
      <Example>
        <![CDATA[
<script engine="kscript">
     
   var image = k.site.image.get(imageGuid); 
  
</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"> 
   if (k.request.files.length>0)
   {
         var image = k.site.images.getByUrl("/kooboo.png");
         image.ContentBytes = k.request.files[0].bytes; 
         k.site.images.update(image); 
   }  
    </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 image = k.site.images.getByUrl("/kooboo.png");
      k.site.images.delete(image.id); 
        
  </script>
	]]> 
      </Example>
      <Params>
        <Param>
          <Name>nameOrId</Name>
          <Description>nameOrId</Description>
          <Type>object</Type>
        </Param>
      </Params>
    </Method>


  </Methods>


</KScriptSetting>