Skip to content

Commit

Permalink
Upgrade minimum PHP version to 7.1 & Rename functions
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineLemaire authored Jun 30, 2020
1 parent d70de22 commit 8840ef9
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 41 deletions.
24 changes: 24 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# CHANGELOG

## 2.0.0 (2020-06-30)
* Upgrade minimum PHP version to 7.1
* BC BREAK: review naming of all functions in all endpoint to simplify them:
* list
* get
* update
* create
* search
* link
* ...

Eg:
```
# Before
$client->users->getUsers;
$client->users->getUser('155468');
# After
$client->users->list();
$client->users->get('155468');
```


## 1.1.0 (2020-06-30)

* Fix AircallCalls::comment
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,58 +44,58 @@ $client->ping();

```php
// Get generic data about the account
$client->company->getCompany();
$client->company->get();
```

### Users

```php
// Get a user by ID
$client->users->getUser('155468');
$client->users->get('155468');

// List all users
$client->users->getUsers();
$client->users->list();
```

### Calls

```php
// Get a call by ID
$client->calls->getCall('155468');
$client->calls->get('155468');

// List all calls
$client->calls->getCalls();
$client->calls->list();

// Search calls
$client->calls->searchCalls([
$client->calls->search([
'tags' => 'myTag',
]);

// Display a link in-app to the User who answered a specific Call.
$client->calls->linkCall('155468', [
$client->calls->link('155468', [
'link' => 'http://something.io/mypage'
]);

// Transfer the Call to another user.
$client->calls->transfertCall('1644658', [
$client->calls->transfert('1644658', [
'user_id' => '8945487'
]);

// Delete the recording of a specific Call.
$client->calls->deleteRecordingCall('795312');
$client->calls->deleteRecording('795312');

// Delete the voicemail of a specific Call.
$client->calls->deleteVoicemailCall('13877988');
$client->calls->deleteVoicemail('13877988');
```

### Contacts

