-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcampus_backend.proto
615 lines (528 loc) · 16.2 KB
/
campus_backend.proto
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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
syntax = "proto3";
package api;
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "CampusApiProto";
option go_package = "github.com/TUM-Dev/Campus-Backend/api";
option java_multiple_files = true;
option java_outer_classname = "CampusApiProto";
option java_package = "app.tum.campus.api";
service Campus {
rpc ListNewsAlerts(ListNewsAlertsRequest) returns (ListNewsAlertsReply) {
option (google.api.http) = {
get: "/news/alerts"
response_body: "alerts"
};
}
rpc ListNewsSources(ListNewsSourcesRequest) returns (ListNewsSourcesReply) {
option (google.api.http) = {
get: "/news/sources",
response_body: "sources"
};
}
rpc ListNews(ListNewsRequest) returns (ListNewsReply) {
option (google.api.http) = {
get: "/news",
response_body: "news"
};
}
// This endpoint retrieves Canteen Ratings from the Backend.
rpc ListCanteenRatings(ListCanteenRatingsRequest) returns (ListCanteenRatingsReply) {
option (google.api.http) = {
post: "/canteen/rating/get",
body: "*",
};
}
// Allows to query ratings for a specific dish in a specific cafeteria.
rpc GetDishRatings(GetDishRatingsRequest) returns (GetDishRatingsReply) {
option (google.api.http) = {
post: "/dish/rating/get",
body: "*",
};
}
rpc CreateCanteenRating(CreateCanteenRatingRequest) returns (CreateCanteenRatingReply) {
option (google.api.http) = {
post: "/canteen/rating/new",
body: "*",
};
}
rpc CreateDishRating(CreateDishRatingRequest) returns (CreateDishRatingReply) {
option (google.api.http) = {
post: "/dish/rating/new",
body: "*",
};
}
rpc ListAvailableDishTags(ListAvailableDishTagsRequest) returns (ListAvailableDishTagsReply) {
option (google.api.http) = {
get: "/dish/rating/allRatingTags",
response_body: "rating_tags"
};
}
rpc ListNameTags(ListNameTagsRequest) returns (ListNameTagsReply) {
option (google.api.http) = {
get: "/dish/rating/allDishTags",
response_body: "rating_tags"
};
}
rpc ListAvailableCanteenTags(ListAvailableCanteenTagsRequest) returns (ListAvailableCanteenTagsReply) {
option (google.api.http) = {
get: "/canteen/rating/allRatingTags",
response_body: "rating_tags"
};
}
rpc ListCanteens(ListCanteensRequest) returns (ListCanteensReply) {
option (google.api.http) = {
get: "/canteen/allCanteens",
response_body: "canteen"
};
}
// Returns all dishes for a specific cafeteria, year, week and day
rpc ListDishes(ListDishesRequest) returns (ListDishesReply) {
option (google.api.http) = {
get: "/dishes",
response_body: "dish"
};
}
rpc ListResponsiblePerson(ListResponsiblePersonRequest) returns (ListResponsiblePersonReply) {
option (google.api.http) = {get: "/barrierfree/contacts"};
}
rpc ListMoreInformation(ListMoreInformationRequest) returns (ListMoreInformationReply) {
option (google.api.http) = {get: "/barrierfree/moreInformation"};
}
rpc ListOpeningTimes(ListOpeningTimesRequest) returns (ListOpeningTimesReply) {
option (google.api.http) = {get: "/openingtimes/{language}"};
}
rpc GetUpdateNote(GetUpdateNoteRequest) returns (GetUpdateNoteReply) {
option (google.api.http) = {get: "/updatenote/{version}"};
}
rpc ListMovies(ListMoviesRequest) returns (ListMoviesReply) {
option (google.api.http) = {get: "/movies/{last_id}"};
}
rpc CreateFeedback(stream CreateFeedbackRequest) returns (CreateFeedbackReply) {
option (google.api.http) = {
post: "/feedback",
body: "attachment",
};
}
rpc GetUploadStatus(GetUploadStatusRequest) returns (GetUploadStatusReply) {
option (google.api.http) = {get: "/device/uploaded/{lrz_id}"};
}
rpc GetNotification(GetNotificationRequest) returns (GetNotificationReply) {
option (google.api.http) = {get: "/notifications/{notification_id}"};
}
rpc GetNotificationConfirm(GetNotificationConfirmRequest) returns (GetNotificationConfirmReply) {
option (google.api.http) = {get: "/notifications/confirm/{notification_id}"};
}
rpc GetMember(GetMemberRequest) returns (GetMemberReply) {
option (google.api.http) = {get: "/members/{lrz_id}"};
}
rpc GetCanteenHeadCount(GetCanteenHeadCountRequest) returns (GetCanteenHeadCountReply) {
option (google.api.http) = {get: "/canteen/headCount/{canteen_id}"};
}
// Create an device (Android/iOS/Windows) for push notifications
rpc CreateDevice(CreateDeviceRequest) returns (CreateDeviceReply) {
option (google.api.http) = {
post: "/device",
body: "*",
};
}
// Delete a device from push notifications
rpc DeleteDevice(DeleteDeviceRequest) returns (DeleteDeviceReply) {
option (google.api.http) = {delete: "/device/{device_id}"};
}
}
enum DeviceType {
IOS = 0;
ANDROID = 1;
WINDOWS = 2;
}
message CreateDeviceRequest {
string device_id = 1;
string public_key = 2;
DeviceType device_type = 3;
}
message CreateDeviceReply {
string device_id = 1;
}
message DeleteDeviceRequest {
string device_id = 1;
DeviceType device_type = 2;
}
message DeleteDeviceReply {
string device_id = 1;
}
message News {
int64 id = 1;
string title = 2;
string text = 3;
string link = 4;
// where a news thumbnail is stored. empty string means no image is available
string image_url = 5;
// the id of the news source
string source_id = 6;
// where the icon can be found
string source_icon_url = 9;
// human readable title of the news source
string source_title = 10;
// when the news item was created in OUR database
google.protobuf.Timestamp created = 7;
// the date of the news item
google.protobuf.Timestamp date = 8;
}
message ListNewsReply {
repeated News news = 1;
}
message ListNewsRequest {
// the last id of the news item received. 0 to get all news items
int32 last_news_id = 1;
// filter by news source id. 0 to get all news items
int32 news_source = 2;
// the oldest time you want to be included in the response
google.protobuf.Timestamp oldest_date_at = 3;
}
message ListNewsSourcesRequest {}
message ListNewsSourcesReply {
repeated NewsSource sources = 1;
}
message NewsSource {
string source = 1;
string title = 2;
// where the icon can be found
string icon_url = 3;
}
message ListNewsAlertsRequest {
// the last id of the news item received. 0 to get all news items
int32 last_news_alert_id = 1;
}
message ListNewsAlertsReply {
repeated NewsAlert alerts = 1;
}
message NewsAlert {
string image_url = 1;
string link = 2;
google.protobuf.Timestamp created = 3;
google.protobuf.Timestamp from = 4;
google.protobuf.Timestamp to = 5;
}
message ListCanteenRatingsRequest {
// canteenId Mandatory Name of the canteen (EAT-API naming scheme "MENSA_GARCHING")
string canteen_id = 1;
// Optional Parameter to define an interval for the ratings (Lower bound)
google.protobuf.Timestamp from = 2;
// Optional Parameter to define an interval for the ratings (Upper bound)
google.protobuf.Timestamp to = 3;
// Optional Parameter defines how many ratings are queried. If all ratings should be queried, enter "-1"
int32 limit = 4;
}
message ListCanteenRatingsReply {
repeated SingleRatingReply rating = 1;
double avg = 2;
double std = 3;
int32 min = 4;
int32 max = 5;
repeated RatingTagResult rating_tags = 6;
}
message GetDishRatingsRequest {
// Mandatory Name of the canteen (EAT-API naming scheme "MENSA_GARCHING")
string canteen_id = 1;
// Mandatory Name of the dish (EAT-API naming scheme) Must be available int the given mensa
string dish = 2;
// Optional Parameter to define an interval for the ratings (Lower bound)
google.protobuf.Timestamp from = 3;
// Optional Parameter to define an interval for the ratings (Upper bound)
google.protobuf.Timestamp to = 4;
// Optional Parameter defines how many ratings are queried. If all ratings should be queried, enter "-1"
int32 limit = 5;
}
message GetDishRatingsReply {
// a number of actual ratings
repeated SingleRatingReply rating = 1;
// average rating for all dish rating tags which were used to rate this dish in this cafeteria
double avg = 2;
// std of all dish rating tags which were used to rate this dish in this cafeteria
double std = 3;
// minimum of all dish rating tags which were used to rate this dish in this cafeteria
int32 min = 4;
// maximum of all dish rating tags which were used to rate this dish in this cafeteria
int32 max = 5;
repeated RatingTagResult rating_tags = 6;
repeated RatingTagResult name_tags = 7;
}
message SingleRatingReply {
// number in the range 1-5
int32 points = 1;
// Optional JPEG image in Base64
bytes image = 2;
// Optional comment (max 256 chars)
string comment = 3;
repeated RatingTagNewRequest rating_tags = 4;
google.protobuf.Timestamp visited = 5;
}
message CreateCanteenRatingReply {}
message CreateCanteenRatingRequest {
// number in the range 1-5
int32 points = 1;
string canteen_id = 2;
bytes image = 3;
// Optional list of tag ratings add as many tags with a rating (1-5) of the list of canteenRatingTags
repeated RatingTag rating_tags = 4;
// Optional comment (max 256 chars)
string comment = 6;
}
message CreateDishRatingReply {}
message CreateDishRatingRequest {
// number in the range 1-5
int32 points = 1;
// Mandatory Name of the dish (EAT-API naming scheme "MENSA_GARCHING") Must be available int the given mensa
string canteen_id = 2;
// Mandatory Name of the dish (EAT-API naming scheme) Must be available int the given mensa
string dish = 3;
// Optional JPEG image in Base64
bytes image = 4;
// Optional list of tag ratings add as many tags with a rating (1-5) of the list of dishRatingTags
repeated RatingTag rating_tags = 5;
// Optional comment (max 256 chars)
string comment = 7;
}
message ListAvailableDishTagsRequest {}
message ListAvailableDishTagsReply {
repeated TagsOverview rating_tags = 1;
}
message ListNameTagsRequest {}
message ListNameTagsReply {
repeated TagsOverview rating_tags = 1;
}
message ListAvailableCanteenTagsRequest {}
message ListAvailableCanteenTagsReply {
repeated TagsOverview rating_tags = 1;
}
message TagsOverview {
int32 tag_id = 1;
string de = 2;
string en = 3;
}
message RatingTag {
int64 tag_id = 1;
double points = 2;
}
message RatingTagNewRequest {
int32 tag_id = 1;
int32 points = 2;
}
message RatingTagResult {
int32 tag_id = 1;
double avg = 2;
double std = 3;
int32 min = 4;
int32 max = 5;
}
message ListCanteensRequest {}
message ListCanteensReply {
repeated Canteen canteen = 1;
}
message Canteen {
string id = 1;
string address = 2;
double longitude = 3;
double latitude = 4;
}
message ListDishesRequest {
string canteen_id = 1;
// >=2022 until the current year
int32 year = 2;
// Week of the dish.
// Must be in the range 1 - 52
int32 week = 3;
// Day of the week
// Days must be in the range 0 (Monday) - 4 (Friday)
int32 day = 4;
}
message ListDishesReply {
repeated string dish = 1;
}
message ListResponsiblePersonRequest {}
message ListResponsiblePersonReply {
repeated ResponsiblePerson responsible_person = 1;
}
message ResponsiblePerson {
string name = 1;
string telephone = 2;
string email = 3;
string faculty = 4;
string tum_id = 5;
}
message RoomInformationElement {
int32 room_id = 1;
string room_code = 2;
string building_nr = 3;
string arch_id = 4;
string info = 5;
string address = 6;
string purpose = 7;
string campus = 8;
string name = 9;
}
message ListMoreInformationRequest {}
message ListMoreInformationReply {
message MoreInformation {
string title = 1;
string category = 2;
string url = 3;
}
repeated MoreInformation infos = 1;
}
message ListOpeningTimesRequest {
string language = 1;
}
message ListOpeningTimesReply {
repeated OpeningTimesMsgElement facilities = 1;
}
message OpeningTimesMsgElement {
int32 id = 1;
string category = 2;
string name = 3;
string address = 4;
string room = 5;
string transport_station = 6;
string opening_hours = 7;
string infos = 8;
string url = 9;
string language = 10;
int32 reference_id = 11;
}
message GetUpdateNoteRequest {
int64 version = 1;
}
message GetUpdateNoteReply {
string message = 1;
string version_name = 2;
}
message ListMoviesRequest {
// the last Id you have requested. Use -1 to get all movies
int32 last_id = 1;
// the oldest time you want to be included in the response
google.protobuf.Timestamp oldest_date_at = 2;
}
message ListMoviesReply {
repeated Movie movies = 1;
}
message Movie {
// the id of the movie
int64 movie_id = 3;
// the date of the movie
google.protobuf.Timestamp date = 4;
// when the movie was created in OUR database
google.protobuf.Timestamp created = 5;
// title of the movie if available, empty otherwise
string title = 6;
// Where the movie is shown
string location = 18;
// release year of the movie if available, empty otherwise
string release_year = 7;
// runtime of the movie if available, empty otherwise
string runtime = 8;
// genre of the movie if available, empty otherwise
string genre = 9;
// director of the movie as by omdb(/tu-film), empty otherwise
string director = 10;
// actors of the movie as by omdb(/tu-film), empty otherwise
string actors = 11;
// imdb rating for the movie if available, empty otherwise
string imdb_rating = 12;
// short description of the movie including limited html tags (only <b>, <i>)
string description = 13;
// Where to find a trailer for this movie
string trailer_url = 15;
// Where to find additional information about this movie
string additional_information_url = 16;
reserved /*cover_name,cover_path = */ 1, 2;
// the id of the cover image
int64 cover_id = 14;
// Where to find a cover image for this movie
string cover_url = 17;
}
message CreateFeedbackRequest {
enum Recipient {
// Feedback for the TUM Dev Team
TUM_DEV = 0;
// Feedback for the general TUM Contact Form
TUM_CONTACT = 1;
}
// who is the feedback for
Recipient recipient = 1;
// the email address of the user
string from_email = 2;
// The actual message
string message = 3;
// Optional location which the user can choose (data protection) to attach or not
Coordinate location = 4;
// Optional os information which the user can choose (data protection) to attach or not
string os_version = 5;
// Optional app information which the user can choose (data protection) to attach or not
string app_version = 6;
// Optional file in Base64.
// Accepted file formats: jpeg, jpg, png, webp, md, txt, pdf
// Maximum file size 4MB as by Protobuf maximum per request message size
bytes attachment = 7;
}
message Coordinate {
double latitude = 1;
double longitude = 2;
}
message CreateFeedbackReply {}
message CreateFeedbackImageReply {
string status = 1;
}
message CreateFeedbackImageRequest {
int32 id = 1;
int32 image_nr = 2;
//todo where does the file come from?
}
message GetMemberRequest {
string lrz_id = 1;
}
message GetMemberReply {
string lrz_id = 1;
string name = 2;
int32 member_id = 3;
}
message GetUploadStatusRequest {
string lrz_id = 1;
}
message GetUploadStatusReply {
string fcm_token = 1;
string public_key = 2;
bool student_id = 3;
bool employee_id = 4;
bool external_id = 5;
}
message GetNotificationRequest {
int32 notification_id = 1;
}
message GetNotificationReply {
int32 notification_id = 1;
int32 type = 2;
string title = 3;
string description = 4;
string signature = 5;
}
message GetNotificationConfirmRequest {
int32 notification_id = 1;
}
message GetNotificationConfirmReply {
string status = 1;
}
message GetCanteenHeadCountRequest {
// The requested canteen ID
string canteen_id = 1;
}
message GetCanteenHeadCountReply {
// The absolut count of humans in the canteen. Only valid in case percent != -1.
uint32 count = 1;
// The maximum nunmber of humans in the canteen for the percent to be 100.00. Only valid in case percent != -1.
uint32 max_count = 2;
// Current capacity utilization of the canteen clamped to 0 and 100 or -1 in case no data is available.
float percent = 3;
// A time stamp indicating how up to date the response is. Only valid in case percent != -1.
google.protobuf.Timestamp timestamp = 4;
}