From 1ac9c86a665e6fc0bf904cc96c4950f21f140eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lys=C3=BD?= Date: Wed, 26 Oct 2022 10:57:54 +0200 Subject: [PATCH] Add updateList documentation [MAILPOET-4752] --- doc/Readme.md | 1 + doc/api_methods/UpdateList.md | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 doc/api_methods/UpdateList.md diff --git a/doc/Readme.md b/doc/Readme.md index 5f45f03a98..040f1075b9 100644 --- a/doc/Readme.md +++ b/doc/Readme.md @@ -38,6 +38,7 @@ Class `\MailPoet\API\API` becomes available once MailPoet plugin is loaded by Wo - [Subscribe to Lists (subscribeToLists)](api_methods/SubscribeToLists.md) - [Unsubscribe from List (unsubscribeFromList)](api_methods/UnsubscribeFromList.md) - [Unsubscribe from Lists (unsubscribeFromLists)](api_methods/UnsubscribeFromLists.md) +- [Update List (updateList)](api_methods/UpdateList.md) ### Usage examples diff --git a/doc/api_methods/UpdateList.md b/doc/api_methods/UpdateList.md new file mode 100644 index 0000000000..119347dc66 --- /dev/null +++ b/doc/api_methods/UpdateList.md @@ -0,0 +1,38 @@ +[back to list](../Readme.md) + +# Add Subscriber + +## `array updateList(array $list)` + +This method provides functionality for updating a list name or description. + +It returns the updated list. See [Get Lists](GetLists.md) for a list data structure description. + +## Arguments + +### `$list` (required) + +An associative array which contains list data. + +| Property | Type | Limits | Description | +| ---------------------- | ------------ | --------- | -------------------------- | +| id (required) | string | 11 chars | A id of the list. | +| name (required) | string | 90 chars | A name of the list. | +| description (optional) | string\|null | 250 chars | A description of the list. | + +## 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 | The list was not found by id | +| 14 | Missing list name | +| 15 | Trying to use a list that is already used | +| 18 | Missing list id | +| 19 | The list couldn’t be updated in the database |