```php
// List all contacts
$client->contacts->getContacts();
$client->contacts->list();

// Get a contact by ID
$client->contacts->getContact('699421');
$client->contacts->get('699421');

// Create a contact
$client->contacts->create([
Expand All @@ -117,7 +117,7 @@ $client->contacts->create([
]);

// Search contacts
$client->contacts->searchContacts([
$client->contacts->search([
'phone_number' => '+33631000000',
'email' => 'john.doe@something.io'
]);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"require": {
"guzzlehttp/guzzle": "~6.0",
"php": ">= 5.6"
"php": ">= 7.1"
},
"require-dev": {
"phpunit/phpunit": "4.0.*"
Expand Down
16 changes: 8 additions & 8 deletions src/AircallCalls.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ public function __construct($client)
*
* @return mixed
*/
public function getCalls($options)
public function list($options)
{
return $this->client->get(self::BASE_ENDPOINT, $options);
}

/**
* Gets a single Call with their ID.
* Retrieve a single Call.
*
* @param int $id
*
* @throws \GuzzleHttp\Exception\GuzzleException
*
* @return mixed
*/
public function getCall($id)
public function get($id)
{
$path = $this->callPath($id);

Expand All @@ -63,7 +63,7 @@ public function getCall($id)
*
* @return mixed
*/
public function searchCalls($options = [])
public function search($options = [])
{
return $this->client->get(self::BASE_ENDPOINT.'/search', $options);
}
Expand All @@ -80,7 +80,7 @@ public function searchCalls($options = [])
*
* @return mixed
*/
public function linkCall($id, $options = [])
public function link($id, $options = [])
{
$path = $this->callPath($id);

Expand All @@ -97,7 +97,7 @@ public function linkCall($id, $options = [])
*
* @return mixed
*/
public function transfertCall($id, $options = [])
public function transfert($id, $options = [])
{
$path = $this->callPath($id);

Expand Down Expand Up @@ -200,7 +200,7 @@ public function setTags($id, $options = [])
*
* @return mixed
*/
public function deleteRecordingCall($id)
public function deleteRecording($id)
{
$path = $this->callPath($id);

Expand All @@ -217,7 +217,7 @@ public function deleteRecordingCall($id)
*
* @return mixed
*/
public function deleteVoicemailCall($id, $options = [])
public function deleteVoicemail($id, $options = [])
{
$path = $this->callPath($id);

Expand Down
2 changes: 1 addition & 1 deletion src/AircallCompany.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct($client)
*
* @return mixed
*/
public function getCompany($options = [])
public function get($options = [])
{
return $this->client->get(self::BASE_ENDPOINT, $options);
}
Expand Down
8 changes: 4 additions & 4 deletions src/AircallContacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ public function __construct($client)
*
* @return mixed
*/
public function getContacts($options = [])
public function list($options = [])
{
return $this->client->get(self::BASE_ENDPOINT, $options);
}

/**
* Gets a single Contact with their ID.
* Retrieve a single Contact.
*
* @param int $id
*
* @throws \GuzzleHttp\Exception\GuzzleException
*
* @return mixed
*/
public function getContact($id)
public function get($id)
{
$path = $this->contactPath($id);

Expand Down Expand Up @@ -110,7 +110,7 @@ public function delete($id)
*
* @return mixed
*/
public function searchContacts($options = [])
public function search($options = [])
{
return $this->client->get(self::BASE_ENDPOINT.'/search', $options);
}
Expand Down
10 changes: 5 additions & 5 deletions src/AircallNumbers.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,29 @@ public function __construct($client)
*
* @return mixed
*/
public function getNumbers($options = [])
public function list($options = [])
{
return $this->client->get(self::BASE_ENDPOINT, $options);
}

/**
* Gets a single Number with their ID.
* Retrieve a Number.
*
* @param int $id
*
* @throws \GuzzleHttp\Exception\GuzzleException
*
* @return mixed
*/
public function getNumber($id)
public function get($id)
{
$path = $this->numberPath($id);

return $this->client->get($path);
}

/**
* Update a single Number with their ID.
* Update a single Number.
*
* @param int $id
* @param array $options
Expand All @@ -64,7 +64,7 @@ public function getNumber($id)
*
* @return mixed
*/
public function updateNumber($id, $options = [])
public function update($id, $options = [])
{
$path = $this->numberPath($id);

Expand Down
6 changes: 3 additions & 3 deletions src/AircallTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ public function __construct($client)
*
* @return mixed
*/
public function getTags($options = [])
public function list($options = [])
{
return $this->client->get(self::BASE_ENDPOINT, $options);
}

/**
* Retrieve a Tag with their ID.
* Retrieve a Tag.
*
* @param int $id
*
* @throws \GuzzleHttp\Exception\GuzzleException
*
* @return mixed
*/
public function getTag($id)
public function get($id)
{
$path = $this->tagPath($id);

Expand Down
8 changes: 4 additions & 4 deletions src/AircallUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,29 @@ public function __construct($client)
*
* @return mixed
*/
public function getUsers($options = [])
public function list($options = [])
{
return $this->client->get(self::BASE_ENDPOINT, $options);
}

/**
* Gets a single User with their ID.
* Retrieve a single User.
*
* @param int $id
*
* @throws \GuzzleHttp\Exception\GuzzleException
*
* @return mixed
*/
public function getUser($id)
public function get($id)
{
$path = $this->userPath($id);

return $this->client->get($path);
}

/**
* Start an outbound call for a specific User.
* Start an outbound call.
*
* @param int $id
*
Expand Down
4 changes: 2 additions & 2 deletions src/AircallWebhooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct($client)
*
* @return mixed
*/
public function getWebhooks($options = [])
public function list($options = [])
{
return $this->client->get(self::BASE_ENDPOINT, $options);
}
Expand Down Expand Up @@ -59,7 +59,7 @@ public function create($options = [])
*
* @return mixed
*/
public function getWebhook($id)
public function get($id)
{
$path = $this->webhookPath($id);

Expand Down

0 comments on commit 8840ef9

Please sign in to comment.