import { NetworkProductModuleDefinitionResponse } from '../domain/product-module-definition'; import { RootAPIHelper } from './root-api'; /** * Fetch the full body product module from Root. * @param apiKey Root API key with CLI permissions * @param productModuleKey The Root product module key * @param pullLive Flag to indicate whether the live version should be fetched * @returns A full body product module */ export const fetchProductModuleDefinition = async (params: { apiKey: string; productModuleKey: string; pullLive: boolean; host: string; signal?: AbortSignal; }): Promise => { const { apiKey, productModuleKey, host, pullLive, signal } = params; const rootApi = new RootAPIHelper({ host, apiKey, throwResponseErrors: true }); const path = `/cli/product-modules/${productModuleKey}`; const searchParams = { live_version: pullLive.toString() }; return rootApi.send({ path, searchParams, signal }); };