Skip to content

Commit 0b485a5

Browse files
chore: remove resources and implement own response factory
1 parent e757bcd commit 0b485a5

File tree

32 files changed

+717
-133
lines changed

32 files changed

+717
-133
lines changed

.docs/api/openapi.yml

Lines changed: 392 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,392 @@
1+
openapi: "3.0.2"
2+
3+
info:
4+
title: Laravel API Starter Documentation
5+
description: Laravel API Starter Documentation
6+
version: "2.1"
7+
termsOfService: https://github.com/kingscode/laravel-api-starter
8+
contact:
9+
name: Kings Code
10+
url: https://kingscode.nl
11+
12+
paths:
13+
/auth/dispense:
14+
post:
15+
description: Dispense a new token
16+
requestBody:
17+
content:
18+
multipart/form-data:
19+
schema:
20+
type: object
21+
required:
22+
- email
23+
- token
24+
properties:
25+
redirect_uri:
26+
type: string
27+
email:
28+
type: string
29+
token:
30+
type: string
31+
responses:
32+
302:
33+
description: All is good and the user will be redirected back to the website.
34+
422:
35+
description: The resource had validation errors.
36+
/auth/login:
37+
post:
38+
description: Request a login.
39+
requestBody:
40+
content:
41+
multipart/form-data:
42+
schema:
43+
type: object
44+
required:
45+
- email
46+
- password
47+
properties:
48+
email:
49+
type: string
50+
password:
51+
type: string
52+
responses:
53+
200:
54+
description: The resource was stored.
55+
content:
56+
application/json:
57+
schema:
58+
type: object
59+
properties:
60+
data:
61+
type: array
62+
items:
63+
type: object
64+
properties:
65+
token:
66+
type: string
67+
422:
68+
description: The request had validation errors.
69+
/auth/logout:
70+
post:
71+
security:
72+
- BearerAuth: []
73+
description: Log out the given user (invalidate the used token).
74+
responses:
75+
200:
76+
description: The token was invalidated.
77+
/invitation/accept:
78+
post:
79+
requestBody:
80+
content:
81+
multipart/form-data:
82+
schema:
83+
type: object
84+
required:
85+
- email
86+
- token
87+
- password
88+
- password_confirmation
89+
properties:
90+
email:
91+
type: string
92+
token:
93+
type: string
94+
password:
95+
type: string
96+
password_confirmation:
97+
type: string
98+
responses:
99+
200:
100+
description: Password has been reset.
101+
400:
102+
description: Something went wrong.
103+
/password/forgotten:
104+
post:
105+
requestBody:
106+
content:
107+
multipart/form-data:
108+
schema:
109+
type: object
110+
required:
111+
- email
112+
properties:
113+
email:
114+
type: string
115+
responses:
116+
200:
117+
description: Password forgotten email has been sent if the user exists.
118+
/password/reset:
119+
post:
120+
requestBody:
121+
content:
122+
multipart/form-data:
123+
schema:
124+
type: object
125+
required:
126+
- email
127+
- token
128+
- password
129+
- password_confirmation
130+
properties:
131+
email:
132+
type: string
133+
token:
134+
type: string
135+
password:
136+
type: string
137+
password_confirmation:
138+
type: string
139+
responses:
140+
200:
141+
description: Password has been reset.
142+
400:
143+
description: Something went wrong.
144+
/profile:
145+
get:
146+
security:
147+
- BearerAuth: []
148+
description: Get the profile of the logged in user.
149+
responses:
150+
200:
151+
description: All is ok.
152+
content:
153+
application/json:
154+
schema:
155+
type: object
156+
properties:
157+
id:
158+
type: integer
159+
name:
160+
type: string
161+
email:
162+
type: string
163+
is_admin:
164+
type: boolean
165+
is_business:
166+
type: boolean
167+
can_order_on_invoice:
168+
type: boolean
169+
put:
170+
security:
171+
- BearerAuth: []
172+
description: Update the profile of the logged in user.
173+
requestBody:
174+
content:
175+
multipart/form-data:
176+
schema:
177+
type: object
178+
required:
179+
- name
180+
- email
181+
properties:
182+
name:
183+
type: string
184+
email:
185+
type: string
186+
responses:
187+
200:
188+
description: Profile updated.
189+
422:
190+
description: Validation errors.
191+
/profile/email:
192+
put:
193+
security:
194+
- BearerAuth: []
195+
description: Update the email of the logged in user.
196+
requestBody:
197+
content:
198+
multipart/form-data:
199+
schema:
200+
type: object
201+
required:
202+
- email
203+
properties:
204+
email:
205+
type: string
206+
responses:
207+
200:
208+
description: Password updated.
209+
422:
210+
description: Validation errors.
211+
/profile/email/verify:
212+
post:
213+
security:
214+
- BearerAuth: []
215+
description: Update the email of the logged in user.
216+
requestBody:
217+
content:
218+
multipart/form-data:
219+
schema:
220+
type: object
221+
required:
222+
- email
223+
- token
224+
properties:
225+
email:
226+
type: string
227+
token:
228+
type: string
229+
responses:
230+
200:
231+
description: Password updated.
232+
422:
233+
description: Validation errors.
234+
/profile/password:
235+
put:
236+
security:
237+
- BearerAuth: []
238+
description: Update the password of the logged in user.
239+
requestBody:
240+
content:
241+
multipart/form-data:
242+
schema:
243+
type: object
244+
required:
245+
- password
246+
- password_confirmation
247+
- current_password
248+
properties:
249+
password:
250+
type: string
251+
maxLength: 191
252+
minLength: 10
253+
password_confirmation:
254+
type: string
255+
current_password:
256+
type: string
257+
responses:
258+
200:
259+
description: Password updated.
260+
422:
261+
description: Validation errors.
262+
/user:
263+
get:
264+
security:
265+
- BearerAuth: []
266+
description: Get paginated Users.
267+
parameters:
268+
- name: perPage
269+
in: query
270+
required: false
271+
schema:
272+
type: integer
273+
- name: sortBy
274+
in: query
275+
required: false
276+
schema:
277+
type: string
278+
enum: [name, email]
279+
default: name
280+
- name: desc
281+
in: query
282+
required: false
283+
schema:
284+
type: boolean
285+
default: false
286+
responses:
287+
200:
288+
description: A paginated index of users.
289+
content:
290+
application/json:
291+
schema:
292+
type: object
293+
properties:
294+
data:
295+
type: array
296+
items:
297+
properties:
298+
id:
299+
type: integer
300+
name:
301+
type: string
302+
email:
303+
type: string
304+
post:
305+
security:
306+
- BearerAuth: []
307+
description: Store a new user.
308+
requestBody:
309+
content:
310+
multipart/form-data:
311+
schema:
312+
type: object
313+
required:
314+
- name
315+
properties:
316+
name:
317+
type: string
318+
email:
319+
type: string
320+
responses:
321+
200:
322+
description: The resource was stored.
323+
422:
324+
description: The resource had validation errors.
325+
/user/{user}:
326+
parameters:
327+
- name: user
328+
in: path
329+
required: true
330+
schema:
331+
type: integer
332+
get:
333+
security:
334+
- BearerAuth: []
335+
description: Retrieve the given User.
336+
responses:
337+
200:
338+
description: The user.
339+
content:
340+
application/json:
341+
schema:
342+
type: object
343+
properties:
344+
data:
345+
type: array
346+
items:
347+
properties:
348+
id:
349+
type: integer
350+
name:
351+
type: string
352+
email:
353+
type: string
354+
put:
355+
security:
356+
- BearerAuth: []
357+
description: Update the user.
358+
requestBody:
359+
content:
360+
multipart/form-data:
361+
schema:
362+
type: object
363+
required:
364+
- name
365+
- email
366+
properties:
367+
name:
368+
type: string
369+
email:
370+
type: string
371+
responses:
372+
200:
373+
description: The resource was updated.
374+
404:
375+
description: Not found.
376+
422:
377+
description: The resource had validation errors.
378+
379+
delete:
380+
security:
381+
- BearerAuth: []
382+
description: Delete the resource.
383+
responses:
384+
200:
385+
description: The resource was deleted.
386+
409:
387+
description: The resource was not deleted due to a conflict.
388+
components:
389+
securitySchemes:
390+
BearerAuth:
391+
type: http
392+
scheme: bearer

0 commit comments

Comments
 (0)