only POST new/changed data to the API when saving (#2)

This commit is contained in:
James 2019-09-07 09:22:07 +01:00
parent fe713f6926
commit 927e68f71b
2 changed files with 4 additions and 1 deletions

View File

@ -4,8 +4,10 @@ namespace JHodges\GiteaBot;
class GiteaData{
protected $data=null;
protected $newData=null;
public function __construct($data=null){
$this->newData=new stdClass();
if(!$data){
$data=new stdClass();
}
@ -14,6 +16,7 @@ class GiteaData{
public function __set($k,$v){
$this->data->$k=$v;
$this->newData->$k=$v;
}
public function __get($k){

View File

@ -15,7 +15,7 @@ class GiteaRepoData extends GiteaData{
}
public function save(){
return $this->repo->request($this->url,'PATCH',$this->data);
return $this->repo->request($this->url,'PATCH',$this->newData);
}
}