From 1dffba15f8bfd9fe96f366f0983c6bbbe60a49c0 Mon Sep 17 00:00:00 2001 From: Peter Quentin Date: Thu, 23 May 2019 15:02:03 +0200 Subject: [PATCH] Make query parameters available on get requests for all resources --- src/contacts/Contacts.php | 7 +++++-- src/deals/Deals.php | 21 +++++++++++++++------ src/lists/Lists.php | 7 +++++-- src/tags/Tags.php | 7 +++++-- src/tracking/EventTracking.php | 7 +++++-- src/tracking/SiteTracking.php | 7 +++++-- 6 files changed, 40 insertions(+), 16 deletions(-) diff --git a/src/contacts/Contacts.php b/src/contacts/Contacts.php index a6335d1..169ffb8 100644 --- a/src/contacts/Contacts.php +++ b/src/contacts/Contacts.php @@ -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(); } diff --git a/src/deals/Deals.php b/src/deals/Deals.php index 6830e13..7a468ec 100644 --- a/src/deals/Deals.php +++ b/src/deals/Deals.php @@ -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(); } @@ -221,13 +224,16 @@ 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(); } @@ -235,13 +241,16 @@ public function listAllPipelines() /** * 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(); } diff --git a/src/lists/Lists.php b/src/lists/Lists.php index bd87f78..94d8d47 100644 --- a/src/lists/Lists.php +++ b/src/lists/Lists.php @@ -36,9 +36,10 @@ 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)) { @@ -46,7 +47,9 @@ public function retrieve($id = null) } $req = $this->client ->getClient() - ->get($uri); + ->get($uri, [ + 'query' => $query_params + ]); return $req->getBody()->getContents(); } diff --git a/src/tags/Tags.php b/src/tags/Tags.php index fce7e81..f8c2312 100644 --- a/src/tags/Tags.php +++ b/src/tags/Tags.php @@ -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(); } diff --git a/src/tracking/EventTracking.php b/src/tracking/EventTracking.php index 9e23156..7b4f3ad 100644 --- a/src/tracking/EventTracking.php +++ b/src/tracking/EventTracking.php @@ -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(); } diff --git a/src/tracking/SiteTracking.php b/src/tracking/SiteTracking.php index 76b5015..4343127 100644 --- a/src/tracking/SiteTracking.php +++ b/src/tracking/SiteTracking.php @@ -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(); }