add-tag-to-contact.php
3 years ago
base-action.php
3 years ago
create-tag-action.php
3 years ago
list-all-tags.php
3 years ago
retrieve-custom-fields-action.php
3 years ago
retrieve-lists-action.php
3 years ago
sync-contact-action.php
3 years ago
update-list-status.php
3 years ago
retrieve-lists-action.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Jet_Form_Builder\Integrations\Active_Campaign\Api; |
| 5 | |
| 6 | |
| 7 | use Jet_Form_Builder\Classes\Arrayable\Arrayable; |
| 8 | |
| 9 | class Retrieve_Lists_Action extends Base_Action implements Arrayable { |
| 10 | |
| 11 | protected $method = \WP_REST_Server::READABLE; |
| 12 | |
| 13 | public function action_endpoint() { |
| 14 | return 'lists'; |
| 15 | } |
| 16 | |
| 17 | public function action_query_args(): array { |
| 18 | return array( |
| 19 | 'limit' => '-1', |
| 20 | ); |
| 21 | } |
| 22 | |
| 23 | public function to_array(): array { |
| 24 | $response = array(); |
| 25 | $lists = $this->response_body['lists'] ?? array(); |
| 26 | |
| 27 | foreach ( $lists as $list ) { |
| 28 | $response[] = array( |
| 29 | 'value' => $list['id'], |
| 30 | 'label' => $list['name'], |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | return $response; |
| 35 | } |
| 36 | |
| 37 | } |