@scalar/api-client 0.1.21 → 0.2.1
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/components/ApiClient/Request/RequestBody.vue.d.ts +0 -6
- package/dist/components/ApiClient/Request/RequestBody.vue.d.ts.map +1 -1
- package/dist/components/ApiClient/Response/ResponseHeaders.vue.d.ts.map +1 -1
- package/dist/components/CodeMirror/CodeMirror.vue.d.ts.map +1 -1
- package/dist/components/SimpleTable/SimpleCell.vue.d.ts.map +1 -1
- package/dist/components/SimpleTable/SimpleHeader.vue.d.ts.map +1 -1
- package/dist/components/SimpleTable/SimpleRow.vue.d.ts.map +1 -1
- package/dist/components/SimpleTable/SimpleTable.vue.d.ts.map +1 -1
- package/dist/fixtures/index.d.ts +1 -1
- package/dist/fixtures/index.d.ts.map +1 -1
- package/dist/helpers/sendRequest.d.ts.map +1 -1
- package/dist/index.js +98 -60
- package/package.json +7 -9
- package/src/components/ApiClient/AddressBar.vue +462 -0
- package/src/components/ApiClient/ApiClient.vue +266 -0
- package/src/components/ApiClient/Request/Request.vue +271 -0
- package/src/components/ApiClient/Request/RequestAuth.vue +221 -0
- package/src/components/ApiClient/Request/RequestBody.vue +39 -0
- package/src/components/ApiClient/Request/RequestHeaders.vue +24 -0
- package/src/components/ApiClient/Request/RequestQuery.vue +25 -0
- package/src/components/ApiClient/Request/RequestVariables.vue +25 -0
- package/src/components/ApiClient/Request/index.ts +1 -0
- package/src/components/ApiClient/RequestHistory.vue +114 -0
- package/src/components/ApiClient/RequestHistoryItem.vue +59 -0
- package/src/components/ApiClient/Response/Copilot.vue.bak +385 -0
- package/src/components/ApiClient/Response/Response.vue +120 -0
- package/src/components/ApiClient/Response/ResponseBody.vue +23 -0
- package/src/components/ApiClient/Response/ResponseHeaders.vue +52 -0
- package/src/components/ApiClient/Response/ResponseMetaInformation.vue +58 -0
- package/src/components/ApiClient/Response/index.ts +1 -0
- package/src/components/ApiClient/index.ts +1 -0
- package/src/components/CodeMirror/CodeMirror.vue +232 -0
- package/src/components/CodeMirror/extensions/variables.ts +41 -0
- package/src/components/CodeMirror/index.ts +1 -0
- package/src/components/CollapsibleSection/CollapsibleSection.vue +149 -0
- package/src/components/CollapsibleSection/index.ts +1 -0
- package/src/components/FlowModal.vue +133 -0
- package/src/components/Grid/Grid.vue +511 -0
- package/src/components/Grid/SimpleGrid.vue +33 -0
- package/src/components/Grid/index.ts +2 -0
- package/src/components/HelpfulLink.vue +19 -0
- package/src/components/SimpleTable/SimpleCell.vue +47 -0
- package/src/components/SimpleTable/SimpleHeader.vue +17 -0
- package/src/components/SimpleTable/SimpleRow.vue +14 -0
- package/src/components/SimpleTable/SimpleTable.vue +13 -0
- package/src/components/SimpleTable/index.ts +4 -0
- package/src/fixtures/httpHeaders.ts +530 -0
- package/src/fixtures/httpStatusCodes.ts +259 -0
- package/src/fixtures/index.ts +6 -0
- package/src/helpers/createPlaceholderRequest.ts +16 -0
- package/src/helpers/generateParameters.ts +19 -0
- package/src/helpers/generateRequest.ts +26 -0
- package/src/helpers/index.ts +5 -0
- package/src/helpers/mapFromArray.ts +16 -0
- package/src/helpers/sendRequest.ts +94 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useCopilot.ts +64 -0
- package/src/hooks/useOperation.test.ts +7 -0
- package/src/hooks/useOperation.ts +43 -0
- package/src/index.ts +9 -0
- package/src/stores/apiClientRequestStore.ts +103 -0
- package/src/stores/apiClientStore.ts +57 -0
- package/src/stores/index.ts +5 -0
- package/src/types.ts +181 -0
- package/dist/index2.js +0 -4
- package/dist/style.css +0 -1550
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useApiClientRequestStore } from '../../../stores/apiClientRequestStore'
|
|
3
|
+
import RequestAuth from './RequestAuth.vue'
|
|
4
|
+
import RequestBody from './RequestBody.vue'
|
|
5
|
+
import RequestHeaders from './RequestHeaders.vue'
|
|
6
|
+
import RequestQuery from './RequestQuery.vue'
|
|
7
|
+
import RequestVariables from './RequestVariables.vue'
|
|
8
|
+
|
|
9
|
+
const { activeRequest, readOnly } = useApiClientRequestStore()
|
|
10
|
+
</script>
|
|
11
|
+
<template>
|
|
12
|
+
<div class="scalar-api-client__main__left custom-scroll">
|
|
13
|
+
<div class="scalar-api-client__main__content">
|
|
14
|
+
<label>Request</label>
|
|
15
|
+
<div class="meta">
|
|
16
|
+
<div class="meta-item meta-item__input">
|
|
17
|
+
<input
|
|
18
|
+
v-model="activeRequest.name"
|
|
19
|
+
class="scalar-api-client__request-name"
|
|
20
|
+
:disabled="readOnly"
|
|
21
|
+
placeholder="Request Name"
|
|
22
|
+
type="text" />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<div>
|
|
27
|
+
<RequestAuth />
|
|
28
|
+
<RequestVariables :paths="activeRequest.parameters" />
|
|
29
|
+
<RequestQuery :queries="activeRequest.query" />
|
|
30
|
+
<RequestHeaders :headers="activeRequest.headers" />
|
|
31
|
+
<RequestBody
|
|
32
|
+
:body="activeRequest.body"
|
|
33
|
+
:formData="activeRequest.formData"
|
|
34
|
+
:requestBody="activeRequest.body" />
|
|
35
|
+
<div class="scalar-api-client__main__scroll-container" />
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
<style>
|
|
40
|
+
.scalar-api-client__main__left {
|
|
41
|
+
width: 50%;
|
|
42
|
+
border-right: 1px solid var(--theme-border-color);
|
|
43
|
+
padding: 0 0 12px 12px;
|
|
44
|
+
}
|
|
45
|
+
@media screen and (max-width: 820px) {
|
|
46
|
+
.scalar-api-client__main__left {
|
|
47
|
+
width: 100%;
|
|
48
|
+
border-right: none;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
.scalar-api-client__item__content {
|
|
52
|
+
flex-flow: wrap;
|
|
53
|
+
padding: 0 12px 12px;
|
|
54
|
+
border-radius: 3px;
|
|
55
|
+
color: var(--theme-color-disabled);
|
|
56
|
+
font-size: 12px;
|
|
57
|
+
margin-top: -3px;
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
}
|
|
60
|
+
.scalar-api-client__item__content .cm-s-default {
|
|
61
|
+
border: 1px solid var(--theme-border-color);
|
|
62
|
+
border-radius: var(--theme-radius-lg);
|
|
63
|
+
}
|
|
64
|
+
.scalar-api-client__item__content .scalar-api-client__item__content--code {
|
|
65
|
+
width: 100%;
|
|
66
|
+
max-height: calc(100vh - 200px);
|
|
67
|
+
overflow: auto;
|
|
68
|
+
}
|
|
69
|
+
.scalar-api-client__item__content .cm-scroller {
|
|
70
|
+
border: 1px solid var(--theme-border-color);
|
|
71
|
+
border-radius: 3px;
|
|
72
|
+
}
|
|
73
|
+
.scalar-api-client__item__content .cm-editor {
|
|
74
|
+
outline: none !important;
|
|
75
|
+
}
|
|
76
|
+
.scalar-api-client__item__content .cm-editor .cm-gutters {
|
|
77
|
+
background: transparent;
|
|
78
|
+
}
|
|
79
|
+
.scalar-api-client__item__content .cm-scroll {
|
|
80
|
+
background: transparent;
|
|
81
|
+
}
|
|
82
|
+
.scalar-api-client__item__content .cm-editor * {
|
|
83
|
+
font-size: 11px;
|
|
84
|
+
}
|
|
85
|
+
.scalar-api-client__item__content .cm-editor .cm-line {
|
|
86
|
+
color: var(--theme-color-1);
|
|
87
|
+
}
|
|
88
|
+
.scalar-api-client__item__content-button {
|
|
89
|
+
width: 100%;
|
|
90
|
+
appearance: none;
|
|
91
|
+
border: none;
|
|
92
|
+
outline: none;
|
|
93
|
+
font-size: 12px;
|
|
94
|
+
background: var(--scalar-api-client-color) !important;
|
|
95
|
+
text-align: center;
|
|
96
|
+
font-weight: var(--theme-bold);
|
|
97
|
+
padding: 12px;
|
|
98
|
+
text-transform: uppercase;
|
|
99
|
+
border-radius: var(--theme-radius-lg);
|
|
100
|
+
color: white;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
}
|
|
103
|
+
.scalar-api-client__item__content__split {
|
|
104
|
+
justify-content: space-between;
|
|
105
|
+
}
|
|
106
|
+
.scalar-collapsible-section-flex {
|
|
107
|
+
width: 100%;
|
|
108
|
+
}
|
|
109
|
+
.input {
|
|
110
|
+
background: var(--theme-background-2);
|
|
111
|
+
border: 1px solid var(--theme-border-color);
|
|
112
|
+
border-radius: 3px;
|
|
113
|
+
position: relative;
|
|
114
|
+
width: 100%;
|
|
115
|
+
text-align: left;
|
|
116
|
+
margin-bottom: 6px;
|
|
117
|
+
}
|
|
118
|
+
.input__half {
|
|
119
|
+
width: calc(50% - 3px);
|
|
120
|
+
}
|
|
121
|
+
.input:focus-within {
|
|
122
|
+
background: var(--theme-background-3);
|
|
123
|
+
}
|
|
124
|
+
.input label,
|
|
125
|
+
.input input {
|
|
126
|
+
padding: 12px;
|
|
127
|
+
border: 0;
|
|
128
|
+
outline: none;
|
|
129
|
+
font-size: 12px;
|
|
130
|
+
color: var(--theme-color-1);
|
|
131
|
+
width: 100%;
|
|
132
|
+
background: transparent;
|
|
133
|
+
appearance: none;
|
|
134
|
+
-webkit-appearance: none;
|
|
135
|
+
left: 0;
|
|
136
|
+
}
|
|
137
|
+
.input label {
|
|
138
|
+
position: absolute;
|
|
139
|
+
color: var(--theme-color-2);
|
|
140
|
+
}
|
|
141
|
+
.input input {
|
|
142
|
+
opacity: 0;
|
|
143
|
+
position: relative;
|
|
144
|
+
z-index: 99;
|
|
145
|
+
padding: 18px 12px 6px 12px;
|
|
146
|
+
}
|
|
147
|
+
.input input:not(:placeholder-shown),
|
|
148
|
+
.input:focus-within input {
|
|
149
|
+
opacity: 1;
|
|
150
|
+
}
|
|
151
|
+
.input input:not(:placeholder-shown) + label,
|
|
152
|
+
.input:focus-within label {
|
|
153
|
+
font-size: 10px;
|
|
154
|
+
top: -6px;
|
|
155
|
+
color: var(--theme-color-1);
|
|
156
|
+
}
|
|
157
|
+
.input input:not(:placeholder-shown) + label {
|
|
158
|
+
color: var(--theme-color-2);
|
|
159
|
+
}
|
|
160
|
+
.select {
|
|
161
|
+
background: --theme-background-1;
|
|
162
|
+
border-radius: var(--theme-radius-lg);
|
|
163
|
+
font-size: 12px;
|
|
164
|
+
border: 1px solid var(--theme-border-color);
|
|
165
|
+
width: 100%;
|
|
166
|
+
position: relative;
|
|
167
|
+
margin-bottom: 6px;
|
|
168
|
+
}
|
|
169
|
+
.select:focus-within {
|
|
170
|
+
background: var(--theme-background-3);
|
|
171
|
+
}
|
|
172
|
+
.select:hover {
|
|
173
|
+
background: var(--theme-background-3);
|
|
174
|
+
}
|
|
175
|
+
.select svg {
|
|
176
|
+
position: absolute;
|
|
177
|
+
right: 12px;
|
|
178
|
+
pointer-events: none;
|
|
179
|
+
color: var(--theme-color-2);
|
|
180
|
+
width: 6px;
|
|
181
|
+
top: 10px;
|
|
182
|
+
}
|
|
183
|
+
.select label {
|
|
184
|
+
display: block;
|
|
185
|
+
font-size: 10px;
|
|
186
|
+
color: var(--theme-color-2);
|
|
187
|
+
position: absolute;
|
|
188
|
+
left: 12px;
|
|
189
|
+
top: 6px;
|
|
190
|
+
}
|
|
191
|
+
.select select {
|
|
192
|
+
background: transparent;
|
|
193
|
+
outline: none;
|
|
194
|
+
border: none;
|
|
195
|
+
-webkit-appearance: none;
|
|
196
|
+
font-size: 12px;
|
|
197
|
+
color: var(--theme-color-1);
|
|
198
|
+
appearance: none;
|
|
199
|
+
width: 100%;
|
|
200
|
+
padding: 18px 12px 6px 12px;
|
|
201
|
+
top: 0;
|
|
202
|
+
position: relative;
|
|
203
|
+
cursor: pointer;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.check {
|
|
207
|
+
display: flex;
|
|
208
|
+
position: relative;
|
|
209
|
+
cursor: pointer;
|
|
210
|
+
align-items: center;
|
|
211
|
+
font-size: 12px;
|
|
212
|
+
border: 1px solid var(--theme-border-color);
|
|
213
|
+
border-radius: 3px;
|
|
214
|
+
padding: 10px 12px;
|
|
215
|
+
user-select: none;
|
|
216
|
+
width: 100%;
|
|
217
|
+
}
|
|
218
|
+
.check p {
|
|
219
|
+
color: var(--theme-color-2);
|
|
220
|
+
}
|
|
221
|
+
.check input {
|
|
222
|
+
position: absolute;
|
|
223
|
+
opacity: 0;
|
|
224
|
+
cursor: pointer;
|
|
225
|
+
height: 0;
|
|
226
|
+
width: 0;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.checkmark {
|
|
230
|
+
height: 15px;
|
|
231
|
+
width: 15px;
|
|
232
|
+
background: var(--theme-background-3);
|
|
233
|
+
margin-right: 10px;
|
|
234
|
+
border-radius: 3px;
|
|
235
|
+
display: flex;
|
|
236
|
+
align-items: center;
|
|
237
|
+
justify-content: center;
|
|
238
|
+
position: relative;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.check input:checked ~ p {
|
|
242
|
+
color: var(--theme-color-1);
|
|
243
|
+
}
|
|
244
|
+
.check .checkmark:after {
|
|
245
|
+
content: '';
|
|
246
|
+
display: none;
|
|
247
|
+
width: 5px;
|
|
248
|
+
height: 8px;
|
|
249
|
+
border: solid var(--theme-color-disabled);
|
|
250
|
+
border-width: 0 2px 2px 0;
|
|
251
|
+
transform: rotate(45deg) translate3d(0, -1px, 0);
|
|
252
|
+
}
|
|
253
|
+
.check input:checked ~ .checkmark:after {
|
|
254
|
+
display: block;
|
|
255
|
+
}
|
|
256
|
+
.scalar-api-client__main__scroll-container {
|
|
257
|
+
height: calc(100vh - 320px);
|
|
258
|
+
}
|
|
259
|
+
.scalar-api-client__request-name {
|
|
260
|
+
outline: none;
|
|
261
|
+
border: none;
|
|
262
|
+
appearance: none;
|
|
263
|
+
-webkit-appearance: none;
|
|
264
|
+
color: var(--theme-color-disabled);
|
|
265
|
+
border-radius: var(--theme-radius-lg);
|
|
266
|
+
font-size: var(--theme-mini);
|
|
267
|
+
font-weight: var(--theme-bold);
|
|
268
|
+
width: 100%;
|
|
269
|
+
background: transparent;
|
|
270
|
+
}
|
|
271
|
+
</style>
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
import { useApiClientRequestStore } from '../../../stores/apiClientRequestStore'
|
|
5
|
+
import { CollapsibleSection } from '../../CollapsibleSection'
|
|
6
|
+
|
|
7
|
+
const store = useApiClientRequestStore()
|
|
8
|
+
|
|
9
|
+
const { authState } = store
|
|
10
|
+
|
|
11
|
+
const show = ref(true)
|
|
12
|
+
|
|
13
|
+
const authTypeFriendlyString: { [key: string]: string } = {
|
|
14
|
+
basic: 'Basic Auth',
|
|
15
|
+
digest: 'Digest Auth',
|
|
16
|
+
oauthOne: 'OAuth 1.0',
|
|
17
|
+
oauthTwo: 'OAuth 2.0',
|
|
18
|
+
bearer: 'Bearer Token',
|
|
19
|
+
none: 'None',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const authDropdownItems = [
|
|
23
|
+
{
|
|
24
|
+
text: 'Basic Auth',
|
|
25
|
+
type: 'basic',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
text: 'OAuth 2.0',
|
|
29
|
+
type: 'oauthTwo',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
text: 'Bearer Token',
|
|
33
|
+
type: 'bearer',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
text: 'None',
|
|
37
|
+
type: 'none',
|
|
38
|
+
},
|
|
39
|
+
]
|
|
40
|
+
</script>
|
|
41
|
+
<template>
|
|
42
|
+
<CollapsibleSection title="Authentication">
|
|
43
|
+
<template #options>
|
|
44
|
+
<div>
|
|
45
|
+
<span>
|
|
46
|
+
{{ authTypeFriendlyString[authState.type] }}
|
|
47
|
+
<svg
|
|
48
|
+
height="18"
|
|
49
|
+
viewBox="0 0 10 18"
|
|
50
|
+
width="10"
|
|
51
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
52
|
+
<path
|
|
53
|
+
d="M5 2.83L8.17 6l1.41-1.41L5 0 .41 4.59 1.83 6 5 2.83zm0 12.34L1.83 12 .42 13.41 5 18l4.59-4.59L8.17 12 5 15.17z"
|
|
54
|
+
fill="currentColor"
|
|
55
|
+
fill-rule="nonzero" />
|
|
56
|
+
</svg>
|
|
57
|
+
</span>
|
|
58
|
+
<select
|
|
59
|
+
v-show="show"
|
|
60
|
+
v-model="authState.type"
|
|
61
|
+
@click.prevent>
|
|
62
|
+
<option
|
|
63
|
+
v-for="option in authDropdownItems"
|
|
64
|
+
:key="option.type"
|
|
65
|
+
:value="option.type">
|
|
66
|
+
{{ option.text }}
|
|
67
|
+
</option>
|
|
68
|
+
</select>
|
|
69
|
+
</div>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<template v-if="authState.type === 'none'">
|
|
73
|
+
<div class="scalar-api-client__empty-state">No Authentication</div>
|
|
74
|
+
</template>
|
|
75
|
+
<template v-else>
|
|
76
|
+
<template v-if="authState.type === 'basic'">
|
|
77
|
+
<div class="input input__half">
|
|
78
|
+
<input
|
|
79
|
+
v-model="authState.basic.userName"
|
|
80
|
+
autocomplete="off"
|
|
81
|
+
placeholder="Username"
|
|
82
|
+
spellcheck="false"
|
|
83
|
+
type="text" />
|
|
84
|
+
<label for="Username">Username</label>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="input input__half">
|
|
87
|
+
<input
|
|
88
|
+
v-model="authState.basic.password"
|
|
89
|
+
autocomplete="off"
|
|
90
|
+
placeholder="Username"
|
|
91
|
+
spellcheck="false"
|
|
92
|
+
type="password" />
|
|
93
|
+
<label for="Password">Password</label>
|
|
94
|
+
</div>
|
|
95
|
+
<label class="check">
|
|
96
|
+
<input
|
|
97
|
+
v-model="authState.basic.active"
|
|
98
|
+
type="checkbox" />
|
|
99
|
+
<span class="checkmark" />
|
|
100
|
+
<p>Enabled</p>
|
|
101
|
+
</label>
|
|
102
|
+
</template>
|
|
103
|
+
<template v-else-if="authState.type === 'digest'">
|
|
104
|
+
<div class="input input__half">
|
|
105
|
+
<input
|
|
106
|
+
v-model="authState.digest.userName"
|
|
107
|
+
autocomplete="off"
|
|
108
|
+
placeholder="Username"
|
|
109
|
+
spellcheck="false"
|
|
110
|
+
type="text" />
|
|
111
|
+
<label for="Username">Username</label>
|
|
112
|
+
</div>
|
|
113
|
+
<div class="input input__half">
|
|
114
|
+
<input
|
|
115
|
+
v-model="authState.digest.password"
|
|
116
|
+
autocomplete="off"
|
|
117
|
+
placeholder="Password"
|
|
118
|
+
spellcheck="false"
|
|
119
|
+
type="password" />
|
|
120
|
+
<label for="Password">Password</label>
|
|
121
|
+
</div>
|
|
122
|
+
<label class="check">
|
|
123
|
+
<input
|
|
124
|
+
v-model="authState.digest.active"
|
|
125
|
+
type="checkbox" />
|
|
126
|
+
<span class="checkmark" />
|
|
127
|
+
<p>Enabled</p>
|
|
128
|
+
</label>
|
|
129
|
+
</template>
|
|
130
|
+
<template v-else-if="authState.type === 'oauthTwo'">
|
|
131
|
+
<div class="input">
|
|
132
|
+
<input
|
|
133
|
+
v-model="authState.oauthTwo.generatedToken"
|
|
134
|
+
autocomplete="off"
|
|
135
|
+
placeholder="Generated Token"
|
|
136
|
+
spellcheck="false"
|
|
137
|
+
type="text" />
|
|
138
|
+
<label for="Consumer Key">Generated Token</label>
|
|
139
|
+
</div>
|
|
140
|
+
<div class="input">
|
|
141
|
+
<input
|
|
142
|
+
v-model="authState.oauthTwo.discoveryURL"
|
|
143
|
+
autocomplete="off"
|
|
144
|
+
placeholder="Discovery URL"
|
|
145
|
+
spellcheck="false"
|
|
146
|
+
type="text" />
|
|
147
|
+
<label for="Consumer Key">OIDC Discovery URL</label>
|
|
148
|
+
</div>
|
|
149
|
+
<div class="input">
|
|
150
|
+
<input
|
|
151
|
+
v-model="authState.oauthTwo.authURL"
|
|
152
|
+
autocomplete="off"
|
|
153
|
+
placeholder="Auth URL"
|
|
154
|
+
spellcheck="false"
|
|
155
|
+
type="text" />
|
|
156
|
+
<label for="Consumer Key">Auth URL</label>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="input">
|
|
159
|
+
<input
|
|
160
|
+
v-model="authState.oauthTwo.accessTokenURL"
|
|
161
|
+
autocomplete="off"
|
|
162
|
+
placeholder="Access Token URL"
|
|
163
|
+
spellcheck="false"
|
|
164
|
+
type="text" />
|
|
165
|
+
<label for="Consumer Key">Access Token URL</label>
|
|
166
|
+
</div>
|
|
167
|
+
<div class="input input__half">
|
|
168
|
+
<input
|
|
169
|
+
v-model="authState.oauthTwo.clientID"
|
|
170
|
+
autocomplete="off"
|
|
171
|
+
placeholder="Client ID"
|
|
172
|
+
spellcheck="false"
|
|
173
|
+
type="text" />
|
|
174
|
+
<label for="Consumer Key">Client ID</label>
|
|
175
|
+
</div>
|
|
176
|
+
<div class="input input__half">
|
|
177
|
+
<input
|
|
178
|
+
v-model="authState.oauthTwo.clientSecret"
|
|
179
|
+
autocomplete="off"
|
|
180
|
+
placeholder="Client Secret"
|
|
181
|
+
spellcheck="false"
|
|
182
|
+
type="text" />
|
|
183
|
+
<label for="Consumer Key">Client Secret</label>
|
|
184
|
+
</div>
|
|
185
|
+
<div class="input">
|
|
186
|
+
<input
|
|
187
|
+
v-model="authState.oauthTwo.scope"
|
|
188
|
+
autocomplete="off"
|
|
189
|
+
placeholder="Scope"
|
|
190
|
+
spellcheck="false"
|
|
191
|
+
type="text" />
|
|
192
|
+
<label for="Consumer Key">Scope</label>
|
|
193
|
+
</div>
|
|
194
|
+
<!-- @click="generateOauthTwoToken" -->
|
|
195
|
+
<button
|
|
196
|
+
class="scalar-api-client__item__content-button"
|
|
197
|
+
type="button">
|
|
198
|
+
Generate Token
|
|
199
|
+
</button>
|
|
200
|
+
</template>
|
|
201
|
+
<template v-else-if="authState.type === 'bearer'">
|
|
202
|
+
<div class="input">
|
|
203
|
+
<input
|
|
204
|
+
v-model="authState.bearer.token"
|
|
205
|
+
autocomplete="off"
|
|
206
|
+
placeholder="Username"
|
|
207
|
+
spellcheck="false"
|
|
208
|
+
type="text" />
|
|
209
|
+
<label for="Username">Token</label>
|
|
210
|
+
</div>
|
|
211
|
+
<label class="check">
|
|
212
|
+
<input
|
|
213
|
+
v-model="authState.bearer.active"
|
|
214
|
+
type="checkbox" />
|
|
215
|
+
<span class="checkmark" />
|
|
216
|
+
<p>Enabled</p>
|
|
217
|
+
</label>
|
|
218
|
+
</template>
|
|
219
|
+
</template>
|
|
220
|
+
</CollapsibleSection>
|
|
221
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useApiClientRequestStore } from '../../../stores/apiClientRequestStore'
|
|
3
|
+
import { CodeMirror } from '../../CodeMirror'
|
|
4
|
+
import { CollapsibleSection } from '../../CollapsibleSection'
|
|
5
|
+
import { Grid } from '../../Grid'
|
|
6
|
+
|
|
7
|
+
defineProps<{
|
|
8
|
+
body?: string
|
|
9
|
+
formData?: any[]
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
const { activeRequest, setActiveRequest } = useApiClientRequestStore()
|
|
13
|
+
|
|
14
|
+
const updateActiveRequest = (value: string) => {
|
|
15
|
+
if (activeRequest.body !== value) {
|
|
16
|
+
setActiveRequest({
|
|
17
|
+
...activeRequest,
|
|
18
|
+
body: value,
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
<template>
|
|
24
|
+
<CollapsibleSection title="Body">
|
|
25
|
+
<template
|
|
26
|
+
v-if="body && body.length === 0 && formData && formData.length === 0">
|
|
27
|
+
<span>No Body</span>
|
|
28
|
+
</template>
|
|
29
|
+
<template v-else-if="formData && formData.length > 0">
|
|
30
|
+
<Grid :items="formData" />
|
|
31
|
+
</template>
|
|
32
|
+
<CodeMirror
|
|
33
|
+
v-else
|
|
34
|
+
:content="activeRequest.body"
|
|
35
|
+
:languages="['json']"
|
|
36
|
+
:lineNumbers="true"
|
|
37
|
+
@change="updateActiveRequest" />
|
|
38
|
+
</CollapsibleSection>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CollapsibleSection } from '../../CollapsibleSection'
|
|
3
|
+
import { Grid } from '../../Grid'
|
|
4
|
+
|
|
5
|
+
defineProps<{ headers: any[] }>()
|
|
6
|
+
</script>
|
|
7
|
+
<template>
|
|
8
|
+
<CollapsibleSection title="Headers">
|
|
9
|
+
<template v-if="headers.length === 0">
|
|
10
|
+
<div class="scalar-api-client__empty-state">No Headers</div>
|
|
11
|
+
</template>
|
|
12
|
+
<template v-else>
|
|
13
|
+
<Grid :items="headers" />
|
|
14
|
+
<!-- @addAnother="addQuery"
|
|
15
|
+
@deleteItem="deleteQuery"
|
|
16
|
+
@toggleDescription="toggleDescription"
|
|
17
|
+
@toggleVisibility="(key, value) => updateQuery(key, 'active', value)"
|
|
18
|
+
@updateDescription="(key, value) => updateQuery(key, 'description', value)"
|
|
19
|
+
@updateKey="(key, value) => updateQuery(key, 'key', value)"
|
|
20
|
+
@updateOrder="updateQueryOrder"
|
|
21
|
+
@updateValue="(key, value) => updateQuery(key, 'value', value)" -->
|
|
22
|
+
</template>
|
|
23
|
+
</CollapsibleSection>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Query } from '../../../types'
|
|
3
|
+
import { CollapsibleSection } from '../../CollapsibleSection'
|
|
4
|
+
import { Grid } from '../../Grid'
|
|
5
|
+
|
|
6
|
+
defineProps<{ queries: Query[] }>()
|
|
7
|
+
</script>
|
|
8
|
+
<template>
|
|
9
|
+
<CollapsibleSection title="Query Parameters">
|
|
10
|
+
<template v-if="queries.length === 0">
|
|
11
|
+
<div class="scalar-api-client__empty-state">No Query Parameters</div>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-else>
|
|
14
|
+
<Grid :items="queries" />
|
|
15
|
+
<!-- @addAnother="addQuery"
|
|
16
|
+
@deleteItem="deleteQuery"
|
|
17
|
+
@toggleDescription="toggleDescription"
|
|
18
|
+
@toggleVisibility="(key, value) => updateQuery(key, 'active', value)"
|
|
19
|
+
@updateDescription="(key, value) => updateQuery(key, 'description', value)"
|
|
20
|
+
@updateKey="(key, value) => updateQuery(key, 'key', value)"
|
|
21
|
+
@updateOrder="updateQueryOrder"
|
|
22
|
+
@updateValue="(key, value) => updateQuery(key, 'value', value)" -->
|
|
23
|
+
</template>
|
|
24
|
+
</CollapsibleSection>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { BaseParameter } from '../../../types'
|
|
3
|
+
import { CollapsibleSection } from '../../CollapsibleSection'
|
|
4
|
+
import { Grid } from '../../Grid'
|
|
5
|
+
|
|
6
|
+
defineProps<{ paths: BaseParameter[] }>()
|
|
7
|
+
</script>
|
|
8
|
+
<template>
|
|
9
|
+
<CollapsibleSection title="Variables">
|
|
10
|
+
<template v-if="paths.length === 0">
|
|
11
|
+
<div class="scalar-api-client__empty-state">No variables</div>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-else>
|
|
14
|
+
<Grid :items="paths" />
|
|
15
|
+
<!-- @addAnother="addQuery"
|
|
16
|
+
@deleteItem="deleteQuery"
|
|
17
|
+
@toggleDescription="toggleDescription"
|
|
18
|
+
@toggleVisibility="(key, value) => updateQuery(key, 'active', value)"
|
|
19
|
+
@updateDescription="(key, value) => updateQuery(key, 'description', value)"
|
|
20
|
+
@updateKey="(key, value) => updateQuery(key, 'key', value)"
|
|
21
|
+
@updateOrder="updateQueryOrder"
|
|
22
|
+
@updateValue="(key, value) => updateQuery(key, 'value', value)" -->
|
|
23
|
+
</template>
|
|
24
|
+
</CollapsibleSection>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Request } from './Request.vue'
|