@mintlify/msft-sdk 1.1.67 → 1.1.69
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/README.md +82 -2
- package/dist/api-playground-2/ApiExamples.js +19 -21
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +104 -105
- package/dist/api-playground-2/components/Example/RequestExample.js +37 -37
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +98 -98
- package/dist/components/apiPage.js +57 -54
- package/dist/components/docsPage.js +38 -39
- package/dist/constants/index.js +5 -2
- package/dist/contexts/ConfigContext.js +39 -31
- package/dist/hooks/useApiPlaygroundDisplay.js +6 -8
- package/dist/hooks/useSendPlaygroundRequest.js +9 -10
- package/dist/index.d.ts +71 -2
- package/dist/index.js +116 -110
- package/dist/openapi/convertOpenApiSpecToHrefMap.js +20 -0
- package/dist/openapi/convertOpenApiSpecToNav.js +44 -0
- package/dist/openapi/loadAndConvertOpenApiSpec.js +14 -0
- package/package.json +5 -2
- package/dist/hooks/useEndpoint.js +0 -15
package/README.md
CHANGED
|
@@ -52,13 +52,93 @@ import { DocsPage } from "@mintlify/msft-sdk";
|
|
|
52
52
|
|
|
53
53
|
## Core Exports
|
|
54
54
|
|
|
55
|
+
### Documentation Components
|
|
55
56
|
- `DocsPage` - Main documentation page component
|
|
57
|
+
- `ApiPage` - API reference page component
|
|
58
|
+
- `DocsLayout` - Layout with navigation sidebar
|
|
56
59
|
- `MDXRenderer` - Standalone MDX renderer
|
|
57
|
-
- `convertHtmlToMdx` - Convert HTML to MDX
|
|
58
|
-
- `serializeMdx` - Compile MDX to React components
|
|
59
60
|
- `NavTree`, `TableOfContents` - Navigation components
|
|
60
61
|
- `allComponents` - All available MDX components
|
|
61
62
|
|
|
63
|
+
### Content Processing
|
|
64
|
+
- `convertHtmlToMdx` - Convert HTML to MDX
|
|
65
|
+
- `serializeMdx` - Compile MDX to React components
|
|
66
|
+
|
|
67
|
+
### OpenAPI Utilities
|
|
68
|
+
- `convertOpenApiSpecToGraph` - Convert OpenAPI spec to schema graph data
|
|
69
|
+
- `convertOpenApiSpecToNav` - Generate navigation structure from OpenAPI spec
|
|
70
|
+
- `convertOpenApiSpecToHrefMap` - Create href-to-endpoint lookup map
|
|
71
|
+
|
|
72
|
+
## OpenAPI Integration
|
|
73
|
+
|
|
74
|
+
The SDK provides utilities for working with OpenAPI specifications:
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import {
|
|
78
|
+
convertOpenApiSpecToGraph,
|
|
79
|
+
convertOpenApiSpecToNav,
|
|
80
|
+
convertOpenApiSpecToHrefMap,
|
|
81
|
+
getApiReferenceDataFromGraph,
|
|
82
|
+
ApiPage,
|
|
83
|
+
} from "@mintlify/msft-sdk";
|
|
84
|
+
import openApiSpec from "./my-openapi-spec.json";
|
|
85
|
+
|
|
86
|
+
// Convert spec to schema graph (required for API rendering)
|
|
87
|
+
const graphData = convertOpenApiSpecToGraph(openApiSpec, {
|
|
88
|
+
filename: "my-api.json",
|
|
89
|
+
originalFileLocation: "my-api.json",
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Generate navigation from OpenAPI spec
|
|
93
|
+
const navData = convertOpenApiSpecToNav(openApiSpec);
|
|
94
|
+
|
|
95
|
+
// Create href-to-endpoint map for routing
|
|
96
|
+
const hrefMap = convertOpenApiSpecToHrefMap(openApiSpec);
|
|
97
|
+
|
|
98
|
+
// Get API reference data for a specific endpoint
|
|
99
|
+
const apiReferenceData = getApiReferenceDataFromGraph({
|
|
100
|
+
metadata: {
|
|
101
|
+
title: "Create User",
|
|
102
|
+
description: "Create a new user",
|
|
103
|
+
openapi: "post /users",
|
|
104
|
+
},
|
|
105
|
+
schemaGraphData: graphData,
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Render the API page
|
|
109
|
+
<ApiPage
|
|
110
|
+
apiReferenceData={apiReferenceData}
|
|
111
|
+
pageMetadata={metadata}
|
|
112
|
+
theme="light"
|
|
113
|
+
/>;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Development
|
|
117
|
+
|
|
118
|
+
### Running Tests
|
|
119
|
+
|
|
120
|
+
This project uses [Vitest](https://vitest.dev/) for testing.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Run tests once
|
|
124
|
+
npm test
|
|
125
|
+
|
|
126
|
+
# Run tests in watch mode
|
|
127
|
+
npm run test:watch
|
|
128
|
+
|
|
129
|
+
# Run tests with coverage
|
|
130
|
+
npm run test:coverage
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Test Structure
|
|
134
|
+
|
|
135
|
+
Tests are located in the `tests/` directory and are organized as follows:
|
|
136
|
+
|
|
137
|
+
- `tests/fixtures/` - Test fixtures including OpenAPI specs and expected outputs
|
|
138
|
+
- `tests/*.test.ts` - Test files for various conversion functions
|
|
139
|
+
|
|
140
|
+
The test fixtures are kept outside of the `src/` directory to ensure they're not bundled with the package.
|
|
141
|
+
|
|
62
142
|
## License
|
|
63
143
|
|
|
64
144
|
MIT © Mintlify, Inc.
|
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { useContext as
|
|
2
|
+
import { useContext as f, useState as x, useMemo as u } from "react";
|
|
3
3
|
import { useDebouncedApiPlaygroundInputs as d } from "./hooks/usePlaygroundInputsStore.js";
|
|
4
|
-
import { CodeExampleLabelContext as
|
|
4
|
+
import { CodeExampleLabelContext as h } from "../contexts/CodeExampleLabelContext.js";
|
|
5
5
|
import { ApiReferenceContext2 as g } from "../contexts/ConfigContext.js";
|
|
6
|
-
import
|
|
7
|
-
import { clsx as
|
|
8
|
-
import { RequestExample as
|
|
9
|
-
import { ResponseExample as
|
|
10
|
-
import { initialApiPlaygroundInputs as
|
|
11
|
-
const
|
|
12
|
-
const { apiReferenceData2:
|
|
13
|
-
|
|
14
|
-
const s = u(
|
|
15
|
-
() => h(
|
|
6
|
+
import R from "../components/Api/ErrorBoundary.js";
|
|
7
|
+
import { clsx as v } from "clsx";
|
|
8
|
+
import { RequestExample as C } from "./components/Example/RequestExample.js";
|
|
9
|
+
import { ResponseExample as D } from "./components/Example/ResponseExample.js";
|
|
10
|
+
import { initialApiPlaygroundInputs as E } from "./constants/index.js";
|
|
11
|
+
const q = ({ className: t, isModal: r = !1, apiReferenceData: m, noInputs: n = !1 }) => {
|
|
12
|
+
const { apiReferenceData2: a } = f(g), i = m || a, o = d(100), [p, s] = x(), l = u(
|
|
13
|
+
() => v(
|
|
16
14
|
"mint:w-full mint:xl:w-[28rem] mint:gap-6 mint:grid mint:grid-rows-[repeat(auto-fit,minmax(0,min-content))] mint:grid-rows mint:relative mint:max-h-[calc(100%-32px)] mint:min-h-[18rem]",
|
|
17
|
-
|
|
15
|
+
t
|
|
18
16
|
),
|
|
19
|
-
[
|
|
17
|
+
[t, r]
|
|
20
18
|
);
|
|
21
|
-
return /* @__PURE__ */ e(
|
|
19
|
+
return /* @__PURE__ */ e(h.Provider, { value: { selectedLabel: p, setSelectedLabel: s }, children: /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ c(R, { children: [
|
|
22
20
|
/* @__PURE__ */ e(
|
|
23
|
-
|
|
21
|
+
C,
|
|
24
22
|
{
|
|
25
|
-
apiReferenceData:
|
|
26
|
-
inputs: n ?
|
|
23
|
+
apiReferenceData: i,
|
|
24
|
+
inputs: n ? E : o,
|
|
27
25
|
maxHeight: "mint:max-h-[40vh]"
|
|
28
26
|
}
|
|
29
27
|
),
|
|
30
|
-
/* @__PURE__ */ e(
|
|
28
|
+
/* @__PURE__ */ e(D, { apiReferenceData: i, maxHeight: "mint:max-h-[40vh]" })
|
|
31
29
|
] }) }) });
|
|
32
30
|
};
|
|
33
31
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
q as ApiExamples,
|
|
33
|
+
q as default
|
|
36
34
|
};
|
|
@@ -1,146 +1,145 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { generateRequest as
|
|
4
|
-
import { generateSnippet as
|
|
5
|
-
import { getFirstExampleValue as
|
|
6
|
-
import { CodeGroupSelect as
|
|
7
|
-
import { CodeSnippets as
|
|
8
|
-
import { langToPresetMap as
|
|
9
|
-
const
|
|
10
|
-
baseUrl:
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as V, useEffect as B } from "react";
|
|
3
|
+
import { generateRequest as w } from "../../generators/generateRequest.js";
|
|
4
|
+
import { generateSnippet as x } from "../../generators/generateSnippet.js";
|
|
5
|
+
import { getFirstExampleValue as C } from "../../schemaGraph/processExamples.js";
|
|
6
|
+
import { CodeGroupSelect as G } from "../../../components/content-components/CodeGroupSelect/index.js";
|
|
7
|
+
import { CodeSnippets as P } from "../../../components/content-components/code-snippets.js";
|
|
8
|
+
import { langToPresetMap as b } from "../../../constants/snippetPresets.js";
|
|
9
|
+
const X = ({
|
|
10
|
+
baseUrl: s,
|
|
11
11
|
apiReferenceData: t,
|
|
12
|
-
inputs:
|
|
13
|
-
requestExampleLanguages:
|
|
14
|
-
requiredOnly:
|
|
15
|
-
maxHeight:
|
|
16
|
-
selectedSecurityOptionIndex:
|
|
17
|
-
selectedRequestBodyContentTypeIndex:
|
|
12
|
+
inputs: o,
|
|
13
|
+
requestExampleLanguages: c,
|
|
14
|
+
requiredOnly: n,
|
|
15
|
+
maxHeight: r,
|
|
16
|
+
selectedSecurityOptionIndex: f,
|
|
17
|
+
selectedRequestBodyContentTypeIndex: p
|
|
18
18
|
}) => {
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
const m = (u = t.dependencies) == null ? void 0 : u.requestBody;
|
|
19
|
+
var l, e, j;
|
|
20
|
+
const m = (l = t.dependencies) == null ? void 0 : l.requestBody;
|
|
22
21
|
if (!m)
|
|
23
|
-
return
|
|
24
|
-
|
|
22
|
+
return /* @__PURE__ */ a(
|
|
23
|
+
k,
|
|
25
24
|
{
|
|
26
25
|
apiReferenceData: t,
|
|
27
|
-
baseUrl:
|
|
28
|
-
inputs:
|
|
29
|
-
requestExampleLanguages:
|
|
30
|
-
requiredOnly:
|
|
31
|
-
maxHeight:
|
|
32
|
-
selectedSecurityOptionIndex:
|
|
26
|
+
baseUrl: s,
|
|
27
|
+
inputs: o,
|
|
28
|
+
requestExampleLanguages: c,
|
|
29
|
+
requiredOnly: n,
|
|
30
|
+
maxHeight: r,
|
|
31
|
+
selectedSecurityOptionIndex: f
|
|
33
32
|
}
|
|
34
33
|
);
|
|
35
|
-
const i =
|
|
34
|
+
const i = C(
|
|
36
35
|
m.content,
|
|
37
|
-
|
|
36
|
+
p
|
|
38
37
|
);
|
|
39
38
|
if (!i) return null;
|
|
40
|
-
const
|
|
41
|
-
([
|
|
42
|
-
contentType:
|
|
43
|
-
examples:
|
|
39
|
+
const h = Object.entries(m.content).map(
|
|
40
|
+
([S, T]) => ({
|
|
41
|
+
contentType: S,
|
|
42
|
+
examples: T.examples
|
|
44
43
|
})
|
|
45
|
-
),
|
|
46
|
-
return Object.keys(
|
|
47
|
-
|
|
44
|
+
), M = (e = h[p]) == null ? void 0 : e.examples, u = (j = h[p]) == null ? void 0 : j.contentType;
|
|
45
|
+
return Object.keys(M).length > 1 ? /* @__PURE__ */ a(
|
|
46
|
+
v,
|
|
48
47
|
{
|
|
49
48
|
apiReferenceData: t,
|
|
50
|
-
selectedBodyContentType:
|
|
51
|
-
baseUrl:
|
|
52
|
-
inputs:
|
|
53
|
-
examples:
|
|
54
|
-
requiredOnly:
|
|
55
|
-
maxHeight:
|
|
56
|
-
selectedSecurityOptionIndex:
|
|
49
|
+
selectedBodyContentType: u,
|
|
50
|
+
baseUrl: s,
|
|
51
|
+
inputs: o,
|
|
52
|
+
examples: M,
|
|
53
|
+
requiredOnly: n,
|
|
54
|
+
maxHeight: r,
|
|
55
|
+
selectedSecurityOptionIndex: f
|
|
57
56
|
}
|
|
58
|
-
) : /* @__PURE__ */
|
|
59
|
-
|
|
57
|
+
) : /* @__PURE__ */ a(
|
|
58
|
+
k,
|
|
60
59
|
{
|
|
61
60
|
apiReferenceData: t,
|
|
62
|
-
selectedBodyContentType:
|
|
63
|
-
baseUrl:
|
|
64
|
-
inputs:
|
|
61
|
+
selectedBodyContentType: u,
|
|
62
|
+
baseUrl: s,
|
|
63
|
+
inputs: o,
|
|
65
64
|
exampleValue: i,
|
|
66
|
-
requestExampleLanguages:
|
|
67
|
-
requiredOnly:
|
|
68
|
-
maxHeight:
|
|
69
|
-
selectedSecurityOptionIndex:
|
|
65
|
+
requestExampleLanguages: c,
|
|
66
|
+
requiredOnly: n,
|
|
67
|
+
maxHeight: r,
|
|
68
|
+
selectedSecurityOptionIndex: f
|
|
70
69
|
}
|
|
71
70
|
);
|
|
72
|
-
},
|
|
73
|
-
baseUrl:
|
|
71
|
+
}, k = ({
|
|
72
|
+
baseUrl: s,
|
|
74
73
|
apiReferenceData: t,
|
|
75
|
-
inputs:
|
|
76
|
-
selectedBodyContentType:
|
|
77
|
-
exampleValue:
|
|
78
|
-
requestExampleLanguages:
|
|
79
|
-
requiredOnly:
|
|
80
|
-
maxHeight:
|
|
74
|
+
inputs: o,
|
|
75
|
+
selectedBodyContentType: c,
|
|
76
|
+
exampleValue: n,
|
|
77
|
+
requestExampleLanguages: r,
|
|
78
|
+
requiredOnly: f,
|
|
79
|
+
maxHeight: p,
|
|
81
80
|
selectedSecurityOptionIndex: m
|
|
82
81
|
}) => {
|
|
83
|
-
const i =
|
|
84
|
-
baseUrl:
|
|
82
|
+
const i = w({
|
|
83
|
+
baseUrl: s,
|
|
85
84
|
apiReferenceData: t,
|
|
86
|
-
inputs:
|
|
87
|
-
selectedBodyContentType:
|
|
88
|
-
exampleData:
|
|
89
|
-
requiredOnly:
|
|
85
|
+
inputs: o,
|
|
86
|
+
selectedBodyContentType: c,
|
|
87
|
+
exampleData: n,
|
|
88
|
+
requiredOnly: f,
|
|
90
89
|
selectedSecurityOptionIndex: m
|
|
91
|
-
}),
|
|
92
|
-
const
|
|
93
|
-
return
|
|
94
|
-
}, []),
|
|
90
|
+
}), h = r == null ? void 0 : r.reduce((u, l) => {
|
|
91
|
+
const e = b[l];
|
|
92
|
+
return e && u.push(e), u;
|
|
93
|
+
}, []), M = x({
|
|
95
94
|
apiReferenceData: t,
|
|
96
|
-
pathInputs:
|
|
95
|
+
pathInputs: o.path,
|
|
97
96
|
request: i,
|
|
98
|
-
snippetPresets:
|
|
97
|
+
snippetPresets: h
|
|
99
98
|
});
|
|
100
|
-
return /* @__PURE__ */
|
|
101
|
-
},
|
|
102
|
-
baseUrl:
|
|
99
|
+
return /* @__PURE__ */ a(P, { snippets: M, dropdown: !0, maxHeight: p, showCopyButton: !1, noMargins: !0 });
|
|
100
|
+
}, v = ({
|
|
101
|
+
baseUrl: s,
|
|
103
102
|
apiReferenceData: t,
|
|
104
|
-
inputs:
|
|
105
|
-
selectedBodyContentType:
|
|
106
|
-
examples:
|
|
107
|
-
requiredOnly:
|
|
108
|
-
maxHeight:
|
|
109
|
-
selectedSecurityOptionIndex:
|
|
103
|
+
inputs: o,
|
|
104
|
+
selectedBodyContentType: c,
|
|
105
|
+
examples: n,
|
|
106
|
+
requiredOnly: r,
|
|
107
|
+
maxHeight: f,
|
|
108
|
+
selectedSecurityOptionIndex: p
|
|
110
109
|
}) => {
|
|
111
|
-
const [m, i] =
|
|
112
|
-
return
|
|
113
|
-
const
|
|
110
|
+
const [m, i] = V({}), [h, M] = V(null);
|
|
111
|
+
return B(() => {
|
|
112
|
+
const u = o.path, l = {};
|
|
114
113
|
try {
|
|
115
|
-
for (const [
|
|
116
|
-
if (!
|
|
117
|
-
const
|
|
118
|
-
baseUrl:
|
|
114
|
+
for (const [e, { value: j }] of Object.entries(n)) {
|
|
115
|
+
if (!j) continue;
|
|
116
|
+
const S = w({
|
|
117
|
+
baseUrl: s,
|
|
119
118
|
apiReferenceData: t,
|
|
120
|
-
inputs:
|
|
121
|
-
selectedBodyContentType:
|
|
122
|
-
exampleData:
|
|
123
|
-
requiredOnly:
|
|
124
|
-
selectedSecurityOptionIndex:
|
|
119
|
+
inputs: o,
|
|
120
|
+
selectedBodyContentType: c,
|
|
121
|
+
exampleData: j,
|
|
122
|
+
requiredOnly: r,
|
|
123
|
+
selectedSecurityOptionIndex: p
|
|
125
124
|
});
|
|
126
|
-
|
|
125
|
+
x({
|
|
127
126
|
apiReferenceData: t,
|
|
128
|
-
pathInputs:
|
|
129
|
-
request:
|
|
127
|
+
pathInputs: u,
|
|
128
|
+
request: S,
|
|
130
129
|
isMultipleRequest: !0
|
|
131
|
-
}).forEach((
|
|
132
|
-
|
|
133
|
-
...
|
|
134
|
-
[
|
|
130
|
+
}).forEach((E) => {
|
|
131
|
+
l[E.filename] = {
|
|
132
|
+
...l[E.filename],
|
|
133
|
+
[e]: E
|
|
135
134
|
};
|
|
136
135
|
});
|
|
137
136
|
}
|
|
138
|
-
i(
|
|
139
|
-
} catch (
|
|
140
|
-
console.error(
|
|
137
|
+
i(l);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
console.error(e), M(e);
|
|
141
140
|
}
|
|
142
|
-
}, [
|
|
141
|
+
}, [s, t, o, c, n, r, p]), h || Object.keys(m).length === 0 ? null : /* @__PURE__ */ a(G, { snippets: m, maxHeight: f });
|
|
143
142
|
};
|
|
144
143
|
export {
|
|
145
|
-
|
|
144
|
+
X as GeneratedRequestExample
|
|
146
145
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { memo as O } from "react";
|
|
3
|
-
import { initialApiPlaygroundInputs as
|
|
4
|
-
import { generateSnippetMap as
|
|
5
|
-
import { useSelectedBaseUrl as
|
|
6
|
-
import { useSelectedRequestBodyContentType as
|
|
7
|
-
import { useSelectedSecurityOption as
|
|
8
|
-
import { CodeGroupSelect as
|
|
9
|
-
import { CodeSnippet as
|
|
10
|
-
import { CodeSnippets as
|
|
11
|
-
import { CodeBlock as
|
|
12
|
-
import { CodeGroup as
|
|
13
|
-
import { shikiLangToDisplayLang as
|
|
3
|
+
import { initialApiPlaygroundInputs as j } from "../../constants/index.js";
|
|
4
|
+
import { generateSnippetMap as w } from "../../generators/generateSnippetMap.js";
|
|
5
|
+
import { useSelectedBaseUrl as B } from "../../hooks/useSelectedBaseUrl.js";
|
|
6
|
+
import { useSelectedRequestBodyContentType as L } from "../../hooks/useSelectedRequestBodyContentType.js";
|
|
7
|
+
import { useSelectedSecurityOption as T } from "../../hooks/useSelectedSecurityOption.js";
|
|
8
|
+
import { CodeGroupSelect as k } from "../../../components/content-components/CodeGroupSelect/index.js";
|
|
9
|
+
import { CodeSnippet as P } from "../../../components/content-components/code-snippet.js";
|
|
10
|
+
import { CodeSnippets as v } from "../../../components/content-components/code-snippets.js";
|
|
11
|
+
import { CodeBlock as h } from "../../../components/content-components/code-block.js";
|
|
12
|
+
import { CodeGroup as b } from "../../../components/content-components/code-group.js";
|
|
13
|
+
import { shikiLangToDisplayLang as G } from "../../../constants/snippetPresets.js";
|
|
14
14
|
import { useApiPlaygroundDisplay as I } from "../../../hooks/useApiPlaygroundDisplay.js";
|
|
15
|
-
import { GeneratedRequestExample as
|
|
15
|
+
import { GeneratedRequestExample as E } from "./GeneratedRequestExample.js";
|
|
16
16
|
const N = O(
|
|
17
17
|
({
|
|
18
18
|
apiReferenceData: e,
|
|
19
|
-
inputs:
|
|
20
|
-
maxHeight:
|
|
19
|
+
inputs: u = j,
|
|
20
|
+
maxHeight: i
|
|
21
21
|
}) => {
|
|
22
|
-
var g,
|
|
23
|
-
const n = (g = e.operation) == null ? void 0 : g.requestExamples, { selectedRequestBodyContentTypeIndex:
|
|
24
|
-
switch (
|
|
22
|
+
var g, f, y, S, q, x;
|
|
23
|
+
const n = (g = e.operation) == null ? void 0 : g.requestExamples, { selectedRequestBodyContentTypeIndex: p } = L(), { selectedSecurityOptionIndex: a } = T(), M = I(), m = (f = e.operation) == null ? void 0 : f.requestExampleLanguages, d = (y = e.operation) == null ? void 0 : y.requiredOnlyExamples, { baseUrl: s } = B();
|
|
24
|
+
switch ((S = e.operation) == null ? void 0 : S.requestExampleType) {
|
|
25
25
|
case "mdx":
|
|
26
26
|
if (!n) return null;
|
|
27
27
|
const C = n.some((o) => o.dropdown ?? !1);
|
|
28
|
-
return /* @__PURE__ */ r(
|
|
29
|
-
|
|
28
|
+
return /* @__PURE__ */ r(b, { isSmallText: !0, dropdown: C, noMargins: !0, className: i, children: n.map((o, t) => /* @__PURE__ */ r(
|
|
29
|
+
h,
|
|
30
30
|
{
|
|
31
31
|
language: o.language,
|
|
32
32
|
fileName: o.filename,
|
|
@@ -35,54 +35,54 @@ const N = O(
|
|
|
35
35
|
`${o.filename}-${o.language}-${t}`
|
|
36
36
|
)) });
|
|
37
37
|
case "webhook":
|
|
38
|
-
return (
|
|
38
|
+
return (q = n == null ? void 0 : n[0]) != null && q.code ? /* @__PURE__ */ r(b, { isSmallText: !0, noMargins: !0, hideCodeSnippetFeedbackButton: !0, children: /* @__PURE__ */ r(h, { language: "json", filename: "Example Request Body", children: /* @__PURE__ */ r(P, { language: "json", children: (x = n[0]) == null ? void 0 : x.code }) }) }) : null;
|
|
39
39
|
case "codeSamples":
|
|
40
40
|
if (!e.operation.codeSamples) return null;
|
|
41
|
-
const c =
|
|
41
|
+
const c = w({
|
|
42
42
|
apiReferenceData: e,
|
|
43
43
|
codeSamples: e.operation.codeSamples,
|
|
44
44
|
baseUrl: s,
|
|
45
45
|
apiPlaygroundMode: M,
|
|
46
46
|
requestExampleLanguages: m,
|
|
47
47
|
requiredOnly: d,
|
|
48
|
-
inputs:
|
|
49
|
-
selectedSecurityOptionIndex:
|
|
50
|
-
selectedRequestBodyContentTypeIndex:
|
|
48
|
+
inputs: u,
|
|
49
|
+
selectedSecurityOptionIndex: a,
|
|
50
|
+
selectedRequestBodyContentTypeIndex: p
|
|
51
51
|
});
|
|
52
52
|
if (Object.values(c).every((o) => Object.keys(o).length <= 1)) {
|
|
53
53
|
let t = Object.values(c).flatMap((l) => Object.values(l));
|
|
54
54
|
return new Set(t.map((l) => l.filename)).size !== t.length && (t = t.map((l) => ({
|
|
55
55
|
...l,
|
|
56
|
-
filename:
|
|
57
|
-
}))), /* @__PURE__ */ r(
|
|
56
|
+
filename: G[l.language] ?? l.language
|
|
57
|
+
}))), /* @__PURE__ */ r(v, { snippets: t, noMargins: !0, dropdown: !0 });
|
|
58
58
|
}
|
|
59
|
-
return /* @__PURE__ */ r(
|
|
59
|
+
return /* @__PURE__ */ r(k, { snippets: c });
|
|
60
60
|
case "generated":
|
|
61
61
|
return s ? /* @__PURE__ */ r(
|
|
62
|
-
|
|
62
|
+
E,
|
|
63
63
|
{
|
|
64
64
|
apiReferenceData: e,
|
|
65
65
|
baseUrl: s,
|
|
66
|
-
inputs:
|
|
67
|
-
selectedSecurityOptionIndex:
|
|
66
|
+
inputs: u,
|
|
67
|
+
selectedSecurityOptionIndex: a,
|
|
68
68
|
requestExampleLanguages: m,
|
|
69
69
|
requiredOnly: d,
|
|
70
|
-
selectedRequestBodyContentTypeIndex:
|
|
71
|
-
maxHeight:
|
|
70
|
+
selectedRequestBodyContentTypeIndex: p,
|
|
71
|
+
maxHeight: i
|
|
72
72
|
}
|
|
73
73
|
) : null;
|
|
74
74
|
case "examples":
|
|
75
75
|
return !e.operation.prefillPlaygroundExamples || !s ? null : /* @__PURE__ */ r(
|
|
76
|
-
|
|
76
|
+
E,
|
|
77
77
|
{
|
|
78
78
|
apiReferenceData: e,
|
|
79
79
|
baseUrl: s,
|
|
80
|
-
inputs:
|
|
81
|
-
selectedSecurityOptionIndex:
|
|
80
|
+
inputs: u,
|
|
81
|
+
selectedSecurityOptionIndex: a,
|
|
82
82
|
requestExampleLanguages: m,
|
|
83
83
|
requiredOnly: d,
|
|
84
|
-
selectedRequestBodyContentTypeIndex:
|
|
85
|
-
maxHeight:
|
|
84
|
+
selectedRequestBodyContentTypeIndex: p,
|
|
85
|
+
maxHeight: i
|
|
86
86
|
}
|
|
87
87
|
);
|
|
88
88
|
default:
|