-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage_models.py
208 lines (177 loc) · 8.01 KB
/
message_models.py
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
"""
message_models.py -- Udacity conference server-side Python App Engine
HTTP controller handlers for memcache & task queue access
created by @Robert_Avram on 2015 June 6
"""
import endpoints
from protorpc import messages
from protorpc import message_types
class ProfileMiniForm(messages.Message):
"""ProfileMiniForm -- update Profile form message"""
displayName = messages.StringField(1)
teeShirtSize = messages.EnumField('TeeShirtSize', 2)
class ProfileForm(messages.Message):
"""ProfileForm -- Profile outbound form message"""
displayName = messages.StringField(1)
mainEmail = messages.StringField(2)
teeShirtSize = messages.EnumField('TeeShirtSize', 3)
conferenceKeysToAttend = messages.StringField(4, repeated=True)
class StringMessage(messages.Message):
"""StringMessage-- outbound (single) string message"""
data = messages.StringField(1, required=True)
class BooleanMessage(messages.Message):
"""BooleanMessage-- outbound Boolean value message"""
data = messages.BooleanField(1)
class ConferenceSessionForm(messages.Message):
'''ConferenceSession - ConferenceSessions in/outbound form messages'''
name = messages.StringField(1)
type = messages.StringField(2)
duration = messages.IntegerField(3)
startDate = messages.StringField(4)
startTime = messages.StringField(5)
highlights = messages.StringField(6)
speakerKey = messages.StringField(7)
class ConferenceSessionFormOut(messages.Message):
'''ConferenceSession - ConferenceSessions in/outbound form messages'''
name = messages.StringField(1)
type = messages.StringField(2)
duration = messages.IntegerField(3)
startDate = messages.StringField(4)
startTime = messages.StringField(5)
highlights = messages.StringField(6)
speakerKey = messages.StringField(7)
speakerName = messages.StringField(8)
sessionKey = messages.StringField(9)
confKey = messages.StringField(10)
class ConferenceSessionForm_search(messages.Message):
'''ConferenceSession - ConferenceSessions in/outbound form messages'''
websafeSessionKey = messages.StringField(1)
name = messages.StringField(2)
type = messages.StringField(3)
duration = messages.IntegerField(4) # in Minutes
startDate = messages.StringField(5)
startTime = messages.StringField(6)
highlights = messages.StringField(7)
speakerName = messages.StringField(8)
conferenceName = messages.StringField(9)
conferenceTopics = messages.StringField(10)
conferenceCity = messages.StringField(11)
conferenceDescription = messages.StringField(12)
class ConferenceSessionForms(messages.Message):
"""ConferenceSessionForms -- multiple ConferenceSession form message"""
items = messages.MessageField(ConferenceSessionFormOut, 1, repeated=True)
class ConferenceSessionForms_search(messages.Message):
"""ConferenceSessionForms -- multiple ConferenceSession form message"""
items = messages.MessageField(ConferenceSessionForm_search, 1, repeated=True)
class ConferenceSpeakerForm(messages.Message):
'''Conference Speaker - Speaker Profile form message'''
displayName = messages.StringField(1)
class ConferenceSpeakerFormOut(messages.Message):
'''Conference Speaker - Speaker Profile form message'''
displayName = messages.StringField(1)
websafekey = messages.StringField(2)
class ConferenceSpeakerForms(messages.Message):
'''Conference Speaker - Speaker Profile form message'''
items = messages.MessageField(ConferenceSpeakerFormOut, 1, repeated=True)
class ConferenceForm(messages.Message):
"""ConferenceForm -- Conference outbound form message"""
name = messages.StringField(1)
description = messages.StringField(2)
organizerUserId = messages.StringField(3)
topics = messages.StringField(4, repeated=True)
city = messages.StringField(5)
startDate = messages.StringField(6) #DateTimeField()
month = messages.IntegerField(7)
maxAttendees = messages.IntegerField(8)
seatsAvailable = messages.IntegerField(9)
endDate = messages.StringField(10) #DateTimeField()
websafeKey = messages.StringField(11)
organizerDisplayName = messages.StringField(12)
class ConferenceForms(messages.Message):
"""ConferenceForms -- multiple Conference outbound form message"""
items = messages.MessageField(ConferenceForm, 1, repeated=True)
class WishListForm(messages.Message):
''' WhishListForms - repr conferences and sessionslists '''
conferences = messages.MessageField(ConferenceForms, 1)
sessions = messages.MessageField(ConferenceSessionForms, 2)
class TeeShirtSize(messages.Enum):
"""TeeShirtSize -- t-shirt size enumeration value"""
NOT_SPECIFIED = 1
XS_M = 2
XS_W = 3
S_M = 4
S_W = 5
M_M = 6
M_W = 7
L_M = 8
L_W = 9
XL_M = 10
XL_W = 11
XXL_M = 12
XXL_W = 13
XXXL_M = 14
XXXL_W = 15
class ConferenceQueryForm(messages.Message):
"""ConferenceQueryForm -- Conference query inbound form message"""
field = messages.StringField(1)
operator = messages.StringField(2)
value = messages.StringField(3)
class ConferenceQueryForms(messages.Message):
"""ConferenceQueryForms -- multiple ConferenceQueryForm inbound form message"""
filters = messages.MessageField(ConferenceQueryForm, 1, repeated=True)
class FeaturedSpeakerForm(messages.Message):
"""ConferenceQueryForms -- multiple ConferenceQueryForm inbound form message"""
name = messages.StringField(1)
conference = messages.StringField(2)
conference_location = messages.StringField(3)
sessions = messages.StringField(4, repeated=True)
# - - - - - - - - - - - Resource Containers - - - - - - - - - - - - - - - - - - - - - - -
CONF_GET_REQUEST = endpoints.ResourceContainer(
message_types.VoidMessage,
websafeConferenceKey=messages.StringField(1),
)
CONF_POST_REQUEST = endpoints.ResourceContainer(
ConferenceForm,
websafeConferenceKey=messages.StringField(1),
)
# - - - - - - - - - - - - added by @Robert_Avram - - - - - - - - - - - - - - - - - -
SPEAKER_SESSION_GET_REQUEST = endpoints.ResourceContainer(
message_types.VoidMessage,
websafeSpeakerKey=messages.StringField(1),
)
GET_SESSIONS_BY_SPEAKER_CONFERENCE = endpoints.ResourceContainer(
websafeSpeakerKey=messages.StringField(1),
websafeConferenceKey=messages.StringField(2),
)
SESSION_GET_REQUEST = endpoints.ResourceContainer(
message_types.VoidMessage,
websafeSessionKey=messages.StringField(1),
)
REMOVE_SESSION_POST_REQUEST = endpoints.ResourceContainer(
websafeSessionKey=messages.StringField(1),
removeConference=messages.BooleanField(2)
)
GET_SPEAKERS_BY_NAME = endpoints.ResourceContainer(
displayName=messages.StringField(1),
)
SESSION_POST_REQUEST = endpoints.ResourceContainer(
ConferenceSessionForm,
websafeConferenceKey=messages.StringField(1),
)
CONF_SESSION_TYPE_REQUEST = endpoints.ResourceContainer(
websafeConferenceKey=messages.StringField(1),
typeOfSession=messages.StringField(2, repeated=True)
)
QUERY_PROBLEM = endpoints.ResourceContainer(
afterTime=messages.IntegerField(1),
exclude=messages.StringField(2, repeated=True)
)
QUERY_PROBLEM2 = endpoints.ResourceContainer(
after_time=messages.StringField(1),
before_time=messages.StringField(2),
exclude_types=messages.StringField(3, repeated=True),
include_types=messages.StringField(4, repeated=True),
search_highlights=messages.StringField(5),
search_general=messages.StringField(6)
)
# - - - - - - - - - - - - end added_by @Robert_Avram - - - - - - - - - - - - - - - - - -