ConvertKit/ConvertKitSDK-PHP

ConvertKit_API::create_custom_field() does not support multiple fields creation

slaFFik opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

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

The \ConvertKit_API\ConvertKit_API::create_custom_field() 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_custom_field() to support not just the string parameter as a single field label, but also accepting an array OR always accepting an array (even with a single field label).

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 ( $field_labels as $label ) {
	$options['label'][] = [ 'name' => $label ];
}

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

Additional context

No response

Whoops, please ignore this issue, I only after the creation noticed the create_custom_fields() method.