ate_jobs = $ate_jobs; $this->job_repository = $job_repository; } function add_hooks() { $this->register_routes(); } function register_routes() { parent::register_route( WPML_TM_ATE_AMS_Endpoints::STORE_JOB, array( 'methods' => 'POST', 'callback' => array( $this, 'store_ate_job' ), 'args' => array( 'wpml_job_id' => array( 'required' => true, 'type' => 'string', 'validate_callback' => array( 'WPML_REST_Arguments_Validation', 'integer' ), 'sanitize_callback' => array( 'WPML_REST_Arguments_Sanitation', 'integer' ), ), 'ate_job_data' => array( 'required' => true, 'type' => 'array', ), ), ) ); } /** * @param WP_REST_Request $request * * @return bool * @throws \InvalidArgumentException */ public function store_ate_job( WP_REST_Request $request ) { $wpml_job_id = $request->get_param( 'wpml_job_id' ); $ate_job_data = $request->get_param( 'ate_job_data' ); $this->ate_jobs->store( $wpml_job_id, $ate_job_data ); return true; } function get_allowed_capabilities( WP_REST_Request $request ) { return self::CAPABILITY; } }