Interface ApiSender

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ApiSender
Interface fonctionnelle définissant le contrat d'envoi de requêtes HTTP. L'interface permet de découpler la logique métier (LegoFactory) de l'implémentation technique réseau (HttpURLConnection).
  • Method Summary

    Modifier and Type
    Method
    Description
    send(String endpoint, String method, String body)
    Envoie une requête brute vers l'API.
  • Method Details

    • send

      String send(String endpoint, String method, String body) throws IOException
      Envoie une requête brute vers l'API.
      Parameters:
      endpoint - L'URL complète ou le chemin de la ressource cible.
      method - Le verbe HTTP à utiliser ("GET", "POST", "DELETE"...).
      body - Le corps de la requête.
      Returns:
      La réponse brute du serveur sous forme de chaîne de caractères.
      Throws:
      IOException - Si une erreur réseau survient (timeout, DNS, serveur injoignable...).