src/IronWorker.php
public function postTasks($name, $payloads = array(), $options = array())
    {
        $url = "projects/{$this->project_id}/tasks";

        $request = array(
            'tasks' => array(),
        );

        foreach ($payloads as $payload) {
            $task_data = array(
                "name"      => $name,
                "code_name" => $name,
                'payload'   => json_encode($payload),

            );

            foreach ($options as $k => $v) {
                $task_data[$k] = $v;
            }

            $request['tasks'][] = $task_data;
        }

        $this->setCommonHeaders();
        $res = $this->apiCall(self::POST, $url, $request);
        $tasks = self::json_decode($res);

        $ids = array();
        foreach ($tasks->tasks as $task) {
            $ids[] = $task->id;
        }
        return $ids;
    }
public function postTasks($name, $payloads = array(), $options = array())
    {
        $url = "projects/{$this->project_id}/tasks";

        $request = array(
            'tasks' => array(),
        );

        foreach ($payloads as $payload) {
            $task_data = array(
                "name"      => $name,
                "code_name" => $name,
                'payload'   => json_encode($payload),

            );

            foreach ($options as $k => $v) {
                $task_data[$k] = $v;
            }

            $request['tasks'][] = $task_data;
        }

        $this->setCommonHeaders();
        $res = $this->apiCall(self::POST, $url, $request);
        $tasks = self::json_decode($res);

        $ids = array();
        foreach ($tasks->tasks as $task) {
            $ids[] = $task->id;
        }
        return $ids;
    }
public function postTasks ( $ name , $ payloads = array ( ) , $ options = array ( ) ) { $ url = "projects/{$this->project_id}/tasks" ; $ request = array ( 'tasks' => array ( ) , ) ; foreach ( $ payloads as $ payload ) { $ task_data = array ( "name" => $ name , "code_name" => $ name , 'payload' => json_encode ( $ payload ) , ) ; foreach ( $ options as $ k => $ v ) { $ task_data [ $ k ] = $ v ; } $ request [ 'tasks' ] [ ] = $ task_data ; } $ this -> setCommonHeaders ( ) ; $ res = $ this -> apiCall ( self :: POST , $ url , $ request ) ; $ tasks = self :: json_decode ( $ res ) ; $ ids = array ( ) ; foreach ( $ tasks -> tasks as $ task ) { $ ids [ ] = $ task -> id ; } return $ ids ; }
Queues many tasks at a time

@param string $name Package name
@param array $payloads. Each payload will be converted to separate task
@param array $options same as postTask()
@return array IDs
Queues many tasks at a time