From d037f4ed11e8c408508e312fa28f470d01c21cfb Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Mon, 8 Jun 2026 11:34:53 +0100 Subject: [PATCH 1/2] Add `slim` query parameter to `get_subscribers()` and `get_form_subscriptions()` --- src/ConvertKit_API_Traits.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ConvertKit_API_Traits.php b/src/ConvertKit_API_Traits.php index f758017..4f95c06 100644 --- a/src/ConvertKit_API_Traits.php +++ b/src/ConvertKit_API_Traits.php @@ -332,6 +332,7 @@ public function add_subscriber_to_legacy_form(int $form_id, int $subscriber_id) * @param \DateTime|null $created_before Filter subscribers who have been created before this date. * @param \DateTime|null $added_after Filter subscribers who have been added to the form after this date. * @param \DateTime|null $added_before Filter subscribers who have been added to the form before this date. + * @param boolean $slim When true, omits expensive optional fields from the response. * @param boolean $include_total_count To include the total count of records in the response, use true. * @param string $after_cursor Return results after the given pagination cursor. * @param string $before_cursor Return results before the given pagination cursor. @@ -348,13 +349,14 @@ public function get_form_subscriptions( \DateTime|null $created_before = null, \DateTime|null $added_after = null, \DateTime|null $added_before = null, + bool $slim = false, bool $include_total_count = false, string $after_cursor = '', string $before_cursor = '', int $per_page = 100 ) { // Build parameters. - $options = []; + $options = ['slim' => $slim]; if (!empty($subscriber_state)) { $options['status'] = $subscriber_state; @@ -1363,6 +1365,7 @@ public function get_post(int $id) * @param string $sort_field Sort Field (id|updated_at|cancelled_at). * @param string $sort_order Sort Order (asc|desc). * @param array $include Additional fields to include: attribution, tags, location, canceled_at. + * @param boolean $slim When true, omits expensive optional fields from the response. * @param boolean $include_total_count To include the total count of records in the response, use true. * @param string $after_cursor Return results after the given pagination cursor. * @param string $before_cursor Return results before the given pagination cursor. @@ -1384,13 +1387,14 @@ public function get_subscribers( string $sort_field = 'id', string $sort_order = 'desc', array $include = [], + bool $slim = false, bool $include_total_count = false, string $after_cursor = '', string $before_cursor = '', int $per_page = 100 ) { // Build parameters. - $options = []; + $options = ['slim' => $slim]; if (!empty($subscriber_state)) { $options['status'] = $subscriber_state; From 64614c38f075829e8d7e9fcf48a32790d0578114 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Mon, 8 Jun 2026 11:42:53 +0100 Subject: [PATCH 2/2] Added tests --- tests/ConvertKitAPITest.php | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tests/ConvertKitAPITest.php b/tests/ConvertKitAPITest.php index cb07ce6..295eaa4 100644 --- a/tests/ConvertKitAPITest.php +++ b/tests/ConvertKitAPITest.php @@ -689,6 +689,30 @@ public function testGetFormSubscriptions() $this->assertPaginationExists($result); } + /** + * Test that get_form_subscriptions() returns the expected data + * when the slim parameter is specified. + * + * @since 2.5 + * + * @return void + */ + public function testGetFormSubscriptionsWithSlimParameter() + { + $result = $this->api->get_form_subscriptions( + form_id: (int) $_ENV['CONVERTKIT_API_FORM_ID'], + slim: true + ); + + // Assert subscribers and pagination exist. + $this->assertDataExists($result, 'subscribers'); + $this->assertPaginationExists($result); + + // Confirm custom field values are excluded from the data. + $subscriber = get_object_vars($result->subscribers[0]); + $this->assertArrayNotHasKey('fields', $subscriber); + } + /** * Test that get_form_subscriptions() returns the expected data * when the total count is included. @@ -3829,6 +3853,29 @@ public function testGetSubscribers() $this->assertPaginationExists($result); } + /** + * Test that get_subscribers() returns the expected data + * when the slim parameter is specified. + * + * @since 2.5 + * + * @return void + */ + public function testGetSubscribersWithSlimParameter() + { + $result = $this->api->get_subscribers( + slim: true + ); + + // Assert subscribers and pagination exist. + $this->assertDataExists($result, 'subscribers'); + $this->assertPaginationExists($result); + + // Confirm custom field values are excluded from the data. + $subscriber = get_object_vars($result->subscribers[0]); + $this->assertArrayNotHasKey('fields', $subscriber); + } + /** * Test that get_subscribers() returns the expected data * when the total count is included.