@stainless-api/docs-ui 0.1.0-beta.5 → 0.1.0-beta.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/breadcrumbs-BdYnaHA8.d.ts +20 -0
- package/dist/breadcrumbs-CA7GmW_8.d.ts +20 -0
- package/dist/breadcrumbs-nSFZO5Gf.js +63 -0
- package/dist/chunk-DRcLgZ1e.js +18 -0
- package/dist/component-DRO8kQSp.js +23 -0
- package/dist/component-generics-B6Fn47Mz.js +45 -0
- package/dist/component-generics-BHFUK06s.d.ts +30 -0
- package/dist/component-generics-BJSyydZ-.d.ts +30 -0
- package/dist/components/MaskedInput.d.ts +14 -0
- package/dist/components/MaskedInput.js +76 -0
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +9 -0
- package/dist/components/icons.d.ts +55 -0
- package/dist/components/icons.js +3 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +18 -0
- package/dist/components/method.d.ts +2 -0
- package/dist/components/method.js +10 -0
- package/dist/components/overview.d.ts +2 -0
- package/dist/components/overview.js +11 -0
- package/dist/components/primitives.d.ts +2 -0
- package/dist/components/primitives.js +8 -0
- package/dist/components/properties.d.ts +2 -0
- package/dist/components/properties.js +9 -0
- package/dist/components/sdk.d.ts +2 -0
- package/dist/components/sdk.js +10 -0
- package/dist/components/sidebar.d.ts +2 -0
- package/dist/components/sidebar.js +11 -0
- package/dist/components/snippets.d.ts +3 -0
- package/dist/components/snippets.js +9 -0
- package/dist/components-D7M-BwNI.js +71 -0
- package/dist/contexts/component-generics.d.ts +2 -0
- package/dist/contexts/component-generics.js +3 -0
- package/dist/contexts/component-types.d.ts +16 -0
- package/dist/contexts/component-types.js +0 -0
- package/dist/contexts/component.d.ts +29 -0
- package/dist/contexts/component.js +27 -0
- package/dist/contexts/docs.d.ts +2 -0
- package/dist/contexts/docs.js +3 -0
- package/dist/contexts/index.d.ts +16 -0
- package/dist/contexts/index.js +7 -0
- package/dist/contexts/markdown.d.ts +2 -0
- package/dist/contexts/markdown.js +4 -0
- package/dist/contexts/navigation.d.ts +2 -0
- package/dist/contexts/navigation.js +3 -0
- package/dist/contexts/use-components.d.ts +14 -0
- package/dist/contexts/use-components.js +4 -0
- package/dist/contexts-p3rRZDlM.js +39 -0
- package/dist/csharp-CDSxfCZE.js +283 -0
- package/dist/docs-BUS__I1m.d.ts +47 -0
- package/dist/docs-CXqi26jB.js +54 -0
- package/dist/docs-fKyo35eI.d.ts +47 -0
- package/dist/go-1c3S5ETL.js +303 -0
- package/dist/http-2QNWXH9t.js +330 -0
- package/dist/icons-Ckod9aod.js +869 -0
- package/dist/index-5Yl-BBg3.d.ts +15 -0
- package/dist/index-9LRO8R1a.d.ts +274 -0
- package/dist/index-CBIJwoyp.d.ts +13 -0
- package/dist/index-ClCZKGcw.d.ts +274 -0
- package/dist/index-pMKpm2Jk.d.ts +13 -0
- package/dist/index-q3bZhNWj.d.ts +15 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +29 -7542
- package/dist/java-BbjF_oUI.js +403 -0
- package/dist/languages/csharp.d.ts +11 -0
- package/dist/languages/csharp.js +9 -0
- package/dist/languages/go.d.ts +11 -0
- package/dist/languages/go.js +9 -0
- package/dist/languages/http.d.ts +11 -0
- package/dist/languages/http.js +19 -0
- package/dist/languages/index.d.ts +11 -0
- package/dist/languages/index.js +26 -0
- package/dist/languages/java.d.ts +11 -0
- package/dist/languages/java.js +9 -0
- package/dist/languages/python.d.ts +11 -0
- package/dist/languages/python.js +9 -0
- package/dist/languages/ruby.d.ts +11 -0
- package/dist/languages/ruby.js +9 -0
- package/dist/languages/typescript.d.ts +11 -0
- package/dist/languages/typescript.js +9 -0
- package/dist/languages-BCYZjzuS.js +26 -0
- package/dist/markdown/index.d.ts +12 -0
- package/dist/markdown/index.js +104 -0
- package/dist/markdown/md.d.ts +15 -0
- package/dist/markdown/md.js +3 -0
- package/dist/markdown/printer.d.ts +2 -0
- package/dist/markdown/printer.js +28 -0
- package/dist/markdown/utils.d.ts +3 -0
- package/dist/markdown/utils.js +3 -0
- package/dist/markdown-C8o8WrwG.d.ts +22 -0
- package/dist/markdown-CqJohZei.d.ts +22 -0
- package/dist/markdown-CxdeWgjV.js +48 -0
- package/dist/md-oM2tUaCA.js +41 -0
- package/dist/method-CE08mUME.js +115 -0
- package/dist/method-CMt6uyix.d.ts +71 -0
- package/dist/method-r5UAB40b.d.ts +71 -0
- package/dist/navigation-9_4wRkcT.d.ts +29 -0
- package/dist/navigation-C5TN0SgC.js +24 -0
- package/dist/navigation-zuoWsXzh.d.ts +29 -0
- package/dist/overview-DXmLmmr7.d.ts +39 -0
- package/dist/overview-S2hUqPXA.js +139 -0
- package/dist/overview-ixhAhHj8.d.ts +39 -0
- package/dist/primitives-BIWfwN5L.js +258 -0
- package/dist/primitives-BVXfSSiS.d.ts +97 -0
- package/dist/primitives-Bl0wzAGo.d.ts +97 -0
- package/dist/printer-DBw4S_Jn.d.ts +13 -0
- package/dist/printer-bNxiG6UB.js +74 -0
- package/dist/properties-C-NU_ghj.d.ts +54 -0
- package/dist/properties-GT9ixNTg.d.ts +54 -0
- package/dist/properties-jlGW3USi.js +131 -0
- package/dist/python-USOwFDv_.js +279 -0
- package/dist/routing-CMqh1cTZ.d.ts +54 -0
- package/dist/routing-Wbb7YECB.js +194 -0
- package/dist/routing.d.ts +2 -0
- package/dist/routing.js +3 -180
- package/dist/ruby-CSvGbSLe.js +387 -0
- package/dist/sdk-B5W3VipN.d.ts +118 -0
- package/dist/sdk-CS6A3HW3.d.ts +118 -0
- package/dist/sdk-CSCbbn3O.js +336 -0
- package/dist/sidebar-C3fZrgmP.d.ts +36 -0
- package/dist/sidebar-CWyvCrJ0.js +81 -0
- package/dist/sidebar-CbCLUteD.d.ts +36 -0
- package/dist/snippets-BQLXEIf6.js +161 -0
- package/dist/snippets-C72s2IwS.d.ts +51 -0
- package/dist/snippets-DcFph7ir.d.ts +51 -0
- package/dist/spec.d.ts +65 -0
- package/dist/spec.js +167 -0
- package/dist/style-D7RO5ymE.d.ts +168 -0
- package/dist/style-gnVEeXFj.js +169 -0
- package/dist/style.d.ts +2 -0
- package/dist/style.js +3 -0
- package/dist/styles/main.css +727 -754
- package/dist/styles/main.js +0 -0
- package/dist/styles/primitives.css +317 -461
- package/dist/styles/primitives.js +0 -0
- package/dist/styles/resets.css +32 -41
- package/dist/styles/resets.js +0 -0
- package/dist/styles/search.css +175 -274
- package/dist/styles/search.js +0 -0
- package/dist/styles/sidebar.css +59 -60
- package/dist/styles/sidebar.js +0 -0
- package/dist/styles/variables.css +26 -89
- package/dist/styles/variables.js +0 -0
- package/dist/styles.css +2910 -0
- package/dist/styles.mjs +1 -0
- package/dist/typescript-DXG9psK3.js +449 -0
- package/dist/use-components-RWQbviGq.js +7 -0
- package/dist/utils-CqnL9Fc3.js +31 -0
- package/dist/utils-DGnJ6mcU.d.ts +21 -0
- package/dist/utils-D_1AWSRX.js +32 -0
- package/dist/utils-d8paVwKN.d.ts +14 -0
- package/dist/utils-uQbtk0-_.d.ts +21 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +3 -0
- package/package.json +73 -21
- package/dist/mcp.js +0 -16003
- package/dist/styles/snippets.css +0 -132
- package/src/components/breadcrumbs.tsx +0 -94
- package/src/components/chat.tsx +0 -154
- package/src/components/dropdown.tsx +0 -91
- package/src/components/icons.tsx +0 -584
- package/src/components/index.ts +0 -9
- package/src/components/method.tsx +0 -144
- package/src/components/overview.tsx +0 -159
- package/src/components/primitives.tsx +0 -284
- package/src/components/properties.tsx +0 -130
- package/src/components/scripts/dropdown.ts +0 -78
- package/src/components/sdk.tsx +0 -402
- package/src/components/sidebar.tsx +0 -99
- package/src/components/snippets.tsx +0 -179
- package/src/contexts/component-generics.tsx +0 -48
- package/src/contexts/component-types.tsx +0 -5
- package/src/contexts/component.tsx +0 -32
- package/src/contexts/docs.tsx +0 -75
- package/src/contexts/index.tsx +0 -17
- package/src/contexts/markdown.tsx +0 -43
- package/src/contexts/navigation.tsx +0 -44
- package/src/contexts/search.tsx +0 -28
- package/src/contexts/use-components.tsx +0 -4
- package/src/index.ts +0 -6
- package/src/languages/go.tsx +0 -281
- package/src/languages/http.tsx +0 -321
- package/src/languages/index.ts +0 -26
- package/src/languages/java.tsx +0 -358
- package/src/languages/python.tsx +0 -255
- package/src/languages/ruby.tsx +0 -320
- package/src/languages/typescript.tsx +0 -393
- package/src/markdown/index.ts +0 -107
- package/src/markdown/md.ts +0 -45
- package/src/markdown/utils.ts +0 -49
- package/src/routing.ts +0 -238
- package/src/search/form.tsx +0 -127
- package/src/search/index.tsx +0 -1
- package/src/search/indexer.ts +0 -246
- package/src/search/mcp.ts +0 -61
- package/src/search/printer.tsx +0 -86
- package/src/search/providers/algolia.ts +0 -88
- package/src/search/providers/fuse.ts +0 -19
- package/src/search/providers/pagefind.ts +0 -17
- package/src/search/providers/walker.ts +0 -30
- package/src/search/results.tsx +0 -181
- package/src/search/state.ts +0 -64
- package/src/search/types.ts +0 -116
- package/src/style.ts +0 -197
- package/src/styles/main.css +0 -993
- package/src/styles/primitives.css +0 -573
- package/src/styles/resets.css +0 -47
- package/src/styles/search.css +0 -342
- package/src/styles/sidebar.css +0 -87
- package/src/styles/snippets.css +0 -132
- package/src/styles/variables.css +0 -90
- package/src/utils.ts +0 -41
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { a as useLanguage, l as useSpec, n as useContentPanelLayout, r as useDeclaration, s as useSettings } from "./docs-CXqi26jB.js";
|
|
2
|
+
import { n as useNavigation } from "./navigation-C5TN0SgC.js";
|
|
3
|
+
import { n as useLanguageComponents } from "./contexts-p3rRZDlM.js";
|
|
4
|
+
import { t as useComponents } from "./use-components-RWQbviGq.js";
|
|
5
|
+
import { t as style_default } from "./style-gnVEeXFj.js";
|
|
6
|
+
import { c as getLanguageSnippet, t as LanguageNames } from "./routing-Wbb7YECB.js";
|
|
7
|
+
import { a as KotlinIcon, c as RubyIcon, i as JavaIcon, l as TerraformIcon, n as CurlIcon, o as PowershellIcon, r as GoIcon, s as PythonIcon, t as CSharpIcon, u as TypescriptIcon } from "./icons-Ckod9aod.js";
|
|
8
|
+
import * as React$1 from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { BookOpen, Copy, Github } from "lucide-react";
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
import { Button, Callout } from "@stainless-api/ui-primitives";
|
|
13
|
+
|
|
14
|
+
//#region src/components/sdk.tsx
|
|
15
|
+
const PropertyModelContext = React$1.createContext({});
|
|
16
|
+
function usePropertyModel() {
|
|
17
|
+
return React$1.useContext(PropertyModelContext);
|
|
18
|
+
}
|
|
19
|
+
const ReferenceNestingContext = React$1.createContext([]);
|
|
20
|
+
function useReferenceNesting() {
|
|
21
|
+
return React$1.useContext(ReferenceNestingContext);
|
|
22
|
+
}
|
|
23
|
+
const SDKSnippetLanguages = {
|
|
24
|
+
"node.default": { name: "TypeScript" },
|
|
25
|
+
"typescript.default": { name: "TypeScript" },
|
|
26
|
+
"python.default": { name: "Python" },
|
|
27
|
+
"go.default": { name: "Go" },
|
|
28
|
+
"java.default": { name: "Java" },
|
|
29
|
+
"kotlin.default": { name: "Kotlin" },
|
|
30
|
+
"http.curl": { name: "cURL" },
|
|
31
|
+
"http.powershell": { name: "Powershell" },
|
|
32
|
+
"terraform.default": { name: "Terraform" },
|
|
33
|
+
"ruby.default": { name: "Ruby" },
|
|
34
|
+
"csharp.default": { name: "C#" },
|
|
35
|
+
"php.default": { name: "PHP" }
|
|
36
|
+
};
|
|
37
|
+
function SDKChildren({ paths, expand, depth }) {
|
|
38
|
+
const Docs = useComponents();
|
|
39
|
+
return /* @__PURE__ */ jsx("div", {
|
|
40
|
+
className: style_default.Properties,
|
|
41
|
+
children: paths.map((path, i) => /* @__PURE__ */ jsx(Docs.SDKDeclaration, {
|
|
42
|
+
path,
|
|
43
|
+
expand,
|
|
44
|
+
depth
|
|
45
|
+
}, i))
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function SDKDeclaration({ path, expand, depth = 0 }) {
|
|
49
|
+
const Lang = useLanguageComponents();
|
|
50
|
+
const Docs = useComponents();
|
|
51
|
+
const decl = useDeclaration(path, true);
|
|
52
|
+
const settings = useSettings();
|
|
53
|
+
const model = usePropertyModel();
|
|
54
|
+
const nesting = useReferenceNesting();
|
|
55
|
+
const { selectedPath } = useNavigation();
|
|
56
|
+
if (decl.kind.endsWith("Reference")) {
|
|
57
|
+
const refId = "type" in decl && typeof decl.type !== "string" && "$ref" in decl.type ? decl.type["$ref"] : void 0;
|
|
58
|
+
if (refId && refId !== path && !nesting.includes(refId)) return /* @__PURE__ */ jsx(ReferenceNestingContext.Provider, {
|
|
59
|
+
value: [...nesting, refId],
|
|
60
|
+
children: /* @__PURE__ */ jsx(SDKDeclaration, {
|
|
61
|
+
path: refId,
|
|
62
|
+
expand,
|
|
63
|
+
depth
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const isUnion = "childrenParentSchema" in decl && decl.childrenParentSchema && ["enum", "union"].includes(decl.childrenParentSchema);
|
|
68
|
+
const id = model?.propertyPath ? `${model.propertyPath} + ${path}` : path;
|
|
69
|
+
const shouldExpand = selectedPath?.startsWith(path) && nesting.length < 1 || settings?.properties?.expandDepth && depth <= settings?.properties?.expandDepth && !isUnion || expand;
|
|
70
|
+
const hasChildren = "children" in decl && (decl.children?.length ?? 0) > 0 && !decl.children?.includes(path) && !(isUnion && decl.childrenParentSchema === "enum" && decl.children?.length === 1) && (settings?.properties?.includeModelProperties !== false || !("modelPath" in decl));
|
|
71
|
+
const content = /* @__PURE__ */ jsx(Lang.Property, {
|
|
72
|
+
decl,
|
|
73
|
+
children: ({ ...props }) => /* @__PURE__ */ jsx(Docs.Property, {
|
|
74
|
+
id,
|
|
75
|
+
expand: shouldExpand,
|
|
76
|
+
constraints: "constraints" in decl && /* @__PURE__ */ jsx(Docs.SDKConstraints, { constraints: decl["constraints"] }),
|
|
77
|
+
declaration: /* @__PURE__ */ jsx(Lang.Declaration, { decl }),
|
|
78
|
+
title: "title" in decl ? decl.title : void 0,
|
|
79
|
+
description: "docstring" in decl ? decl["docstring"] : void 0,
|
|
80
|
+
deprecated: decl.deprecated,
|
|
81
|
+
...props,
|
|
82
|
+
children: hasChildren && /* @__PURE__ */ jsxs(Fragment$1, { children: [isUnion && /* @__PURE__ */ jsx("div", {
|
|
83
|
+
className: style_default.PropertyAnnotation,
|
|
84
|
+
children: "Accepts one of the following:"
|
|
85
|
+
}), /* @__PURE__ */ jsx(Docs.SDKChildren, {
|
|
86
|
+
paths: decl.children ?? [],
|
|
87
|
+
depth: depth + 1
|
|
88
|
+
})] })
|
|
89
|
+
})
|
|
90
|
+
});
|
|
91
|
+
if ("modelPath" in decl) {
|
|
92
|
+
const value = {
|
|
93
|
+
modelPath: decl.modelPath,
|
|
94
|
+
propertyPath: decl.stainlessPath
|
|
95
|
+
};
|
|
96
|
+
return /* @__PURE__ */ jsx(PropertyModelContext.Provider, {
|
|
97
|
+
value,
|
|
98
|
+
children: content
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return content;
|
|
102
|
+
}
|
|
103
|
+
function SDKConstraints({ constraints }) {
|
|
104
|
+
if (constraints) return /* @__PURE__ */ jsx("div", {
|
|
105
|
+
className: style_default.PropertyConstraints,
|
|
106
|
+
children: Object.entries(constraints).map(([name, value]) => /* @__PURE__ */ jsxs("div", {
|
|
107
|
+
className: style_default.PropertyConstraint,
|
|
108
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
109
|
+
className: style_default.PropertyConstraintName,
|
|
110
|
+
children: name
|
|
111
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
112
|
+
className: style_default.PropertyConstraintValue,
|
|
113
|
+
children: value
|
|
114
|
+
})]
|
|
115
|
+
}, name))
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
const snippetIcons = {
|
|
119
|
+
"node.default": TypescriptIcon,
|
|
120
|
+
"typescript.default": TypescriptIcon,
|
|
121
|
+
"go.default": GoIcon,
|
|
122
|
+
"python.default": PythonIcon,
|
|
123
|
+
"terraform.default": TerraformIcon,
|
|
124
|
+
"http.curl": CurlIcon,
|
|
125
|
+
"http.powershell": PowershellIcon,
|
|
126
|
+
"ruby.default": RubyIcon,
|
|
127
|
+
"java.default": JavaIcon,
|
|
128
|
+
"kotlin.default": KotlinIcon,
|
|
129
|
+
"csharp.default": CSharpIcon,
|
|
130
|
+
"php.default": CSharpIcon
|
|
131
|
+
};
|
|
132
|
+
function SDKIcon({ language }) {
|
|
133
|
+
const LangIcon = snippetIcons[language];
|
|
134
|
+
if (!LangIcon) return null;
|
|
135
|
+
return /* @__PURE__ */ jsx(LangIcon, { className: clsx(style_default.Icon, language.split(".").shift()) });
|
|
136
|
+
}
|
|
137
|
+
function SDKRequestTitle({ snippetLanguage }) {
|
|
138
|
+
const languageName = SDKSnippetLanguages[snippetLanguage]?.name;
|
|
139
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
140
|
+
className: style_default.SnippetRequestTitleLanguage,
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ jsx(SDKIcon, { language: snippetLanguage }),
|
|
143
|
+
" ",
|
|
144
|
+
languageName
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function SDKExample({ method, transformRequestSnippet }) {
|
|
149
|
+
const Docs = useComponents();
|
|
150
|
+
const snippetLanguage = getLanguageSnippet(useLanguage());
|
|
151
|
+
return /* @__PURE__ */ jsx(Docs.Snippet, {
|
|
152
|
+
requestTitle: /* @__PURE__ */ jsx(Docs.SDKRequestTitle, { snippetLanguage }),
|
|
153
|
+
method,
|
|
154
|
+
transformRequestSnippet
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function SDKMethodHeader({ method }) {
|
|
158
|
+
const Docs = useComponents();
|
|
159
|
+
const Lang = useLanguageComponents();
|
|
160
|
+
const decl = useDeclaration(method.stainlessPath, true);
|
|
161
|
+
return /* @__PURE__ */ jsx(Docs.MethodHeader, {
|
|
162
|
+
level: "h1",
|
|
163
|
+
title: method.summary ?? method.title,
|
|
164
|
+
signature: /* @__PURE__ */ jsx(Lang.MethodSignature, { decl }),
|
|
165
|
+
badges: method.deprecated && /* @__PURE__ */ jsx(Docs.Badge, {
|
|
166
|
+
id: "deprecated",
|
|
167
|
+
children: "Deprecated"
|
|
168
|
+
}),
|
|
169
|
+
children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
|
|
170
|
+
httpMethod: method.httpMethod,
|
|
171
|
+
endpoint: method.endpoint.split(" ", 2).at(-1)
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function SDKMethodInfo({ method }) {
|
|
176
|
+
const Docs = useComponents();
|
|
177
|
+
const Lang = useLanguageComponents();
|
|
178
|
+
const decl = useDeclaration(method.stainlessPath, true);
|
|
179
|
+
const spec = useSpec();
|
|
180
|
+
const language = useLanguage();
|
|
181
|
+
if (Lang.MethodInfo) return /* @__PURE__ */ jsx(Lang.MethodInfo, { decl });
|
|
182
|
+
function shouldExpand(items) {
|
|
183
|
+
if (items.length > 1) return false;
|
|
184
|
+
const item = items[0];
|
|
185
|
+
if (!item) return false;
|
|
186
|
+
const decl$1 = spec?.decls?.[language]?.[item];
|
|
187
|
+
return decl$1 && "children" in decl$1 && decl$1.children && decl$1.children.length > 0;
|
|
188
|
+
}
|
|
189
|
+
return /* @__PURE__ */ jsx(Docs.MethodInfo, {
|
|
190
|
+
parameters: "paramsChildren" in decl && Array.isArray(decl.paramsChildren) && decl.paramsChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
|
|
191
|
+
expand: shouldExpand(decl.paramsChildren),
|
|
192
|
+
paths: decl.paramsChildren
|
|
193
|
+
}),
|
|
194
|
+
returns: "responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
|
|
195
|
+
expand: shouldExpand(decl.responseChildren),
|
|
196
|
+
paths: decl.responseChildren
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
function SDKMethod({ method, transformRequestSnippet }) {
|
|
201
|
+
const Docs = useComponents();
|
|
202
|
+
const decl = useDeclaration(method?.stainlessPath, false);
|
|
203
|
+
const layout = useContentPanelLayout();
|
|
204
|
+
const language = useLanguage();
|
|
205
|
+
if (!decl) return /* @__PURE__ */ jsxs("div", {
|
|
206
|
+
className: style_default.Method,
|
|
207
|
+
children: [/* @__PURE__ */ jsx(Docs.MethodHeader, {
|
|
208
|
+
level: "h1",
|
|
209
|
+
title: method.summary ?? method.title,
|
|
210
|
+
children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
|
|
211
|
+
httpMethod: method.httpMethod,
|
|
212
|
+
endpoint: method.endpoint.split(" ", 2).at(-1)
|
|
213
|
+
})
|
|
214
|
+
}), /* @__PURE__ */ jsxs(Callout, {
|
|
215
|
+
variant: "warning",
|
|
216
|
+
children: [
|
|
217
|
+
"The method ",
|
|
218
|
+
/* @__PURE__ */ jsx("code", { children: method.name }),
|
|
219
|
+
" is not implemented in ",
|
|
220
|
+
LanguageNames[language] ?? language,
|
|
221
|
+
"."
|
|
222
|
+
]
|
|
223
|
+
})]
|
|
224
|
+
});
|
|
225
|
+
return /* @__PURE__ */ jsxs(Docs.Method, {
|
|
226
|
+
id: method.stainlessPath,
|
|
227
|
+
header: /* @__PURE__ */ jsx(Docs.SDKMethodHeader, { method }),
|
|
228
|
+
className: clsx({
|
|
229
|
+
[style_default.MethodSinglePane]: layout === "single-pane",
|
|
230
|
+
[style_default.MethodDoublePane]: layout === "double-pane"
|
|
231
|
+
}),
|
|
232
|
+
children: [
|
|
233
|
+
/* @__PURE__ */ jsxs("div", {
|
|
234
|
+
className: style_default.MethodContentColumn,
|
|
235
|
+
children: [/* @__PURE__ */ jsx(Docs.MethodDescription, { description: method.description }), /* @__PURE__ */ jsx(Docs.SDKMethodInfo, { method })]
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ jsx("div", {
|
|
238
|
+
className: clsx(style_default.MethodExample, "not-content", "stl-ui-not-prose"),
|
|
239
|
+
children: /* @__PURE__ */ jsx(Docs.SDKExample, {
|
|
240
|
+
method,
|
|
241
|
+
transformRequestSnippet
|
|
242
|
+
})
|
|
243
|
+
}),
|
|
244
|
+
/* @__PURE__ */ jsxs("div", {
|
|
245
|
+
className: style_default.MethodResponseColumn,
|
|
246
|
+
children: [/* @__PURE__ */ jsx("h5", { children: "Returns Examples" }), /* @__PURE__ */ jsx(Docs.SnippetResponse, { responses: method.exampleResponses })]
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function SDKModel({ model }) {
|
|
252
|
+
const Docs = useComponents();
|
|
253
|
+
if (!useDeclaration(`${model.stainlessPath} > (schema)`, true)) return null;
|
|
254
|
+
return /* @__PURE__ */ jsx("div", {
|
|
255
|
+
className: style_default.Model,
|
|
256
|
+
tabIndex: 0,
|
|
257
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
258
|
+
className: style_default.ResourceContentProperties,
|
|
259
|
+
children: /* @__PURE__ */ jsx(Docs.SDKDeclaration, { path: `${model.stainlessPath} > (schema)` })
|
|
260
|
+
})
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function SDKReference({ stainlessPath, children }) {
|
|
264
|
+
const Docs = useComponents();
|
|
265
|
+
if (!stainlessPath || !stainlessPath.endsWith("(schema)")) return children;
|
|
266
|
+
return /* @__PURE__ */ jsx("span", {
|
|
267
|
+
className: style_default.TypeReference,
|
|
268
|
+
children: /* @__PURE__ */ jsx(Docs.Link, {
|
|
269
|
+
stainlessPath,
|
|
270
|
+
children
|
|
271
|
+
})
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
function SDKLanguageBlock({ language, version, install, links }) {
|
|
275
|
+
const Docs = useComponents();
|
|
276
|
+
const lang = `${language}.default`;
|
|
277
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
278
|
+
className: style_default.LanguageBlock,
|
|
279
|
+
children: [
|
|
280
|
+
/* @__PURE__ */ jsxs("div", {
|
|
281
|
+
className: style_default.LanguageBlockContent,
|
|
282
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
283
|
+
className: style_default.LanguageBlockContentIcon,
|
|
284
|
+
children: /* @__PURE__ */ jsx(Docs.SDKIcon, {
|
|
285
|
+
language: lang,
|
|
286
|
+
size: 24
|
|
287
|
+
})
|
|
288
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
289
|
+
className: style_default.LanguageBlockContentInfo,
|
|
290
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
291
|
+
className: style_default.LanguageBlockContentInfoLanguage,
|
|
292
|
+
children: Docs.SDKSnippetLanguages[lang].name
|
|
293
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
294
|
+
className: style_default.LanguageBlockContentInfoVersion,
|
|
295
|
+
children: version
|
|
296
|
+
})]
|
|
297
|
+
})]
|
|
298
|
+
}),
|
|
299
|
+
/* @__PURE__ */ jsxs("div", {
|
|
300
|
+
className: style_default.LanguageBlockInstall,
|
|
301
|
+
"data-stldocs-copy-parent": true,
|
|
302
|
+
children: [
|
|
303
|
+
/* @__PURE__ */ jsx("pre", {
|
|
304
|
+
"data-stldocs-copy-content": true,
|
|
305
|
+
children: install
|
|
306
|
+
}),
|
|
307
|
+
" ",
|
|
308
|
+
/* @__PURE__ */ jsx(Button, {
|
|
309
|
+
variant: "ghost",
|
|
310
|
+
size: "sm",
|
|
311
|
+
"data-stldocs-snippet-copy": true,
|
|
312
|
+
children: /* @__PURE__ */ jsx(Copy, {
|
|
313
|
+
size: 16,
|
|
314
|
+
className: style_default.Icon
|
|
315
|
+
})
|
|
316
|
+
})
|
|
317
|
+
]
|
|
318
|
+
}),
|
|
319
|
+
/* @__PURE__ */ jsxs("div", {
|
|
320
|
+
className: style_default.LanguageBlockLinks,
|
|
321
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
322
|
+
href: links.repo,
|
|
323
|
+
variant: "outline",
|
|
324
|
+
children: /* @__PURE__ */ jsx(Button.Icon, { icon: Github })
|
|
325
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
326
|
+
href: links.docs,
|
|
327
|
+
variant: "outline",
|
|
328
|
+
children: [/* @__PURE__ */ jsx(Button.Icon, { icon: BookOpen }), /* @__PURE__ */ jsx(Button.Label, { children: "Read Docs" })]
|
|
329
|
+
})]
|
|
330
|
+
})
|
|
331
|
+
]
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
//#endregion
|
|
336
|
+
export { useReferenceNesting as _, SDKDeclaration as a, SDKLanguageBlock as c, SDKMethodInfo as d, SDKModel as f, usePropertyModel as g, SDKSnippetLanguages as h, SDKConstraints as i, SDKMethod as l, SDKRequestTitle as m, ReferenceNestingContext as n, SDKExample as o, SDKReference as p, SDKChildren as r, SDKIcon as s, PropertyModelContext as t, SDKMethodHeader as u };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import * as react_jsx_runtime78 from "react/jsx-runtime";
|
|
3
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
4
|
+
|
|
5
|
+
//#region src/components/sidebar.d.ts
|
|
6
|
+
type SidebarExpanderProps = {
|
|
7
|
+
open?: boolean;
|
|
8
|
+
summary: React$1.ReactNode;
|
|
9
|
+
children?: React$1.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare function SidebarExpander({
|
|
12
|
+
open,
|
|
13
|
+
summary,
|
|
14
|
+
children
|
|
15
|
+
}: SidebarExpanderProps): react_jsx_runtime78.JSX.Element;
|
|
16
|
+
type SidebarMethodProps = {
|
|
17
|
+
method: SDKJSON.Method;
|
|
18
|
+
};
|
|
19
|
+
declare function SidebarMethod({
|
|
20
|
+
method
|
|
21
|
+
}: SidebarMethodProps): react_jsx_runtime78.JSX.Element;
|
|
22
|
+
type SidebarResourceProps = {
|
|
23
|
+
resource: SDKJSON.Resource;
|
|
24
|
+
};
|
|
25
|
+
declare function SidebarResource({
|
|
26
|
+
resource
|
|
27
|
+
}: SidebarResourceProps): react_jsx_runtime78.JSX.Element;
|
|
28
|
+
type SidebarProps = {
|
|
29
|
+
resources: SDKJSON.Resource[];
|
|
30
|
+
selectedPath?: string;
|
|
31
|
+
};
|
|
32
|
+
declare function Sidebar({
|
|
33
|
+
resources
|
|
34
|
+
}: SidebarProps): react_jsx_runtime78.JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { SidebarProps as a, SidebarMethodProps as i, SidebarExpander as n, SidebarResource as o, SidebarMethod as r, SidebarResourceProps as s, Sidebar as t };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { n as useNavigation } from "./navigation-C5TN0SgC.js";
|
|
2
|
+
import { t as useComponents } from "./use-components-RWQbviGq.js";
|
|
3
|
+
import { t as style_default } from "./style-gnVEeXFj.js";
|
|
4
|
+
import { o as MethodIconBadge } from "./method-CE08mUME.js";
|
|
5
|
+
import { r as isResourceEmpty } from "./utils-D_1AWSRX.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
9
|
+
|
|
10
|
+
//#region src/components/sidebar.tsx
|
|
11
|
+
function SidebarExpander({ open, summary, children }) {
|
|
12
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
13
|
+
className: style_default.SidebarExpander,
|
|
14
|
+
open,
|
|
15
|
+
children: [/* @__PURE__ */ jsxs("summary", {
|
|
16
|
+
className: style_default.ExpanderSummary,
|
|
17
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
18
|
+
className: style_default.ExpanderSummaryContent,
|
|
19
|
+
children: summary
|
|
20
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: style_default.ExpanderSummaryIcon,
|
|
22
|
+
children: [/* @__PURE__ */ jsx(ChevronRight, {
|
|
23
|
+
size: 16,
|
|
24
|
+
strokeWidth: 1,
|
|
25
|
+
className: style_default.Icon
|
|
26
|
+
}), /* @__PURE__ */ jsx(ChevronDown, {
|
|
27
|
+
size: 16,
|
|
28
|
+
strokeWidth: 1,
|
|
29
|
+
className: style_default.Icon
|
|
30
|
+
})]
|
|
31
|
+
})]
|
|
32
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
33
|
+
className: style_default.ExpanderContent,
|
|
34
|
+
children
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function SidebarMethod({ method }) {
|
|
39
|
+
const Docs = useComponents();
|
|
40
|
+
const { selectedPath } = useNavigation();
|
|
41
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
42
|
+
className: style_default.SidebarMethod,
|
|
43
|
+
"data-selected": method.stainlessPath === selectedPath,
|
|
44
|
+
children: [/* @__PURE__ */ jsx(MethodIconBadge, { httpMethod: method.httpMethod }), /* @__PURE__ */ jsx(Docs.Link, {
|
|
45
|
+
stainlessPath: method.stainlessPath,
|
|
46
|
+
children: method.summary
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function SidebarResource({ resource }) {
|
|
51
|
+
const Docs = useComponents();
|
|
52
|
+
const { selectedPath } = useNavigation();
|
|
53
|
+
const subresources = Object.values(resource.subresources ?? {}).map((sub) => /* @__PURE__ */ jsx(SidebarResource, { resource: sub }, sub.stainlessPath));
|
|
54
|
+
const methods = Object.values(resource.methods).map((method) => /* @__PURE__ */ jsx(SidebarMethod, { method }, method.stainlessPath));
|
|
55
|
+
const hasChildren = subresources.length > 0 || methods.length > 0;
|
|
56
|
+
const title = /* @__PURE__ */ jsx("div", {
|
|
57
|
+
className: style_default.SidebarResourceTitle,
|
|
58
|
+
children: /* @__PURE__ */ jsx(Docs.Link, {
|
|
59
|
+
stainlessPath: resource.stainlessPath,
|
|
60
|
+
children: resource.title
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
return /* @__PURE__ */ jsx("div", {
|
|
64
|
+
className: style_default.SidebarResource,
|
|
65
|
+
"data-selected": resource.stainlessPath === selectedPath,
|
|
66
|
+
children: hasChildren ? /* @__PURE__ */ jsxs(SidebarExpander, {
|
|
67
|
+
summary: title,
|
|
68
|
+
open: true,
|
|
69
|
+
children: [methods, subresources]
|
|
70
|
+
}) : title
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function Sidebar({ resources }) {
|
|
74
|
+
return /* @__PURE__ */ jsx("div", {
|
|
75
|
+
className: `${style_default.Root} ${style_default.Sidebar}`,
|
|
76
|
+
children: resources.filter((resource) => !isResourceEmpty(resource)).map((resource) => /* @__PURE__ */ jsx(SidebarResource, { resource }, resource.stainlessPath))
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { SidebarResource as i, SidebarExpander as n, SidebarMethod as r, Sidebar as t };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import * as react_jsx_runtime67 from "react/jsx-runtime";
|
|
3
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
4
|
+
|
|
5
|
+
//#region src/components/sidebar.d.ts
|
|
6
|
+
type SidebarExpanderProps = {
|
|
7
|
+
open?: boolean;
|
|
8
|
+
summary: React$1.ReactNode;
|
|
9
|
+
children?: React$1.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare function SidebarExpander({
|
|
12
|
+
open,
|
|
13
|
+
summary,
|
|
14
|
+
children
|
|
15
|
+
}: SidebarExpanderProps): react_jsx_runtime67.JSX.Element;
|
|
16
|
+
type SidebarMethodProps = {
|
|
17
|
+
method: SDKJSON.Method;
|
|
18
|
+
};
|
|
19
|
+
declare function SidebarMethod({
|
|
20
|
+
method
|
|
21
|
+
}: SidebarMethodProps): react_jsx_runtime67.JSX.Element;
|
|
22
|
+
type SidebarResourceProps = {
|
|
23
|
+
resource: SDKJSON.Resource;
|
|
24
|
+
};
|
|
25
|
+
declare function SidebarResource({
|
|
26
|
+
resource
|
|
27
|
+
}: SidebarResourceProps): react_jsx_runtime67.JSX.Element;
|
|
28
|
+
type SidebarProps = {
|
|
29
|
+
resources: SDKJSON.Resource[];
|
|
30
|
+
selectedPath?: string;
|
|
31
|
+
};
|
|
32
|
+
declare function Sidebar({
|
|
33
|
+
resources
|
|
34
|
+
}: SidebarProps): react_jsx_runtime67.JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { SidebarProps as a, SidebarMethodProps as i, SidebarExpander as n, SidebarResource as o, SidebarMethod as r, SidebarResourceProps as s, Sidebar as t };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { a as useLanguage, c as useSnippet, r as useDeclaration } from "./docs-CXqi26jB.js";
|
|
2
|
+
import { r as useHighlight } from "./markdown-CxdeWgjV.js";
|
|
3
|
+
import { t as useComponents } from "./use-components-RWQbviGq.js";
|
|
4
|
+
import { t as style_default } from "./style-gnVEeXFj.js";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { CheckIcon, CircleAlertIcon, CopyIcon } from "lucide-react";
|
|
8
|
+
import clsx from "clsx";
|
|
9
|
+
import { Button } from "@stainless-api/ui-primitives";
|
|
10
|
+
|
|
11
|
+
//#region src/components/snippets.tsx
|
|
12
|
+
function SnippetCode({ content, language }) {
|
|
13
|
+
const lang = useLanguage();
|
|
14
|
+
const highlighted = useHighlight(content, language || lang);
|
|
15
|
+
return /* @__PURE__ */ jsx("div", {
|
|
16
|
+
className: style_default.SnippetCode,
|
|
17
|
+
children: /* @__PURE__ */ jsx("pre", {
|
|
18
|
+
className: style_default.SnippetCodeContent,
|
|
19
|
+
"data-stldocs-copy-content": true,
|
|
20
|
+
children: /* @__PURE__ */ jsx("code", {
|
|
21
|
+
className: language === "json" ? "snippet-json" : "snippet",
|
|
22
|
+
dangerouslySetInnerHTML: { __html: highlighted }
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function SnippetContainer({ children }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
className: clsx(style_default.Snippet),
|
|
30
|
+
children
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function SnippetRequestContainer({ children }) {
|
|
34
|
+
return /* @__PURE__ */ jsx("div", { children });
|
|
35
|
+
}
|
|
36
|
+
function Snippet({ requestTitle, method, transformRequestSnippet }) {
|
|
37
|
+
const Docs = useComponents();
|
|
38
|
+
const language = useLanguage();
|
|
39
|
+
const originalSnippet = useSnippet(method.stainlessPath, void 0, language === "http" ? "curl" : "default");
|
|
40
|
+
const decl = useDeclaration(method.stainlessPath, false);
|
|
41
|
+
if (!originalSnippet) {
|
|
42
|
+
console.warn(`Snippet not found for method '${method.stainlessPath}'`);
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const signature = decl && "qualified" in decl ? decl.qualified : void 0;
|
|
46
|
+
const responses = method.exampleResponses;
|
|
47
|
+
const snippet = transformRequestSnippet ? transformRequestSnippet({
|
|
48
|
+
snippet: originalSnippet,
|
|
49
|
+
language
|
|
50
|
+
}) : originalSnippet;
|
|
51
|
+
return /* @__PURE__ */ jsxs(Docs.SnippetContainer, {
|
|
52
|
+
signature,
|
|
53
|
+
children: [snippet && /* @__PURE__ */ jsx(Docs.SnippetRequestContainer, {
|
|
54
|
+
signature,
|
|
55
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
56
|
+
className: style_default.SnippetRequest,
|
|
57
|
+
"data-stldocs-copy-parent": true,
|
|
58
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: style_default.SnippetRequestTitle,
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsxs("div", {
|
|
62
|
+
className: style_default.SnippetRequestTitleMethod,
|
|
63
|
+
children: [/* @__PURE__ */ jsx(Docs.MethodRoute, {
|
|
64
|
+
httpMethod: method.httpMethod,
|
|
65
|
+
iconOnly: true
|
|
66
|
+
}), /* @__PURE__ */ jsx("h5", { children: method.summary ?? method.title })]
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ jsx("div", {
|
|
69
|
+
className: style_default.SnippetRequestTitleContent,
|
|
70
|
+
children: requestTitle
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsx(Docs.SnippetButtons, { content: snippet })
|
|
73
|
+
]
|
|
74
|
+
}), /* @__PURE__ */ jsx(Docs.SnippetCode, {
|
|
75
|
+
content: snippet,
|
|
76
|
+
signature
|
|
77
|
+
})]
|
|
78
|
+
})
|
|
79
|
+
}), responses && /* @__PURE__ */ jsx(Docs.SnippetResponse, { responses })]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function SnippetButtons({ content }) {
|
|
83
|
+
const [CopyButtonIcon, setCopyIcon] = React$1.useState(CopyIcon);
|
|
84
|
+
async function handleCopy() {
|
|
85
|
+
try {
|
|
86
|
+
await navigator.clipboard.writeText(content);
|
|
87
|
+
setCopyIcon(CheckIcon);
|
|
88
|
+
} catch {
|
|
89
|
+
setCopyIcon(CircleAlertIcon);
|
|
90
|
+
}
|
|
91
|
+
setTimeout(() => setCopyIcon(CopyIcon), 1e3);
|
|
92
|
+
}
|
|
93
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
94
|
+
variant: "ghost",
|
|
95
|
+
"data-stldocs-snippet-copy": true,
|
|
96
|
+
children: /* @__PURE__ */ jsx(CopyButtonIcon, {
|
|
97
|
+
size: 16,
|
|
98
|
+
className: style_default.Icon,
|
|
99
|
+
onClick: handleCopy
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function SnippetResponse({ responses }) {
|
|
104
|
+
const { SnippetCode: SnippetCode$1 } = useComponents();
|
|
105
|
+
if (!responses) return null;
|
|
106
|
+
const mappedResponses = Object.keys(responses).map((key) => {
|
|
107
|
+
const responseContent = responses[key];
|
|
108
|
+
if (!responseContent) return null;
|
|
109
|
+
const responseType = Object.keys(responseContent)[0];
|
|
110
|
+
if (!responseType) return null;
|
|
111
|
+
const response = responseContent[responseType];
|
|
112
|
+
if (!response) return null;
|
|
113
|
+
const examples = response?.examples;
|
|
114
|
+
if (!examples) return null;
|
|
115
|
+
const exampleType = Object.keys(examples)[0];
|
|
116
|
+
if (!exampleType) return null;
|
|
117
|
+
let value = examples[exampleType]?.value;
|
|
118
|
+
if (!value) return null;
|
|
119
|
+
let language = "none";
|
|
120
|
+
if (responseType === "application/json" || typeof value === "object") {
|
|
121
|
+
language = "json";
|
|
122
|
+
value = JSON.stringify(value, null, 2);
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
language,
|
|
126
|
+
responseCode: key,
|
|
127
|
+
content: value
|
|
128
|
+
};
|
|
129
|
+
}).filter(Boolean);
|
|
130
|
+
if (mappedResponses.length === 0) return null;
|
|
131
|
+
return /* @__PURE__ */ jsx("div", {
|
|
132
|
+
className: style_default.SnippetMultiResponse,
|
|
133
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
134
|
+
className: clsx(style_default.Snippet),
|
|
135
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
136
|
+
className: clsx(style_default.SnippetResponseTab, mappedResponses.length === 1 && style_default.SnippetResponseTabSingleReturn),
|
|
137
|
+
children: mappedResponses.map(({ responseCode }, index) => /* @__PURE__ */ jsx("div", {
|
|
138
|
+
"data-snippet-response-tab-id": `snippet-response-tab-${responseCode}-${index}`,
|
|
139
|
+
className: clsx(style_default.SnippetResponseTabItem, index === 0 && style_default.SnippetResponseTabItemActive),
|
|
140
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
141
|
+
disabled: mappedResponses.length === 1,
|
|
142
|
+
variant: "ghost",
|
|
143
|
+
children: [responseCode, " example"]
|
|
144
|
+
})
|
|
145
|
+
}, `snippet-response-tab-item-${responseCode}-${index}`))
|
|
146
|
+
}), mappedResponses.map(({ responseCode, content, language }, index) => {
|
|
147
|
+
return /* @__PURE__ */ jsx("div", {
|
|
148
|
+
className: clsx(style_default.SnippetResponsePane, index === 0 && style_default.SnippetResponsePaneActive),
|
|
149
|
+
"data-snippet-response-pane-id": `snippet-response-tab-${responseCode}-${index}`,
|
|
150
|
+
children: /* @__PURE__ */ jsx(SnippetCode$1, {
|
|
151
|
+
content,
|
|
152
|
+
language
|
|
153
|
+
})
|
|
154
|
+
}, `snippet-response-${responseCode}-${index}`);
|
|
155
|
+
})]
|
|
156
|
+
})
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
//#endregion
|
|
161
|
+
export { SnippetRequestContainer as a, SnippetContainer as i, SnippetButtons as n, SnippetResponse as o, SnippetCode as r, Snippet as t };
|