GetCampaigns.php 888 Bytes
<?php
namespace App\Service\Requests\Direct;

use App\Jobs\ProcessCallLimitedAPI;
use App\Service\API\API;
use App\Service\Requests\APIRequest;
use App\Service\Requests\DirectRequest;

class GetCampaigns extends DirectRequest{
    protected $next;
    protected $timestamp;

    function call($next = null, $response = null){
        $this->next = $next;
        $this->requestPrepare($response);
        $process = new ProcessCallLimitedAPI($this);
        dispatch($process)->onQueue('api');
    }

    function handle($response){
        echo 'get campaigns';
        print_r($response);
    }

    private function requestPrepare($response){
        $this->setService('campaigns');
        $this->setMethod('get');
        $this->setTimestamp($response);
    }

    private function setTimestamp($response){
        $this->timestamp = $response['result']['Timestamp'] ?? '';
    }

}