@@ -5,6 +5,7 @@ import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro";
55import SchemaViewer from " ~/components/models/SchemaViewer.astro" ;
66import { Code } from " ~/components" ;
77import { LinkButton } from " ~/components" ;
8+ import { CollapsibleSection } from " ~/components/CollapsibleSection" ;
89import {
910 GraphQLToJSONSchemaBuilder ,
1011 type Field ,
@@ -59,7 +60,10 @@ const typescriptInput = await compile(
5960 { additionalProperties: false , bannerComment: " " },
6061);
6162
62- const [group, queryName] = name .split (" ." );
63+ const [group, queryName] = name .split (" ." ) as [
64+ " account" | " zone" | " organization" ,
65+ string ,
66+ ];
6367const gqlQuery = graphQLJSONSchemaToExample (
6468 ` ${group }s ` ,
6569 queryName ,
@@ -74,19 +78,26 @@ const gqlQuery = graphQLJSONSchemaToExample(
7478>
7579 <h2 >{ name .split (" ." ).join (" " )} </h2 >
7680 <p >{ query .description } </p >
77- <h3 >Example</h3 >
78- <LinkButton href ={ ` /analytics/graphql-api/graphiql?query=${btoa (gqlQuery )} ` }
79- >Open in GraphiQL</LinkButton
80- >
81- <Code code ={ gqlQuery } lang =" graphql" />
82- <h3 id =" Parameters" >Parameters</h3 >
83- <SchemaViewer schema ={ completeInputType } />
84- <h4 >Typescript definition</h4 >
85- <Code code ={ typescriptInput } lang =" typescript" />
86- <h3 id =" Output" >Output</h3 >
87- <SchemaViewer schema ={ completeResponseType } />
88- <h4 >Typescript definition</h4 >
89- <Code code ={ typescriptOutput } lang =" typescript" />
81+ <div class =" mt-4" >
82+ <CollapsibleSection client:load title =" Example GraphQL Query" defaultOpen >
83+ <LinkButton
84+ href ={ ` /analytics/graphql-api/graphiql?query=${btoa (gqlQuery )} ` }
85+ >Open in GraphiQL</LinkButton
86+ >
87+ <Code code ={ gqlQuery } lang =" graphql" />
88+ </CollapsibleSection >
89+
90+ <CollapsibleSection client:load title =" Parameters" >
91+ <SchemaViewer schema ={ completeInputType } />
92+ <h4 >Typescript definition</h4 >
93+ <Code code ={ typescriptInput } lang =" typescript" />
94+ </CollapsibleSection >
95+ <CollapsibleSection client:load title =" Output" >
96+ <SchemaViewer schema ={ completeResponseType } />
97+ <h4 >Typescript definition</h4 >
98+ <Code code ={ typescriptOutput } lang =" typescript" />
99+ </CollapsibleSection >
100+ </div >
90101</StarlightPage >
91102
92103<style >
0 commit comments