Skip to content

Commit 1acedd4

Browse files
committed
Update the OAS to reflect the latest UI changes
- Added Auth endpoints - Added Search endpoints - Added Users endpoints - Added `(content_type)/latest` endpoints
1 parent 9a85f3b commit 1acedd4

File tree

10 files changed

+738
-392
lines changed

10 files changed

+738
-392
lines changed

oas/2.0/agencies.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ info:
44
description: "API Description"
55
version: "0.1.0"
66
servers:
7-
- url: "http://dev-api.nationalpolicedata.org/api/v1"
7+
- url: "http://127.0.0.1:5001/api/v1"
88
description: "Development environment"
9-
- url: "https://stage-api.nationalpolicedata.org/api/v1"
9+
- url: "https://dev.nationalpolicedata.org/api/v1"
1010
description: "Staging environment"
1111
- url: "https://api.nationalpolicedata.org"
1212
description: "Production environment"

oas/2.0/authentication.yaml

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
openapi: "3.0.3"
2+
info:
3+
title: "Authentication"
4+
description: "API Description"
5+
version: "0.1.0"
6+
servers:
7+
- url: "http://dev.nationalpolicedata.org/api/v1"
8+
description: "Development environment"
9+
- url: "https://dev.nationalpolicedata.org/api/v1"
10+
description: "Staging environment"
11+
- url: "https://api.nationalpolicedata.org"
12+
description: "Production environment"
13+
x-readme:
14+
explorer-enabled: true
15+
proxy-enabled: true
16+
samples-enabled: true
17+
security:
18+
- bearerAuth: []
19+
tags:
20+
- name: "Authentication"
21+
description: "API for authenticating and creating user accounts."
22+
paths:
23+
/auth/register:
24+
post:
25+
summary: "register User Account"
26+
operationId: "register"
27+
description: "Create a new user account."
28+
tags:
29+
- Authentication
30+
requestBody:
31+
content:
32+
application/json:
33+
schema:
34+
$ref: "#/components/schemas/RegisterRequest"
35+
responses:
36+
"200":
37+
description: "Logs in and returns the created user object."
38+
content:
39+
application/json:
40+
schema:
41+
$ref: "#/components/schemas/RegisterResponse"
42+
"400":
43+
$ref: '../common/error.yaml#/components/responses/validationError'
44+
"409":
45+
$ref: '../common/error.yaml#/components/responses/conflictError'
46+
/auth/login:
47+
post:
48+
summary: "Log in"
49+
operationId: "login"
50+
description: "Log in to an existing user account."
51+
tags:
52+
- Authentication
53+
requestBody:
54+
content:
55+
application/json:
56+
schema:
57+
$ref: "#/components/schemas/LoginRequest"
58+
responses:
59+
'200':
60+
description: 'Returns JWT that may be used to authenticate future API requests.'
61+
content:
62+
application/json:
63+
schema:
64+
$ref: '#/components/schemas/LoginResponse'
65+
'400':
66+
$ref: '../common/error.yaml#/components/responses/validationError'
67+
/auth/refresh:
68+
post:
69+
summary: "Refresh Access Token"
70+
operationId: "refreshToken"
71+
description: >
72+
Refreshes the current access token to reset the expiration date.
73+
tags:
74+
- Authentication
75+
responses:
76+
'200':
77+
description: >
78+
Returns the updated employment records. The response also includes
79+
information about any records that could not be added.
80+
content:
81+
application/json:
82+
schema:
83+
$ref: '#/components/schemas/LoginResponse'
84+
'401':
85+
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
86+
/auth/logout:
87+
post:
88+
summary: "Log out"
89+
operationId: "logout"
90+
description: "Revokes the access token used to autheticate this request."
91+
tags:
92+
- Authentication
93+
responses:
94+
"200":
95+
description: OK
96+
content:
97+
application/json:
98+
schema:
99+
$ref: "#/components/schemas/LogoutResponse"
100+
'401':
101+
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
102+
/auth/whoami:
103+
get:
104+
summary: "Who Am I"
105+
operationId: "whoami"
106+
description: "Returns the user that matches the access token used to authenticate the request."
107+
tags:
108+
- Authentication
109+
responses:
110+
"200":
111+
description: OK
112+
content:
113+
application/json:
114+
schema:
115+
$ref: "#/components/schemas/CurrentUser"
116+
'401':
117+
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
118+
components:
119+
securitySchemes:
120+
bearerAuth:
121+
type: http
122+
scheme: bearer
123+
bearerFormat: JWT
124+
schemas:
125+
RegisterRequest:
126+
type: "object"
127+
properties:
128+
email:
129+
type: "string"
130+
description: "The user's email address."
131+
password:
132+
type: "string"
133+
description: "The user's desired password."
134+
first_name:
135+
type: "string"
136+
description: "The user's first name."
137+
last_name:
138+
type: "string"
139+
description: "The user's last name."
140+
phone_number:
141+
type: "string"
142+
description: "The user's phone number."
143+
required:
144+
- email
145+
- first_name
146+
- last_name
147+
- password
148+
- phone_number
149+
RegisterResponse:
150+
type: "object"
151+
properties:
152+
msg:
153+
type: string
154+
description: information about the registration action.
155+
access_token:
156+
type: string
157+
description: The JWT that can be used to authenticate API requests on behalf of the user.
158+
LoginRequest:
159+
type: object
160+
properties:
161+
email:
162+
type: string
163+
description: The user's email address.
164+
password:
165+
type: string
166+
description: The user's password.
167+
required:
168+
- email
169+
- password
170+
LoginResponse:
171+
type: object
172+
properties:
173+
access_token:
174+
type: string
175+
description: The JWT that can be used to authenticate API requests on behalf of the user.
176+
message:
177+
type: string
178+
description: Additional detail aboout the login action.
179+
CurrentUser:
180+
type: object
181+
properties:
182+
first_name:
183+
type: string
184+
description: The user's first name.
185+
last_name:
186+
type: string
187+
description: The user's last name.
188+
LogoutResponse:
189+
type: object
190+
properties:
191+
msg:
192+
type: string
193+
description: A report of the logout action.
194+

