Skip to content

Commit

Permalink
Update endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
dantepiazza committed Jun 21, 2024
1 parent 5e4fc75 commit c30574e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/Endpoints/Contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,48 @@ class Contacts {
function __construct($adapter){
$this -> adapter = $adapter;
}

/**
* Create a new contact
*
* @since 1.0
*
* @param array $options
*
* @return Dolibarr\Adapter\Response
**/
public function Create(array $options) {
$this -> adapter -> payload = $options;

return $this -> adapter -> exec('post', 'contacts') -> response;
}

/**
* Update a contact
*
* @since 1.0
*
* @param array $options
*
* @return Dolibarr\Adapter\Response
**/
public function Update(int $thirdparty, array $options) {
$this -> adapter -> payload = $options;

return $this -> adapter -> exec('put', 'contacts/'.$thirdparty) -> response;
}

/**
* List contacts
*
* @since 1.0
*
* @param array $options
*
* @return Dolibarr\Adapter\Response
**/
public function All(array $options = []) {
return $this -> adapter -> exec('get', 'contacts', $options) -> response;
}
}

15 changes: 15 additions & 0 deletions src/Endpoints/Thirdparties.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ public function Create(array $options) {

return $this -> adapter -> exec('post', 'thirdparties') -> response;
}

/**
* Update a thirdpart
*
* @since 1.0
*
* @param array $options
*
* @return Dolibarr\Adapter\Response
**/
public function Update(int $thirdparty, array $options) {
$this -> adapter -> payload = $options;

return $this -> adapter -> exec('put', 'thirdparties/'.$thirdparty) -> response;
}

/**
* List thirdparties
Expand Down

0 comments on commit c30574e

Please sign in to comment.