From 760d6a7edffb8206d8b3bc139b8e119691bb33a4 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Tue, 21 Mar 2023 15:52:42 +0000 Subject: [PATCH 01/15] Added phpDocumentor generated API docs --- .gitignore | 1 + composer.json | 10 +- docs/classes/ConvertKit_API/ConvertKit_API.md | 1504 +++++++++++++++++ docs/index.md | 26 + phpcs.xml | 5 + src/ConvertKit_API.php | 4 +- 6 files changed, 1544 insertions(+), 6 deletions(-) create mode 100644 docs/classes/ConvertKit_API/ConvertKit_API.md create mode 100644 docs/index.md diff --git a/.gitignore b/.gitignore index 36c9917..7a9b69d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.phpdoc .DS_Store .env .env.testing diff --git a/composer.json b/composer.json index 6dee533..89e528c 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,8 @@ "vlucas/phpdotenv": "^5.5", "phpunit/phpunit": "^5.7 || ^9.0", "squizlabs/php_codesniffer": "^3.3", - "phpstan/phpstan": "^1.2" + "phpstan/phpstan": "^1.2", + "saggre/phpdocumentor-markdown": "^0.1.3" }, "autoload": { "psr-4": { @@ -31,5 +32,8 @@ } }, "minimum-stability": "dev", - "prefer-stable": true -} \ No newline at end of file + "prefer-stable": true, + "scripts": { + "create-docs": "phpDocumentor --directory=src --target=docs --template='vendor/saggre/phpdocumentor-markdown/themes/markdown'" + } +} diff --git a/docs/classes/ConvertKit_API/ConvertKit_API.md b/docs/classes/ConvertKit_API/ConvertKit_API.md new file mode 100644 index 0000000..c31fa89 --- /dev/null +++ b/docs/classes/ConvertKit_API/ConvertKit_API.md @@ -0,0 +1,1504 @@ +*** + +# ConvertKit_API + +ConvertKit API Class + + + +* Full name: `\ConvertKit_API\ConvertKit_API` + + +## Constants + +| Constant | Visibility | Type | Value | +|:---------|:-----------|:-----|:------| +|`VERSION`|public|string|'1.0.0'| + +## Properties + + +### api_key + +ConvertKit API Key + +```php +protected string $api_key +``` + + + + + + +*** + +### api_secret + +ConvertKit API Secret + +```php +protected string $api_secret +``` + + + + + + +*** + +### api_version + +Version of ConvertKit API + +```php +protected string $api_version +``` + + + + + + +*** + +### api_url_base + +ConvertKit API URL + +```php +protected string $api_url_base +``` + + + + + + +*** + +### debug + +Debug + +```php +protected bool $debug +``` + + + + + + +*** + +### debug_logger + +Debug + +```php +protected \Monolog\Logger $debug_logger +``` + + + + + + +*** + +### client + +Guzzle Http Client + +```php +protected \GuzzleHttp\Client $client +``` + + + + + + +*** + +## Methods + + +### __construct + +Constructor for ConvertKitAPI instance + +```php +public __construct(string $api_key, string $api_secret, bool $debug = false): mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$api_key` | **string** | ConvertKit API Key. | +| `$api_secret` | **string** | ConvertKit API Secret. | +| `$debug` | **bool** | Log requests to debugger. | + + + + +*** + +### create_log + +Add an entry to monologger. + +```php +private create_log(string $message): void +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$message` | **string** | Message. | + + + + +*** + +### get_account + +Gets the current account + +```php +public get_account(): false|mixed +``` + + + + + + + + + + + +*** + +### get_forms + +Gets all forms. + +```php +public get_forms(): false|mixed +``` + + + + + + + + + + + +*** + +### get_landing_pages + +Gets all landing pages. + +```php +public get_landing_pages(): false|mixed +``` + + + + + + + + + + + +*** + +### form_subscribe + +Adds a subscriber to a form. + +```php +public form_subscribe(int $form_id, array<string,string> $options): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$form_id` | **int** | Form ID. | +| `$options` | **array** | Array of user data (email, name). | + + + + +*** + +### get_form_subscriptions + +List subscriptions to a form + +```php +public get_form_subscriptions(int $form_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$form_id` | **int** | Form ID. | +| `$sort_order` | **string** | Sort Order (asc&#124;desc). | +| `$subscriber_state` | **string** | Subscriber State (active,cancelled). | +| `$page` | **int** | Page. | + + + +**See Also:** + +* https://developers.convertkit.com/#list-subscriptions-to-a-form - + +*** + +### get_sequences + +Gets all sequences + +```php +public get_sequences(): false|mixed +``` + + + + + + + + + + +**See Also:** + +* https://developers.convertkit.com/#list-sequences - + +*** + +### add_subscriber_to_sequence + +Adds a subscriber to a sequence by email address + +```php +public add_subscriber_to_sequence(int $sequence_id, string $email, string $first_name = '', array<string,string> $fields = [], array<string,int> $tag_ids = []): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$sequence_id` | **int** | Sequence ID. | +| `$email` | **string** | Email Address. | +| `$first_name` | **string** | First Name. | +| `$fields` | **array** | Custom Fields. | +| `$tag_ids` | **array** | Tag ID(s) to subscribe to. | + + + +**See Also:** + +* https://developers.convertkit.com/#add-subscriber-to-a-sequence - + +*** + +### get_sequence_subscriptions + +Gets subscribers to a sequence + +```php +public get_sequence_subscriptions(int $sequence_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$sequence_id` | **int** | Sequence ID. | +| `$sort_order` | **string** | Sort Order (asc&#124;desc). | +| `$subscriber_state` | **string** | Subscriber State (active,cancelled). | +| `$page` | **int** | Page. | + + + +**See Also:** + +* https://developers.convertkit.com/#list-subscriptions-to-a-sequence - + +*** + +### get_tags + +Gets all tags. + +```php +public get_tags(): false|mixed +``` + + + + + + + + + + +**See Also:** + +* https://developers.convertkit.com/#list-tags - + +*** + +### create_tag + +Creates a tag. + +```php +public create_tag(string $tag): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$tag` | **string** | Tag Name. | + + + +**See Also:** + +* https://developers.convertkit.com/#create-a-tag - + +*** + +### tag_subscriber + +Tags a subscriber with the given existing Tag. + +```php +public tag_subscriber(int $tag_id, string $email, string $first_name = '', array<string,string> $fields = []): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$tag_id` | **int** | Tag ID. | +| `$email` | **string** | Email Address. | +| `$first_name` | **string** | First Name. | +| `$fields` | **array** | Custom Fields. | + + + +**See Also:** + +* https://developers.convertkit.com/#tag-a-subscriber - + +*** + +### add_tag + +Adds a tag to a subscriber. + +```php +public add_tag(int $tag, array<string,mixed> $options): false|object +``` + + + + + + +* **Warning:** this method is **deprecated**. This means that this method will likely be removed in a future version. + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$tag` | **int** | Tag ID. | +| `$options` | **array** | Array of user data. | + + + +**See Also:** + +* https://developers.convertkit.com/#tag-a-subscriber - + +*** + +### remove_tag_from_subscriber + +Removes a tag from a subscriber. + +```php +public remove_tag_from_subscriber(int $tag_id, int $subscriber_id): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$tag_id` | **int** | Tag ID. | +| `$subscriber_id` | **int** | Subscriber ID. | + + + +**See Also:** + +* https://developers.convertkit.com/#remove-tag-from-a-subscriber - + +*** + +### remove_tag_from_subscriber_by_email + +Removes a tag from a subscriber by email address. + +```php +public remove_tag_from_subscriber_by_email(int $tag_id, string $email): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$tag_id` | **int** | Tag ID. | +| `$email` | **string** | Subscriber email address. | + + + +**See Also:** + +* https://developers.convertkit.com/#remove-tag-from-a-subscriber-by-email - + +*** + +### get_tag_subscriptions + +List subscriptions to a tag + +```php +public get_tag_subscriptions(int $tag_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$tag_id` | **int** | Tag ID. | +| `$sort_order` | **string** | Sort Order (asc&#124;desc). | +| `$subscriber_state` | **string** | Subscriber State (active,cancelled). | +| `$page` | **int** | Page. | + + + +**See Also:** + +* https://developers.convertkit.com/#list-subscriptions-to-a-tag - + +*** + +### get_resources + +Gets a resource index +Possible resources: forms, landing_pages, subscription_forms, tags + +```php +public get_resources(string $resource): array<int|string,mixed|\stdClass> +``` + +GET /{$resource}/ + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$resource` | **string** | Resource type. | + + +**Return Value:** + +API response + + + +*** + +### get_subscriber_id + +Get the ConvertKit subscriber ID associated with email address if it exists. + +```php +public get_subscriber_id(string $email_address): false|int +``` + +Return false if subscriber not found. + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$email_address` | **string** | Email Address. | + + + + +*** + +### get_subscriber + +Get subscriber by id + +```php +public get_subscriber(int $subscriber_id): false|int +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$subscriber_id` | **int** | Subscriber ID. | + + + +**See Also:** + +* https://developers.convertkit.com/#view-a-single-subscriber - + +*** + +### update_subscriber + +Updates the information for a single subscriber. + +```php +public update_subscriber(int $subscriber_id, string $first_name = '', string $email_address = '', array<string,string> $fields = []): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$subscriber_id` | **int** | Existing Subscriber ID. | +| `$first_name` | **string** | New First Name. | +| `$email_address` | **string** | New Email Address. | +| `$fields` | **array** | Updated Custom Fields. | + + + +**See Also:** + +* https://developers.convertkit.com/#update-subscriber - + +*** + +### unsubscribe + +Unsubscribe an email address from all forms and sequences. + +```php +public unsubscribe(string $email): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$email` | **string** | Email Address. | + + + +**See Also:** + +* https://developers.convertkit.com/#unsubscribe-subscriber - + +*** + +### form_unsubscribe + +Remove subscription from a form + +```php +public form_unsubscribe(array<string,string> $options): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$options` | **array** | Array of user data (email). | + + + +**See Also:** + +* https://developers.convertkit.com/#unsubscribe-subscriber - + +*** + +### get_subscriber_tags + +Get a list of the tags for a subscriber. + +```php +public get_subscriber_tags(int $subscriber_id): false|array<int,\stdClass> +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$subscriber_id` | **int** | Subscriber ID. | + + + +**See Also:** + +* https://developers.convertkit.com/#list-tags-for-a-subscriber - + +*** + +### get_broadcasts + +Gets a list of broadcasts. + +```php +public get_broadcasts(): false|array<int,\stdClass> +``` + + + + + + + + + + +**See Also:** + +* https://developers.convertkit.com/#list-broadcasts - + +*** + +### create_broadcast + +Creates a broadcast. + +```php +public create_broadcast(string $subject = '', string $content = '', string $description = '', bool $public = false, \DateTime $published_at = null, \DateTime $send_at = null, string $email_address = '', string $email_layout_template = '', string $thumbnail_alt = '', string $thumbnail_url = ''): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$subject` | **string** | The broadcast email's subject. | +| `$content` | **string** | The broadcast's email HTML content. | +| `$description` | **string** | An internal description of this broadcast. | +| `$public` | **bool** | Specifies whether or not this is a public post. | +| `$published_at` | **\DateTime** | Specifies the time that this post was published (applicable
only to public posts). | +| `$send_at` | **\DateTime** | Time that this broadcast should be sent; leave blank to create
a draft broadcast. If set to a future time, this is the time that
the broadcast will be scheduled to send. | +| `$email_address` | **string** | Sending email address; leave blank to use your account's
default sending email address. | +| `$email_layout_template` | **string** | Name of the email template to use; leave blank to use your
account's default email template. | +| `$thumbnail_alt` | **string** | Specify the ALT attribute of the public thumbnail image
(applicable only to public posts). | +| `$thumbnail_url` | **string** | Specify the URL of the thumbnail image to accompany the broadcast
post (applicable only to public posts). | + + + +**See Also:** + +* https://developers.convertkit.com/#create-a-broadcast - + +*** + +### get_broadcast + +Retrieve a specific broadcast. + +```php +public get_broadcast(int $id): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$id` | **int** | Broadcast ID. | + + + +**See Also:** + +* https://developers.convertkit.com/#retrieve-a-specific-broadcast - + +*** + +### get_broadcast_stats + +Get the statistics (recipient count, open rate, click rate, unsubscribe count, +total clicks, status, and send progress) for a specific broadcast. + +```php +public get_broadcast_stats(int $id): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$id` | **int** | Broadcast ID. | + + + +**See Also:** + +* https://developers.convertkit.com/#retrieve-a-specific-broadcast - + +*** + +### update_broadcast + +Updates a broadcast. + +```php +public update_broadcast(int $id, string $subject = '', string $content = '', string $description = '', bool $public = false, \DateTime $published_at = null, \DateTime $send_at = null, string $email_address = '', string $email_layout_template = '', string $thumbnail_alt = '', string $thumbnail_url = ''): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$id` | **int** | Broadcast ID. | +| `$subject` | **string** | The broadcast email's subject. | +| `$content` | **string** | The broadcast's email HTML content. | +| `$description` | **string** | An internal description of this broadcast. | +| `$public` | **bool** | Specifies whether or not this is a public post. | +| `$published_at` | **\DateTime** | Specifies the time that this post was published (applicable
only to public posts). | +| `$send_at` | **\DateTime** | Time that this broadcast should be sent; leave blank to create
a draft broadcast. If set to a future time, this is the time that
the broadcast will be scheduled to send. | +| `$email_address` | **string** | Sending email address; leave blank to use your account's
default sending email address. | +| `$email_layout_template` | **string** | Name of the email template to use; leave blank to use your
account's default email template. | +| `$thumbnail_alt` | **string** | Specify the ALT attribute of the public thumbnail image
(applicable only to public posts). | +| `$thumbnail_url` | **string** | Specify the URL of the thumbnail image to accompany the broadcast
post (applicable only to public posts). | + + + +**See Also:** + +* https://developers.convertkit.com/#create-a-broadcast - + +*** + +### destroy_broadcast + +Deletes an existing broadcast. + +```php +public destroy_broadcast(int $id): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$id` | **int** | Broadcast ID. | + + + +**See Also:** + +* https://developers.convertkit.com/#destroy-webhook - + +*** + +### create_webhook + +Creates a webhook that will be called based on the chosen event types. + +```php +public create_webhook(string $url, string $event, string $parameter = ''): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$url` | **string** | URL to receive event. | +| `$event` | **string** | Event to subscribe to. | +| `$parameter` | **string** | Optional parameter depending on the event. | + + + +**See Also:** + +* https://developers.convertkit.com/#create-a-webhook - + +*** + +### destroy_webhook + +Deletes an existing webhook. + +```php +public destroy_webhook(int $rule_id): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$rule_id` | **int** | Rule ID. | + + + +**See Also:** + +* https://developers.convertkit.com/#destroy-webhook - + +*** + +### get_custom_fields + +List custom fields. + +```php +public get_custom_fields(): false|object +``` + + + + + + + + + + +**See Also:** + +* https://developers.convertkit.com/#list-fields - + +*** + +### create_custom_field + +Creates a custom field. + +```php +public create_custom_field(string $label): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$label` | **string** | Custom Field label. | + + + +**See Also:** + +* https://developers.convertkit.com/#create-field - + +*** + +### create_custom_fields + +Creates multiple custom fields. + +```php +public create_custom_fields(string[] $labels): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$labels` | **string[]** | Custom Fields labels. | + + + +**See Also:** + +* https://developers.convertkit.com/#create-field - + +*** + +### update_custom_field + +Updates an existing custom field. + +```php +public update_custom_field(int $id, string $label): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$id` | **int** | Custom Field ID. | +| `$label` | **string** | Updated Custom Field label. | + + + +**See Also:** + +* https://developers.convertkit.com/#update-field - + +*** + +### delete_custom_field + +Deletes an existing custom field. + +```php +public delete_custom_field(int $id): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$id` | **int** | Custom Field ID. | + + + +**See Also:** + +* https://developers.convertkit.com/#destroy-field - + +*** + +### list_purchases + +List purchases. + +```php +public list_purchases(array<string,string> $options): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$options` | **array** | Request options. | + + + +**See Also:** + +* https://developers.convertkit.com/#list-purchases - + +*** + +### get_purchase + +Retuns a specific purchase. + +```php +public get_purchase(int $purchase_id): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$purchase_id` | **int** | Purchase ID. | + + + +**See Also:** + +* https://developers.convertkit.com/#retrieve-a-specific-purchase - + +*** + +### create_purchase + +Creates a purchase. + +```php +public create_purchase(array<string,string> $options): false|object +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$options` | **array** | Purchase data. | + + + +**See Also:** + +* https://developers.convertkit.com/#create-a-purchase - + +*** + +### get_resource + +Get markup from ConvertKit for the provided $url. + +```php +public get_resource(string $url): false|string +``` + +Supports legacy forms and legacy landing pages. +Forms and Landing Pages should be embedded using the supplied JS embed script in +the API response when using get_resources(). + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$url` | **string** | URL of HTML page. | + + + + +*** + +### convert_relative_to_absolute_urls + +Converts any relative URls to absolute, fully qualified HTTP(s) URLs for the given +DOM Elements. + +```php +private convert_relative_to_absolute_urls(\DOMNodeList<\DOMElement> $elements, string $attribute, string $url): void +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$elements` | **\DOMNodeList<\DOMElement>** | Elements. | +| `$attribute` | **string** | HTML Attribute. | +| `$url` | **string** | Absolute URL to prepend to relative URLs. | + + + + +*** + +### strip_html_head_body_tags + +Strips , and opening and closing tags from the given markup, +as well as the Content-Type meta tag we might have added in get_html(). + +```php +private strip_html_head_body_tags(string $markup): string +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$markup` | **string** | HTML Markup. | + + +**Return Value:** + +HTML Markup + + + +*** + +### get + +Performs a GET request to the API. + +```php +public get(string $endpoint, array<string,int|string|array<string,int|string>> $args = []): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$endpoint` | **string** | API Endpoint. | +| `$args` | **array>** | Request arguments. | + + + + +*** + +### post + +Performs a POST request to the API. + +```php +public post(string $endpoint, array<string,bool|int|string|array<int|string,int|string>> $args = []): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$endpoint` | **string** | API Endpoint. | +| `$args` | **array>** | Request arguments. | + + + + +*** + +### put + +Performs a PUT request to the API. + +```php +public put(string $endpoint, array<string,bool|int|string|array<string,int|string>> $args = []): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$endpoint` | **string** | API Endpoint. | +| `$args` | **array>** | Request arguments. | + + + + +*** + +### delete + +Performs a DELETE request to the API. + +```php +public delete(string $endpoint, array<string,int|string|array<string,int|string>> $args = []): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$endpoint` | **string** | API Endpoint. | +| `$args` | **array>** | Request arguments. | + + + + +*** + +### make_request + +Performs an API request using Guzzle. + +```php +public make_request(string $endpoint, string $method, array<string,bool|int|string|array<int|string,int|string>> $args = []): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$endpoint` | **string** | API Endpoint. | +| `$method` | **string** | Request method. | +| `$args` | **array>** | Request arguments. | + + + + +*** + + +*** +> Automatically generated from source code comments on 2023-03-21 using [phpDocumentor](http://www.phpdoc.org/) and [saggre/phpdocumentor-markdown](https://github.com/Saggre/phpDocumentor-markdown) diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..87c6f47 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,26 @@ + +*** + +# Documentation + + + +This is an automatically generated documentation for **Documentation**. + + +## Namespaces + + +### \ConvertKit_API + +#### Classes + +| Class | Description | +|-------|-------------| +| [`ConvertKit_API`](./classes/ConvertKit_API/ConvertKit_API.md) | ConvertKit API Class| + + + + +*** +> Automatically generated from source code comments on 2023-03-21 using [phpDocumentor](http://www.phpdoc.org/) and [saggre/phpdocumentor-markdown](https://github.com/Saggre/phpDocumentor-markdown) diff --git a/phpcs.xml b/phpcs.xml index cca37f6..95c3996 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -23,6 +23,11 @@ + + + + + diff --git a/src/ConvertKit_API.php b/src/ConvertKit_API.php index 5651572..730aed9 100644 --- a/src/ConvertKit_API.php +++ b/src/ConvertKit_API.php @@ -2,9 +2,7 @@ /** * ConvertKit API * - * @package ConvertKit - * @subpackage ConvertKit_API - * @author ConvertKit + * @author ConvertKit */ namespace ConvertKit_API; From db3bb31f6ac72447f9842c5e78b47e08fc5f1966 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 14:20:16 +0000 Subject: [PATCH 02/15] Remove saggre/phpdocumentor-markdown in favor of own phpDocumentor markdown templates to fix encoding issues --- .github/phpdoc-template/class.md.twig | 84 +++++++++++++++++++ .github/phpdoc-template/config/footer.md.twig | 1 + .github/phpdoc-template/config/header.md.twig | 1 + .github/phpdoc-template/include/macros.twig | 62 ++++++++++++++ .github/phpdoc-template/method.md.twig | 61 ++++++++++++++ .github/phpdoc-template/property.md.twig | 32 +++++++ .github/phpdoc-template/template.xml | 14 ++++ composer.json | 3 +- docs/classes/ConvertKit_API/ConvertKit_API.md | 65 ++++++++++---- docs/index.md | 26 ------ 10 files changed, 305 insertions(+), 44 deletions(-) create mode 100644 .github/phpdoc-template/class.md.twig create mode 100644 .github/phpdoc-template/config/footer.md.twig create mode 100644 .github/phpdoc-template/config/header.md.twig create mode 100644 .github/phpdoc-template/include/macros.twig create mode 100644 .github/phpdoc-template/method.md.twig create mode 100644 .github/phpdoc-template/property.md.twig create mode 100644 .github/phpdoc-template/template.xml delete mode 100644 docs/index.md diff --git a/.github/phpdoc-template/class.md.twig b/.github/phpdoc-template/class.md.twig new file mode 100644 index 0000000..fe97363 --- /dev/null +++ b/.github/phpdoc-template/class.md.twig @@ -0,0 +1,84 @@ +{% import 'include/macros.twig' as macros %} +{% block content %} +*** +{% include 'config/header.md.twig' %} + +# {{ node.name }} + +{{ node.summary|raw }} + +{{ node.description|raw }} + +* Full name: `{{ node.FullyQualifiedStructuralElementName }}` +{% if node.parent and node.parent is not empty %}* Parent class: {{ macros.mdClassLink(node.parent, macros.mdClassPath(node), node.parent.FullyQualifiedStructuralElementName) }} +{% endif %} +{% if node.final %}* This class is marked as **final** and can't be subclassed +{% endif %} +{% if node.deprecated %}* **Warning:** this class is **deprecated**. This means that this class will likely be removed in a future version. +{% endif %} +{% if node.interfaces is not empty %} +* This class implements: +{% for interface in node.interfaces %} +{% if loop.index0 > 0 %}{{ ', ' }}{% endif %}{{ macros.mdClassLink(interface, macros.mdClassPath(node), interface) }}{% endfor %} + +{% endif %} +{% if node.abstract %}* This class is an **Abstract class** +{% endif %} +{% if node.final %}* This class is a **Final class** +{% endif %} + +{% if node.tags.see is not empty or node.tags.link is not empty %} +**See Also:** + +{% for see in node.tags.see %} +* {{ see.reference }} {% if see.description %}- {{ see.description|raw }}{% endif %} + +{% endfor %} +{% for link in node.tags.link %} +* {{ link.link }} {% if link.description and link.description != link.link %}- {{ link.description|raw }}{% endif %} + +{% endfor %} + +{% endif %}{# node.tags.see || node.tags.link #} + +{# Check constants #} +{% if node.constants | length > 0 %} +## Constants + +| Constant | Visibility | Type | Value | +|:---------|:-----------|:-----|:------| +{% for constant in node.constants %} +|`{{constant.name}}`|{{ constant.visibility | default('*default*') }}|{{macros.mdEsc(constant.type) | default(' ')}}|{{constant.value}}| +{% endfor %} +{% endif %} + +{% if node.properties | length > 0 %} +## Properties + +{% for property in node.properties %} +{% include 'property.md.twig' %} +{% endfor %} +{% endif %} + +{# Check methods #} +{% if node.methods|length > 0 %} +## Methods + +{% for method in node.methods %} +{% include 'method.md.twig' %} +{% endfor %} +{% endif %}{# if methods #} + +{# Check inherited methods #} +{% if node.InheritedMethods|length > 0 %} + +## Inherited methods + +{% for method in node.InheritedMethods %} +{% include 'method.md.twig' %} +{% endfor %} + +{% endif %}{# if InheritedMethods #} + +{% include 'config/footer.md.twig' %} +{% endblock %} \ No newline at end of file diff --git a/.github/phpdoc-template/config/footer.md.twig b/.github/phpdoc-template/config/footer.md.twig new file mode 100644 index 0000000..c445265 --- /dev/null +++ b/.github/phpdoc-template/config/footer.md.twig @@ -0,0 +1 @@ +{# This and it will be added to every .md file at the end #} \ No newline at end of file diff --git a/.github/phpdoc-template/config/header.md.twig b/.github/phpdoc-template/config/header.md.twig new file mode 100644 index 0000000..aed2196 --- /dev/null +++ b/.github/phpdoc-template/config/header.md.twig @@ -0,0 +1 @@ +{# This will be added to every .md file #} diff --git a/.github/phpdoc-template/include/macros.twig b/.github/phpdoc-template/include/macros.twig new file mode 100644 index 0000000..5dfe92a --- /dev/null +++ b/.github/phpdoc-template/include/macros.twig @@ -0,0 +1,62 @@ +{# + Twig implementation of getRelativePath + @param $relativeTo string The path to make relative to + @param $path string The path to make relative +#} +{% macro mdGetRelativePath(relativeTo, path) %} +{% set from = relativeTo | split('/') %} +{% set to = path | split('/') %} +{% set relPath = to %} +{% set break = false %} +{% for dir in from %} +{% if not break %} +{% set depth = loop.index0 %} +{% if dir == to[depth] %} +{% set relPath = relPath | slice(1) %} +{% else %} +{% set remaining = from | length - depth %} +{% if remaining > 1 %} +{% set relPathLen = relPath | length %} +{% set padLength = remaining - 1 %} +{% for i in 1..padLength %} +{% set relPath = '..' | split('/') | merge(relPath) %} +{% endfor %} +{% set break = true %} +{% else %} +{% set relPath0 = './' ~ relPath[0] %} +{% set relPathRest = relPath | slice(1) %} +{% set relPath = relPath0|split('/') | merge(relPathRest) %} +{% endif %} +{% endif %} +{% endif %} +{% endfor %} +{{ relPath | join('/') }}{% endmacro %} + +{# + Get full md link for a node or for a namespace without /classes directory + @param $nodeOrNamespace object|string The node to get the link for or a PHP class namespace string +#} +{% macro mdNodePath(nodeOrNamespace) %} +{{ nodeOrNamespace.FullyQualifiedStructuralElementName | default(nodeOrNamespace) | replace({'\\':'/'}) | trim ~ (parameter.urlFileExtensions == 'no' ? '' : '.md') }}{% endmacro %} + +{# + Get full link to a class from documentation root directory + @param $nodeOrNamespace object|string The node to get the link for or a PHP class namespace string +#} +{% macro mdClassPath(nodeOrNamespace) %} +{{ 'classes' ~ _self.mdNodePath(nodeOrNamespace) | trim}}{% endmacro %} + +{# + Create a relative md link to a class + @param $nodeOrNamespace object|string The node to get the link for or a PHP class namespace string + @param $relativeTo string The path to make relative to (usually path of the md file that this is being printed to) + @param $name string|null Link text +#} +{% macro mdClassLink(nodeOrNamespace, relativeTo, name = null) %} +[`{{ name | default(nodeOrNamespace.name) | default('Unknown') }}`]({{ _self.mdGetRelativePath(relativeTo, _self.mdClassPath(nodeOrNamespace))}}){% endmacro %} + +{# + Escape markdown special characters + @param $text string The text to escape +#} +{% macro mdEsc(text) %}{{ text | replace({'|':'|'}) | raw }}{% endmacro %} diff --git a/.github/phpdoc-template/method.md.twig b/.github/phpdoc-template/method.md.twig new file mode 100644 index 0000000..797eeda --- /dev/null +++ b/.github/phpdoc-template/method.md.twig @@ -0,0 +1,61 @@ +{% import 'include/macros.twig' as macros %} + +### {{ method.name }} + +{{ method.summary | raw }} + +{# Method signature #} +```php +{% if method.final %}{{ 'final' ~ ' ' }}{% endif %}{{ method.visibility ~ ' ' }}{%if method.static%}{{ 'static' ~ ' ' }}{% endif %}{{ method.name }}({% for argument in method.arguments %} +{{- argument.type | raw }} +{{- argument.byReference ? '&' }} $ +{{- argument.name | raw }}{{ argument.default ? ' = '~argument.default }} +{%- if not loop.last %}, {% endif %} +{%- endfor %}) +{{- method.response.type ? ': ' ~ method.response.type }} +``` + +{{ method.description | raw }} + +{% if method.static %}* This method is **static**.{% endif %} + +{% if method.abstract %}* This method is **abstract**.{% endif %} + +{% if method.final %}* This method is **final**.{% endif %} + +{% if method.deprecated %}* **Warning:** this method is **deprecated**. This means that this method will likely be removed in a future version. + +{% endif %} + + +{% if method.arguments is not empty %} +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +{% for argument in method.arguments %} +| `{{ '$' ~ argument.name }}` | **{{ argument.type ? macros.mdEsc(argument.type) | default(' ') | raw }}** | {{ argument.description | replace({'|': '|'}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | +{% endfor %} + +{% endif %}{# method.arguments is not empty #} + +{% if method.response.description and method.response.description is not empty %} +**Return Value:** + +{{ method.response.description | raw }} + +{% endif %} + +{% if method.tags.see is not empty or method.tags.link is not empty %} +**See Also:** + +{% for see in method.tags.see %} +* {{ see.reference }} {% if see.description %}- {{ see.description | raw }}{% endif %} +{% endfor %} +{% for link in method.tags.link %} +* {{ link.link }} {% if link.description and link.description != link.link %}- {{ link.description | raw }}{% endif %} +{% endfor %} + +{% endif %}{# method.tags.see || method.tags.link #} + +*** diff --git a/.github/phpdoc-template/property.md.twig b/.github/phpdoc-template/property.md.twig new file mode 100644 index 0000000..359974c --- /dev/null +++ b/.github/phpdoc-template/property.md.twig @@ -0,0 +1,32 @@ +{% import 'include/macros.twig' as macros %} + +### {{ property.name }} + +{{ property.summary | raw }} + +{# Method signature #} +```php +{{ property.visibility ~ ' ' }}{% if property.static %}{{ 'static' ~ ' ' }}{% endif %}{% if property.type and property.type is not empty %}{{ property.type ~ ' ' }}{% endif %}{{ '$' ~ property.name }} +``` + +{{ property.description | raw }} + +{% if property.static %}* This property is **static**.{% endif %} + +{% if property.deprecated %}* **Warning:** this property is **deprecated**. This means that this property will likely be removed in a future version. + +{% endif %} + +{% if property.tags.see is not empty or property.tags.link is not empty %} +**See Also:** + +{% for see in property.tags.see %} +* {{ see.reference }} {% if see.description %}- {{ see.description | raw }}{% endif %} +{% endfor %} +{% for link in property.tags.link %} +* {{ link.link }} {% if link.description and link.description != link.link %}- {{ link.description | raw }}{% endif %} +{% endfor %} + +{% endif %}{# method.tags.see || method.tags.link #} + +*** diff --git a/.github/phpdoc-template/template.xml b/.github/phpdoc-template/template.xml new file mode 100644 index 0000000..b9fdc51 --- /dev/null +++ b/.github/phpdoc-template/template.xml @@ -0,0 +1,14 @@ + + diff --git a/composer.json b/composer.json index 89e528c..3cdf706 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,7 @@ "vlucas/phpdotenv": "^5.5", "phpunit/phpunit": "^5.7 || ^9.0", "squizlabs/php_codesniffer": "^3.3", - "phpstan/phpstan": "^1.2", - "saggre/phpdocumentor-markdown": "^0.1.3" + "phpstan/phpstan": "^1.2" }, "autoload": { "psr-4": { diff --git a/docs/classes/ConvertKit_API/ConvertKit_API.md b/docs/classes/ConvertKit_API/ConvertKit_API.md index c31fa89..a89ac0e 100644 --- a/docs/classes/ConvertKit_API/ConvertKit_API.md +++ b/docs/classes/ConvertKit_API/ConvertKit_API.md @@ -245,7 +245,7 @@ public get_landing_pages(): false|mixed Adds a subscriber to a form. ```php -public form_subscribe(int $form_id, array<string,string> $options): false|object +public form_subscribe(int $form_id, array $options): false|object ``` @@ -253,6 +253,8 @@ public form_subscribe(int $form_id, array<string,string> $options): false| +* **Warning:** this method is **deprecated**. This means that this method will likely be removed in a future version. + **Parameters:** @@ -265,6 +267,39 @@ public form_subscribe(int $form_id, array<string,string> $options): false| +*** + +### add_subscriber_to_form + +Adds a subscriber to a form by email address + +```php +public add_subscriber_to_form(int $form_id, string $email, string $first_name = '', array $fields = [], array $tag_ids = []): false|mixed +``` + + + + + + + + +**Parameters:** + +| Parameter | Type | Description | +|-----------|------|-------------| +| `$form_id` | **int** | Form ID. | +| `$email` | **string** | Email Address. | +| `$first_name` | **string** | First Name. | +| `$fields` | **array** | Custom Fields. | +| `$tag_ids` | **array** | Tag ID(s) to subscribe to. | + + + +**See Also:** + +* https://developers.convertkit.com/#add-subscriber-to-a-form - + *** ### get_form_subscriptions @@ -327,7 +362,7 @@ public get_sequences(): false|mixed Adds a subscriber to a sequence by email address ```php -public add_subscriber_to_sequence(int $sequence_id, string $email, string $first_name = '', array<string,string> $fields = [], array<string,int> $tag_ids = []): false|mixed +public add_subscriber_to_sequence(int $sequence_id, string $email, string $first_name = '', array $fields = [], array $tag_ids = []): false|mixed ``` @@ -444,7 +479,7 @@ public create_tag(string $tag): false|mixed Tags a subscriber with the given existing Tag. ```php -public tag_subscriber(int $tag_id, string $email, string $first_name = '', array<string,string> $fields = []): false|mixed +public tag_subscriber(int $tag_id, string $email, string $first_name = '', array $fields = []): false|mixed ``` @@ -476,7 +511,7 @@ public tag_subscriber(int $tag_id, string $email, string $first_name = '� Adds a tag to a subscriber. ```php -public add_tag(int $tag, array<string,mixed> $options): false|object +public add_tag(int $tag, array $options): false|object ``` @@ -686,7 +721,7 @@ public get_subscriber(int $subscriber_id): false|int Updates the information for a single subscriber. ```php -public update_subscriber(int $subscriber_id, string $first_name = '', string $email_address = '', array<string,string> $fields = []): false|mixed +public update_subscriber(int $subscriber_id, string $first_name = '', string $email_address = '', array $fields = []): false|mixed ``` @@ -747,7 +782,7 @@ public unsubscribe(string $email): false|object Remove subscription from a form ```php -public form_unsubscribe(array<string,string> $options): false|object +public form_unsubscribe(array $options): false|object ``` @@ -1193,7 +1228,7 @@ public delete_custom_field(int $id): false|object List purchases. ```php -public list_purchases(array<string,string> $options): false|object +public list_purchases(array $options): false|object ``` @@ -1251,7 +1286,7 @@ public get_purchase(int $purchase_id): false|object Creates a purchase. ```php -public create_purchase(array<string,string> $options): false|object +public create_purchase(array $options): false|object ``` @@ -1309,7 +1344,7 @@ Converts any relative URls to absolute, fully qualified HTTP(s) URLs for the giv DOM Elements. ```php -private convert_relative_to_absolute_urls(\DOMNodeList<\DOMElement> $elements, string $attribute, string $url): void +private convert_relative_to_absolute_urls(\DOMNodeList<\DOMElement> $elements, string $attribute, string $url): void ``` @@ -1368,7 +1403,7 @@ HTML Markup Performs a GET request to the API. ```php -public get(string $endpoint, array<string,int|string|array<string,int|string>> $args = []): false|mixed +public get(string $endpoint, array> $args = []): false|mixed ``` @@ -1395,7 +1430,7 @@ public get(string $endpoint, array<string,int|string|array<string,int|stri Performs a POST request to the API. ```php -public post(string $endpoint, array<string,bool|int|string|array<int|string,int|string>> $args = []): false|mixed +public post(string $endpoint, array> $args = []): false|mixed ``` @@ -1422,7 +1457,7 @@ public post(string $endpoint, array<string,bool|int|string|array<int|strin Performs a PUT request to the API. ```php -public put(string $endpoint, array<string,bool|int|string|array<string,int|string>> $args = []): false|mixed +public put(string $endpoint, array> $args = []): false|mixed ``` @@ -1449,7 +1484,7 @@ public put(string $endpoint, array<string,bool|int|string|array<string,int Performs a DELETE request to the API. ```php -public delete(string $endpoint, array<string,int|string|array<string,int|string>> $args = []): false|mixed +public delete(string $endpoint, array> $args = []): false|mixed ``` @@ -1476,7 +1511,7 @@ public delete(string $endpoint, array<string,int|string|array<string,int|s Performs an API request using Guzzle. ```php -public make_request(string $endpoint, string $method, array<string,bool|int|string|array<int|string,int|string>> $args = []): false|mixed +public make_request(string $endpoint, string $method, array> $args = []): false|mixed ``` @@ -1500,5 +1535,3 @@ public make_request(string $endpoint, string $method, array<string,bool|int|s *** -*** -> Automatically generated from source code comments on 2023-03-21 using [phpDocumentor](http://www.phpdoc.org/) and [saggre/phpdocumentor-markdown](https://github.com/Saggre/phpDocumentor-markdown) diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 87c6f47..0000000 --- a/docs/index.md +++ /dev/null @@ -1,26 +0,0 @@ - -*** - -# Documentation - - - -This is an automatically generated documentation for **Documentation**. - - -## Namespaces - - -### \ConvertKit_API - -#### Classes - -| Class | Description | -|-------|-------------| -| [`ConvertKit_API`](./classes/ConvertKit_API/ConvertKit_API.md) | ConvertKit API Class| - - - - -*** -> Automatically generated from source code comments on 2023-03-21 using [phpDocumentor](http://www.phpdoc.org/) and [saggre/phpdocumentor-markdown](https://github.com/Saggre/phpDocumentor-markdown) From 8d786e71b9aadbf22ea5d666f05887b724f2b534 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 14:20:42 +0000 Subject: [PATCH 03/15] Ignore phpDocumentor ast.dump file for debugging --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7a9b69d..e01cd9c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .env .env.testing .phpunit.result.cache +ast.dump composer.lock phpstan.neon src/logs From 4c696d69dbf83ba9fafe0c0013d79e48d665df24 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 14:22:21 +0000 Subject: [PATCH 04/15] Parameters table: Description: Replace pipe symbol with comma, instead of HTML encoded pipe --- .github/phpdoc-template/method.md.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/phpdoc-template/method.md.twig b/.github/phpdoc-template/method.md.twig index 797eeda..3fa5325 100644 --- a/.github/phpdoc-template/method.md.twig +++ b/.github/phpdoc-template/method.md.twig @@ -34,7 +34,7 @@ | Parameter | Type | Description | |-----------|------|-------------| {% for argument in method.arguments %} -| `{{ '$' ~ argument.name }}` | **{{ argument.type ? macros.mdEsc(argument.type) | default(' ') | raw }}** | {{ argument.description | replace({'|': '|'}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | +| `{{ '$' ~ argument.name }}` | **{{ argument.type ? macros.mdEsc(argument.type) | default(' ') | raw }}** | {{ argument.description | replace({'|': ','}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | {% endfor %} {% endif %}{# method.arguments is not empty #} From 974c4396c90857322a3ef4699542076d31ddda1e Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 14:24:06 +0000 Subject: [PATCH 05/15] Updated instructions for compiling docs --- DEPLOYMENT.md | 6 ++++-- docs/classes/ConvertKit_API/ConvertKit_API.md | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 99f0603..5322da0 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -16,14 +16,16 @@ We follow [Semantic Versioning](https://semver.org/). ## Run phpDocumentor -We use [phpDocumentor](https://www.phpdoc.org/) to automatically generate the [PHP SDK documentation](./docs/classes/ConvertKit_API/ConvertKit_API.md). +We use [phpDocumentor](https://www.phpdoc.org/), with a custom markdown template, to automatically generate the [PHP SDK documentation](./docs/classes/ConvertKit_API/ConvertKit_API.md). In a Terminal window, run the phpDocumentor command to generate documentation in markdown format: ```bash -phpDocumentor --directory=src --target=docs --template="vendor/saggre/phpdocumentor-markdown/themes/markdown" +phpDocumentor --directory=src --target=docs --template=".github/phpdoc-template" ``` +Markdown is generated using Twig. Changes can be made to the template files in the `.github/phpdoc-template` folder. + ## Commit Changes Commit the updated files, which should comprise of: diff --git a/docs/classes/ConvertKit_API/ConvertKit_API.md b/docs/classes/ConvertKit_API/ConvertKit_API.md index a89ac0e..48f821f 100644 --- a/docs/classes/ConvertKit_API/ConvertKit_API.md +++ b/docs/classes/ConvertKit_API/ConvertKit_API.md @@ -322,7 +322,7 @@ public get_form_subscriptions(int $form_id, string $sort_order = 'asc' | Parameter | Type | Description | |-----------|------|-------------| | `$form_id` | **int** | Form ID. | -| `$sort_order` | **string** | Sort Order (asc&#124;desc). | +| `$sort_order` | **string** | Sort Order (asc,desc). | | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | @@ -410,7 +410,7 @@ public get_sequence_subscriptions(int $sequence_id, string $sort_order = 'a | Parameter | Type | Description | |-----------|------|-------------| | `$sequence_id` | **int** | Sequence ID. | -| `$sort_order` | **string** | Sort Order (asc&#124;desc). | +| `$sort_order` | **string** | Sort Order (asc,desc). | | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | @@ -618,7 +618,7 @@ public get_tag_subscriptions(int $tag_id, string $sort_order = 'asc', | Parameter | Type | Description | |-----------|------|-------------| | `$tag_id` | **int** | Tag ID. | -| `$sort_order` | **string** | Sort Order (asc&#124;desc). | +| `$sort_order` | **string** | Sort Order (asc,desc). | | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | From 8e480078890e000d92dc6d7ee6d15b378a33b4cb Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 14:32:50 +0000 Subject: [PATCH 06/15] Fix encoding of single quotation marks in method defaults --- .github/phpdoc-template/method.md.twig | 2 +- docs/classes/ConvertKit_API/ConvertKit_API.md | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/phpdoc-template/method.md.twig b/.github/phpdoc-template/method.md.twig index 3fa5325..411c8e4 100644 --- a/.github/phpdoc-template/method.md.twig +++ b/.github/phpdoc-template/method.md.twig @@ -9,7 +9,7 @@ {% if method.final %}{{ 'final' ~ ' ' }}{% endif %}{{ method.visibility ~ ' ' }}{%if method.static%}{{ 'static' ~ ' ' }}{% endif %}{{ method.name }}({% for argument in method.arguments %} {{- argument.type | raw }} {{- argument.byReference ? '&' }} $ -{{- argument.name | raw }}{{ argument.default ? ' = '~argument.default }} +{{- argument.name | raw }}{% if argument.default %} = {{ argument.default | raw }}{% endif %} {%- if not loop.last %}, {% endif %} {%- endfor %}) {{- method.response.type ? ': ' ~ method.response.type }} diff --git a/docs/classes/ConvertKit_API/ConvertKit_API.md b/docs/classes/ConvertKit_API/ConvertKit_API.md index 48f821f..fef0338 100644 --- a/docs/classes/ConvertKit_API/ConvertKit_API.md +++ b/docs/classes/ConvertKit_API/ConvertKit_API.md @@ -274,7 +274,7 @@ public form_subscribe(int $form_id, array $options): false|object Adds a subscriber to a form by email address ```php -public add_subscriber_to_form(int $form_id, string $email, string $first_name = '', array $fields = [], array $tag_ids = []): false|mixed +public add_subscriber_to_form(int $form_id, string $email, string $first_name = '', array $fields = [], array $tag_ids = []): false|mixed ``` @@ -307,7 +307,7 @@ public add_subscriber_to_form(int $form_id, string $email, string $first_name = List subscriptions to a form ```php -public get_form_subscriptions(int $form_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed +public get_form_subscriptions(int $form_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed ``` @@ -362,7 +362,7 @@ public get_sequences(): false|mixed Adds a subscriber to a sequence by email address ```php -public add_subscriber_to_sequence(int $sequence_id, string $email, string $first_name = '', array $fields = [], array $tag_ids = []): false|mixed +public add_subscriber_to_sequence(int $sequence_id, string $email, string $first_name = '', array $fields = [], array $tag_ids = []): false|mixed ``` @@ -395,7 +395,7 @@ public add_subscriber_to_sequence(int $sequence_id, string $email, string $first Gets subscribers to a sequence ```php -public get_sequence_subscriptions(int $sequence_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed +public get_sequence_subscriptions(int $sequence_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed ``` @@ -479,7 +479,7 @@ public create_tag(string $tag): false|mixed Tags a subscriber with the given existing Tag. ```php -public tag_subscriber(int $tag_id, string $email, string $first_name = '', array $fields = []): false|mixed +public tag_subscriber(int $tag_id, string $email, string $first_name = '', array $fields = []): false|mixed ``` @@ -603,7 +603,7 @@ public remove_tag_from_subscriber_by_email(int $tag_id, string $email): false|mi List subscriptions to a tag ```php -public get_tag_subscriptions(int $tag_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed +public get_tag_subscriptions(int $tag_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed ``` @@ -721,7 +721,7 @@ public get_subscriber(int $subscriber_id): false|int Updates the information for a single subscriber. ```php -public update_subscriber(int $subscriber_id, string $first_name = '', string $email_address = '', array $fields = []): false|mixed +public update_subscriber(int $subscriber_id, string $first_name = '', string $email_address = '', array $fields = []): false|mixed ``` @@ -863,7 +863,7 @@ public get_broadcasts(): false|array<int,\stdClass> Creates a broadcast. ```php -public create_broadcast(string $subject = '', string $content = '', string $description = '', bool $public = false, \DateTime $published_at = null, \DateTime $send_at = null, string $email_address = '', string $email_layout_template = '', string $thumbnail_alt = '', string $thumbnail_url = ''): false|object +public create_broadcast(string $subject = '', string $content = '', string $description = '', bool $public = false, \DateTime $published_at = null, \DateTime $send_at = null, string $email_address = '', string $email_layout_template = '', string $thumbnail_alt = '', string $thumbnail_url = ''): false|object ``` @@ -960,7 +960,7 @@ public get_broadcast_stats(int $id): false|object Updates a broadcast. ```php -public update_broadcast(int $id, string $subject = '', string $content = '', string $description = '', bool $public = false, \DateTime $published_at = null, \DateTime $send_at = null, string $email_address = '', string $email_layout_template = '', string $thumbnail_alt = '', string $thumbnail_url = ''): false|object +public update_broadcast(int $id, string $subject = '', string $content = '', string $description = '', bool $public = false, \DateTime $published_at = null, \DateTime $send_at = null, string $email_address = '', string $email_layout_template = '', string $thumbnail_alt = '', string $thumbnail_url = ''): false|object ``` @@ -1028,7 +1028,7 @@ public destroy_broadcast(int $id): false|object Creates a webhook that will be called based on the chosen event types. ```php -public create_webhook(string $url, string $event, string $parameter = ''): false|object +public create_webhook(string $url, string $event, string $parameter = ''): false|object ``` From e0ba5712f6510606d2ad1fd777db33b2016ec245 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 14:37:41 +0000 Subject: [PATCH 07/15] Experiment with removing macros, header and footer templates --- .github/phpdoc-template/class.md.twig | 7 +- .github/phpdoc-template/config/footer.md.twig | 1 - .github/phpdoc-template/config/header.md.twig | 1 - .github/phpdoc-template/method.md.twig | 8 +- .github/phpdoc-template/property.md.twig | 2 - docs/classes/ConvertKit_API/ConvertKit_API.md | 166 +----------------- 6 files changed, 8 insertions(+), 177 deletions(-) delete mode 100644 .github/phpdoc-template/config/footer.md.twig delete mode 100644 .github/phpdoc-template/config/header.md.twig diff --git a/.github/phpdoc-template/class.md.twig b/.github/phpdoc-template/class.md.twig index fe97363..f481dfe 100644 --- a/.github/phpdoc-template/class.md.twig +++ b/.github/phpdoc-template/class.md.twig @@ -1,8 +1,4 @@ -{% import 'include/macros.twig' as macros %} {% block content %} -*** -{% include 'config/header.md.twig' %} - # {{ node.name }} {{ node.summary|raw }} @@ -48,7 +44,7 @@ | Constant | Visibility | Type | Value | |:---------|:-----------|:-----|:------| {% for constant in node.constants %} -|`{{constant.name}}`|{{ constant.visibility | default('*default*') }}|{{macros.mdEsc(constant.type) | default(' ')}}|{{constant.value}}| +|`{{constant.name}}`|{{ constant.visibility | default('*default*') }}|{{constant.type | default(' ')}}|{{constant.value}}| {% endfor %} {% endif %} @@ -80,5 +76,4 @@ {% endif %}{# if InheritedMethods #} -{% include 'config/footer.md.twig' %} {% endblock %} \ No newline at end of file diff --git a/.github/phpdoc-template/config/footer.md.twig b/.github/phpdoc-template/config/footer.md.twig deleted file mode 100644 index c445265..0000000 --- a/.github/phpdoc-template/config/footer.md.twig +++ /dev/null @@ -1 +0,0 @@ -{# This and it will be added to every .md file at the end #} \ No newline at end of file diff --git a/.github/phpdoc-template/config/header.md.twig b/.github/phpdoc-template/config/header.md.twig deleted file mode 100644 index aed2196..0000000 --- a/.github/phpdoc-template/config/header.md.twig +++ /dev/null @@ -1 +0,0 @@ -{# This will be added to every .md file #} diff --git a/.github/phpdoc-template/method.md.twig b/.github/phpdoc-template/method.md.twig index 411c8e4..c4b3427 100644 --- a/.github/phpdoc-template/method.md.twig +++ b/.github/phpdoc-template/method.md.twig @@ -1,5 +1,3 @@ -{% import 'include/macros.twig' as macros %} - ### {{ method.name }} {{ method.summary | raw }} @@ -34,7 +32,7 @@ | Parameter | Type | Description | |-----------|------|-------------| {% for argument in method.arguments %} -| `{{ '$' ~ argument.name }}` | **{{ argument.type ? macros.mdEsc(argument.type) | default(' ') | raw }}** | {{ argument.description | replace({'|': ','}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | +| `{{ '$' ~ argument.name }}` | **{{ argument.type ? argument.type | default(' ') | raw }}** | {{ argument.description | replace({'|': ','}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | {% endfor %} {% endif %}{# method.arguments is not empty #} @@ -56,6 +54,4 @@ * {{ link.link }} {% if link.description and link.description != link.link %}- {{ link.description | raw }}{% endif %} {% endfor %} -{% endif %}{# method.tags.see || method.tags.link #} - -*** +{% endif %}{# method.tags.see || method.tags.link #} \ No newline at end of file diff --git a/.github/phpdoc-template/property.md.twig b/.github/phpdoc-template/property.md.twig index 359974c..6aa94f4 100644 --- a/.github/phpdoc-template/property.md.twig +++ b/.github/phpdoc-template/property.md.twig @@ -1,5 +1,3 @@ -{% import 'include/macros.twig' as macros %} - ### {{ property.name }} {{ property.summary | raw }} diff --git a/docs/classes/ConvertKit_API/ConvertKit_API.md b/docs/classes/ConvertKit_API/ConvertKit_API.md index fef0338..a2b631f 100644 --- a/docs/classes/ConvertKit_API/ConvertKit_API.md +++ b/docs/classes/ConvertKit_API/ConvertKit_API.md @@ -1,5 +1,3 @@ -*** - # ConvertKit_API ConvertKit API Class @@ -17,7 +15,6 @@ ConvertKit API Class ## Properties - ### api_key ConvertKit API Key @@ -32,7 +29,6 @@ protected string $api_key *** - ### api_secret ConvertKit API Secret @@ -47,7 +43,6 @@ protected string $api_secret *** - ### api_version Version of ConvertKit API @@ -62,7 +57,6 @@ protected string $api_version *** - ### api_url_base ConvertKit API URL @@ -77,7 +71,6 @@ protected string $api_url_base *** - ### debug Debug @@ -92,7 +85,6 @@ protected bool $debug *** - ### debug_logger Debug @@ -107,7 +99,6 @@ protected \Monolog\Logger $debug_logger *** - ### client Guzzle Http Client @@ -125,7 +116,6 @@ protected \GuzzleHttp\Client $client ## Methods - ### __construct Constructor for ConvertKitAPI instance @@ -151,9 +141,6 @@ public __construct(string $api_key, string $api_secret, bool $debug = false): mi - -*** - ### create_log Add an entry to monologger. @@ -177,9 +164,6 @@ private create_log(string $message): void - -*** - ### get_account Gets the current account @@ -197,9 +181,6 @@ public get_account(): false|mixed - -*** - ### get_forms Gets all forms. @@ -217,9 +198,6 @@ public get_forms(): false|mixed - -*** - ### get_landing_pages Gets all landing pages. @@ -237,9 +215,6 @@ public get_landing_pages(): false|mixed - -*** - ### form_subscribe Adds a subscriber to a form. @@ -266,9 +241,6 @@ public form_subscribe(int $form_id, array $options): false|object - -*** - ### add_subscriber_to_form Adds a subscriber to a form by email address @@ -299,9 +271,6 @@ public add_subscriber_to_form(int $form_id, string $email, string $first_name = **See Also:** * https://developers.convertkit.com/#add-subscriber-to-a-form - - -*** - ### get_form_subscriptions List subscriptions to a form @@ -331,9 +300,6 @@ public get_form_subscriptions(int $form_id, string $sort_order = 'asc', string $ **See Also:** * https://developers.convertkit.com/#list-subscriptions-to-a-form - - -*** - ### get_sequences Gets all sequences @@ -354,9 +320,6 @@ public get_sequences(): false|mixed **See Also:** * https://developers.convertkit.com/#list-sequences - - -*** - ### add_subscriber_to_sequence Adds a subscriber to a sequence by email address @@ -387,9 +350,6 @@ public add_subscriber_to_sequence(int $sequence_id, string $email, string $first **See Also:** * https://developers.convertkit.com/#add-subscriber-to-a-sequence - - -*** - ### get_sequence_subscriptions Gets subscribers to a sequence @@ -419,9 +379,6 @@ public get_sequence_subscriptions(int $sequence_id, string $sort_order = 'asc', **See Also:** * https://developers.convertkit.com/#list-subscriptions-to-a-sequence - - -*** - ### get_tags Gets all tags. @@ -442,9 +399,6 @@ public get_tags(): false|mixed **See Also:** * https://developers.convertkit.com/#list-tags - - -*** - ### create_tag Creates a tag. @@ -471,9 +425,6 @@ public create_tag(string $tag): false|mixed **See Also:** * https://developers.convertkit.com/#create-a-tag - - -*** - ### tag_subscriber Tags a subscriber with the given existing Tag. @@ -503,9 +454,6 @@ public tag_subscriber(int $tag_id, string $email, string $first_name = '', array **See Also:** * https://developers.convertkit.com/#tag-a-subscriber - - -*** - ### add_tag Adds a tag to a subscriber. @@ -535,9 +483,6 @@ public add_tag(int $tag, array $options): false|object **See Also:** * https://developers.convertkit.com/#tag-a-subscriber - - -*** - ### remove_tag_from_subscriber Removes a tag from a subscriber. @@ -565,9 +510,6 @@ public remove_tag_from_subscriber(int $tag_id, int $subscriber_id): false|mixed **See Also:** * https://developers.convertkit.com/#remove-tag-from-a-subscriber - - -*** - ### remove_tag_from_subscriber_by_email Removes a tag from a subscriber by email address. @@ -595,9 +537,6 @@ public remove_tag_from_subscriber_by_email(int $tag_id, string $email): false|mi **See Also:** * https://developers.convertkit.com/#remove-tag-from-a-subscriber-by-email - - -*** - ### get_tag_subscriptions List subscriptions to a tag @@ -627,9 +566,6 @@ public get_tag_subscriptions(int $tag_id, string $sort_order = 'asc', string $su **See Also:** * https://developers.convertkit.com/#list-subscriptions-to-a-tag - - -*** - ### get_resources Gets a resource index @@ -658,9 +594,6 @@ GET /{$resource}/ API response - -*** - ### get_subscriber_id Get the ConvertKit subscriber ID associated with email address if it exists. @@ -684,9 +617,6 @@ Return false if subscriber not found. - -*** - ### get_subscriber Get subscriber by id @@ -713,9 +643,6 @@ public get_subscriber(int $subscriber_id): false|int **See Also:** * https://developers.convertkit.com/#view-a-single-subscriber - - -*** - ### update_subscriber Updates the information for a single subscriber. @@ -745,9 +672,6 @@ public update_subscriber(int $subscriber_id, string $first_name = '', string $em **See Also:** * https://developers.convertkit.com/#update-subscriber - - -*** - ### unsubscribe Unsubscribe an email address from all forms and sequences. @@ -774,9 +698,6 @@ public unsubscribe(string $email): false|object **See Also:** * https://developers.convertkit.com/#unsubscribe-subscriber - - -*** - ### form_unsubscribe Remove subscription from a form @@ -803,9 +724,6 @@ public form_unsubscribe(array $options): false|object **See Also:** * https://developers.convertkit.com/#unsubscribe-subscriber - - -*** - ### get_subscriber_tags Get a list of the tags for a subscriber. @@ -832,9 +750,6 @@ public get_subscriber_tags(int $subscriber_id): false|array<int,\stdClass> **See Also:** * https://developers.convertkit.com/#list-tags-for-a-subscriber - - -*** - ### get_broadcasts Gets a list of broadcasts. @@ -855,9 +770,6 @@ public get_broadcasts(): false|array<int,\stdClass> **See Also:** * https://developers.convertkit.com/#list-broadcasts - - -*** - ### create_broadcast Creates a broadcast. @@ -893,9 +805,6 @@ public create_broadcast(string $subject = '', string $content = '', string $desc **See Also:** * https://developers.convertkit.com/#create-a-broadcast - - -*** - ### get_broadcast Retrieve a specific broadcast. @@ -922,9 +831,6 @@ public get_broadcast(int $id): false|object **See Also:** * https://developers.convertkit.com/#retrieve-a-specific-broadcast - - -*** - ### get_broadcast_stats Get the statistics (recipient count, open rate, click rate, unsubscribe count, @@ -952,9 +858,6 @@ public get_broadcast_stats(int $id): false|object **See Also:** * https://developers.convertkit.com/#retrieve-a-specific-broadcast - - -*** - ### update_broadcast Updates a broadcast. @@ -991,9 +894,6 @@ public update_broadcast(int $id, string $subject = '', string $content = '', str **See Also:** * https://developers.convertkit.com/#create-a-broadcast - - -*** - ### destroy_broadcast Deletes an existing broadcast. @@ -1020,9 +920,6 @@ public destroy_broadcast(int $id): false|object **See Also:** * https://developers.convertkit.com/#destroy-webhook - - -*** - ### create_webhook Creates a webhook that will be called based on the chosen event types. @@ -1051,9 +948,6 @@ public create_webhook(string $url, string $event, string $parameter = ''): false **See Also:** * https://developers.convertkit.com/#create-a-webhook - - -*** - ### destroy_webhook Deletes an existing webhook. @@ -1080,9 +974,6 @@ public destroy_webhook(int $rule_id): false|object **See Also:** * https://developers.convertkit.com/#destroy-webhook - - -*** - ### get_custom_fields List custom fields. @@ -1103,9 +994,6 @@ public get_custom_fields(): false|object **See Also:** * https://developers.convertkit.com/#list-fields - - -*** - ### create_custom_field Creates a custom field. @@ -1132,9 +1020,6 @@ public create_custom_field(string $label): false|object **See Also:** * https://developers.convertkit.com/#create-field - - -*** - ### create_custom_fields Creates multiple custom fields. @@ -1161,9 +1046,6 @@ public create_custom_fields(string[] $labels): false|object **See Also:** * https://developers.convertkit.com/#create-field - - -*** - ### update_custom_field Updates an existing custom field. @@ -1191,9 +1073,6 @@ public update_custom_field(int $id, string $label): false|object **See Also:** * https://developers.convertkit.com/#update-field - - -*** - ### delete_custom_field Deletes an existing custom field. @@ -1220,9 +1099,6 @@ public delete_custom_field(int $id): false|object **See Also:** * https://developers.convertkit.com/#destroy-field - - -*** - ### list_purchases List purchases. @@ -1249,9 +1125,6 @@ public list_purchases(array $options): false|object **See Also:** * https://developers.convertkit.com/#list-purchases - - -*** - ### get_purchase Retuns a specific purchase. @@ -1278,9 +1151,6 @@ public get_purchase(int $purchase_id): false|object **See Also:** * https://developers.convertkit.com/#retrieve-a-specific-purchase - - -*** - ### create_purchase Creates a purchase. @@ -1307,9 +1177,6 @@ public create_purchase(array $options): false|object **See Also:** * https://developers.convertkit.com/#create-a-purchase - - -*** - ### get_resource Get markup from ConvertKit for the provided $url. @@ -1335,9 +1202,6 @@ the API response when using get_resources(). - -*** - ### convert_relative_to_absolute_urls Converts any relative URls to absolute, fully qualified HTTP(s) URLs for the given @@ -1364,9 +1228,6 @@ private convert_relative_to_absolute_urls(\DOMNodeList<\DOMElement> $elements, s - -*** - ### strip_html_head_body_tags Strips , and opening and closing tags from the given markup, @@ -1395,9 +1256,6 @@ private strip_html_head_body_tags(string $markup): string HTML Markup - -*** - ### get Performs a GET request to the API. @@ -1418,13 +1276,10 @@ public get(string $endpoint, array> $ | Parameter | Type | Description | |-----------|------|-------------| | `$endpoint` | **string** | API Endpoint. | -| `$args` | **array>** | Request arguments. | +| `$args` | **array>** | Request arguments. | - -*** - ### post Performs a POST request to the API. @@ -1445,13 +1300,10 @@ public post(string $endpoint, array>** | Request arguments. | +| `$args` | **array>** | Request arguments. | - -*** - ### put Performs a PUT request to the API. @@ -1472,13 +1324,10 @@ public put(string $endpoint, array>** | Request arguments. | - +| `$args` | **array>** | Request arguments. | -*** - ### delete Performs a DELETE request to the API. @@ -1499,13 +1348,10 @@ public delete(string $endpoint, array | Parameter | Type | Description | |-----------|------|-------------| | `$endpoint` | **string** | API Endpoint. | -| `$args` | **array>** | Request arguments. | - +| `$args` | **array>** | Request arguments. | -*** - ### make_request Performs an API request using Guzzle. @@ -1527,11 +1373,9 @@ public make_request(string $endpoint, string $method, array>** | Request arguments. | +| `$args` | **array>** | Request arguments. | -*** - From 10c9cd35bcf4bb2e0956294b8303aa05f25203ee Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 14:46:02 +0000 Subject: [PATCH 08/15] Remove unnecessary spacing in markdown docs --- .github/phpdoc-template/class.md.twig | 12 +- .github/phpdoc-template/method.md.twig | 12 +- .github/phpdoc-template/property.md.twig | 17 +- docs/classes/ConvertKit_API/ConvertKit_API.md | 486 ------------------ 4 files changed, 6 insertions(+), 521 deletions(-) diff --git a/.github/phpdoc-template/class.md.twig b/.github/phpdoc-template/class.md.twig index f481dfe..2b43990 100644 --- a/.github/phpdoc-template/class.md.twig +++ b/.github/phpdoc-template/class.md.twig @@ -1,9 +1,8 @@ {% block content %} # {{ node.name }} -{{ node.summary|raw }} - -{{ node.description|raw }} +{% if node.summary %}{{ node.summary|raw }}{% endif %} +{% if node.description %}{{ node.description|raw }}{% endif %} * Full name: `{{ node.FullyQualifiedStructuralElementName }}` {% if node.parent and node.parent is not empty %}* Parent class: {{ macros.mdClassLink(node.parent, macros.mdClassPath(node), node.parent.FullyQualifiedStructuralElementName) }} @@ -36,8 +35,6 @@ {% endfor %} {% endif %}{# node.tags.see || node.tags.link #} - -{# Check constants #} {% if node.constants | length > 0 %} ## Constants @@ -47,7 +44,6 @@ |`{{constant.name}}`|{{ constant.visibility | default('*default*') }}|{{constant.type | default(' ')}}|{{constant.value}}| {% endfor %} {% endif %} - {% if node.properties | length > 0 %} ## Properties @@ -55,8 +51,6 @@ {% include 'property.md.twig' %} {% endfor %} {% endif %} - -{# Check methods #} {% if node.methods|length > 0 %} ## Methods @@ -65,9 +59,7 @@ {% endfor %} {% endif %}{# if methods #} -{# Check inherited methods #} {% if node.InheritedMethods|length > 0 %} - ## Inherited methods {% for method in node.InheritedMethods %} diff --git a/.github/phpdoc-template/method.md.twig b/.github/phpdoc-template/method.md.twig index c4b3427..5ce99dd 100644 --- a/.github/phpdoc-template/method.md.twig +++ b/.github/phpdoc-template/method.md.twig @@ -12,20 +12,13 @@ {%- endfor %}) {{- method.response.type ? ': ' ~ method.response.type }} ``` - -{{ method.description | raw }} - +{% if method.description %}{{ method.description | raw }}{% endif %} {% if method.static %}* This method is **static**.{% endif %} - {% if method.abstract %}* This method is **abstract**.{% endif %} - {% if method.final %}* This method is **final**.{% endif %} - {% if method.deprecated %}* **Warning:** this method is **deprecated**. This means that this method will likely be removed in a future version. - {% endif %} - {% if method.arguments is not empty %} **Parameters:** @@ -34,14 +27,11 @@ {% for argument in method.arguments %} | `{{ '$' ~ argument.name }}` | **{{ argument.type ? argument.type | default(' ') | raw }}** | {{ argument.description | replace({'|': ','}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | {% endfor %} - {% endif %}{# method.arguments is not empty #} - {% if method.response.description and method.response.description is not empty %} **Return Value:** {{ method.response.description | raw }} - {% endif %} {% if method.tags.see is not empty or method.tags.link is not empty %} diff --git a/.github/phpdoc-template/property.md.twig b/.github/phpdoc-template/property.md.twig index 6aa94f4..f5ed48e 100644 --- a/.github/phpdoc-template/property.md.twig +++ b/.github/phpdoc-template/property.md.twig @@ -2,29 +2,18 @@ {{ property.summary | raw }} -{# Method signature #} ```php {{ property.visibility ~ ' ' }}{% if property.static %}{{ 'static' ~ ' ' }}{% endif %}{% if property.type and property.type is not empty %}{{ property.type ~ ' ' }}{% endif %}{{ '$' ~ property.name }} ``` -{{ property.description | raw }} - +{% if property.description %}{{ property.description | raw }}{% endif %} {% if property.static %}* This property is **static**.{% endif %} - -{% if property.deprecated %}* **Warning:** this property is **deprecated**. This means that this property will likely be removed in a future version. - -{% endif %} - +{% if property.deprecated %}* **Warning:** this property is **deprecated**. This means that this property will likely be removed in a future version.{% endif %} {% if property.tags.see is not empty or property.tags.link is not empty %} -**See Also:** - {% for see in property.tags.see %} * {{ see.reference }} {% if see.description %}- {{ see.description | raw }}{% endif %} {% endfor %} {% for link in property.tags.link %} * {{ link.link }} {% if link.description and link.description != link.link %}- {{ link.description | raw }}{% endif %} {% endfor %} - -{% endif %}{# method.tags.see || method.tags.link #} - -*** +{% endif %} \ No newline at end of file diff --git a/docs/classes/ConvertKit_API/ConvertKit_API.md b/docs/classes/ConvertKit_API/ConvertKit_API.md index a2b631f..96d64bd 100644 --- a/docs/classes/ConvertKit_API/ConvertKit_API.md +++ b/docs/classes/ConvertKit_API/ConvertKit_API.md @@ -1,18 +1,13 @@ # ConvertKit_API ConvertKit API Class - - - * Full name: `\ConvertKit_API\ConvertKit_API` - ## Constants | Constant | Visibility | Type | Value | |:---------|:-----------|:-----|:------| |`VERSION`|public|string|'1.0.0'| - ## Properties ### api_key @@ -23,12 +18,6 @@ ConvertKit API Key protected string $api_key ``` - - - - - -*** ### api_secret ConvertKit API Secret @@ -37,12 +26,6 @@ ConvertKit API Secret protected string $api_secret ``` - - - - - -*** ### api_version Version of ConvertKit API @@ -51,12 +34,6 @@ Version of ConvertKit API protected string $api_version ``` - - - - - -*** ### api_url_base ConvertKit API URL @@ -65,12 +42,6 @@ ConvertKit API URL protected string $api_url_base ``` - - - - - -*** ### debug Debug @@ -79,12 +50,6 @@ Debug protected bool $debug ``` - - - - - -*** ### debug_logger Debug @@ -93,12 +58,6 @@ Debug protected \Monolog\Logger $debug_logger ``` - - - - - -*** ### client Guzzle Http Client @@ -107,13 +66,6 @@ Guzzle Http Client protected \GuzzleHttp\Client $client ``` - - - - - -*** - ## Methods ### __construct @@ -124,13 +76,6 @@ Constructor for ConvertKitAPI instance public __construct(string $api_key, string $api_secret, bool $debug = false): mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -139,8 +84,6 @@ public __construct(string $api_key, string $api_secret, bool $debug = false): mi | `$api_secret` | **string** | ConvertKit API Secret. | | `$debug` | **bool** | Log requests to debugger. | - - ### create_log Add an entry to monologger. @@ -149,21 +92,12 @@ Add an entry to monologger. private create_log(string $message): void ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$message` | **string** | Message. | - - ### get_account Gets the current account @@ -173,14 +107,6 @@ public get_account(): false|mixed ``` - - - - - - - - ### get_forms Gets all forms. @@ -190,14 +116,6 @@ public get_forms(): false|mixed ``` - - - - - - - - ### get_landing_pages Gets all landing pages. @@ -207,14 +125,6 @@ public get_landing_pages(): false|mixed ``` - - - - - - - - ### form_subscribe Adds a subscriber to a form. @@ -222,16 +132,8 @@ Adds a subscriber to a form. ```php public form_subscribe(int $form_id, array $options): false|object ``` - - - - - - * **Warning:** this method is **deprecated**. This means that this method will likely be removed in a future version. - - **Parameters:** | Parameter | Type | Description | @@ -239,8 +141,6 @@ public form_subscribe(int $form_id, array $options): false|object | `$form_id` | **int** | Form ID. | | `$options` | **array** | Array of user data (email, name). | - - ### add_subscriber_to_form Adds a subscriber to a form by email address @@ -249,13 +149,6 @@ Adds a subscriber to a form by email address public add_subscriber_to_form(int $form_id, string $email, string $first_name = '', array $fields = [], array $tag_ids = []): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -266,8 +159,6 @@ public add_subscriber_to_form(int $form_id, string $email, string $first_name = | `$fields` | **array** | Custom Fields. | | `$tag_ids` | **array** | Tag ID(s) to subscribe to. | - - **See Also:** * https://developers.convertkit.com/#add-subscriber-to-a-form - @@ -279,13 +170,6 @@ List subscriptions to a form public get_form_subscriptions(int $form_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -295,8 +179,6 @@ public get_form_subscriptions(int $form_id, string $sort_order = 'asc', string $ | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | - - **See Also:** * https://developers.convertkit.com/#list-subscriptions-to-a-form - @@ -309,14 +191,6 @@ public get_sequences(): false|mixed ``` - - - - - - - - **See Also:** * https://developers.convertkit.com/#list-sequences - @@ -328,13 +202,6 @@ Adds a subscriber to a sequence by email address public add_subscriber_to_sequence(int $sequence_id, string $email, string $first_name = '', array $fields = [], array $tag_ids = []): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -345,8 +212,6 @@ public add_subscriber_to_sequence(int $sequence_id, string $email, string $first | `$fields` | **array** | Custom Fields. | | `$tag_ids` | **array** | Tag ID(s) to subscribe to. | - - **See Also:** * https://developers.convertkit.com/#add-subscriber-to-a-sequence - @@ -358,13 +223,6 @@ Gets subscribers to a sequence public get_sequence_subscriptions(int $sequence_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -374,8 +232,6 @@ public get_sequence_subscriptions(int $sequence_id, string $sort_order = 'asc', | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | - - **See Also:** * https://developers.convertkit.com/#list-subscriptions-to-a-sequence - @@ -388,14 +244,6 @@ public get_tags(): false|mixed ``` - - - - - - - - **See Also:** * https://developers.convertkit.com/#list-tags - @@ -407,21 +255,12 @@ Creates a tag. public create_tag(string $tag): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$tag` | **string** | Tag Name. | - - **See Also:** * https://developers.convertkit.com/#create-a-tag - @@ -433,13 +272,6 @@ Tags a subscriber with the given existing Tag. public tag_subscriber(int $tag_id, string $email, string $first_name = '', array $fields = []): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -449,8 +281,6 @@ public tag_subscriber(int $tag_id, string $email, string $first_name = '', array | `$first_name` | **string** | First Name. | | `$fields` | **array** | Custom Fields. | - - **See Also:** * https://developers.convertkit.com/#tag-a-subscriber - @@ -461,16 +291,8 @@ Adds a tag to a subscriber. ```php public add_tag(int $tag, array $options): false|object ``` - - - - - - * **Warning:** this method is **deprecated**. This means that this method will likely be removed in a future version. - - **Parameters:** | Parameter | Type | Description | @@ -478,8 +300,6 @@ public add_tag(int $tag, array $options): false|object | `$tag` | **int** | Tag ID. | | `$options` | **array** | Array of user data. | - - **See Also:** * https://developers.convertkit.com/#tag-a-subscriber - @@ -491,13 +311,6 @@ Removes a tag from a subscriber. public remove_tag_from_subscriber(int $tag_id, int $subscriber_id): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -505,8 +318,6 @@ public remove_tag_from_subscriber(int $tag_id, int $subscriber_id): false|mixed | `$tag_id` | **int** | Tag ID. | | `$subscriber_id` | **int** | Subscriber ID. | - - **See Also:** * https://developers.convertkit.com/#remove-tag-from-a-subscriber - @@ -518,13 +329,6 @@ Removes a tag from a subscriber by email address. public remove_tag_from_subscriber_by_email(int $tag_id, string $email): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -532,8 +336,6 @@ public remove_tag_from_subscriber_by_email(int $tag_id, string $email): false|mi | `$tag_id` | **int** | Tag ID. | | `$email` | **string** | Subscriber email address. | - - **See Also:** * https://developers.convertkit.com/#remove-tag-from-a-subscriber-by-email - @@ -545,13 +347,6 @@ List subscriptions to a tag public get_tag_subscriptions(int $tag_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -561,8 +356,6 @@ public get_tag_subscriptions(int $tag_id, string $sort_order = 'asc', string $su | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | - - **See Also:** * https://developers.convertkit.com/#list-subscriptions-to-a-tag - @@ -574,26 +367,16 @@ Possible resources: forms, landing_pages, subscription_forms, tags ```php public get_resources(string $resource): array<int|string,mixed|\stdClass> ``` - GET /{$resource}/ - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$resource` | **string** | Resource type. | - - **Return Value:** API response - ### get_subscriber_id Get the ConvertKit subscriber ID associated with email address if it exists. @@ -601,22 +384,13 @@ Get the ConvertKit subscriber ID associated with email address if it exists. ```php public get_subscriber_id(string $email_address): false|int ``` - Return false if subscriber not found. - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$email_address` | **string** | Email Address. | - - ### get_subscriber Get subscriber by id @@ -625,21 +399,12 @@ Get subscriber by id public get_subscriber(int $subscriber_id): false|int ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$subscriber_id` | **int** | Subscriber ID. | - - **See Also:** * https://developers.convertkit.com/#view-a-single-subscriber - @@ -651,13 +416,6 @@ Updates the information for a single subscriber. public update_subscriber(int $subscriber_id, string $first_name = '', string $email_address = '', array $fields = []): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -667,8 +425,6 @@ public update_subscriber(int $subscriber_id, string $first_name = '', string $em | `$email_address` | **string** | New Email Address. | | `$fields` | **array** | Updated Custom Fields. | - - **See Also:** * https://developers.convertkit.com/#update-subscriber - @@ -680,21 +436,12 @@ Unsubscribe an email address from all forms and sequences. public unsubscribe(string $email): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$email` | **string** | Email Address. | - - **See Also:** * https://developers.convertkit.com/#unsubscribe-subscriber - @@ -706,21 +453,12 @@ Remove subscription from a form public form_unsubscribe(array $options): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$options` | **array** | Array of user data (email). | - - **See Also:** * https://developers.convertkit.com/#unsubscribe-subscriber - @@ -732,21 +470,12 @@ Get a list of the tags for a subscriber. public get_subscriber_tags(int $subscriber_id): false|array<int,\stdClass> ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$subscriber_id` | **int** | Subscriber ID. | - - **See Also:** * https://developers.convertkit.com/#list-tags-for-a-subscriber - @@ -759,14 +488,6 @@ public get_broadcasts(): false|array<int,\stdClass> ``` - - - - - - - - **See Also:** * https://developers.convertkit.com/#list-broadcasts - @@ -778,13 +499,6 @@ Creates a broadcast. public create_broadcast(string $subject = '', string $content = '', string $description = '', bool $public = false, \DateTime $published_at = null, \DateTime $send_at = null, string $email_address = '', string $email_layout_template = '', string $thumbnail_alt = '', string $thumbnail_url = ''): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -800,8 +514,6 @@ public create_broadcast(string $subject = '', string $content = '', string $desc | `$thumbnail_alt` | **string** | Specify the ALT attribute of the public thumbnail image
(applicable only to public posts). | | `$thumbnail_url` | **string** | Specify the URL of the thumbnail image to accompany the broadcast
post (applicable only to public posts). | - - **See Also:** * https://developers.convertkit.com/#create-a-broadcast - @@ -813,21 +525,12 @@ Retrieve a specific broadcast. public get_broadcast(int $id): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$id` | **int** | Broadcast ID. | - - **See Also:** * https://developers.convertkit.com/#retrieve-a-specific-broadcast - @@ -840,21 +543,12 @@ total clicks, status, and send progress) for a specific broadcast. public get_broadcast_stats(int $id): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$id` | **int** | Broadcast ID. | - - **See Also:** * https://developers.convertkit.com/#retrieve-a-specific-broadcast - @@ -866,13 +560,6 @@ Updates a broadcast. public update_broadcast(int $id, string $subject = '', string $content = '', string $description = '', bool $public = false, \DateTime $published_at = null, \DateTime $send_at = null, string $email_address = '', string $email_layout_template = '', string $thumbnail_alt = '', string $thumbnail_url = ''): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -889,8 +576,6 @@ public update_broadcast(int $id, string $subject = '', string $content = '', str | `$thumbnail_alt` | **string** | Specify the ALT attribute of the public thumbnail image
(applicable only to public posts). | | `$thumbnail_url` | **string** | Specify the URL of the thumbnail image to accompany the broadcast
post (applicable only to public posts). | - - **See Also:** * https://developers.convertkit.com/#create-a-broadcast - @@ -902,21 +587,12 @@ Deletes an existing broadcast. public destroy_broadcast(int $id): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$id` | **int** | Broadcast ID. | - - **See Also:** * https://developers.convertkit.com/#destroy-webhook - @@ -928,13 +604,6 @@ Creates a webhook that will be called based on the chosen event types. public create_webhook(string $url, string $event, string $parameter = ''): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -943,8 +612,6 @@ public create_webhook(string $url, string $event, string $parameter = ''): false | `$event` | **string** | Event to subscribe to. | | `$parameter` | **string** | Optional parameter depending on the event. | - - **See Also:** * https://developers.convertkit.com/#create-a-webhook - @@ -956,21 +623,12 @@ Deletes an existing webhook. public destroy_webhook(int $rule_id): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$rule_id` | **int** | Rule ID. | - - **See Also:** * https://developers.convertkit.com/#destroy-webhook - @@ -983,14 +641,6 @@ public get_custom_fields(): false|object ``` - - - - - - - - **See Also:** * https://developers.convertkit.com/#list-fields - @@ -1002,21 +652,12 @@ Creates a custom field. public create_custom_field(string $label): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$label` | **string** | Custom Field label. | - - **See Also:** * https://developers.convertkit.com/#create-field - @@ -1028,21 +669,12 @@ Creates multiple custom fields. public create_custom_fields(string[] $labels): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$labels` | **string[]** | Custom Fields labels. | - - **See Also:** * https://developers.convertkit.com/#create-field - @@ -1054,13 +686,6 @@ Updates an existing custom field. public update_custom_field(int $id, string $label): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -1068,8 +693,6 @@ public update_custom_field(int $id, string $label): false|object | `$id` | **int** | Custom Field ID. | | `$label` | **string** | Updated Custom Field label. | - - **See Also:** * https://developers.convertkit.com/#update-field - @@ -1081,21 +704,12 @@ Deletes an existing custom field. public delete_custom_field(int $id): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$id` | **int** | Custom Field ID. | - - **See Also:** * https://developers.convertkit.com/#destroy-field - @@ -1107,21 +721,12 @@ List purchases. public list_purchases(array $options): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$options` | **array** | Request options. | - - **See Also:** * https://developers.convertkit.com/#list-purchases - @@ -1133,21 +738,12 @@ Retuns a specific purchase. public get_purchase(int $purchase_id): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$purchase_id` | **int** | Purchase ID. | - - **See Also:** * https://developers.convertkit.com/#retrieve-a-specific-purchase - @@ -1159,21 +755,12 @@ Creates a purchase. public create_purchase(array $options): false|object ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$options` | **array** | Purchase data. | - - **See Also:** * https://developers.convertkit.com/#create-a-purchase - @@ -1184,24 +771,15 @@ Get markup from ConvertKit for the provided $url. ```php public get_resource(string $url): false|string ``` - Supports legacy forms and legacy landing pages. Forms and Landing Pages should be embedded using the supplied JS embed script in the API response when using get_resources(). - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$url` | **string** | URL of HTML page. | - - ### convert_relative_to_absolute_urls Converts any relative URls to absolute, fully qualified HTTP(s) URLs for the given @@ -1211,13 +789,6 @@ DOM Elements. private convert_relative_to_absolute_urls(\DOMNodeList<\DOMElement> $elements, string $attribute, string $url): void ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -1226,8 +797,6 @@ private convert_relative_to_absolute_urls(\DOMNodeList<\DOMElement> $elements, s | `$attribute` | **string** | HTML Attribute. | | `$url` | **string** | Absolute URL to prepend to relative URLs. | - - ### strip_html_head_body_tags Strips , and opening and closing tags from the given markup, @@ -1237,25 +806,15 @@ as well as the Content-Type meta tag we might have added in get_html(). private strip_html_head_body_tags(string $markup): string ``` - - - - - - - **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$markup` | **string** | HTML Markup. | - - **Return Value:** HTML Markup - ### get Performs a GET request to the API. @@ -1264,13 +823,6 @@ Performs a GET request to the API. public get(string $endpoint, array> $args = []): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -1278,8 +830,6 @@ public get(string $endpoint, array> $ | `$endpoint` | **string** | API Endpoint. | | `$args` | **array>** | Request arguments. | - - ### post Performs a POST request to the API. @@ -1288,13 +838,6 @@ Performs a POST request to the API. public post(string $endpoint, array> $args = []): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -1302,8 +845,6 @@ public post(string $endpoint, array>** | Request arguments. | - - ### put Performs a PUT request to the API. @@ -1312,13 +853,6 @@ Performs a PUT request to the API. public put(string $endpoint, array> $args = []): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -1326,8 +860,6 @@ public put(string $endpoint, array>** | Request arguments. | - - ### delete Performs a DELETE request to the API. @@ -1336,13 +868,6 @@ Performs a DELETE request to the API. public delete(string $endpoint, array> $args = []): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -1350,8 +875,6 @@ public delete(string $endpoint, array | `$endpoint` | **string** | API Endpoint. | | `$args` | **array>** | Request arguments. | - - ### make_request Performs an API request using Guzzle. @@ -1360,13 +883,6 @@ Performs an API request using Guzzle. public make_request(string $endpoint, string $method, array> $args = []): false|mixed ``` - - - - - - - **Parameters:** | Parameter | Type | Description | @@ -1377,5 +893,3 @@ public make_request(string $endpoint, string $method, array Date: Wed, 22 Mar 2023 14:49:18 +0000 Subject: [PATCH 09/15] Further improvements to markdown templates for PHP SDK docs --- .github/phpdoc-template/method.md.twig | 6 +- docs/classes/ConvertKit_API/ConvertKit_API.md | 164 ++++++++++++++---- 2 files changed, 135 insertions(+), 35 deletions(-) diff --git a/.github/phpdoc-template/method.md.twig b/.github/phpdoc-template/method.md.twig index 5ce99dd..cb44b88 100644 --- a/.github/phpdoc-template/method.md.twig +++ b/.github/phpdoc-template/method.md.twig @@ -38,10 +38,12 @@ **See Also:** {% for see in method.tags.see %} -* {{ see.reference }} {% if see.description %}- {{ see.description | raw }}{% endif %} +* {{ see.reference }} {% if see.description is not empty %}- {{ see.description | raw }}{% endif %} {% endfor %} {% for link in method.tags.link %} * {{ link.link }} {% if link.description and link.description != link.link %}- {{ link.description | raw }}{% endif %} {% endfor %} -{% endif %}{# method.tags.see || method.tags.link #} \ No newline at end of file +{% endif %}{# method.tags.see || method.tags.link #} + +--- diff --git a/docs/classes/ConvertKit_API/ConvertKit_API.md b/docs/classes/ConvertKit_API/ConvertKit_API.md index 96d64bd..6e26e64 100644 --- a/docs/classes/ConvertKit_API/ConvertKit_API.md +++ b/docs/classes/ConvertKit_API/ConvertKit_API.md @@ -84,6 +84,8 @@ public __construct(string $api_key, string $api_secret, bool $debug = false): mi | `$api_secret` | **string** | ConvertKit API Secret. | | `$debug` | **bool** | Log requests to debugger. | + +--- ### create_log Add an entry to monologger. @@ -98,6 +100,8 @@ private create_log(string $message): void |-----------|------|-------------| | `$message` | **string** | Message. | + +--- ### get_account Gets the current account @@ -107,6 +111,8 @@ public get_account(): false|mixed ``` + +--- ### get_forms Gets all forms. @@ -116,6 +122,8 @@ public get_forms(): false|mixed ``` + +--- ### get_landing_pages Gets all landing pages. @@ -125,6 +133,8 @@ public get_landing_pages(): false|mixed ``` + +--- ### form_subscribe Adds a subscriber to a form. @@ -141,6 +151,8 @@ public form_subscribe(int $form_id, array $options): false|object | `$form_id` | **int** | Form ID. | | `$options` | **array** | Array of user data (email, name). | + +--- ### add_subscriber_to_form Adds a subscriber to a form by email address @@ -161,7 +173,9 @@ public add_subscriber_to_form(int $form_id, string $email, string $first_name = **See Also:** -* https://developers.convertkit.com/#add-subscriber-to-a-form - +* https://developers.convertkit.com/#add-subscriber-to-a-form + +--- ### get_form_subscriptions List subscriptions to a form @@ -181,7 +195,9 @@ public get_form_subscriptions(int $form_id, string $sort_order = 'asc', string $ **See Also:** -* https://developers.convertkit.com/#list-subscriptions-to-a-form - +* https://developers.convertkit.com/#list-subscriptions-to-a-form + +--- ### get_sequences Gets all sequences @@ -193,7 +209,9 @@ public get_sequences(): false|mixed **See Also:** -* https://developers.convertkit.com/#list-sequences - +* https://developers.convertkit.com/#list-sequences + +--- ### add_subscriber_to_sequence Adds a subscriber to a sequence by email address @@ -214,7 +232,9 @@ public add_subscriber_to_sequence(int $sequence_id, string $email, string $first **See Also:** -* https://developers.convertkit.com/#add-subscriber-to-a-sequence - +* https://developers.convertkit.com/#add-subscriber-to-a-sequence + +--- ### get_sequence_subscriptions Gets subscribers to a sequence @@ -234,7 +254,9 @@ public get_sequence_subscriptions(int $sequence_id, string $sort_order = 'asc', **See Also:** -* https://developers.convertkit.com/#list-subscriptions-to-a-sequence - +* https://developers.convertkit.com/#list-subscriptions-to-a-sequence + +--- ### get_tags Gets all tags. @@ -246,7 +268,9 @@ public get_tags(): false|mixed **See Also:** -* https://developers.convertkit.com/#list-tags - +* https://developers.convertkit.com/#list-tags + +--- ### create_tag Creates a tag. @@ -263,7 +287,9 @@ public create_tag(string $tag): false|mixed **See Also:** -* https://developers.convertkit.com/#create-a-tag - +* https://developers.convertkit.com/#create-a-tag + +--- ### tag_subscriber Tags a subscriber with the given existing Tag. @@ -283,7 +309,9 @@ public tag_subscriber(int $tag_id, string $email, string $first_name = '', array **See Also:** -* https://developers.convertkit.com/#tag-a-subscriber - +* https://developers.convertkit.com/#tag-a-subscriber + +--- ### add_tag Adds a tag to a subscriber. @@ -302,7 +330,9 @@ public add_tag(int $tag, array $options): false|object **See Also:** -* https://developers.convertkit.com/#tag-a-subscriber - +* https://developers.convertkit.com/#tag-a-subscriber + +--- ### remove_tag_from_subscriber Removes a tag from a subscriber. @@ -320,7 +350,9 @@ public remove_tag_from_subscriber(int $tag_id, int $subscriber_id): false|mixed **See Also:** -* https://developers.convertkit.com/#remove-tag-from-a-subscriber - +* https://developers.convertkit.com/#remove-tag-from-a-subscriber + +--- ### remove_tag_from_subscriber_by_email Removes a tag from a subscriber by email address. @@ -338,7 +370,9 @@ public remove_tag_from_subscriber_by_email(int $tag_id, string $email): false|mi **See Also:** -* https://developers.convertkit.com/#remove-tag-from-a-subscriber-by-email - +* https://developers.convertkit.com/#remove-tag-from-a-subscriber-by-email + +--- ### get_tag_subscriptions List subscriptions to a tag @@ -358,7 +392,9 @@ public get_tag_subscriptions(int $tag_id, string $sort_order = 'asc', string $su **See Also:** -* https://developers.convertkit.com/#list-subscriptions-to-a-tag - +* https://developers.convertkit.com/#list-subscriptions-to-a-tag + +--- ### get_resources Gets a resource index @@ -377,6 +413,8 @@ GET /{$resource}/ API response + +--- ### get_subscriber_id Get the ConvertKit subscriber ID associated with email address if it exists. @@ -391,6 +429,8 @@ Return false if subscriber not found. |-----------|------|-------------| | `$email_address` | **string** | Email Address. | + +--- ### get_subscriber Get subscriber by id @@ -407,7 +447,9 @@ public get_subscriber(int $subscriber_id): false|int **See Also:** -* https://developers.convertkit.com/#view-a-single-subscriber - +* https://developers.convertkit.com/#view-a-single-subscriber + +--- ### update_subscriber Updates the information for a single subscriber. @@ -427,7 +469,9 @@ public update_subscriber(int $subscriber_id, string $first_name = '', string $em **See Also:** -* https://developers.convertkit.com/#update-subscriber - +* https://developers.convertkit.com/#update-subscriber + +--- ### unsubscribe Unsubscribe an email address from all forms and sequences. @@ -444,7 +488,9 @@ public unsubscribe(string $email): false|object **See Also:** -* https://developers.convertkit.com/#unsubscribe-subscriber - +* https://developers.convertkit.com/#unsubscribe-subscriber + +--- ### form_unsubscribe Remove subscription from a form @@ -461,7 +507,9 @@ public form_unsubscribe(array $options): false|object **See Also:** -* https://developers.convertkit.com/#unsubscribe-subscriber - +* https://developers.convertkit.com/#unsubscribe-subscriber + +--- ### get_subscriber_tags Get a list of the tags for a subscriber. @@ -478,7 +526,9 @@ public get_subscriber_tags(int $subscriber_id): false|array<int,\stdClass> **See Also:** -* https://developers.convertkit.com/#list-tags-for-a-subscriber - +* https://developers.convertkit.com/#list-tags-for-a-subscriber + +--- ### get_broadcasts Gets a list of broadcasts. @@ -490,7 +540,9 @@ public get_broadcasts(): false|array<int,\stdClass> **See Also:** -* https://developers.convertkit.com/#list-broadcasts - +* https://developers.convertkit.com/#list-broadcasts + +--- ### create_broadcast Creates a broadcast. @@ -516,7 +568,9 @@ public create_broadcast(string $subject = '', string $content = '', string $desc **See Also:** -* https://developers.convertkit.com/#create-a-broadcast - +* https://developers.convertkit.com/#create-a-broadcast + +--- ### get_broadcast Retrieve a specific broadcast. @@ -533,7 +587,9 @@ public get_broadcast(int $id): false|object **See Also:** -* https://developers.convertkit.com/#retrieve-a-specific-broadcast - +* https://developers.convertkit.com/#retrieve-a-specific-broadcast + +--- ### get_broadcast_stats Get the statistics (recipient count, open rate, click rate, unsubscribe count, @@ -551,7 +607,9 @@ public get_broadcast_stats(int $id): false|object **See Also:** -* https://developers.convertkit.com/#retrieve-a-specific-broadcast - +* https://developers.convertkit.com/#retrieve-a-specific-broadcast + +--- ### update_broadcast Updates a broadcast. @@ -578,7 +636,9 @@ public update_broadcast(int $id, string $subject = '', string $content = '', str **See Also:** -* https://developers.convertkit.com/#create-a-broadcast - +* https://developers.convertkit.com/#create-a-broadcast + +--- ### destroy_broadcast Deletes an existing broadcast. @@ -595,7 +655,9 @@ public destroy_broadcast(int $id): false|object **See Also:** -* https://developers.convertkit.com/#destroy-webhook - +* https://developers.convertkit.com/#destroy-webhook + +--- ### create_webhook Creates a webhook that will be called based on the chosen event types. @@ -614,7 +676,9 @@ public create_webhook(string $url, string $event, string $parameter = ''): false **See Also:** -* https://developers.convertkit.com/#create-a-webhook - +* https://developers.convertkit.com/#create-a-webhook + +--- ### destroy_webhook Deletes an existing webhook. @@ -631,7 +695,9 @@ public destroy_webhook(int $rule_id): false|object **See Also:** -* https://developers.convertkit.com/#destroy-webhook - +* https://developers.convertkit.com/#destroy-webhook + +--- ### get_custom_fields List custom fields. @@ -643,7 +709,9 @@ public get_custom_fields(): false|object **See Also:** -* https://developers.convertkit.com/#list-fields - +* https://developers.convertkit.com/#list-fields + +--- ### create_custom_field Creates a custom field. @@ -660,7 +728,9 @@ public create_custom_field(string $label): false|object **See Also:** -* https://developers.convertkit.com/#create-field - +* https://developers.convertkit.com/#create-field + +--- ### create_custom_fields Creates multiple custom fields. @@ -677,7 +747,9 @@ public create_custom_fields(string[] $labels): false|object **See Also:** -* https://developers.convertkit.com/#create-field - +* https://developers.convertkit.com/#create-field + +--- ### update_custom_field Updates an existing custom field. @@ -695,7 +767,9 @@ public update_custom_field(int $id, string $label): false|object **See Also:** -* https://developers.convertkit.com/#update-field - +* https://developers.convertkit.com/#update-field + +--- ### delete_custom_field Deletes an existing custom field. @@ -712,7 +786,9 @@ public delete_custom_field(int $id): false|object **See Also:** -* https://developers.convertkit.com/#destroy-field - +* https://developers.convertkit.com/#destroy-field + +--- ### list_purchases List purchases. @@ -729,7 +805,9 @@ public list_purchases(array $options): false|object **See Also:** -* https://developers.convertkit.com/#list-purchases - +* https://developers.convertkit.com/#list-purchases + +--- ### get_purchase Retuns a specific purchase. @@ -746,7 +824,9 @@ public get_purchase(int $purchase_id): false|object **See Also:** -* https://developers.convertkit.com/#retrieve-a-specific-purchase - +* https://developers.convertkit.com/#retrieve-a-specific-purchase + +--- ### create_purchase Creates a purchase. @@ -763,7 +843,9 @@ public create_purchase(array $options): false|object **See Also:** -* https://developers.convertkit.com/#create-a-purchase - +* https://developers.convertkit.com/#create-a-purchase + +--- ### get_resource Get markup from ConvertKit for the provided $url. @@ -780,6 +862,8 @@ the API response when using get_resources(). |-----------|------|-------------| | `$url` | **string** | URL of HTML page. | + +--- ### convert_relative_to_absolute_urls Converts any relative URls to absolute, fully qualified HTTP(s) URLs for the given @@ -797,6 +881,8 @@ private convert_relative_to_absolute_urls(\DOMNodeList<\DOMElement> $elements, s | `$attribute` | **string** | HTML Attribute. | | `$url` | **string** | Absolute URL to prepend to relative URLs. | + +--- ### strip_html_head_body_tags Strips , and opening and closing tags from the given markup, @@ -815,6 +901,8 @@ private strip_html_head_body_tags(string $markup): string HTML Markup + +--- ### get Performs a GET request to the API. @@ -830,6 +918,8 @@ public get(string $endpoint, array> $ | `$endpoint` | **string** | API Endpoint. | | `$args` | **array>** | Request arguments. | + +--- ### post Performs a POST request to the API. @@ -845,6 +935,8 @@ public post(string $endpoint, array>** | Request arguments. | + +--- ### put Performs a PUT request to the API. @@ -860,6 +952,8 @@ public put(string $endpoint, array>** | Request arguments. | + +--- ### delete Performs a DELETE request to the API. @@ -875,6 +969,8 @@ public delete(string $endpoint, array | `$endpoint` | **string** | API Endpoint. | | `$args` | **array>** | Request arguments. | + +--- ### make_request Performs an API request using Guzzle. @@ -892,4 +988,6 @@ public make_request(string $endpoint, string $method, array>** | Request arguments. | +--- + From 7a5bba182b51d103c47665553c92e8b5d5c74188 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 14:49:44 +0000 Subject: [PATCH 10/15] Remove unused macros --- .github/phpdoc-template/include/macros.twig | 62 --------------------- 1 file changed, 62 deletions(-) delete mode 100644 .github/phpdoc-template/include/macros.twig diff --git a/.github/phpdoc-template/include/macros.twig b/.github/phpdoc-template/include/macros.twig deleted file mode 100644 index 5dfe92a..0000000 --- a/.github/phpdoc-template/include/macros.twig +++ /dev/null @@ -1,62 +0,0 @@ -{# - Twig implementation of getRelativePath - @param $relativeTo string The path to make relative to - @param $path string The path to make relative -#} -{% macro mdGetRelativePath(relativeTo, path) %} -{% set from = relativeTo | split('/') %} -{% set to = path | split('/') %} -{% set relPath = to %} -{% set break = false %} -{% for dir in from %} -{% if not break %} -{% set depth = loop.index0 %} -{% if dir == to[depth] %} -{% set relPath = relPath | slice(1) %} -{% else %} -{% set remaining = from | length - depth %} -{% if remaining > 1 %} -{% set relPathLen = relPath | length %} -{% set padLength = remaining - 1 %} -{% for i in 1..padLength %} -{% set relPath = '..' | split('/') | merge(relPath) %} -{% endfor %} -{% set break = true %} -{% else %} -{% set relPath0 = './' ~ relPath[0] %} -{% set relPathRest = relPath | slice(1) %} -{% set relPath = relPath0|split('/') | merge(relPathRest) %} -{% endif %} -{% endif %} -{% endif %} -{% endfor %} -{{ relPath | join('/') }}{% endmacro %} - -{# - Get full md link for a node or for a namespace without /classes directory - @param $nodeOrNamespace object|string The node to get the link for or a PHP class namespace string -#} -{% macro mdNodePath(nodeOrNamespace) %} -{{ nodeOrNamespace.FullyQualifiedStructuralElementName | default(nodeOrNamespace) | replace({'\\':'/'}) | trim ~ (parameter.urlFileExtensions == 'no' ? '' : '.md') }}{% endmacro %} - -{# - Get full link to a class from documentation root directory - @param $nodeOrNamespace object|string The node to get the link for or a PHP class namespace string -#} -{% macro mdClassPath(nodeOrNamespace) %} -{{ 'classes' ~ _self.mdNodePath(nodeOrNamespace) | trim}}{% endmacro %} - -{# - Create a relative md link to a class - @param $nodeOrNamespace object|string The node to get the link for or a PHP class namespace string - @param $relativeTo string The path to make relative to (usually path of the md file that this is being printed to) - @param $name string|null Link text -#} -{% macro mdClassLink(nodeOrNamespace, relativeTo, name = null) %} -[`{{ name | default(nodeOrNamespace.name) | default('Unknown') }}`]({{ _self.mdGetRelativePath(relativeTo, _self.mdClassPath(nodeOrNamespace))}}){% endmacro %} - -{# - Escape markdown special characters - @param $text string The text to escape -#} -{% macro mdEsc(text) %}{{ text | replace({'|':'|'}) | raw }}{% endmacro %} From ff9019fc3793fb6f92c6dd3b052f187cf180a43e Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 14:54:02 +0000 Subject: [PATCH 11/15] Fix encoding on method return types --- .github/phpdoc-template/method.md.twig | 3 +-- docs/classes/ConvertKit_API/ConvertKit_API.md | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/phpdoc-template/method.md.twig b/.github/phpdoc-template/method.md.twig index cb44b88..718b754 100644 --- a/.github/phpdoc-template/method.md.twig +++ b/.github/phpdoc-template/method.md.twig @@ -9,8 +9,7 @@ {{- argument.byReference ? '&' }} $ {{- argument.name | raw }}{% if argument.default %} = {{ argument.default | raw }}{% endif %} {%- if not loop.last %}, {% endif %} -{%- endfor %}) -{{- method.response.type ? ': ' ~ method.response.type }} +{%- endfor %}): {{ method.response.type | raw }} ``` {% if method.description %}{{ method.description | raw }}{% endif %} {% if method.static %}* This method is **static**.{% endif %} diff --git a/docs/classes/ConvertKit_API/ConvertKit_API.md b/docs/classes/ConvertKit_API/ConvertKit_API.md index 6e26e64..c47db71 100644 --- a/docs/classes/ConvertKit_API/ConvertKit_API.md +++ b/docs/classes/ConvertKit_API/ConvertKit_API.md @@ -401,7 +401,7 @@ Gets a resource index Possible resources: forms, landing_pages, subscription_forms, tags ```php -public get_resources(string $resource): array<int|string,mixed|\stdClass> +public get_resources(string $resource): array ``` GET /{$resource}/ **Parameters:** @@ -515,7 +515,7 @@ public form_unsubscribe(array $options): false|object Get a list of the tags for a subscriber. ```php -public get_subscriber_tags(int $subscriber_id): false|array<int,\stdClass> +public get_subscriber_tags(int $subscriber_id): false|array ``` **Parameters:** @@ -534,7 +534,7 @@ public get_subscriber_tags(int $subscriber_id): false|array<int,\stdClass> Gets a list of broadcasts. ```php -public get_broadcasts(): false|array<int,\stdClass> +public get_broadcasts(): false|array ``` From 1fdae1c047f4dca9d0cb045744865c436cf81eb2 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 14:54:55 +0000 Subject: [PATCH 12/15] Add newlines between Parameters and Return Value headings --- .github/phpdoc-template/method.md.twig | 2 + docs/classes/ConvertKit_API/ConvertKit_API.md | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/.github/phpdoc-template/method.md.twig b/.github/phpdoc-template/method.md.twig index 718b754..802100c 100644 --- a/.github/phpdoc-template/method.md.twig +++ b/.github/phpdoc-template/method.md.twig @@ -19,6 +19,7 @@ {% endif %} {% if method.arguments is not empty %} + **Parameters:** | Parameter | Type | Description | @@ -28,6 +29,7 @@ {% endfor %} {% endif %}{# method.arguments is not empty #} {% if method.response.description and method.response.description is not empty %} + **Return Value:** {{ method.response.description | raw }} diff --git a/docs/classes/ConvertKit_API/ConvertKit_API.md b/docs/classes/ConvertKit_API/ConvertKit_API.md index c47db71..bd9f27c 100644 --- a/docs/classes/ConvertKit_API/ConvertKit_API.md +++ b/docs/classes/ConvertKit_API/ConvertKit_API.md @@ -76,6 +76,7 @@ Constructor for ConvertKitAPI instance public __construct(string $api_key, string $api_secret, bool $debug = false): mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -94,6 +95,7 @@ Add an entry to monologger. private create_log(string $message): void ``` + **Parameters:** | Parameter | Type | Description | @@ -144,6 +146,7 @@ public form_subscribe(int $form_id, array $options): false|object ``` * **Warning:** this method is **deprecated**. This means that this method will likely be removed in a future version. + **Parameters:** | Parameter | Type | Description | @@ -161,6 +164,7 @@ Adds a subscriber to a form by email address public add_subscriber_to_form(int $form_id, string $email, string $first_name = '', array $fields = [], array $tag_ids = []): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -184,6 +188,7 @@ List subscriptions to a form public get_form_subscriptions(int $form_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -220,6 +225,7 @@ Adds a subscriber to a sequence by email address public add_subscriber_to_sequence(int $sequence_id, string $email, string $first_name = '', array $fields = [], array $tag_ids = []): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -243,6 +249,7 @@ Gets subscribers to a sequence public get_sequence_subscriptions(int $sequence_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -279,6 +286,7 @@ Creates a tag. public create_tag(string $tag): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -298,6 +306,7 @@ Tags a subscriber with the given existing Tag. public tag_subscriber(int $tag_id, string $email, string $first_name = '', array $fields = []): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -321,6 +330,7 @@ public add_tag(int $tag, array $options): false|object ``` * **Warning:** this method is **deprecated**. This means that this method will likely be removed in a future version. + **Parameters:** | Parameter | Type | Description | @@ -341,6 +351,7 @@ Removes a tag from a subscriber. public remove_tag_from_subscriber(int $tag_id, int $subscriber_id): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -361,6 +372,7 @@ Removes a tag from a subscriber by email address. public remove_tag_from_subscriber_by_email(int $tag_id, string $email): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -381,6 +393,7 @@ List subscriptions to a tag public get_tag_subscriptions(int $tag_id, string $sort_order = 'asc', string $subscriber_state = 'active', int $page = 1): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -404,11 +417,13 @@ Possible resources: forms, landing_pages, subscription_forms, tags public get_resources(string $resource): array ``` GET /{$resource}/ + **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$resource` | **string** | Resource type. | + **Return Value:** API response @@ -423,6 +438,7 @@ Get the ConvertKit subscriber ID associated with email address if it exists. public get_subscriber_id(string $email_address): false|int ``` Return false if subscriber not found. + **Parameters:** | Parameter | Type | Description | @@ -439,6 +455,7 @@ Get subscriber by id public get_subscriber(int $subscriber_id): false|int ``` + **Parameters:** | Parameter | Type | Description | @@ -458,6 +475,7 @@ Updates the information for a single subscriber. public update_subscriber(int $subscriber_id, string $first_name = '', string $email_address = '', array $fields = []): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -480,6 +498,7 @@ Unsubscribe an email address from all forms and sequences. public unsubscribe(string $email): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -499,6 +518,7 @@ Remove subscription from a form public form_unsubscribe(array $options): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -518,6 +538,7 @@ Get a list of the tags for a subscriber. public get_subscriber_tags(int $subscriber_id): false|array ``` + **Parameters:** | Parameter | Type | Description | @@ -551,6 +572,7 @@ Creates a broadcast. public create_broadcast(string $subject = '', string $content = '', string $description = '', bool $public = false, \DateTime $published_at = null, \DateTime $send_at = null, string $email_address = '', string $email_layout_template = '', string $thumbnail_alt = '', string $thumbnail_url = ''): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -579,6 +601,7 @@ Retrieve a specific broadcast. public get_broadcast(int $id): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -599,6 +622,7 @@ total clicks, status, and send progress) for a specific broadcast. public get_broadcast_stats(int $id): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -618,6 +642,7 @@ Updates a broadcast. public update_broadcast(int $id, string $subject = '', string $content = '', string $description = '', bool $public = false, \DateTime $published_at = null, \DateTime $send_at = null, string $email_address = '', string $email_layout_template = '', string $thumbnail_alt = '', string $thumbnail_url = ''): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -647,6 +672,7 @@ Deletes an existing broadcast. public destroy_broadcast(int $id): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -666,6 +692,7 @@ Creates a webhook that will be called based on the chosen event types. public create_webhook(string $url, string $event, string $parameter = ''): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -687,6 +714,7 @@ Deletes an existing webhook. public destroy_webhook(int $rule_id): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -720,6 +748,7 @@ Creates a custom field. public create_custom_field(string $label): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -739,6 +768,7 @@ Creates multiple custom fields. public create_custom_fields(string[] $labels): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -758,6 +788,7 @@ Updates an existing custom field. public update_custom_field(int $id, string $label): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -778,6 +809,7 @@ Deletes an existing custom field. public delete_custom_field(int $id): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -797,6 +829,7 @@ List purchases. public list_purchases(array $options): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -816,6 +849,7 @@ Retuns a specific purchase. public get_purchase(int $purchase_id): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -835,6 +869,7 @@ Creates a purchase. public create_purchase(array $options): false|object ``` + **Parameters:** | Parameter | Type | Description | @@ -856,6 +891,7 @@ public get_resource(string $url): false|string Supports legacy forms and legacy landing pages. Forms and Landing Pages should be embedded using the supplied JS embed script in the API response when using get_resources(). + **Parameters:** | Parameter | Type | Description | @@ -873,6 +909,7 @@ DOM Elements. private convert_relative_to_absolute_urls(\DOMNodeList<\DOMElement> $elements, string $attribute, string $url): void ``` + **Parameters:** | Parameter | Type | Description | @@ -892,11 +929,13 @@ as well as the Content-Type meta tag we might have added in get_html(). private strip_html_head_body_tags(string $markup): string ``` + **Parameters:** | Parameter | Type | Description | |-----------|------|-------------| | `$markup` | **string** | HTML Markup. | + **Return Value:** HTML Markup @@ -911,6 +950,7 @@ Performs a GET request to the API. public get(string $endpoint, array> $args = []): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -928,6 +968,7 @@ Performs a POST request to the API. public post(string $endpoint, array> $args = []): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -945,6 +986,7 @@ Performs a PUT request to the API. public put(string $endpoint, array> $args = []): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -962,6 +1004,7 @@ Performs a DELETE request to the API. public delete(string $endpoint, array> $args = []): false|mixed ``` + **Parameters:** | Parameter | Type | Description | @@ -979,6 +1022,7 @@ Performs an API request using Guzzle. public make_request(string $endpoint, string $method, array> $args = []): false|mixed ``` + **Parameters:** | Parameter | Type | Description | From 37c4624eac54aee3fbca7eac9a486b346b7daafd Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 14:58:29 +0000 Subject: [PATCH 13/15] Escape pipes in tables for better rendering --- .github/phpdoc-template/method.md.twig | 2 +- docs/classes/ConvertKit_API/ConvertKit_API.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/phpdoc-template/method.md.twig b/.github/phpdoc-template/method.md.twig index 802100c..062d2fb 100644 --- a/.github/phpdoc-template/method.md.twig +++ b/.github/phpdoc-template/method.md.twig @@ -25,7 +25,7 @@ | Parameter | Type | Description | |-----------|------|-------------| {% for argument in method.arguments %} -| `{{ '$' ~ argument.name }}` | **{{ argument.type ? argument.type | default(' ') | raw }}** | {{ argument.description | replace({'|': ','}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | +| `{{ '$' ~ argument.name }}` | **{{ argument.type ? argument.type | default(' ') | raw }}** | {{ argument.description | replace({'|': '\|'}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | {% endfor %} {% endif %}{# method.arguments is not empty #} {% if method.response.description and method.response.description is not empty %} diff --git a/docs/classes/ConvertKit_API/ConvertKit_API.md b/docs/classes/ConvertKit_API/ConvertKit_API.md index bd9f27c..61e4cbd 100644 --- a/docs/classes/ConvertKit_API/ConvertKit_API.md +++ b/docs/classes/ConvertKit_API/ConvertKit_API.md @@ -194,7 +194,7 @@ public get_form_subscriptions(int $form_id, string $sort_order = 'asc', string $ | Parameter | Type | Description | |-----------|------|-------------| | `$form_id` | **int** | Form ID. | -| `$sort_order` | **string** | Sort Order (asc,desc). | +| `$sort_order` | **string** | Sort Order (asc|desc). | | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | @@ -255,7 +255,7 @@ public get_sequence_subscriptions(int $sequence_id, string $sort_order = 'asc', | Parameter | Type | Description | |-----------|------|-------------| | `$sequence_id` | **int** | Sequence ID. | -| `$sort_order` | **string** | Sort Order (asc,desc). | +| `$sort_order` | **string** | Sort Order (asc|desc). | | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | @@ -399,7 +399,7 @@ public get_tag_subscriptions(int $tag_id, string $sort_order = 'asc', string $su | Parameter | Type | Description | |-----------|------|-------------| | `$tag_id` | **int** | Tag ID. | -| `$sort_order` | **string** | Sort Order (asc,desc). | +| `$sort_order` | **string** | Sort Order (asc|desc). | | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | From c370af0b57871541d81bf40eb022682822b3f8c7 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 15:00:22 +0000 Subject: [PATCH 14/15] Escape pipes in tables for argument types --- .github/phpdoc-template/method.md.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/phpdoc-template/method.md.twig b/.github/phpdoc-template/method.md.twig index 062d2fb..ee8b9ae 100644 --- a/.github/phpdoc-template/method.md.twig +++ b/.github/phpdoc-template/method.md.twig @@ -25,7 +25,7 @@ | Parameter | Type | Description | |-----------|------|-------------| {% for argument in method.arguments %} -| `{{ '$' ~ argument.name }}` | **{{ argument.type ? argument.type | default(' ') | raw }}** | {{ argument.description | replace({'|': '\|'}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | +| `{{ '$' ~ argument.name }}` | **{{ argument.type ? argument.type | default(' ') | replace({'|': '\|'}) | raw }}** | {{ argument.description | replace({'|': '\|'}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | {% endfor %} {% endif %}{# method.arguments is not empty #} {% if method.response.description and method.response.description is not empty %} From 0ebf834754402ca96c31b0e9135671eb51c36860 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 22 Mar 2023 15:41:51 +0000 Subject: [PATCH 15/15] Double escape pipe symbols in tables to ensure output renders correctly --- .github/phpdoc-template/method.md.twig | 2 +- docs/classes/ConvertKit_API/ConvertKit_API.md | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/phpdoc-template/method.md.twig b/.github/phpdoc-template/method.md.twig index ee8b9ae..980147f 100644 --- a/.github/phpdoc-template/method.md.twig +++ b/.github/phpdoc-template/method.md.twig @@ -25,7 +25,7 @@ | Parameter | Type | Description | |-----------|------|-------------| {% for argument in method.arguments %} -| `{{ '$' ~ argument.name }}` | **{{ argument.type ? argument.type | default(' ') | replace({'|': '\|'}) | raw }}** | {{ argument.description | replace({'|': '\|'}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | +| `{{ '$' ~ argument.name }}` | **{{ argument.type ? argument.type | default(' ') | replace({'|': '\\|'}) | raw }}** | {{ argument.description | replace({'|': '\\|'}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} | {% endfor %} {% endif %}{# method.arguments is not empty #} {% if method.response.description and method.response.description is not empty %} diff --git a/docs/classes/ConvertKit_API/ConvertKit_API.md b/docs/classes/ConvertKit_API/ConvertKit_API.md index 61e4cbd..bddaf68 100644 --- a/docs/classes/ConvertKit_API/ConvertKit_API.md +++ b/docs/classes/ConvertKit_API/ConvertKit_API.md @@ -194,7 +194,7 @@ public get_form_subscriptions(int $form_id, string $sort_order = 'asc', string $ | Parameter | Type | Description | |-----------|------|-------------| | `$form_id` | **int** | Form ID. | -| `$sort_order` | **string** | Sort Order (asc|desc). | +| `$sort_order` | **string** | Sort Order (asc\|desc). | | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | @@ -255,7 +255,7 @@ public get_sequence_subscriptions(int $sequence_id, string $sort_order = 'asc', | Parameter | Type | Description | |-----------|------|-------------| | `$sequence_id` | **int** | Sequence ID. | -| `$sort_order` | **string** | Sort Order (asc|desc). | +| `$sort_order` | **string** | Sort Order (asc\|desc). | | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | @@ -399,7 +399,7 @@ public get_tag_subscriptions(int $tag_id, string $sort_order = 'asc', string $su | Parameter | Type | Description | |-----------|------|-------------| | `$tag_id` | **int** | Tag ID. | -| `$sort_order` | **string** | Sort Order (asc|desc). | +| `$sort_order` | **string** | Sort Order (asc\|desc). | | `$subscriber_state` | **string** | Subscriber State (active,cancelled). | | `$page` | **int** | Page. | @@ -956,7 +956,7 @@ public get(string $endpoint, array> $ | Parameter | Type | Description | |-----------|------|-------------| | `$endpoint` | **string** | API Endpoint. | -| `$args` | **array>** | Request arguments. | +| `$args` | **array>** | Request arguments. | --- @@ -974,7 +974,7 @@ public post(string $endpoint, array>** | Request arguments. | +| `$args` | **array>** | Request arguments. | --- @@ -992,7 +992,7 @@ public put(string $endpoint, array>** | Request arguments. | +| `$args` | **array>** | Request arguments. | --- @@ -1010,7 +1010,7 @@ public delete(string $endpoint, array | Parameter | Type | Description | |-----------|------|-------------| | `$endpoint` | **string** | API Endpoint. | -| `$args` | **array>** | Request arguments. | +| `$args` | **array>** | Request arguments. | --- @@ -1029,7 +1029,7 @@ public make_request(string $endpoint, string $method, array>** | Request arguments. | +| `$args` | **array>** | Request arguments. | ---