From 933b947f457f7e7ad5438a0deeb8fe24372bf36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lys=C3=BD?= Date: Thu, 27 Oct 2022 08:47:08 +0200 Subject: [PATCH] Add deleteList documentation [MAILPOET-4752] --- doc/Readme.md | 1 + doc/api_methods/DeleteList.md | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 doc/api_methods/DeleteList.md diff --git a/doc/Readme.md b/doc/Readme.md index 040f1075b9..05e4eb1b62 100644 --- a/doc/Readme.md +++ b/doc/Readme.md @@ -28,6 +28,7 @@ Class `\MailPoet\API\API` becomes available once MailPoet plugin is loaded by Wo - [Add List (addList)](api_methods/AddList.md) - [Add Subscriber (addSubscriber)](api_methods/AddSubscriber.md) - [Add Subscriber Field (addSubscriberField)](api_methods/AddSubscriberField.md) +- [Delete List (deleteList)](api_methods/DeleteList.md) - [Get Lists (getLists)](api_methods/GetLists.md) - [Get Subscriber (getSubscriber)](api_methods/GetSubscriber.md) - [Get Subscribers (getSubscribers)](api_methods/GetSubscribers.md) diff --git a/doc/api_methods/DeleteList.md b/doc/api_methods/DeleteList.md new file mode 100644 index 0000000000..f9932220f3 --- /dev/null +++ b/doc/api_methods/DeleteList.md @@ -0,0 +1,26 @@ +[back to list](../Readme.md) + +# Delete List + +## `bool deleteList(string $list_id)` + +This method provides functionality for deleting a new list. + +It returns a boolean value. + +## Error handling + +All expected errors from the API are exceptions of class `\MailPoet\API\MP\v1\APIException`. +Code of the exception is populated to distinguish between different errors. + +An exception of base class `\Exception` can be thrown when something unexpected happens. + +Codes description: + +| Code | Description | +| ---- | --------------------------------------------------------------- | +| 5 | List does not exist | +| 18 | List id is empty | +| 20 | List cannot be deleted because it’s used for an automatic email | +| 21 | List cannot be deleted because it’s used for a form | +| 22 | The list couldn’t be deleted from the database |