specra-cli 0.3.0
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/LICENSE.MD +33 -0
- package/README.md +246 -0
- package/dist/api-client-VHQARPDT.js +15 -0
- package/dist/api-client-VHQARPDT.js.map +1 -0
- package/dist/chunk-5765WX4D.js +192 -0
- package/dist/chunk-5765WX4D.js.map +1 -0
- package/dist/chunk-72RDEJR2.js +94 -0
- package/dist/chunk-72RDEJR2.js.map +1 -0
- package/dist/chunk-SQ2MMFUZ.js +102 -0
- package/dist/chunk-SQ2MMFUZ.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +242 -0
- package/dist/cli.js.map +1 -0
- package/dist/deploy-V4JO2D6B.js +179 -0
- package/dist/deploy-V4JO2D6B.js.map +1 -0
- package/dist/doctor-ICALAJ4N.js +309 -0
- package/dist/doctor-ICALAJ4N.js.map +1 -0
- package/dist/login-UG3WU7DY.js +92 -0
- package/dist/login-UG3WU7DY.js.map +1 -0
- package/dist/logout-WJKHJZT6.js +24 -0
- package/dist/logout-WJKHJZT6.js.map +1 -0
- package/dist/logs-BLUJPWNO.js +77 -0
- package/dist/logs-BLUJPWNO.js.map +1 -0
- package/dist/projects-LJ57GK3D.js +49 -0
- package/dist/projects-LJ57GK3D.js.map +1 -0
- package/package.json +50 -0
- package/templates/book-docs/.env.sample +1 -0
- package/templates/book-docs/docs/v1.0.0/concepts.mdx +89 -0
- package/templates/book-docs/docs/v1.0.0/content/_category_.json +7 -0
- package/templates/book-docs/docs/v1.0.0/content/formatting.mdx +128 -0
- package/templates/book-docs/docs/v1.0.0/content/reusable-content.mdx +116 -0
- package/templates/book-docs/docs/v1.0.0/content/structure.mdx +92 -0
- package/templates/book-docs/docs/v1.0.0/customization/_category_.json +7 -0
- package/templates/book-docs/docs/v1.0.0/customization/branding.mdx +115 -0
- package/templates/book-docs/docs/v1.0.0/customization/themes.mdx +81 -0
- package/templates/book-docs/docs/v1.0.0/introduction.mdx +38 -0
- package/templates/book-docs/docs/v1.0.0/quickstart.mdx +112 -0
- package/templates/book-docs/docs/v2.0.0/concepts.mdx +89 -0
- package/templates/book-docs/docs/v2.0.0/content/_category_.json +7 -0
- package/templates/book-docs/docs/v2.0.0/content/formatting.mdx +128 -0
- package/templates/book-docs/docs/v2.0.0/content/reusable-content.mdx +116 -0
- package/templates/book-docs/docs/v2.0.0/content/structure.mdx +92 -0
- package/templates/book-docs/docs/v2.0.0/customization/_category_.json +7 -0
- package/templates/book-docs/docs/v2.0.0/customization/branding.mdx +115 -0
- package/templates/book-docs/docs/v2.0.0/customization/themes.mdx +81 -0
- package/templates/book-docs/docs/v2.0.0/introduction.mdx +39 -0
- package/templates/book-docs/docs/v2.0.0/quickstart.mdx +112 -0
- package/templates/book-docs/gitignore +7 -0
- package/templates/book-docs/package.json +28 -0
- package/templates/book-docs/postcss.config.mjs +8 -0
- package/templates/book-docs/public/api-specs/openapi-example.json +259 -0
- package/templates/book-docs/public/api-specs/postman-example.json +205 -0
- package/templates/book-docs/public/api-specs/test-api.json +256 -0
- package/templates/book-docs/public/api-specs/users-api.json +264 -0
- package/templates/book-docs/specra.config.json +77 -0
- package/templates/book-docs/src/app.css +86 -0
- package/templates/book-docs/src/app.html +17 -0
- package/templates/book-docs/src/params/product.ts +7 -0
- package/templates/book-docs/src/routes/+layout.server.ts +14 -0
- package/templates/book-docs/src/routes/+layout.svelte +21 -0
- package/templates/book-docs/src/routes/+page.server.ts +9 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
- package/templates/book-docs/src/routes/docs/[version]/+layout.server.ts +42 -0
- package/templates/book-docs/src/routes/docs/[version]/+page.server.ts +27 -0
- package/templates/book-docs/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
- package/templates/book-docs/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
- package/templates/book-docs/static/favicon.svg +4 -0
- package/templates/book-docs/svelte.config.js +13 -0
- package/templates/book-docs/tsconfig.json +12 -0
- package/templates/book-docs/vite.config.ts +6 -0
- package/templates/jbrains-docs/.env.sample +1 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/async.mdx +95 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/generics.mdx +126 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/control-flow.mdx +106 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/syntax.mdx +129 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/types.mdx +135 -0
- package/templates/jbrains-docs/docs/v1.0.0/getting-started.mdx +111 -0
- package/templates/jbrains-docs/docs/v1.0.0/home.mdx +37 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/build-tools.mdx +165 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/testing.mdx +112 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/async.mdx +95 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/generics.mdx +126 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/control-flow.mdx +106 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/syntax.mdx +129 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/types.mdx +135 -0
- package/templates/jbrains-docs/docs/v2.0.0/getting-started.mdx +111 -0
- package/templates/jbrains-docs/docs/v2.0.0/home.mdx +37 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/build-tools.mdx +165 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/testing.mdx +112 -0
- package/templates/jbrains-docs/gitignore +7 -0
- package/templates/jbrains-docs/package.json +28 -0
- package/templates/jbrains-docs/postcss.config.mjs +8 -0
- package/templates/jbrains-docs/public/api-specs/openapi-example.json +259 -0
- package/templates/jbrains-docs/public/api-specs/postman-example.json +205 -0
- package/templates/jbrains-docs/public/api-specs/test-api.json +256 -0
- package/templates/jbrains-docs/public/api-specs/users-api.json +264 -0
- package/templates/jbrains-docs/specra.config.json +80 -0
- package/templates/jbrains-docs/src/app.css +86 -0
- package/templates/jbrains-docs/src/app.html +17 -0
- package/templates/jbrains-docs/src/params/product.ts +7 -0
- package/templates/jbrains-docs/src/routes/+layout.server.ts +14 -0
- package/templates/jbrains-docs/src/routes/+layout.svelte +21 -0
- package/templates/jbrains-docs/src/routes/+page.server.ts +9 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/+layout.server.ts +42 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/+page.server.ts +27 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
- package/templates/jbrains-docs/static/favicon.svg +4 -0
- package/templates/jbrains-docs/svelte.config.js +13 -0
- package/templates/jbrains-docs/tsconfig.json +12 -0
- package/templates/jbrains-docs/vite.config.ts +6 -0
- package/templates/minimal/.env.sample +1 -0
- package/templates/minimal/docs/v1.0.0/about.mdx +57 -0
- package/templates/minimal/docs/v1.0.0/components/_category_.json +8 -0
- package/templates/minimal/docs/v1.0.0/components/callout.mdx +83 -0
- package/templates/minimal/docs/v1.0.0/components/code-block.mdx +103 -0
- package/templates/minimal/docs/v1.0.0/components/index.mdx +8 -0
- package/templates/minimal/docs/v1.0.0/components/tabs.mdx +92 -0
- package/templates/minimal/docs/v1.0.0/configuration.mdx +322 -0
- package/templates/minimal/docs/v1.0.0/features.mdx +197 -0
- package/templates/minimal/docs/v1.0.0/getting-started.mdx +183 -0
- package/templates/minimal/docs/v2.0.0/about.mdx +57 -0
- package/templates/minimal/docs/v2.0.0/components/_category_.json +8 -0
- package/templates/minimal/docs/v2.0.0/components/callout.mdx +83 -0
- package/templates/minimal/docs/v2.0.0/components/code-block.mdx +103 -0
- package/templates/minimal/docs/v2.0.0/components/index.mdx +8 -0
- package/templates/minimal/docs/v2.0.0/components/tabs.mdx +92 -0
- package/templates/minimal/docs/v2.0.0/configuration.mdx +322 -0
- package/templates/minimal/docs/v2.0.0/features.mdx +197 -0
- package/templates/minimal/docs/v2.0.0/getting-started.mdx +183 -0
- package/templates/minimal/gitignore +7 -0
- package/templates/minimal/package.json +29 -0
- package/templates/minimal/postcss.config.mjs +8 -0
- package/templates/minimal/specra.config.json +91 -0
- package/templates/minimal/src/app.css +86 -0
- package/templates/minimal/src/app.html +17 -0
- package/templates/minimal/src/hooks.server.ts +8 -0
- package/templates/minimal/src/params/product.ts +7 -0
- package/templates/minimal/src/routes/+error.svelte +10 -0
- package/templates/minimal/src/routes/+layout.server.ts +14 -0
- package/templates/minimal/src/routes/+layout.svelte +21 -0
- package/templates/minimal/src/routes/+page.server.ts +9 -0
- package/templates/minimal/src/routes/+page.svelte +149 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
- package/templates/minimal/src/routes/docs/[version]/+layout.server.ts +42 -0
- package/templates/minimal/src/routes/docs/[version]/+page.server.ts +27 -0
- package/templates/minimal/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
- package/templates/minimal/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
- package/templates/minimal/static/api-specs/openapi-example.json +259 -0
- package/templates/minimal/static/api-specs/postman-example.json +205 -0
- package/templates/minimal/static/api-specs/test-api.json +256 -0
- package/templates/minimal/static/api-specs/users-api.json +264 -0
- package/templates/minimal/static/favicon.svg +4 -0
- package/templates/minimal/svelte.config.js +13 -0
- package/templates/minimal/tsconfig.json +12 -0
- package/templates/minimal/vite.config.ts +6 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
{
|
|
2
|
+
"info": {
|
|
3
|
+
"name": "Product API",
|
|
4
|
+
"description": "API for managing products in an e-commerce system (Postman Collection example)",
|
|
5
|
+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
|
6
|
+
"version": "1.0.0"
|
|
7
|
+
},
|
|
8
|
+
"auth": {
|
|
9
|
+
"type": "bearer"
|
|
10
|
+
},
|
|
11
|
+
"variable": [
|
|
12
|
+
{
|
|
13
|
+
"key": "baseUrl",
|
|
14
|
+
"value": "https://api.store.com/v1",
|
|
15
|
+
"type": "string"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"item": [
|
|
19
|
+
{
|
|
20
|
+
"name": "Products",
|
|
21
|
+
"item": [
|
|
22
|
+
{
|
|
23
|
+
"name": "Get All Products",
|
|
24
|
+
"request": {
|
|
25
|
+
"method": "GET",
|
|
26
|
+
"header": [
|
|
27
|
+
{
|
|
28
|
+
"key": "Accept",
|
|
29
|
+
"value": "application/json"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"url": {
|
|
33
|
+
"raw": "{{baseUrl}}/products?category=electronics&limit=10",
|
|
34
|
+
"host": ["{{baseUrl}}"],
|
|
35
|
+
"path": ["products"],
|
|
36
|
+
"query": [
|
|
37
|
+
{
|
|
38
|
+
"key": "category",
|
|
39
|
+
"value": "electronics",
|
|
40
|
+
"description": "Filter by product category"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"key": "limit",
|
|
44
|
+
"value": "10",
|
|
45
|
+
"description": "Maximum number of products to return"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"description": "Retrieve a list of products with optional filtering"
|
|
50
|
+
},
|
|
51
|
+
"response": [
|
|
52
|
+
{
|
|
53
|
+
"name": "Success Response",
|
|
54
|
+
"code": 200,
|
|
55
|
+
"body": "[\n {\n \"id\": \"prod_123\",\n \"name\": \"Laptop\",\n \"price\": 999.99,\n \"category\": \"electronics\",\n \"inStock\": true\n },\n {\n \"id\": \"prod_456\",\n \"name\": \"Mouse\",\n \"price\": 29.99,\n \"category\": \"electronics\",\n \"inStock\": true\n }\n]"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "Get Product by ID",
|
|
61
|
+
"request": {
|
|
62
|
+
"method": "GET",
|
|
63
|
+
"header": [
|
|
64
|
+
{
|
|
65
|
+
"key": "Accept",
|
|
66
|
+
"value": "application/json"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"url": {
|
|
70
|
+
"raw": "{{baseUrl}}/products/:id",
|
|
71
|
+
"host": ["{{baseUrl}}"],
|
|
72
|
+
"path": ["products", ":id"],
|
|
73
|
+
"variable": [
|
|
74
|
+
{
|
|
75
|
+
"key": "id",
|
|
76
|
+
"value": "prod_123",
|
|
77
|
+
"description": "Product ID"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"description": "Get a single product by its ID"
|
|
82
|
+
},
|
|
83
|
+
"response": [
|
|
84
|
+
{
|
|
85
|
+
"name": "Success",
|
|
86
|
+
"code": 200,
|
|
87
|
+
"body": "{\n \"id\": \"prod_123\",\n \"name\": \"Laptop\",\n \"price\": 999.99,\n \"category\": \"electronics\",\n \"description\": \"High-performance laptop\",\n \"inStock\": true\n}"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "Not Found",
|
|
91
|
+
"code": 404,
|
|
92
|
+
"body": "{\n \"error\": \"Product not found\",\n \"code\": \"PRODUCT_NOT_FOUND\"\n}"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "Create Product",
|
|
98
|
+
"request": {
|
|
99
|
+
"method": "POST",
|
|
100
|
+
"header": [
|
|
101
|
+
{
|
|
102
|
+
"key": "Content-Type",
|
|
103
|
+
"value": "application/json"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"key": "Accept",
|
|
107
|
+
"value": "application/json"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"body": {
|
|
111
|
+
"mode": "raw",
|
|
112
|
+
"raw": "{\n \"name\": \"Wireless Keyboard\",\n \"price\": 79.99,\n \"category\": \"electronics\",\n \"description\": \"Ergonomic wireless keyboard\",\n \"inStock\": true\n}"
|
|
113
|
+
},
|
|
114
|
+
"url": {
|
|
115
|
+
"raw": "{{baseUrl}}/products",
|
|
116
|
+
"host": ["{{baseUrl}}"],
|
|
117
|
+
"path": ["products"]
|
|
118
|
+
},
|
|
119
|
+
"description": "Create a new product in the catalog"
|
|
120
|
+
},
|
|
121
|
+
"response": [
|
|
122
|
+
{
|
|
123
|
+
"name": "Created",
|
|
124
|
+
"code": 201,
|
|
125
|
+
"body": "{\n \"id\": \"prod_789\",\n \"name\": \"Wireless Keyboard\",\n \"price\": 79.99,\n \"category\": \"electronics\",\n \"description\": \"Ergonomic wireless keyboard\",\n \"inStock\": true,\n \"createdAt\": \"2024-01-15T10:30:00Z\"\n}"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "Validation Error",
|
|
129
|
+
"code": 400,
|
|
130
|
+
"body": "{\n \"error\": \"Invalid product data\",\n \"details\": {\n \"price\": \"Price must be a positive number\"\n }\n}"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "Update Product",
|
|
136
|
+
"request": {
|
|
137
|
+
"method": "PATCH",
|
|
138
|
+
"header": [
|
|
139
|
+
{
|
|
140
|
+
"key": "Content-Type",
|
|
141
|
+
"value": "application/json"
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"body": {
|
|
145
|
+
"mode": "raw",
|
|
146
|
+
"raw": "{\n \"price\": 89.99,\n \"inStock\": false\n}"
|
|
147
|
+
},
|
|
148
|
+
"url": {
|
|
149
|
+
"raw": "{{baseUrl}}/products/:id",
|
|
150
|
+
"host": ["{{baseUrl}}"],
|
|
151
|
+
"path": ["products", ":id"],
|
|
152
|
+
"variable": [
|
|
153
|
+
{
|
|
154
|
+
"key": "id",
|
|
155
|
+
"value": "prod_123",
|
|
156
|
+
"description": "Product ID to update"
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
"description": "Update specific fields of a product"
|
|
161
|
+
},
|
|
162
|
+
"response": [
|
|
163
|
+
{
|
|
164
|
+
"name": "Updated",
|
|
165
|
+
"code": 200,
|
|
166
|
+
"body": "{\n \"id\": \"prod_123\",\n \"name\": \"Laptop\",\n \"price\": 89.99,\n \"category\": \"electronics\",\n \"description\": \"High-performance laptop\",\n \"inStock\": false,\n \"updatedAt\": \"2024-01-16T15:45:00Z\"\n}"
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "Delete Product",
|
|
172
|
+
"request": {
|
|
173
|
+
"method": "DELETE",
|
|
174
|
+
"header": [],
|
|
175
|
+
"url": {
|
|
176
|
+
"raw": "{{baseUrl}}/products/:id",
|
|
177
|
+
"host": ["{{baseUrl}}"],
|
|
178
|
+
"path": ["products", ":id"],
|
|
179
|
+
"variable": [
|
|
180
|
+
{
|
|
181
|
+
"key": "id",
|
|
182
|
+
"value": "prod_123",
|
|
183
|
+
"description": "Product ID to delete"
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"description": "Delete a product from the catalog"
|
|
188
|
+
},
|
|
189
|
+
"response": [
|
|
190
|
+
{
|
|
191
|
+
"name": "Deleted",
|
|
192
|
+
"code": 204,
|
|
193
|
+
"body": ""
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"name": "Not Found",
|
|
197
|
+
"code": 404,
|
|
198
|
+
"body": "{\n \"error\": \"Product not found\"\n}"
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"title": "Test API",
|
|
4
|
+
"description": "A simple test API for demonstrating the API documentation system",
|
|
5
|
+
"baseUrl": "https://jsonplaceholder.typicode.com",
|
|
6
|
+
"auth": {
|
|
7
|
+
"type": "apiKey",
|
|
8
|
+
"description": "This is a public API - no authentication required for testing",
|
|
9
|
+
"headerName": "X-API-Key"
|
|
10
|
+
},
|
|
11
|
+
"endpoints": [
|
|
12
|
+
{
|
|
13
|
+
"title": "Get All Posts",
|
|
14
|
+
"method": "GET",
|
|
15
|
+
"path": "/posts",
|
|
16
|
+
"description": "Retrieve a list of all blog posts",
|
|
17
|
+
"queryParams": [
|
|
18
|
+
{
|
|
19
|
+
"name": "_limit",
|
|
20
|
+
"type": "number",
|
|
21
|
+
"description": "Limit the number of results",
|
|
22
|
+
"example": 5
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "userId",
|
|
26
|
+
"type": "number",
|
|
27
|
+
"description": "Filter posts by user ID",
|
|
28
|
+
"example": 1
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"successResponse": {
|
|
32
|
+
"status": 200,
|
|
33
|
+
"description": "List of posts retrieved successfully",
|
|
34
|
+
"example": [
|
|
35
|
+
{
|
|
36
|
+
"userId": 1,
|
|
37
|
+
"id": 1,
|
|
38
|
+
"title": "sunt aut facere repellat provident",
|
|
39
|
+
"body": "quia et suscipit..."
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"userId": 1,
|
|
43
|
+
"id": 2,
|
|
44
|
+
"title": "qui est esse",
|
|
45
|
+
"body": "est rerum tempore vitae..."
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"examples": [
|
|
50
|
+
{
|
|
51
|
+
"title": "cURL",
|
|
52
|
+
"language": "bash",
|
|
53
|
+
"code": "curl https://jsonplaceholder.typicode.com/posts?_limit=5"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"title": "JavaScript",
|
|
57
|
+
"language": "javascript",
|
|
58
|
+
"code": "const response = await fetch('https://jsonplaceholder.typicode.com/posts?_limit=5');\nconst posts = await response.json();\nconsole.log(posts);"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"title": "Python",
|
|
62
|
+
"language": "python",
|
|
63
|
+
"code": "import requests\n\nresponse = requests.get('https://jsonplaceholder.typicode.com/posts', params={'_limit': 5})\nposts = response.json()\nprint(posts)"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"title": "Get Post by ID",
|
|
69
|
+
"method": "GET",
|
|
70
|
+
"path": "/posts/:id",
|
|
71
|
+
"description": "Retrieve a single post by its ID",
|
|
72
|
+
"pathParams": [
|
|
73
|
+
{
|
|
74
|
+
"name": "id",
|
|
75
|
+
"type": "number",
|
|
76
|
+
"required": true,
|
|
77
|
+
"description": "The ID of the post to retrieve",
|
|
78
|
+
"example": 1
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"successResponse": {
|
|
82
|
+
"status": 200,
|
|
83
|
+
"description": "Post retrieved successfully",
|
|
84
|
+
"example": {
|
|
85
|
+
"userId": 1,
|
|
86
|
+
"id": 1,
|
|
87
|
+
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
|
|
88
|
+
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"errorResponses": [
|
|
92
|
+
{
|
|
93
|
+
"status": 404,
|
|
94
|
+
"description": "Post not found",
|
|
95
|
+
"example": {}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"title": "Create New Post",
|
|
101
|
+
"method": "POST",
|
|
102
|
+
"path": "/posts",
|
|
103
|
+
"description": "Create a new blog post",
|
|
104
|
+
"body": {
|
|
105
|
+
"description": "Post data to create",
|
|
106
|
+
"example": {
|
|
107
|
+
"title": "My New Post",
|
|
108
|
+
"body": "This is the content of my new post",
|
|
109
|
+
"userId": 1
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"successResponse": {
|
|
113
|
+
"status": 201,
|
|
114
|
+
"description": "Post created successfully",
|
|
115
|
+
"example": {
|
|
116
|
+
"id": 101,
|
|
117
|
+
"title": "My New Post",
|
|
118
|
+
"body": "This is the content of my new post",
|
|
119
|
+
"userId": 1
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"examples": [
|
|
123
|
+
{
|
|
124
|
+
"title": "cURL",
|
|
125
|
+
"language": "bash",
|
|
126
|
+
"code": "curl -X POST https://jsonplaceholder.typicode.com/posts \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"title\": \"My New Post\",\n \"body\": \"This is the content\",\n \"userId\": 1\n }'"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"title": "JavaScript",
|
|
130
|
+
"language": "javascript",
|
|
131
|
+
"code": "const response = await fetch('https://jsonplaceholder.typicode.com/posts', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n title: 'My New Post',\n body: 'This is the content',\n userId: 1\n })\n});\nconst post = await response.json();\nconsole.log(post);"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"title": "Update Post",
|
|
137
|
+
"method": "PUT",
|
|
138
|
+
"path": "/posts/:id",
|
|
139
|
+
"description": "Update an existing post (replaces all fields)",
|
|
140
|
+
"pathParams": [
|
|
141
|
+
{
|
|
142
|
+
"name": "id",
|
|
143
|
+
"type": "number",
|
|
144
|
+
"required": true,
|
|
145
|
+
"description": "The ID of the post to update",
|
|
146
|
+
"example": 1
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"body": {
|
|
150
|
+
"description": "Complete post data",
|
|
151
|
+
"example": {
|
|
152
|
+
"id": 1,
|
|
153
|
+
"title": "Updated Title",
|
|
154
|
+
"body": "Updated content",
|
|
155
|
+
"userId": 1
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"successResponse": {
|
|
159
|
+
"status": 200,
|
|
160
|
+
"description": "Post updated successfully",
|
|
161
|
+
"example": {
|
|
162
|
+
"id": 1,
|
|
163
|
+
"title": "Updated Title",
|
|
164
|
+
"body": "Updated content",
|
|
165
|
+
"userId": 1
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"title": "Partially Update Post",
|
|
171
|
+
"method": "PATCH",
|
|
172
|
+
"path": "/posts/:id",
|
|
173
|
+
"description": "Partially update a post (only updates provided fields)",
|
|
174
|
+
"pathParams": [
|
|
175
|
+
{
|
|
176
|
+
"name": "id",
|
|
177
|
+
"type": "number",
|
|
178
|
+
"required": true,
|
|
179
|
+
"description": "The ID of the post to update",
|
|
180
|
+
"example": 1
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"body": {
|
|
184
|
+
"description": "Fields to update (all optional)",
|
|
185
|
+
"example": {
|
|
186
|
+
"title": "New Title Only"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"successResponse": {
|
|
190
|
+
"status": 200,
|
|
191
|
+
"description": "Post updated successfully",
|
|
192
|
+
"example": {
|
|
193
|
+
"userId": 1,
|
|
194
|
+
"id": 1,
|
|
195
|
+
"title": "New Title Only",
|
|
196
|
+
"body": "quia et suscipit..."
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"title": "Delete Post",
|
|
202
|
+
"method": "DELETE",
|
|
203
|
+
"path": "/posts/:id",
|
|
204
|
+
"description": "Delete a post",
|
|
205
|
+
"pathParams": [
|
|
206
|
+
{
|
|
207
|
+
"name": "id",
|
|
208
|
+
"type": "number",
|
|
209
|
+
"required": true,
|
|
210
|
+
"description": "The ID of the post to delete",
|
|
211
|
+
"example": 1
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"successResponse": {
|
|
215
|
+
"status": 200,
|
|
216
|
+
"description": "Post deleted successfully",
|
|
217
|
+
"example": {}
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"title": "Get Comments for Post",
|
|
222
|
+
"method": "GET",
|
|
223
|
+
"path": "/posts/:id/comments",
|
|
224
|
+
"description": "Retrieve all comments for a specific post",
|
|
225
|
+
"pathParams": [
|
|
226
|
+
{
|
|
227
|
+
"name": "id",
|
|
228
|
+
"type": "number",
|
|
229
|
+
"required": true,
|
|
230
|
+
"description": "The post ID",
|
|
231
|
+
"example": 1
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"successResponse": {
|
|
235
|
+
"status": 200,
|
|
236
|
+
"description": "Comments retrieved successfully",
|
|
237
|
+
"example": [
|
|
238
|
+
{
|
|
239
|
+
"postId": 1,
|
|
240
|
+
"id": 1,
|
|
241
|
+
"name": "id labore ex et quam laborum",
|
|
242
|
+
"email": "Eliseo@gardner.biz",
|
|
243
|
+
"body": "laudantium enim quasi est quidem magnam..."
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"postId": 1,
|
|
247
|
+
"id": 2,
|
|
248
|
+
"name": "quo vero reiciendis velit similique earum",
|
|
249
|
+
"email": "Jayne_Kuhic@sydney.com",
|
|
250
|
+
"body": "est natus enim nihil est dolore omnis..."
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
}
|