api_client_creds = $api_client_creds; } /** * Check the user_id, make the API call, and handle the response. * * @param string|null $user_id - Auth0 user ID to get. * * @return null|string */ public function call( $user_id = null ) { if ( empty( $user_id ) ) { return self::RETURN_ON_FAILURE; } if ( ! $this->set_bearer( self::API_SCOPE ) ) { return self::RETURN_ON_FAILURE; } return $this ->set_path( 'api/v2/users/' . rawurlencode( $user_id ) ) ->get() ->handle_response( __METHOD__ ); } /** * Handle API response. * * @param string $method - Method that called the API. * * @return integer */ protected function handle_response( $method ) { if ( $this->handle_wp_error( $method ) ) { return self::RETURN_ON_FAILURE; } if ( $this->handle_failed_response( $method ) ) { return self::RETURN_ON_FAILURE; } return $this->response_body; } }