diff --git a/apps/docs/pages/reference/analytics/[...slug].tsx b/apps/docs/pages/reference/analytics/[...slug].tsx new file mode 100644 index 0000000000..edbdaef260 --- /dev/null +++ b/apps/docs/pages/reference/analytics/[...slug].tsx @@ -0,0 +1,169 @@ +import specFile from '~/../../spec/transforms/analytics_v0_openapi_deparsed.json' assert { type: 'json' } +import { gen_v3, enrichedOperation } from '~/lib/refGenerator/helpers' +import { Tabs } from '~/../../packages/ui' + +// @ts-ignore +import CodeBlock from '~/components/CodeBlock/CodeBlock' +import RefSubLayout from '~/layouts/ref/RefSubLayout' + +export type AcceptedValue = { + id: string + name: string + type: 'string' | 'boolean' | 'object' + description?: string +} + +export type Flag = { + id: string + name: string + description: string + default_value: string + accepted_values: AcceptedValue[] +} + +export type ApiParameter = { + example: string + in: string + name: string + required: boolean + schema: { + type: string + example: string + } +} +// @ts-ignore +const generatedSpec = gen_v3(specFile, 'wat', { apiUrl: 'apiv0' }) + +export default function Config() { + return ( + +
+
+
+

{generatedSpec.info.title}

+

{generatedSpec.info.description}

+
+ +
+ {generatedSpec.operations.map((operation: any) => ( +
+ + +
+ + {operation.operation} + {operation.fullPath} + +
+ {/* Path Parameters */} + {operation.parameters && + operation.parameters.filter((parameter) => parameter.in === 'path').length > + 0 && ( +
+

Path parameters

+
    + {operation.parameters && + operation.parameters + .filter((parameter: any) => parameter.in === 'path') + .map((parameter: any) => ( +
  • +
    +
    + {parameter.name} +
    + {parameter.required && ( +
    + REQUIRED +
    + )} +
    +
    +

    {parameter.description}

    +
    + {parameter.example && ( +
    + Example: + + {parameter.example} + +
    + )} +
  • + ))} +
+
+ )} + + {/* Header Parameters */} + {operation.parameters && + operation.parameters.filter((parameter) => parameter.in === 'header').length > + 0 && ( +
+

Header parameters

+
    + {operation.parameters && + operation.parameters + .filter((parameter: any) => parameter.in === 'header') + .map((parameter: any) => ( +
  • +
    + {parameter.name} + + {parameter.required && 'required'} + +
    +
    + Example: + + {parameter.example} + +
    +
  • + ))} +
+
+ )} +
+ + {operation.responseList.length > 0 && ( + <> +

Responses

+ + {operation.responseList.map((response: any) => ( + +

{response.description}

+ {response?.content && response?.content['application/json'] && ( +
+ + {JSON.stringify(response.content['application/json'], null, 2)} + +
+ )} +
+ ))} +
+ + )} +
+
+
+ ))} +
+
+
+
+ ) +}