/** This component displays API requests in multiple different formats using the tabs component. It syncs across the page. Please note: it doees NOT cover all kinds of API requests just yet. If the type you're looking for isn't included, you may need to do some extra development before it can be used. In the future, it may be necessary to separate into multiple components based on request types, for instance. **/ import React from 'react'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; const indentation = 2; const Component = ({ verb, payload, url, title }) => { const verbUpper = verb?.toUpperCase() || ''; const prettyPayload = JSON.stringify(payload, null, indentation); return ( {` ${verbUpper} /${url} Authorization: content-type: application/json ${prettyPayload} `.trim()} {` curl -H "Content-Type: application/json" \\ -H "Authorization: " \\ -X ${verbUpper} -d '${prettyPayload}' \\ /${url} `.trim()} {`echo '${prettyPayload}' \\ | http ${verbUpper} \\ /${url} \\ Authorization:`.trim()} ); }; export default Component;