def get_restaurants(name=None, opening_time=None, open_day=None, cuisine_type=None, menu=None): url = RESTAURANTS_SERVICE + "/restaurants?" if name is not None: url += "name=" + str(name) + "&" if opening_time is not None: url += "opening_time=" + str(opening_time) + "&" if open_day is not None: url += "open_day=" + str(open_day) + "&" if cuisine_type is not None: url += "cuisine_type=" + str(cuisine_type) + "&" if menu is not None: url += "menu=" + str(menu) + "&" if url[-1] == "&": url = url[:-1] if url[-1] == "?": url = url[:-1] return _get(url)
def get_bookings(user=None, rest=None, table=None, begin=None, end=None, begin_entrance=None, end_entrance=None): url = BOOKINGS_SERVICE+"bookings?" if user is not None: url += "user="******"&" if rest is not None: url += "rest="+str(rest)+"&" if table is not None: url += "table="+str(table)+"&" if begin is not None: url += "begin="+str(begin)+"&" if end is not None: url += "end="+str(end)+"&" if begin_entrance is not None: url += "begin_entrance="+str(begin_entrance)+"&" if end_entrance is not None: url += "end_entrance="+str(end_entrance)+"&" return _get(url)
def get_restaurant_tables(restaurant_id, capacity=None): url = RESTAURANTS_SERVICE + ('/restaurants/%d/tables?' % restaurant_id) if capacity is not None: url += "capacity=" + str(capacity) if url[-1] == "?": url = url[:-1] return _get(url)
def get_users(ssn=None, phone=None, email=None, is_positive=None): url = USER_SERVICE + '/users?' if ssn is not None: url += 'ssn=' + str(ssn) + '&' if phone is not None: url += 'phone=' + str(phone) + '&' if email is not None: url += 'email=' + str(email) + '&' if is_positive is not None: url += 'is_positive=True' return _get(url=url)
def get_a_booking(id): return _get(BOOKINGS_SERVICE+"bookings/"+str(id))
def get_user_contacts(user_id, begin=None, end=None): url = USER_SERVICE + '/users/' + str(user_id) + '/contacts?' if begin is not None and end is not None: url += 'begin=' + str(begin) + '&' url += 'end=' + str(end) return _get(url)
def get_user(user_id): url = USER_SERVICE + '/users/' + str(user_id) return _get(url=url)
def get_notification(id): return _get(f"{NOTIFICATIONS_SERVICE}/notifications/{id}")
def get_notifications(user_id, read=None): url = f"{NOTIFICATIONS_SERVICE}/notifications?user_id={user_id}" if read is not None: url += f"&read={'true' if read else 'false'}" return _get(url)
def get_restaurant_table(restaurant_id, table_id): url = RESTAURANTS_SERVICE + ('/restaurants/%d/tables/%d' % (restaurant_id, table_id)) return _get(url)
def get_restaurant_rating(restaurant_id): url = RESTAURANTS_SERVICE + ('/restaurants/%d/rate' % restaurant_id) return _get(url)