<?php

namespace Auth0\SDK\API\Management;

use Auth0\SDK\API\Helpers\ApiClient;
use Auth0\SDK\API\Header\ContentType;

class Jobs extends GenericResource 
{
  public function get($id) 
  {
    return $this->apiClient->get()
      ->jobs($id)
      ->call();
  }

  public function getErrors($id) 
  {
    return $this->apiClient->get()
      ->jobs($id)
      ->errors()
      ->call();
  }

  public function importUsers($file_path, $connection_id) 
  {
    return $this->apiClient->post()
      ->jobs()
      ->addPath('users-imports')
      ->addFile('users', $file_path)
      ->addFormParam('connection_id', $connection_id)
      ->call();
  }

  public function sendVerificationEmail($user_id, $result_url = null) 
  {
      $body = [
        'user_id' => $user_id
      ];
      
      if(!is_null($result_url)){
          $body['result_url'] = $result_url;
      }
      
    return $this->apiClient->post()
      ->jobs()
      ->addPath('verification-email')
      ->withHeader(new ContentType('application/json'))
      ->withBody(json_encode($body))
      ->call();
  }
}

<?php

namespace Auth0\SDK\API\Management;

use Auth0\SDK\API\Helpers\ApiClient;
use Auth0\SDK\API\Header\ContentType;

class Jobs extends GenericResource 
{
  public function get($id) 
  {
    return $this->apiClient->get()
      ->jobs($id)
      ->call();
  }

  public function getErrors($id) 
  {
    return $this->apiClient->get()
      ->jobs($id)
      ->errors()
      ->call();
  }

  public function importUsers($file_path, $connection_id) 
  {
    return $this->apiClient->post()
      ->jobs()
      ->addPath('users-imports')
      ->addFile('users', $file_path)
      ->addFormParam('connection_id', $connection_id)
      ->call();
  }

  public function sendVerificationEmail($user_id) 
  {
    return $this->apiClient->post()
      ->jobs()
      ->addPath('verification-email')
      ->withHeader(new ContentType('application/json'))
      ->withBody(json_encode([
        'user_id' => $user_id
      ]))
      ->call();
  }
}
Revert "Added support for custom redirect URL when sending verification email…"
Revert "Added support for custom redirect URL when sending verification email…"
