vue-api-request-builder 0.2.5 → 0.2.7
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 +216 -168
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.es.js +9048 -10
- package/dist/index.umd.js +159 -1922
- package/package.json +8 -2
- package/dist/abap-D0Neqhq6.js +0 -1404
- package/dist/apex-B5LhxkeG.js +0 -332
- package/dist/assets/css.worker-DNgQEC96.js +0 -84
- package/dist/assets/editor.worker-BKD3YLiN.js +0 -12
- package/dist/assets/html.worker-B7xpmB-M.js +0 -461
- package/dist/assets/json.worker-td2JV8fN.js +0 -49
- package/dist/assets/ts.worker-CqZGdM85.js +0 -51334
- package/dist/azcli-BrBH0QTU.js +0 -74
- package/dist/bat-BfzAov64.js +0 -106
- package/dist/bicep-C3bCSWel.js +0 -108
- package/dist/cameligo-sFL5plcd.js +0 -180
- package/dist/clojure-CfeExRz0.js +0 -767
- package/dist/coffee-Xws5K0WL.js +0 -238
- package/dist/cpp-CqOUEpxN.js +0 -395
- package/dist/csharp-DVLiBOZb.js +0 -332
- package/dist/csp-DVFp9bw5.js +0 -59
- package/dist/css-DwARn2R6.js +0 -193
- package/dist/cssMode-CLL8L5NS.js +0 -1577
- package/dist/cypher-uY0Mffat.js +0 -269
- package/dist/dart-D27H-mX_.js +0 -287
- package/dist/dockerfile-CmV85WZK.js +0 -136
- package/dist/ecl--fKn7yzB.js +0 -462
- package/dist/elixir-DUhH17ON.js +0 -575
- package/dist/flow9-B3Dx2LLe.js +0 -148
- package/dist/freemarker2-DTcNz0NY.js +0 -995
- package/dist/fsharp-SyqBfUAR.js +0 -223
- package/dist/go-BbMR2tdT.js +0 -224
- package/dist/graphql-DDJE6tIl.js +0 -157
- package/dist/handlebars-Cx0-w-7E.js +0 -425
- package/dist/hcl-YBvpaUqf.js +0 -189
- package/dist/html-C5tr3pzc.js +0 -314
- package/dist/htmlMode-CoxRCpNW.js +0 -1587
- package/dist/index-BQj88CBp.js +0 -113063
- package/dist/ini-Ct73dBtM.js +0 -77
- package/dist/java-C_jlkwoG.js +0 -238
- package/dist/javascript-DreDpYLL.js +0 -76
- package/dist/jsonMode-J_5EpjnI.js +0 -2002
- package/dist/julia-D8WE5U1e.js +0 -517
- package/dist/kotlin-Zy9aq5yB.js +0 -259
- package/dist/less-sZ0iHtE8.js +0 -168
- package/dist/lexon-CsdNL29A.js +0 -163
- package/dist/liquid-D4BjZHpf.js +0 -246
- package/dist/lua-C2YJo0zw.js +0 -168
- package/dist/m3-CPLP40SG.js +0 -216
- package/dist/markdown-B1mf5e0R.js +0 -235
- package/dist/mdx-XOAIeZ0T.js +0 -171
- package/dist/mips-DA33BZX1.js +0 -204
- package/dist/msdax-CCYFIQsP.js +0 -381
- package/dist/mysql-hjmIjL-D.js +0 -884
- package/dist/objective-c-RRCpEmqC.js +0 -189
- package/dist/pascal-CeV8XfxB.js +0 -257
- package/dist/pascaligo-IEEGVJAJ.js +0 -170
- package/dist/perl-B5-QbHq_.js +0 -632
- package/dist/pgsql-s6kqEJmi.js +0 -857
- package/dist/php-CWWqzOo8.js +0 -506
- package/dist/pla-FSvb_YP_.js +0 -143
- package/dist/postiats-DQdscQXO.js +0 -913
- package/dist/powerquery-CtA5JA1I.js +0 -896
- package/dist/powershell-DglEq96N.js +0 -245
- package/dist/protobuf-BSepub3e.js +0 -426
- package/dist/pug-B1847F4G.js +0 -408
- package/dist/python-HUeBjc1V.js +0 -307
- package/dist/qsharp-D4i0Nqg9.js +0 -307
- package/dist/r-cdRigKxa.js +0 -249
- package/dist/razor-DIq2UlHM.js +0 -556
- package/dist/redis-D9MFxvE8.js +0 -308
- package/dist/redshift-CmCnsvL-.js +0 -815
- package/dist/restructuredtext-CWy8J51t.js +0 -180
- package/dist/ruby-WP-c36m5.js +0 -517
- package/dist/rust-Q9FLdYpu.js +0 -349
- package/dist/sb-C54-JBGT.js +0 -121
- package/dist/scala-CzbFImc5.js +0 -376
- package/dist/scheme-BhfDmYN3.js +0 -114
- package/dist/scss-CEmiBXpS.js +0 -268
- package/dist/shell-Bmc1VhG0.js +0 -227
- package/dist/solidity-C9Q2I8Hh.js +0 -1373
- package/dist/sophia-jWa1UyKz.js +0 -205
- package/dist/sparql-CM7jctbc.js +0 -207
- package/dist/sql-WzihTkbg.js +0 -859
- package/dist/st-6y7_3aup.js +0 -422
- package/dist/swift-k-0zxG_D.js +0 -318
- package/dist/systemverilog-Pnr5_rIP.js +0 -582
- package/dist/tcl-fNPXval8.js +0 -238
- package/dist/tsMode-CYG-_Z0W.js +0 -895
- package/dist/twig-L2MkztkV.js +0 -398
- package/dist/typescript-_CZvF4eO.js +0 -349
- package/dist/typespec-Cqqo-3Pt.js +0 -123
- package/dist/vb-B5YC2xN9.js +0 -378
- package/dist/wgsl-B-_uRex7.js +0 -445
- package/dist/xml-Bh4P_Mbb.js +0 -101
- package/dist/yaml-CMs-twPQ.js +0 -212
package/README.md
CHANGED
|
@@ -1,168 +1,216 @@
|
|
|
1
|
-
# API Request Builder
|
|
2
|
-
|
|
3
|
-
A Vue 3 component for building and testing API requests with a beautiful UI.
|
|
4
|
-
|
|
5
|
-
# Start of Selection
|
|
6
|
-
[中文文档](README_zh.md)
|
|
7
|
-
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
##
|
|
43
|
-
|
|
44
|
-
###
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
1
|
+
# API Request Builder
|
|
2
|
+
|
|
3
|
+
A Vue 3 component for building and testing API requests with a beautiful UI.
|
|
4
|
+
|
|
5
|
+
# Start of Selection
|
|
6
|
+
[中文文档](README_zh.md)
|
|
7
|
+
|
|
8
|
+
## Workflow
|
|
9
|
+
|
|
10
|
+
```mermaid
|
|
11
|
+
graph TD
|
|
12
|
+
A[Start] --> B[Configure Request]
|
|
13
|
+
B --> C[RequestForm Component]
|
|
14
|
+
C --> D[Set Request Parameters]
|
|
15
|
+
D --> E[URL/Path]
|
|
16
|
+
D --> F[Authentication]
|
|
17
|
+
D --> G[Headers]
|
|
18
|
+
D --> H[Request Body]
|
|
19
|
+
E & F & G & H --> I[Execute Request]
|
|
20
|
+
I --> J[ResponseSection Component]
|
|
21
|
+
J --> K[Display Response]
|
|
22
|
+
K --> L[Status Code]
|
|
23
|
+
K --> M[Response Headers]
|
|
24
|
+
K --> N[Response Body]
|
|
25
|
+
L & M & N --> O[Data Transformation]
|
|
26
|
+
O --> P[DataTransform Component]
|
|
27
|
+
P --> Q[Transform Function]
|
|
28
|
+
Q --> R[Transformed Result]
|
|
29
|
+
R --> S[End]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install vue-api-request-builder
|
|
36
|
+
# or
|
|
37
|
+
yarn add vue-api-request-builder
|
|
38
|
+
# or
|
|
39
|
+
pnpm add vue-api-request-builder
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
### Basic Usage
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<template>
|
|
48
|
+
<div class="app-container">
|
|
49
|
+
<RequestForm v-model="requestSchema" @update:modelValue="handleSchemaChange" />
|
|
50
|
+
<ResponseSection v-model="requestSchema" />
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import { ref } from 'vue';
|
|
56
|
+
import { RequestForm, ResponseSection, type RequestSchema, defaultRequestSchema } from 'vue-api-request-builder';
|
|
57
|
+
|
|
58
|
+
const requestSchema = ref<RequestSchema>(defaultRequestSchema);
|
|
59
|
+
|
|
60
|
+
const handleSchemaChange = (newSchema: RequestSchema) => {
|
|
61
|
+
console.log("Schema changed:", newSchema);
|
|
62
|
+
};
|
|
63
|
+
</script>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Components
|
|
67
|
+
|
|
68
|
+
### RequestForm
|
|
69
|
+
|
|
70
|
+
The main component for building API requests. It provides a form interface for configuring:
|
|
71
|
+
|
|
72
|
+
#### Props
|
|
73
|
+
- `modelValue` (RequestSchema): The request schema object (v-model)
|
|
74
|
+
|
|
75
|
+
#### Events
|
|
76
|
+
- `update:modelValue`: Emitted when the schema changes
|
|
77
|
+
|
|
78
|
+
#### Features
|
|
79
|
+
- HTTP method selection (GET, POST, PUT, DELETE, OPTIONS)
|
|
80
|
+
- URL configuration with base URL and path
|
|
81
|
+
- URL parameters management
|
|
82
|
+
- Authentication options:
|
|
83
|
+
- None
|
|
84
|
+
- Basic Auth
|
|
85
|
+
- Bearer Token
|
|
86
|
+
- Custom headers
|
|
87
|
+
- Request body support for:
|
|
88
|
+
- JSON
|
|
89
|
+
- Form Data
|
|
90
|
+
- Raw text
|
|
91
|
+
- Live preview of request URL and body
|
|
92
|
+
|
|
93
|
+
### ResponseSection
|
|
94
|
+
|
|
95
|
+
Displays the response from the API request.
|
|
96
|
+
|
|
97
|
+
#### Props
|
|
98
|
+
- `modelValue` (RequestSchema): The request schema object (v-model)
|
|
99
|
+
|
|
100
|
+
#### Features
|
|
101
|
+
- Request method selection (XMLHttpRequest/Fetch)
|
|
102
|
+
- Response display:
|
|
103
|
+
- Status code with color coding
|
|
104
|
+
- Response time
|
|
105
|
+
- Response headers
|
|
106
|
+
- Response body with formatting
|
|
107
|
+
- Error handling and display
|
|
108
|
+
|
|
109
|
+
### DataTransform
|
|
110
|
+
|
|
111
|
+
Component for configuring and executing data transformation functions.
|
|
112
|
+
|
|
113
|
+
#### Props
|
|
114
|
+
- `modelValue` (string): The transformation function string (v-model)
|
|
115
|
+
|
|
116
|
+
#### Features
|
|
117
|
+
- Code editor interface
|
|
118
|
+
- JavaScript function support
|
|
119
|
+
- Real-time syntax checking
|
|
120
|
+
- Function execution preview
|
|
121
|
+
|
|
122
|
+
### KeyValueInput
|
|
123
|
+
|
|
124
|
+
A reusable component for managing key-value pairs.
|
|
125
|
+
|
|
126
|
+
#### Props
|
|
127
|
+
- `modelValue` (KeyValuePair[]): Array of key-value pairs (v-model)
|
|
128
|
+
- `addButtonText` (string): Text for the add button
|
|
129
|
+
- `showPreview` (boolean): Whether to show the preview
|
|
130
|
+
- `previewText` (string): Text to show in preview
|
|
131
|
+
|
|
132
|
+
#### Events
|
|
133
|
+
- `update:modelValue`: Emitted when the key-value pairs change
|
|
134
|
+
|
|
135
|
+
## Types
|
|
136
|
+
|
|
137
|
+
### RequestSchema
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
interface RequestSchema {
|
|
141
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS';
|
|
142
|
+
url: string;
|
|
143
|
+
path: string;
|
|
144
|
+
auth: AuthConfig;
|
|
145
|
+
params: KeyValuePair[];
|
|
146
|
+
headers: KeyValuePair[];
|
|
147
|
+
body: RequestBody;
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### AuthConfig
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
interface AuthConfig {
|
|
155
|
+
type: 'none' | 'Basic' | 'Bearer';
|
|
156
|
+
username?: string;
|
|
157
|
+
password?: string;
|
|
158
|
+
token?: string;
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### RequestBody
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
interface RequestBody {
|
|
166
|
+
type: 'application/json' | 'multipart/form-data' | 'text/plain';
|
|
167
|
+
json?: string;
|
|
168
|
+
formData?: KeyValuePair[];
|
|
169
|
+
raw?: string;
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### ResponseData
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
interface ResponseData {
|
|
177
|
+
status: string;
|
|
178
|
+
headers: Record<string, string>;
|
|
179
|
+
body: string;
|
|
180
|
+
timing?: number;
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Utilities
|
|
185
|
+
|
|
186
|
+
### executeRequest
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
function executeRequest(
|
|
190
|
+
schema: RequestSchema,
|
|
191
|
+
method: 'fetch' | 'xhr' = 'xhr'
|
|
192
|
+
): Promise<ResponseData>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Executes the API request using either Fetch API or XMLHttpRequest.
|
|
196
|
+
|
|
197
|
+
### executeTransformFunction
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
function executeTransformFunction(
|
|
201
|
+
transformFunctionString: string,
|
|
202
|
+
data: any
|
|
203
|
+
): any
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Executes a data transformation function to convert input data into the desired format.
|
|
207
|
+
|
|
208
|
+
## Dependencies
|
|
209
|
+
|
|
210
|
+
This package requires:
|
|
211
|
+
- Vue 3.x
|
|
212
|
+
- Ant Design Vue 4.x
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
MIT
|