@@ -22,7 +22,7 @@ class ConvertKit_API
2222 *
2323 * @var string
2424 */
25- public const VERSION = '1.0 .0 ' ;
25+ public const VERSION = '1.1 .0 ' ;
2626
2727 /**
2828 * ConvertKit API Key
@@ -393,6 +393,36 @@ public function create_tag(string $tag)
393393 );
394394 }
395395
396+ /**
397+ * Creates multiple tags.
398+ *
399+ * @param array<int,string> $tags Tag Names.
400+ *
401+ * @since 1.1.0
402+ *
403+ * @see https://developers.convertkit.com/#create-a-tag
404+ *
405+ * @return false|mixed
406+ */
407+ public function create_tags (array $ tags )
408+ {
409+ // Build API compatible array of tags.
410+ $ apiTags = [];
411+ foreach ($ tags as $ i => $ tag ) {
412+ $ apiTags [] = [
413+ 'name ' => (string ) $ tag ,
414+ ];
415+ }
416+
417+ return $ this ->post (
418+ 'tags ' ,
419+ [
420+ 'api_key ' => $ this ->api_key ,
421+ 'tag ' => $ apiTags ,
422+ ]
423+ );
424+ }
425+
396426 /**
397427 * Tags a subscriber with the given existing Tag.
398428 *
@@ -1449,8 +1479,8 @@ public function get(string $endpoint, array $args = [])
14491479 /**
14501480 * Performs a POST request to the API.
14511481 *
1452- * @param string $endpoint API Endpoint.
1453- * @param array<string, bool|integer|string|array<int|string, int|string>| string> $args Request arguments.
1482+ * @param string $endpoint API Endpoint.
1483+ * @param array<string, bool|integer|string|array<int|string, int|string|array< string|string>> > $args Request arguments.
14541484 *
14551485 * @return false|mixed
14561486 */
@@ -1500,9 +1530,9 @@ public function delete(string $endpoint, array $args = [])
15001530 /**
15011531 * Performs an API request using Guzzle.
15021532 *
1503- * @param string $endpoint API Endpoint.
1504- * @param string $method Request method.
1505- * @param array<string, bool|integer|string|array<int|string, int|string>| string> $args Request arguments.
1533+ * @param string $endpoint API Endpoint.
1534+ * @param string $method Request method.
1535+ * @param array<string, bool|integer|string|array<int|string, int|string|array< string|string>> > $args Request arguments.
15061536 *
15071537 * @throws \Exception If JSON encoding arguments failed.
15081538 *
0 commit comments