services – Instantiate the controller with a non-concrete interface class

As a background, I am rebuilding an old code and want to wrap all the curl-based queries in an interface (HttpRequestInterface) so that I can swap them later without having to write all the API calls. now.

I'm trying to pass the HttpRequestInterface to the controller, but he keeps saying `

TypeError: Argument 1 passed to
Drupal my_api Controller MyController :: __ construct () must be
an instance of Drupal my_api Controller HttpRequestInterface,
given instance of Drupal my_api Services HttpRequest CurlRequest

Drupal is new to the .Net world and loves the fact that this feature is ready for use. It seems that I'm following the examples and the code I find in the kernel, but it's obvious that I'm missing something.

You will find below the relevant files. I have included only what seems relevant to the question; you can have more.

Controller:

<? php

Drupal namespace  my_api  Controller;

use Drupal  Core  DependencyInjection  ContainerInjectionInterface;
use Symfony  Component  DependencyInjection  ContainerInterface;
use Symfony  Component  HttpFoundation  Response;
use Drupal  my_api  Controller  BaseApiController;

/ **
* Controller routines for Api routes.
* /
The RallyBoundController class extends BaseApiController {

`BaseController:

Drupal namespace  my_api  Controller;

use Drupal  Core  DependencyInjection  ContainerInjectionInterface;
use Symfony  Component  DependencyInjection  ContainerInterface;
use Drupal  Core  Controller  ControllerBase;
use Drupal  my_api  Services  HttpRequest  HttpRequestInterace;

/ **
* BaseApiController summarizes the common concerns of APIs.
* /
the abstract class BaseApiController extends ControllerBase {
protected $ httpService;

/ **
* Contructor requires the HttpRequest service.
*
* @param HttpRequestInterface $ httpService
* Implementation of HttpRequestInterface defined in services.yml.
* /
public function __construct (HttpRequestInterface $ httpService) {
$ this-> httpService = $ httpService;
}

/ **
* Get the HttpRequest implementation as an interface so that we can exchange as needed.
* /
Public static function create (ContainerInterface $ container) {
returns a new static value (
$ container-> get (& # 39; my_api.httprequest & # 39;)
)
}

Service.yml:

services:
mon_api.httprequest:
class: Drupal  my_api  Services  HttpRequest  CurlRequest

Thanks for the help.