-
-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathapi.ts
More file actions
175 lines (162 loc) · 3.39 KB
/
api.ts
File metadata and controls
175 lines (162 loc) · 3.39 KB
1
2
3
4
5
6
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
169
170
171
172
173
174
175
export type AccessToken = string
export interface Source {
name?: string
id?: number
url?: string
contact_email?: string
}
export interface Perpetrator {
first_name?: string
last_name?: string
}
export interface UseOfForce {
item?: string
}
export interface Incident {
id: number
source?: Source
source_id?: number
location?: string
locationLonLat?: [number, number] //TODO: Backend data does not return locationLonLat attribute. Remove this and refactor frontend
latitude?: number
longitude?: number
time_of_incident?: string
department?: string
perpetrators: Perpetrator[]
description?: string
use_of_force?: UseOfForce[]
}
interface AuthenticatedRequest {
accessToken: AccessToken
}
export interface SearchRequest extends AuthenticatedRequest {
query: string
location?: string
source?: string
page?: number
}
export type SearchResponse = {
uid: string | number
title: string
subtitle: string
content_type: string
source: string
last_updated: string
description?: string
tags?: string[]
}
export type PaginatedSearchResponses = {
error?: string | null
page?: number
pages?: number
per_page?: number
total?: number
results: SearchResponse[]
}
export interface SocialMedia {
twitter_url?: string
facebook_url?: string
linkedin_url?: string
instagram_url?: string
youtube_url?: string
tiktok_url?: string
}
export interface ContactInfo {
additional_emails: string[]
phone_numbers: string[]
}
export interface UserProfile {
uid: string
first_name: string
last_name: string
primary_email: string
contact_info: ContactInfo
location?: {
city?: string
state?: string
}
employment?: {
employer?: string
title?: string
}
bio?: string
profile_image?: string
social_media?: SocialMedia
website?: string
role: string
active: boolean
}
export type UpdateUserProfilePayload = {
first_name?: string
last_name?: string
bio?: string
title?: string
organization?: string
location?: {
city?: string
state?: string
}
employment?: {
employer?: string
title?: string
}
contact_info?: {
additional_emails?: string[]
phone_numbers?: string[]
}
website?: string
social_media?: {
twitter_url?: string
facebook_url?: string
linkedin_url?: string
instagram_url?: string
youtube_url?: string
tiktok_url?: string
}
primary_email?: string
}
export interface AgenciesRequest extends AuthenticatedRequest {
name?: string
city?: string
state?: string
zip_code?: string
jurisdiction?: string
page?: number
per_page?: number
}
export interface AgencyResponse {
uid: string
name: string
website_url?: string | null
hq_address?: string | null
hq_city?: string | null
hq_state?: string | null
hq_zip?: string | null
phone?: string | null
email?: string | null
description?: string | null
jurisdiction?: string | null
units?: Array<{
uid: string
name: string
website_url?: string | null
phone?: string | null
email?: string | null
description?: string | null
address?: string | null
city?: string | null
state?: string | null
zip?: string | null
agency_url?: string | null
officers_url?: string | null
date_established?: string | null
}>
}
export type AgenciesApiResponse = {
results: AgencyResponse[]
page: number
per_page: number
pages: number
total: number
error?: string
}