/**
 * This service builds API clients.
 */ import nodeFetch from "node-fetch" ; import { PagoPAClient } from "../clients/pagopa" ; import { IPagoPAClientFactoryInterface , PagoPAEnvironment } from "./IPagoPAClientFactory" ; export default class PagoPAClientFactory implements IPagoPAClientFactoryInterface { private readonly prodApiClient ! : ReturnType < PagoPAClient > ; private readonly testApiClient ! : ReturnType < PagoPAClient > ; constructor ( pagoPAApiUrlProd , pagoPAApiUrlTest , fetchApi = ( nodeFetch as any ) as typeof fetch ) { this . prodApiClient = PagoPAClient ( pagoPAApiUrlProd , fetchApi ) ; this . testApiClient = PagoPAClient ( pagoPAApiUrlTest , fetchApi ) ; } /**
     * {@inheritDoc}
     */ public getClient ( environment ) { return environment === PagoPAEnvironment . TEST ? this . testApiClient : this . prodApiClient ; } }