Skip to content

Commit

Permalink
Merge pull request #3 from peterquentin/fix/query-parameters-for-get-…
Browse files Browse the repository at this point in the history
…requests

Make query parameters available on get requests for all resources
  • Loading branch information
atomasevic authored May 24, 2019
2 parents a2a9dfc + 1dffba1 commit 1dc992c
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 16 deletions.
7 changes: 5 additions & 2 deletions src/contacts/Contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,16 @@ public function listAll(array $query_params = [], int $limit = 20, int $offset =
/**
* List all custom fields
* @see https://developers.activecampaign.com/v3/reference#retrieve-fields-1
* @param array $query_params
* @return string
*/
public function listAllCustomFields()
public function listAllCustomFields(array $query_params = [])
{
$req = $this->client
->getClient()
->get('/api/3/fields');
->get('/api/3/fields', [
'query' => $query_params
]);

return $req->getBody()->getContents();
}
Expand Down
21 changes: 15 additions & 6 deletions src/deals/Deals.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,16 @@ public function deleteCustomFieldValue(int $custom_field_id)
/**
* List all custom fields
* @see https://developers.activecampaign.com/reference#retrieve-all-dealcustomfielddata-resources
* @param array $query_params
* @return string
*/
public function listAllCustomFields()
public function listAllCustomFields(array $query_params = [])
{
$req = $this->client
->getClient()
->get('/api/3/dealCustomFieldMeta');
->get('/api/3/dealCustomFieldMeta', [
'query' => $query_params
]);

return $req->getBody()->getContents();
}
Expand All @@ -221,27 +224,33 @@ public function listAllCustomFieldValues(array $query_params)
/**
* List all pipelines
* @see https://developers.activecampaign.com/reference#list-all-pipelines
* @param array $query_params
* @return string
*/
public function listAllPipelines()
public function listAllPipelines(array $query_params = [])
{
$req = $this->client
->getClient()
->get('/api/3/dealGroups');
->get('/api/3/dealGroups', [
'query' => $query_params
]);

return $req->getBody()->getContents();
}

/**
* List all stages
* @see https://developers.activecampaign.com/reference#list-all-deal-stages
* @param array $query_params
* @return string
*/
public function listAllStages()
public function listAllStages(array $query_params = [])
{
$req = $this->client
->getClient()
->get('/api/3/dealStages');
->get('/api/3/dealStages', [
'query' => $query_params
]);

return $req->getBody()->getContents();
}
Expand Down
7 changes: 5 additions & 2 deletions src/lists/Lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,20 @@ public function create(array $list)
* Retrieve all lists or a list when id is not null
* @see https://developers.activecampaign.com/reference#retrieve-a-list
* @param null $id
* @param array $query_params
* @return string
*/
public function retrieve($id = null)
public function retrieve($id = null, array $query_params = [])
{
$uri = '/api/3/lists';
if (!is_null($id)) {
$uri .= '/' . $id;
}
$req = $this->client
->getClient()
->get($uri);
->get($uri, [
'query' => $query_params
]);

return $req->getBody()->getContents();
}
Expand Down
7 changes: 5 additions & 2 deletions src/tags/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ class Tags extends Resource
/**
* List all tags
* @see https://developers.activecampaign.com/reference#retrieve-all-tags
* @param array $query_params
* @return string
*/
public function listAll()
public function listAll(array $query_params = [])
{
$req = $this->client
->getClient()
->get('/api/3/tags');
->get('/api/3/tags', [
'query' => $query_params
]);

return $req->getBody()->getContents();
}
Expand Down
7 changes: 5 additions & 2 deletions src/tracking/EventTracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ public function deleteEvent(string $event_name)
* List all events
* @see https://developers.activecampaign.com/v3/reference#list-all-event-types
*
* @param array $query_params
* @return string
*/
public function listAllEvents()
public function listAllEvents(array $query_params = [])
{
$req = $this->client
->getClient()
->get('api/3/eventTrackingEvents');
->get('api/3/eventTrackingEvents', [
'query' => $query_params
]);

return $req->getBody()->getContents();
}
Expand Down
7 changes: 5 additions & 2 deletions src/tracking/SiteTracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ class SiteTracking extends Resource
/**
* Get site tracking status (enabled or disabled)
* @see https://developers.activecampaign.com/reference#retrieve-site-tracking-status
* @param array $query_params
* @return string
*/
public function retrieveStatus()
public function retrieveStatus(array $query_params = [])
{
$req = $this->client
->getClient()
->get('api/3/siteTracking');
->get('api/3/siteTracking', [
'query' => $query_params
]);

return $req->getBody()->getContents();
}
Expand Down

0 comments on commit 1dc992c

Please sign in to comment.