action-factory.php
1 year ago
base-api-action.php
1 year ago
create-contact-action.php
1 year ago
get-custom-fields-action.php
1 year ago
get-lists-action.php
1 year ago
get-lists-action.php
28 lines
| 1 | <?php |
| 2 | |
| 3 | namespace JFB_Modules\Actions_V2\Get_Response\Api; |
| 4 | |
| 5 | class Get_Lists_Action extends Base_Api_Action { |
| 6 | |
| 7 | protected $method = 'GET'; |
| 8 | |
| 9 | public function action_endpoint() { |
| 10 | return 'campaigns'; |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * @return \Generator |
| 15 | */ |
| 16 | public function generate_lists(): \Generator { |
| 17 | $response = $this->get_response_body(); |
| 18 | |
| 19 | foreach ( $response as $list ) { |
| 20 | yield array( |
| 21 | 'value' => $list['campaignId'], |
| 22 | 'label' => $list['name'], |
| 23 | ); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | } |
| 28 |