Events
note
use this link for all endpoints
https://us-central1-calmevents-7de4e.cloudfunctions.net/api/v1/
note
status codes
200 ==> Successful
Authentication
login
use post* endpoint
/login
request body
{
"email": "example@example.com",
"password": "your password"
}
signup
post*
/signup
request body
{
"email": "example@example.com",
"password": "your password"
}
get data
get*
/user
params required
{
"id": "user_id"
}
update
soon
Events
create
*post
/create
note
fields required
{
title,
description,
date,
time,
dressCode,
price,
maxAttendees,
addr,
city,
country,
}
all
*get
/all
single
*get
/event
params required
{
"id": "event id"
}
Models
user
class UserModel {
String id;
String username;
String firstName;
String lastName;
String phoneNumber;
String email;
String password;
String dateOfBirth;
String profilePicture;
String imageId;
String role;
String defaultCard;
String status;
String currentSubscription;
String subscriptionDateStarted;
String subscriptionDateEnded;
bool hasActiveSubscription;
bool isDeleted;
String facebook;
String instagram;
String twitter;
String passwordResetToken;
String passwordResetExpires;
UserModel(
{this.username,
this.firstName,
this.lastName,
this.phoneNumber,
this.email,
this.password,
this.dateOfBirth,
this.profilePicture,
this.imageId,
this.role,
this.defaultCard,
this.status,
this.currentSubscription,
this.subscriptionDateStarted,
this.subscriptionDateEnded,
this.hasActiveSubscription,
this.isDeleted,
this.facebook,
this.instagram,
this.twitter,
this.passwordResetToken,
this.passwordResetExpires});
UserModel.fromJson(Map<String, dynamic> json) {
id =json["id"];
username = json['username'];
firstName = json['firstName'];
lastName = json['lastName'];
phoneNumber = json['phoneNumber'];
email = json['email'];
password = json['password'];
dateOfBirth = json['dateOfBirth'];
profilePicture = json['profilePicture'];
imageId = json['imageId'];
role = json['role'];
defaultCard = json['defaultCard'];
status = json['status'];
currentSubscription = json['currentSubscription'];
subscriptionDateStarted = json['subscriptionDateStarted'];
subscriptionDateEnded = json['subscriptionDateEnded'];
hasActiveSubscription = json['hasActiveSubscription'];
isDeleted = json['isDeleted'];
facebook = json['facebook'];
instagram = json['instagram'];
twitter = json['twitter'];
passwordResetToken = json['passwordResetToken'];
passwordResetExpires = json['passwordResetExpires'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['username'] = this.username;
data['firstName'] = this.firstName;
data['lastName'] = this.lastName;
data['phoneNumber'] = this.phoneNumber;
data['email'] = this.email;
data['password'] = this.password;
data['dateOfBirth'] = this.dateOfBirth;
data['profilePicture'] = this.profilePicture;
data['imageId'] = this.imageId;
data['role'] = this.role;
data['defaultCard'] = this.defaultCard;
data['status'] = this.status;
data['currentSubscription'] = this.currentSubscription;
data['subscriptionDateStarted'] = this.subscriptionDateStarted;
data['subscriptionDateEnded'] = this.subscriptionDateEnded;
data['hasActiveSubscription'] = this.hasActiveSubscription;
data['isDeleted'] = this.isDeleted;
data['facebook'] = this.facebook;
data['instagram'] = this.instagram;
data['twitter'] = this.twitter;
data['passwordResetToken'] = this.passwordResetToken;
data['passwordResetExpires'] = this.passwordResetExpires;
return data;
}
}
event
class EventModel {
String title;
String description;
String location;
Address address;
String date;
String time;
List<String> images;
String dressCode;
int price;
int maxAttendees;
List<Null> attendees;
List<Null> updates;
EventModel(
{this.title,
this.description,
this.location,
this.address,
this.date,
this.time,
this.images,
this.dressCode,
this.price,
this.maxAttendees,
this.attendees,
this.updates});
EventModel.fromJson(Map<String, dynamic> json) {
title = json['title'];
description = json['description'];
location = json['location'];
address =
json['address'] != null ? new Address.fromJson(json['address']) : null;
date = json['date'];
time = json['time'];
images = json['images'].cast<String>();
dressCode = json['dressCode'];
price = json['price'];
maxAttendees = json['maxAttendees'];
if (json['attendees'] != null) {
attendees = new List<Null>();
json['attendees'].forEach((v) {
attendees.add(new Null.fromJson(v));
});
}
if (json['updates'] != null) {
updates = new List<Null>();
json['updates'].forEach((v) {
updates.add(new Null.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['title'] = this.title;
data['description'] = this.description;
data['location'] = this.location;
if (this.address != null) {
data['address'] = this.address.toJson();
}
data['date'] = this.date;
data['time'] = this.time;
data['images'] = this.images;
data['dressCode'] = this.dressCode;
data['price'] = this.price;
data['maxAttendees'] = this.maxAttendees;
if (this.attendees != null) {
data['attendees'] = this.attendees.map((v) => v.toJson()).toList();
}
if (this.updates != null) {
data['updates'] = this.updates.map((v) => v.toJson()).toList();
}
return data;
}
}
class Address {
String address;
String city;
String country;
Address({this.address, this.city, this.country});
Address.fromJson(Map<String, dynamic> json) {
address = json['address'];
city = json['city'];
country = json['country'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['address'] = this.address;
data['city'] = this.city;
data['country'] = this.country;
return data;
}
}