oas/2.0/complaints.yaml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ info:
44
description: "API Description"
55
version: "0.1.0"
66
servers:
7-
- url: "http://dev-api.nationalpolicedata.org/api/v1"
7+
- url: "http://127.0.0.1:5001/api/v1"
88
description: "Development environment"
9-
- url: "https://stage-api.nationalpolicedata.org/api/v1"
9+
- url: "https://dev.nationalpolicedata.org/api/v1"
1010
description: "Staging environment"
1111
- url: "https://api.nationalpolicedata.org"
1212
description: "Production environment"
@@ -43,6 +43,8 @@ paths:
4343
$ref: "#/components/schemas/Complaint"
4444
'404':
4545
$ref: '../common/error.yaml#/components/responses/notFoundError'
46+
'401':
47+
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
4648
patch:
4749
tags:
4850
- "Complaints"
@@ -70,6 +72,8 @@ paths:
7072
$ref: '../common/error.yaml#/components/responses/validationError'
7173
'404':
7274
$ref: '../common/error.yaml#/components/responses/notFoundError'
75+
'401':
76+
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
7377

7478
/complaints:
7579
post:
@@ -96,6 +100,8 @@ paths:
96100
$ref: "#/components/schemas/Complaint"
97101
'400':
98102
$ref: '../common/error.yaml#/components/responses/validationError'
103+
'401':
104+
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
99105
get:
100106
tags:
101107
- "Complaints"
@@ -114,6 +120,28 @@ paths:
114120
application/json:
115121
schema:
116122
$ref: "#/components/schemas/ComplaintList"
123+
"401":
124+
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
125+
/complaints/latest:
126+
get:
127+
tags:
128+
- "Complaints"
129+
summary: "Latest Complaint Updates"
130+
operationId: "getLatestComplaints"
131+
description: >
132+
Returns the most recently updated or added complaints.
133+
parameters:
134+
- $ref: '../common/pagination.yaml#/components/parameters/page'
135+
- $ref: '../common/pagination.yaml#/components/parameters/per_page'
136+
responses:
137+
"200":
138+
description: "A JSON array of complaint objects"
139+
content:
140+
application/json:
141+
schema:
142+
$ref: "#/components/schemas/ComplaintList"
143+
"401":
144+
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
117145
components:
118146
securitySchemes:
119147
bearerAuth:
@@ -481,14 +509,14 @@ components:
481509
description: "A description of the attachment."
482510
SourceDetails:
483511
oneOf:
484-
- $ref: '#/components/schemas/LegalAction'
512+
- $ref: '#/components/schemas/LegalCaseEvent'
485513
- $ref: '#/components/schemas/PersonalAccount'
486514
- $ref: '#/components/schemas/NewsReport'
487515
- $ref: '#/components/schemas/GovernmentRecord'
488516
discriminator:
489517
propertyName: record_type
490518
mapping:
491-
Legal Action: '#/components/schemas/LegalAction'
519+
Legal Case Event: '#/components/schemas/LegalCaseEvent'
492520
Personal Account: '#/components/schemas/PersonalAccount'
493521
News Report: '#/components/schemas/NewsReport'
494522
Government Record: '#/components/schemas/GovernmentRecord'
@@ -502,14 +530,14 @@ components:
502530
- Personal Account
503531
- News Report
504532
- Government Record
505-
LegalAction:
533+
LegalCaseEvent:
506534
type: "object"
507535
properties:
508536
record_type:
509537
type: "string"
510538
description: "The type of record the complaint is associated with."
511539
enum:
512-
- Legal Action
540+
- Legal Case Event
513541
court:
514542
type: "string"
515543
description: "The court the legal action was filed in."
@@ -519,7 +547,10 @@ components:
519547
docket_number:
520548
type: "string"
521549
description: "The docket number of the case."
522-
date_of_action:
550+
event_summary:
551+
type: "string"
552+
description: "A summary of the event."
553+
date_of_event:
523554
type: "string"
524555
format: "date-time"
525556
description: "The date the legal action was filed."

0 commit comments

Comments
 (0)