Skip to content

Commit 1dc992c

Browse files
authored
Merge pull request #3 from peterquentin/fix/query-parameters-for-get-requests
Make query parameters available on get requests for all resources
2 parents a2a9dfc + 1dffba1 commit 1dc992c

File tree

6 files changed

+40
-16
lines changed

6 files changed

+40
-16
lines changed

src/contacts/Contacts.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,16 @@ public function listAll(array $query_params = [], int $limit = 20, int $offset =
209209
/**
210210
* List all custom fields
211211
* @see https://developers.activecampaign.com/v3/reference#retrieve-fields-1
212+
* @param array $query_params
212213
* @return string
213214
*/
214-
public function listAllCustomFields()
215+
public function listAllCustomFields(array $query_params = [])
215216
{
216217
$req = $this->client
217218
->getClient()
218-
->get('/api/3/fields');
219+
->get('/api/3/fields', [
220+
'query' => $query_params
221+
]);
219222

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

src/deals/Deals.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,16 @@ public function deleteCustomFieldValue(int $custom_field_id)
190190
/**
191191
* List all custom fields
192192
* @see https://developers.activecampaign.com/reference#retrieve-all-dealcustomfielddata-resources
193+
* @param array $query_params
193194
* @return string
194195
*/
195-
public function listAllCustomFields()
196+
public function listAllCustomFields(array $query_params = [])
196197
{
197198
$req = $this->client
198199
->getClient()
199-
->get('/api/3/dealCustomFieldMeta');
200+
->get('/api/3/dealCustomFieldMeta', [
201+
'query' => $query_params
202+
]);
200203

201204
return $req->getBody()->getContents();
202205
}
@@ -221,27 +224,33 @@ public function listAllCustomFieldValues(array $query_params)
221224
/**
222225
* List all pipelines
223226
* @see https://developers.activecampaign.com/reference#list-all-pipelines
227+
* @param array $query_params
224228
* @return string
225229
*/
226-
public function listAllPipelines()
230+
public function listAllPipelines(array $query_params = [])
227231
{
228232
$req = $this->client
229233
->getClient()
230-
->get('/api/3/dealGroups');
234+
->get('/api/3/dealGroups', [
235+
'query' => $query_params
236+
]);
231237

232238
return $req->getBody()->getContents();
233239
}
234240

235241
/**
236242
* List all stages
237243
* @see https://developers.activecampaign.com/reference#list-all-deal-stages
244+
* @param array $query_params
238245
* @return string
239246
*/
240-
public function listAllStages()
247+
public function listAllStages(array $query_params = [])
241248
{
242249
$req = $this->client
243250
->getClient()
244-
->get('/api/3/dealStages');
251+
->get('/api/3/dealStages', [
252+
'query' => $query_params
253+
]);
245254

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

src/lists/Lists.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,20 @@ public function create(array $list)
3636
* Retrieve all lists or a list when id is not null
3737
* @see https://developers.activecampaign.com/reference#retrieve-a-list
3838
* @param null $id
39+
* @param array $query_params
3940
* @return string
4041
*/
41-
public function retrieve($id = null)
42+
public function retrieve($id = null, array $query_params = [])
4243
{
4344
$uri = '/api/3/lists';
4445
if (!is_null($id)) {
4546
$uri .= '/' . $id;
4647
}
4748
$req = $this->client
4849
->getClient()
49-
->get($uri);
50+
->get($uri, [
51+
'query' => $query_params
52+
]);
5053

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

src/tags/Tags.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ class Tags extends Resource
1515
/**
1616
* List all tags
1717
* @see https://developers.activecampaign.com/reference#retrieve-all-tags
18+
* @param array $query_params
1819
* @return string
1920
*/
20-
public function listAll()
21+
public function listAll(array $query_params = [])
2122
{
2223
$req = $this->client
2324
->getClient()
24-
->get('/api/3/tags');
25+
->get('/api/3/tags', [
26+
'query' => $query_params
27+
]);
2528

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

src/tracking/EventTracking.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,16 @@ public function deleteEvent(string $event_name)
6767
* List all events
6868
* @see https://developers.activecampaign.com/v3/reference#list-all-event-types
6969
*
70+
* @param array $query_params
7071
* @return string
7172
*/
72-
public function listAllEvents()
73+
public function listAllEvents(array $query_params = [])
7374
{
7475
$req = $this->client
7576
->getClient()
76-
->get('api/3/eventTrackingEvents');
77+
->get('api/3/eventTrackingEvents', [
78+
'query' => $query_params
79+
]);
7780

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

src/tracking/SiteTracking.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ class SiteTracking extends Resource
1515
/**
1616
* Get site tracking status (enabled or disabled)
1717
* @see https://developers.activecampaign.com/reference#retrieve-site-tracking-status
18+
* @param array $query_params
1819
* @return string
1920
*/
20-
public function retrieveStatus()
21+
public function retrieveStatus(array $query_params = [])
2122
{
2223
$req = $this->client
2324
->getClient()
24-
->get('api/3/siteTracking');
25+
->get('api/3/siteTracking', [
26+
'query' => $query_params
27+
]);
2528

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

0 commit comments

Comments
 (0)