import { codeBlock } from '@sap-cloud-sdk/util' ; import { InstructionWithText } from '@sap-cloud-sdk/generator-common/internal' ; import { OpenApiOperation } from '../openapi-types' ; import { getOperationParamCode } from './code-sample-util' ; const instructionsText = 'To consume the service via the pregenerated typed client library run the code snippet below. For more details about OpenAPI client libraries chose "OpenAPI Consumption Manual" from the "Helpful Links" menu.' ; internal export function genericCodeSample ( ) { const operation = { operationId : 'myFunction' } as OpenApiOperation ; return apiSpecificCodeSample ( 'MyApi' , operation , 'my-npm-package' ) ; } internal export function apiSpecificCodeSample ( apiName , operation , packageName ) { return { text : instructionsText , instructions : codeBlock `
import { ${ apiName } } from '${ packageName }';

const responseData = await ${ apiName }.${ operation . operationId }(${ getOperationParamCode ( operation ) }).execute({ destinationName:'myDestinationName' });
` } ; }