import type { Operation } from './types' import { useTranslation } from 'components/hooks/useTranslation' import { CodeBlock } from './CodeBlock' import { getShellExample, getGHExample, getJSExample } from '../lib/get-rest-code-samples' type Props = { slug: string operation: Operation } export function RestCodeSamples({ operation, slug }: Props) { const { t } = useTranslation('products') const JAVASCRIPT_HEADING = ( JavaScript{' '} @octokit/core.js ) const GH_CLI_HEADING = ( GitHub CLI{' '} gh api ) // Format the example properties into different language examples const languageExamples = operation.codeExamples.map((sample) => { const languageExamples = { curl: getShellExample(operation, sample), javascript: getJSExample(operation, sample), ghcli: getGHExample(operation, sample), } return Object.assign({}, sample, languageExamples) }) return ( <>