Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## [0.4.x (Unreleased)](https://github.com/onlime/bexio-api-client/compare/0.3.1...main)

- Added Bexio company profile endpoint request methods to `Other` resource.
- Create `Banking` resource with bank account methods.
- Added fetch users endpoint request method to `Other` resource.

## [0.4.1 (2022-03-24)](https://github.com/onlime/bexio-api-client/compare/0.4.0...0.4.1)

Expand Down
36 changes: 36 additions & 0 deletions src/Bexio/Resource/Banking.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
namespace Bexio\Resource;

use Bexio\Bexio;

/**
* Class Banking
* @package Bexio\Resource
*/
class Banking extends Bexio
{
/**
* Fetch a list of bank accounts
*
* @link https://docs.bexio.com/#tag/Bank-Accounts/operation/ListBankAccounts
*/
public function getBankAccounts(array $params = []): array
{
return is_array($result = $this->client->get('3.0/banking/accounts', $params)) ? $result : [];
}

/**
* Fetch a single bank account
*
* @link https://docs.bexio.com/#tag/Bank-Accounts/operation/ShowBankAccount
*/
public function getBankAccount(int $id): ?\stdClass
{
try {
return (($result = $this->client->get('3.0/banking/accounts/' . $id)) instanceof \stdClass) ? $result : null;
} catch (\Exception $e) {
// The bank account doesn't exist
return null;
}
}
}
10 changes: 10 additions & 0 deletions src/Bexio/Resource/Other.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,14 @@ public function getUnits(array $params = [])
{
return $this->client->get('unit', $params);
}

/**
* Fetch a list of users
*
* @link https://docs.bexio.com/#tag/User-Management/operation/v3ListUsers
*/
public function getUsers(array $params = []): array
{
return is_array($result = $this->client->get('3.0/users', $params)) ? $result : [];
}
}