Class EnedisApiClient

java.lang.Object
energy.eddie.regionconnector.fr.enedis.client.EnedisApiClient
All Implemented Interfaces:
EnedisAccountingPointDataApi, EnedisHealth, EnedisMeterReadingApi, EnedisSubscribedServicesApi

@Component public class EnedisApiClient extends Object implements EnedisMeterReadingApi, EnedisAccountingPointDataApi, EnedisHealth, EnedisSubscribedServicesApi
  • Field Details

  • Constructor Details

    • EnedisApiClient

      public EnedisApiClient(EnedisTokenProvider tokenProvider, org.springframework.web.reactive.function.client.WebClient webClient)
  • Method Details

    • getSubscribedServices

      public reactor.core.publisher.Mono<ServiceSubscriptionsResponse> getSubscribedServices(long authorizationId)
      Description copied from interface: EnedisSubscribedServicesApi
      Retrieves the subscribed services for a given authorization ID. This includes the usage points associated with an authorization.
      Specified by:
      getSubscribedServices in interface EnedisSubscribedServicesApi
      Parameters:
      authorizationId - the ID of the authorization
      Returns:
      a Mono that emits the subscribed services or an error
    • getConsumptionMeterReading

      public reactor.core.publisher.Mono<MeterReading> getConsumptionMeterReading(String usagePointId, LocalDate start, LocalDate end, Granularity granularity)
      Description copied from interface: EnedisMeterReadingApi
      Retrieves meter reading data for a specified usage point over a given period. This method supports different granularities for the consumption data: Granularity.PT30M and Granularity.P1D.

      Important Constraints:

      • When using Granularity.PT30M, the duration between the start and end dates must not exceed 7 days. Batch the requests
      • The end date is treated as exclusive, meaning consumption on this date is not included in the returned data.

      If the specified period or granularity does not meet these constraints, the method may throw an IllegalArgumentException.

      Specified by:
      getConsumptionMeterReading in interface EnedisMeterReadingApi
      Parameters:
      usagePointId - The unique identifier for the usage point. Must not be null or empty.
      start - The start date of the period for which to retrieve consumption data. Must be before the end date.
      end - The end date of the period, exclusive. Consumption data up to but not including this date is retrieved.
      granularity - The granularity of the consumption data. Must be one of the supported Granularity values.
      Returns:
      A Mono that emits the MeterReading data for the specified usage point and period or an error signal if the request fails.
    • getProductionMeterReading

      public reactor.core.publisher.Mono<MeterReading> getProductionMeterReading(String usagePointId, LocalDate start, LocalDate end, Granularity granularity)
      Description copied from interface: EnedisMeterReadingApi
      Retrieves meter reading data for a specified usage point over a given period. This method supports different granularities for the consumption data: Granularity.PT30M and Granularity.P1D.

      Important Constraints:

      • When using Granularity.PT30M, the duration between the start and end dates must not exceed 7 days. Batch the requests
      • The end date is treated as exclusive, meaning consumption on this date is not included in the returned data.

      If the specified period or granularity does not meet these constraints, the method may throw an IllegalArgumentException.

      Specified by:
      getProductionMeterReading in interface EnedisMeterReadingApi
      Parameters:
      usagePointId - The unique identifier for the usage point. Must not be null or empty.
      start - The start date of the period for which to retrieve consumption data. Must be before the end date.
      end - The end date of the period, exclusive. Consumption data up to but not including this date is retrieved.
      granularity - The granularity of the consumption data. Must be one of the supported Granularity values.
      Returns:
      A Mono that emits the MeterReading data for the specified usage point and period or an error signal if the request fails.
    • getContract

      public reactor.core.publisher.Mono<List<ContractualSituation>> getContract(String usagePointId)
      Description copied from interface: EnedisAccountingPointDataApi
      Retrieves the contractual situations of a usage point, including the contracts, the customer identity and the customer contact data. The API returns an array, so a usage point can carry more than one situation (for instance consumption and production).
      Specified by:
      getContract in interface EnedisAccountingPointDataApi
      Parameters:
      usagePointId - The unique identifier for the usage point. Must not be null or empty.
      Returns:
      A Mono that emits the ContractualSituation list for the specified usage point or an error
    • getAddress

      public reactor.core.publisher.Mono<UsagePointGeneralData> getAddress(String usagePointId)
      Description copied from interface: EnedisAccountingPointDataApi
      Retrieves the general data (installation address) of a usage point.
      Specified by:
      getAddress in interface EnedisAccountingPointDataApi
      Parameters:
      usagePointId - The unique identifier for the usage point. Must not be null or empty.
      Returns:
      A Mono that emits the UsagePointGeneralData for the specified usage point or an error
    • health

      public Map<String,org.springframework.boot.health.contributor.Health> health()
      Specified by:
      health in interface EnedisHealth