This repository has been archived by the owner on May 7, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 148
/
Copy pathschema.graphql
470 lines (386 loc) · 11 KB
/
schema.graphql
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
"""Exposes a URL that specifies the behaviour of this scalar."""
directive @specifiedBy(
"""The URL that specifies the behaviour of this scalar."""
url: String!
) on SCALAR
scalar AlertMode
type AuthPayload {
token: String!
user: User!
}
scalar AuthType
type BlockedUser {
createdAt: DateTime
updatedAt: DateTime
deletedAt: DateTime
user: User
blockedUser: User
}
type Channel {
id: ID!
channelType: ChannelType
name: String
lastMessageId: String
createdAt: DateTime
updatedAt: DateTime
deletedAt: DateTime
"""Get latest message sent to the channel."""
lastMessage: Message
messages(
"""Returns the first n elements from the list."""
first: Int
"""Returns the elements in the list that come after the specified cursor"""
after: String
"""Returns the last n elements from the list."""
last: Int
"""Returns the elements in the list that come before the specified cursor"""
before: String
): MessageConnection
"""
Get memberships assigned to channel. If excludeMe is set, it will not return authenticated user.
"""
memberships(excludeMe: Boolean): [Membership!]
}
type ChannelConnection {
"""
https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types
"""
edges: [ChannelEdge]
"""
https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo
"""
pageInfo: PageInfo!
}
input ChannelCreateInput {
channelType: ChannelType
name: String
userIds: [String!]
}
type ChannelEdge {
"""https://facebook.github.io/relay/graphql/connections.htm#sec-Cursor"""
cursor: String!
"""https://facebook.github.io/relay/graphql/connections.htm#sec-Node"""
node: Channel
}
scalar ChannelType
"""
A date string, such as 2007-12-03, compliant with the `full-date` format
outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for
representation of dates and times using the Gregorian calendar.
"""
scalar Date
"""
A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the
`date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO
8601 standard for representation of dates and times using the Gregorian calendar.
"""
scalar DateTime
type Friend {
createdAt: DateTime
updatedAt: DateTime
deletedAt: DateTime
user: User
friend: User
}
scalar Gender
type Membership {
alertMode: AlertMode
membershipType: MembershipType
isVisible: Boolean
createdAt: DateTime
updatedAt: DateTime
user: User
channel: Channel
}
scalar MembershipType
type Message {
id: ID!
messageType: MessageType!
text: String
imageUrls: [String]
fileUrls: [String]
createdAt: DateTime
updatedAt: DateTime
deletedAt: DateTime
channel: Channel
sender: User
replies: [Reply]
reactions: [Reaction]
}
type MessageConnection {
"""
https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types
"""
edges: [MessageEdge]
"""
https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo
"""
pageInfo: PageInfo!
}
input MessageCreateInput {
messageType: MessageType
text: String
imageUrls: [String!]
fileUrls: [String!]
}
type MessageEdge {
"""https://facebook.github.io/relay/graphql/connections.htm#sec-Cursor"""
cursor: String!
"""https://facebook.github.io/relay/graphql/connections.htm#sec-Node"""
node: Message
}
scalar MessageType
type Mutation {
signUp(photoUpload: Upload, user: UserCreateInput!): User!
signInEmail(email: String!, password: String!): AuthPayload!
signInWithFacebook(accessToken: String!): AuthPayload!
signInWithApple(accessToken: String!): AuthPayload!
signInWithGoogle(accessToken: String!): AuthPayload!
sendVerification(email: String!): Boolean!
"""
Update user with profile. Profile has detailed info as relational table.
"""
updateProfile(user: UserUpdateInput!, profile: UserProfileInput): User
findPassword(email: String!): Boolean!
changeEmailPassword(password: String!, newPassword: String!): Boolean
deleteUser(id: ID!): Boolean!
createNotification(token: String!, device: String, os: String): Notification
deleteNotification(token: String!): Notification
singleUpload(file: Upload!, dir: String): String!
addFriend(friendId: String!): Friend
deleteFriend(friendId: String!): Friend
"""
Creates channel of [ChannelType].
The private channel is unique by the unique members while
the public channel can be created by each request.
The public channel is something like an open chat while
private channel is all kinds of direct messages.
The [Membership] of private channel will be identical to all users which is (member).
<Optional> The channel can be created with message of [MessageType].
Please becareful when creating message and provide proper [MessageType].
This query will return [Channel] with [Membership] without [Message] that has just created.
"""
createChannel(channel: ChannelCreateInput!, message: MessageCreateInput): Channel
"""Find or create channel associated to peer user id."""
findOrCreatePrivateChannel(peerUserIds: [String!]!): Channel
"""
User leaves [public] channel.
Users cannot leave the [private] channel
and rather this is going to be invisible in [Membership].
This will reset to true when new [Message] is created to channel.
User will leave the [public] channel and membership will be removed.
"""
leaveChannel(channelId: String!): Membership
"""Adds some users into [public] channel."""
inviteUsersToChannel(channelId: String!, userIds: [String!]!): Channel
"""Removes some users from [public] channel."""
kickUsersFromChannel(channelId: String!, userIds: [String!]!): Channel
createMessage(channelId: String!, message: MessageCreateInput!, deviceKey: String!): Message
deleteMessage(id: String!): Message
createBlockedUser(blockedUserId: String!): BlockedUser
deleteBlockedUser(blockedUserId: String!): BlockedUser
createReport(reportedUserId: String!, report: String!): Report
}
type Notification {
id: Int!
token: String!
device: String
os: String
createdAt: DateTime
}
"""
PageInfo cursor, as defined in https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo
"""
type PageInfo {
"""
Used to indicate whether more edges exist following the set defined by the clients arguments.
"""
hasNextPage: Boolean!
"""
Used to indicate whether more edges exist prior to the set defined by the clients arguments.
"""
hasPreviousPage: Boolean!
"""
The cursor corresponding to the first nodes in edges. Null if the connection is empty.
"""
startCursor: String
"""
The cursor corresponding to the last nodes in edges. Null if the connection is empty.
"""
endCursor: String
}
type Profile {
socialId: String
authType: AuthType
user: User
organization: String
about: String
projects: String
positions: String
speakings: String
contributions: String
}
type Query {
"""Fetch user profile"""
user(id: ID!): User
"""
Query users with relay pagination. This is filterable but it will not return user itself and the blocked users.
"""
users(
searchText: String
"""Returns the first n elements from the list."""
first: Int
"""Returns the elements in the list that come after the specified cursor"""
after: String
"""Returns the last n elements from the list."""
last: Int
"""Returns the elements in the list that come before the specified cursor"""
before: String
): UserConnection
"""Fetch current user profile when authenticated."""
me: User
notifications(userId: String!): [Notification]
friends(
searchText: String
includeMe: Boolean
"""Returns the first n elements from the list."""
first: Int
"""Returns the elements in the list that come after the specified cursor"""
after: String
"""Returns the last n elements from the list."""
last: Int
"""Returns the elements in the list that come before the specified cursor"""
before: String
): UserConnection
"""Get single channel"""
channel(channelId: String!): Channel
channels(
withMessage: Boolean
"""Returns the first n elements from the list."""
first: Int
"""Returns the elements in the list that come after the specified cursor"""
after: String
"""Returns the last n elements from the list."""
last: Int
"""Returns the elements in the list that come before the specified cursor"""
before: String
): ChannelConnection
"""Get single message"""
message(id: String!): Message
messages(
channelId: String!
searchText: String
"""Returns the first n elements from the list."""
first: Int
"""Returns the elements in the list that come after the specified cursor"""
after: String
"""Returns the last n elements from the list."""
last: Int
"""Returns the elements in the list that come before the specified cursor"""
before: String
): MessageConnection
"""Arguments are not needed. Only find blocked users of signed in user"""
blockedUsers: [User]
reports(userId: String!): [Report]
}
type Reaction {
id: ID!
value: String!
}
type Reply {
id: ID!
messageType: MessageType!
text: String
imageUrls: [String]
fileUrls: [String]
createdAt: DateTime
updatedAt: DateTime
deletedAt: DateTime
sender: User!
}
type Report {
id: ID!
report: String!
createdAt: DateTime
updatedAt: DateTime
deletedAt: DateTime
user: User
reportedUser: User
}
type Subscription {
userSignedIn: User
userUpdated: User
onMessage(deviceKey: String!): Message
}
"""The `Upload` scalar type represents a file upload."""
scalar Upload
type User {
id: ID!
email: String
name: String
nickname: String
thumbURL: String
photoURL: String
birthday: DateTime
gender: Gender
phone: String
statusMessage: String
verified: Boolean
lastSignedIn: DateTime
isOnline: Boolean
createdAt: DateTime
updatedAt: DateTime
deletedAt: DateTime
"""User profile"""
profile: Profile
notifications: [Notification]
"""Check if the user is blocked by the user who have signed in."""
hasBlocked: Boolean
"""This user is a friend of the authenticated user."""
isFriend: Boolean
}
type UserConnection {
"""
https://facebook.github.io/relay/graphql/connections.htm#sec-Edge-Types
"""
edges: [UserEdge]
"""
https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo
"""
pageInfo: PageInfo!
}
input UserCreateInput {
email: String!
password: String!
name: String
nickname: String
birthday: DateTime
gender: Gender
phone: String
statusMessage: String
}
type UserEdge {
"""https://facebook.github.io/relay/graphql/connections.htm#sec-Cursor"""
cursor: String!
"""https://facebook.github.io/relay/graphql/connections.htm#sec-Node"""
node: User
}
input UserProfileInput {
organization: String
about: String
projects: String
positions: String
speakings: String
contributions: String
}
input UserUpdateInput {
email: String
name: String
nickname: String
thumbURL: String
photoURL: String
birthday: DateTime
phone: String
statusMessage: String
gender: Gender
}