-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
392 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace Bluerock\Sellsy\Api; | ||
|
||
use Bluerock\Sellsy\Entities\Invoice; | ||
use Bluerock\Sellsy\Collections\InvoiceCollection; | ||
use Bluerock\Sellsy\Core\Response; | ||
|
||
/** | ||
* The API client for the `rate-categories` namespace. | ||
* | ||
* @package bluerock/sellsy-client | ||
* @author Thomas <[email protected]> | ||
* @version 1.1 | ||
* @access public | ||
* @see https://api.sellsy.com/doc/v2/#tag/Invoices | ||
*/ | ||
class InvoicesApi extends AbstractApi | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
|
||
$this->entity = Invoice::class; | ||
$this->collection = InvoiceCollection::class; | ||
} | ||
|
||
/** | ||
* List all invoices. | ||
* | ||
* @param array $query Query parameters. | ||
* | ||
* @return \Bluerock\Sellsy\Core\Response | ||
* @see https://api.sellsy.com/doc/v2/#operation/get-invoice | ||
*/ | ||
public function index(array $query = []): Response | ||
{ | ||
$response = $this->connection | ||
->request('invoices') | ||
->get($query); | ||
|
||
return $this->prepareResponse($response); | ||
} | ||
|
||
/** | ||
* Show a single invoice by id. | ||
* | ||
* @param string $id The invoice id to retrieve. | ||
* @param array $query Query parameters. | ||
* | ||
* @return \Bluerock\Sellsy\Core\Response | ||
* @see https://api.sellsy.com/doc/v2/#operation/get-invoice | ||
*/ | ||
public function show(string $id, array $query = []): Response | ||
{ | ||
$response = $this->connection | ||
->request("invoices/{$id}") | ||
->get($query); | ||
|
||
return $this->prepareResponse($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
/** | ||
* The API client for the `items` namespace. | ||
* | ||
* @package cedricWebsenso/sellsy-client | ||
* @package bluerock/sellsy-client | ||
* @author Cédric <[email protected]> | ||
* @version 1.0 | ||
* @access public | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?php | ||
|
||
namespace Bluerock\Sellsy\Api; | ||
|
||
use Bluerock\Sellsy\Entities\RateCategory; | ||
use Bluerock\Sellsy\Collections\RateCategoryCollection; | ||
use Bluerock\Sellsy\Core\Response; | ||
|
||
/** | ||
* The API client for the `rate-categories` namespace. | ||
* | ||
* @package bluerock/sellsy-client | ||
* @author Thomas <[email protected]> | ||
* @version 1.1 | ||
* @access public | ||
* @see https://api.sellsy.com/doc/v2/#tag/Rate-Categories | ||
*/ | ||
class RateCategoriesApi extends AbstractApi | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
|
||
$this->entity = RateCategory::class; | ||
$this->collection = RateCategoryCollection::class; | ||
} | ||
|
||
/** | ||
* List all rate categories. | ||
* | ||
* @param array $query Query parameters. | ||
* | ||
* @return \Bluerock\Sellsy\Core\Response | ||
* @see https://api.sellsy.com/doc/v2/#operation/get-rate-categories | ||
*/ | ||
public function index(array $query = []): Response | ||
{ | ||
$response = $this->connection | ||
->request('rate-categories') | ||
->get($query); | ||
|
||
return $this->prepareResponse($response); | ||
} | ||
|
||
/** | ||
* Show a single rate category by id. | ||
* | ||
* @param string $id The rate category id to retrieve. | ||
* @param array $query Query parameters. | ||
* | ||
* @return \Bluerock\Sellsy\Core\Response | ||
* @see https://api.sellsy.com/doc/v2/#operation/get-rate-category | ||
*/ | ||
public function show(string $id, array $query = []): Response | ||
{ | ||
$response = $this->connection | ||
->request("rate-categories/{$id}") | ||
->get($query); | ||
|
||
return $this->prepareResponse($response); | ||
} | ||
|
||
/** | ||
* Store (create) a rate category. | ||
* | ||
* @param RateCategory $rateCategory The rate category entity to store. | ||
* @param array $query Query parameters. | ||
* | ||
* @return \Bluerock\Sellsy\Core\Response | ||
* @see https://api.sellsy.com/doc/v2/#operation/create-rate-category | ||
*/ | ||
public function store(RateCategory $rateCategory, array $query = []): Response | ||
{ | ||
$body = $rateCategory->except('id') | ||
->toArray(); | ||
|
||
$response = $this->connection | ||
->request('rate-categories') | ||
->post(array_filter($body) + $query); | ||
|
||
return $this->prepareResponse($response); | ||
} | ||
|
||
/** | ||
* Update an existing rate category. | ||
* | ||
* @param RateCategory $rateCategory The rate category entity to store. | ||
* @param array $query Query parameters. | ||
* | ||
* @return \Bluerock\Sellsy\Core\Response | ||
* @see https://api.sellsy.com/doc/v2/#operation/update-rate-category | ||
*/ | ||
public function update(RateCategory $rateCategory, array $query = []): Response | ||
{ | ||
$body = $rateCategory->except('id') | ||
->toArray(); | ||
|
||
$response = $this->connection | ||
->request("rate-categories/{$rateCategory->id}") | ||
->put(array_filter($body) + $query); | ||
|
||
return $this->prepareResponse($response); | ||
} | ||
|
||
/** | ||
* Delete an existing rate category. | ||
* | ||
* @param int $id The rate category id to be deleted. | ||
* | ||
* @return \Bluerock\Sellsy\Core\Response | ||
* @see https://api.sellsy.com/doc/v2/#operation/delete-rate-category | ||
*/ | ||
public function destroy(int $id): Response | ||
{ | ||
$response = $this->connection | ||
->request("rate-categories/{$id}") | ||
->delete(); | ||
|
||
return $this->prepareResponse($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Bluerock\Sellsy\Collections; | ||
|
||
use Bluerock\Sellsy\Entities\RateCategory; | ||
use Bluerock\Sellsy\Contracts\EntityCollectionContract; | ||
use Spatie\DataTransferObject\DataTransferObjectCollection; | ||
|
||
/** | ||
* The RateCategory Entity collection. | ||
* | ||
* @package bluerock/sellsy-client | ||
* @author Thomas <[email protected]> | ||
* @version 1.1 | ||
* @access public | ||
* | ||
* @method \Bluerock\Sellsy\Entities\RateCategory current | ||
*/ | ||
class RateCategoryCollection extends DataTransferObjectCollection implements EntityCollectionContract | ||
{ | ||
public static function create(array $data): RateCategoryCollection | ||
{ | ||
return new static(RateCategory::arrayOf($data)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Bluerock\Sellsy\Entities; | ||
|
||
use Bluerock\Sellsy\Entities\Entity; | ||
|
||
/** | ||
* The Accounting Entity. | ||
* | ||
* @package bluerock/sellsy-client | ||
* @author Thomas <[email protected]> | ||
* @version 1.1 | ||
* @access public | ||
*/ | ||
class Accounting extends Entity | ||
{ | ||
/** | ||
* Accounting code ID. | ||
*/ | ||
public ?int $accounting_code_id; | ||
|
||
/** | ||
* Discount accounting code ID. | ||
*/ | ||
public ?int $discount_accounting_code_id; | ||
} |
Oops, something went wrong.