ConvertKit/ConvertKitSDK-PHP

ConvertKit_API::create_tag() does not support multiple tags creation

Closed this issue · 1 comments

Is your feature request related to a problem?

CK API supports creating multiple tags in one go.
See API: https://developers.convertkit.com/#create-a-tag (note the Multiple tags example).

The \ConvertKit_API\ConvertKit_API::create_tag() method does not support this behavior allowing only a single tag per request to be created.

Describe the solution you'd like

Modify \ConvertKit_API\ConvertKit_API::create_tag() to support not just the string parameter as a single tag name, but also accepting an array OR always accepting an array (even with a single tag name).

Describe alternatives you've considered

I had to implement a copy of this method that basically does this:

$options = [ 'api_secret' => $this->api_secret ];

foreach ( $tag_labels as $label ) {
	$options['tag'][] = [ 'name' => $label ];
}

return $this->post( 'tags', $options );

Available with the create_tags() method in 1.1