aboutsummaryrefslogtreecommitdiff
path: root/proto/mi.proto
blob: 96c7f7f9c7bfa6abe43433b8000a45f5c9021b6f (plain)
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
syntax = "proto3";
package within.website.x.mi;
option go_package = "within.website/x/proto/mi";

import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";

service SwitchTracker {
  rpc Members(google.protobuf.Empty) returns (MembersResp);
  rpc WhoIsFront(google.protobuf.Empty) returns (FrontChange);
  rpc Switch(SwitchReq) returns (SwitchResp);
  rpc GetSwitch(GetSwitchReq) returns (FrontChange);
  rpc ListSwitches(ListSwitchesReq) returns (ListSwitchesResp);
}

message MembersResp {
  repeated Member members = 1; // required
}

message Member {
  int32 id = 1;          // required
  string name = 2;       // required
  string avatar_url = 3; // required
}

message Switch {
  string id = 1;         // required
  int32 member_id = 2;   // required
  string started_at = 3; // RFC 3339, required
  string ended_at = 4;   // RFC 3339, optional if switch is current
}

message SwitchReq {
  string member_name = 1; // required
}

message SwitchResp {
  Switch old = 1;     // required
  Switch current = 2; // required
}

message GetSwitchReq {
  string id = 1; // required
}

message FrontChange {
  Switch switch = 1; // required
  Member member = 2; // required
}

message ListSwitchesReq {
  int32 count = 1; // required
  int32 page = 2;  // required
}

message ListSwitchesResp { repeated FrontChange switches = 1; }

service POSSE {
  rpc RefreshBlog(google.protobuf.Empty) returns (google.protobuf.Empty);
}

// Event represents an event that Xe will be attending.
message Event {
  // The name of the event
  string name = 1;
  // The URL for the event
  string url = 2;
  // The day the event starts
  google.protobuf.Timestamp start_date = 3;
  // The day the event ends
  google.protobuf.Timestamp end_date = 4;
  // The location of the event (human-readable)
  string location = 5;
  // Id of the event
  int32 id = 6;
  // The description of the event
  string description = 7;
  // If the event is syndicated to Flyght Tracker
  bool syndicate = 8;
}

// A feed of events, result from mi query.
message EventFeed {
  // The events in the feed
  repeated Event events = 1;
}

// Events lets users fetch the current feed of events that Xe will be attending.
service Events {
  // Get fetches the current feed of upcoming events.
  rpc Get(google.protobuf.Empty) returns (EventFeed);
  // Add adds an event to the feed.
  rpc Add(Event) returns (google.protobuf.Empty);
  // Remove removes an event from the feed.
  rpc Remove(Event) returns (google.protobuf.Empty);
}