GTHC's (Game Tenting Help Center) API which creates endpoints with Google Cloud's Cloud Functions for Firebase 🔥.
GET http://us-central1-gthc-kville.cloudfunctions.net/user?id=amanmibra@gmail.com
Output:
{
"message": "Data successfully grabbed.",
"data": {
"createdAt": "2018-09-23T04:18:17.457Z",
"displayName": "Aman Ibrahim",
"email": "amanmibra@gmail.com",
"id": "amanmibra@gmail.com",
"isCaptain": true,
"isFirstSignIn": true,
"lastSignIn": "2018-09-23T04:18:17.457Z",
"name": "Aman Ibrahim",
"photo": "https://lh5.googleusercontent.com/-6spmS-s24is/AAAAAAAAAAI/AAAAAAAANRI/KyNLiyt_po0/photo.jpg",
"photoURL": "https://lh5.googleusercontent.com/-6spmS-s24is/AAAAAAAAAAI/AAAAAAAANRI/KyNLiyt_po0/photo.jpg",
"team": {
"captain": "amanmibra@gmail.com",
"name": "Tent 1",
"number": 1,
"type": "Black"
},
"test": "tests"
}
}
{
id: amanmibra@gmail.com, // it must be the email of the user, as that is its identifier [REQUIRED]
test: "test value", // one can add new value and it will be appended to the user document
isCaptain: false, // or they can replace existing fields within a document without replace and changing any other fields
}
PUT http://us-central1-gthc-kville.cloudfunctions.net/user
(use example body above in this request)
{
"message": "Put is successful.",
"data": {
"createdAt": "2018-09-23T04:18:17.457Z",
"email": "amanmibra@gmail.com",
"id": "amanmibra@gmail.com",
"isCaptain": false,
"isFirstSignIn": true,
"lastSignIn": "2018-09-23T04:18:17.457Z",
"name": "Aman Ibrahim",
"photoURL": "https://lh5.googleusercontent.com/-6spmS-s24is/AAAAAAAAAAI/AAAAAAAANRI/KyNLiyt_po0/photo.jpg",
"team": {
"captain": "amanmibra@gmail.com",
"name": "Tent 1",
"number": 1,
"type": "Black"
},
"test": "test value"
}
}
GET http://us-central1-gthc-kville.cloudfunctions.net/team?captain=amanmibra@gmail.com
{
"message": "Data successfully grabbed.",
"data": {
"captain": "amanmibra@gmail.com",
"id": "amanmibra@gmail.com",
"name": "Tent 1",
"number": "1",
"type": "Black"
}
}
PUT - meant to be used to add data to existing team documents, make sure to use a POST request if creating a new team
PUT https://us-central1-gthc-kville.cloudfunctions.net/team
{
captain: "amanmibra@gmail.com", // for teams, the identifier is the captain value [REQUIRED]
test: "test value"
}
{
"message": "Put is successful."
}
Note: There will be an update that will include the new team data after calling PUT, just like PUT /USER
.
{
name: "Team Jacob",
type: "Dirty Black",
number: 42,
captain: "jacob@gmail.com",
}
Note: name
, type
, number
, and captain
fields are all REQUIRED, otherwise, add any other fields as you wish. (At the moment those are the only required fields, but a field for passcode will be required eventually in the near future.)
{
"message": "Post is successful."
}
Note: Just like the PUT /team
request, there will more information added to the response time
PUT - https://us-central1-gthc-kville.cloudfunctions.net/shifts?captain=amanmibra@gmail.com
{
"message": "Data successfully grabbed.",
"data": [
{
"id": "3W0ZoJHSXD9WmeAcUJk8",
"captain": "amanmibra@gmail.com",
"endTime": "test",
"startTime": "test",
"users": [
"amanmibra@gmail.com"
]
},
...
]
}
GET - https://us-central1-gthc-kville.cloudfunctions.net/shift?id=3IgcGpynvKaxaACIxQOY
{
"message": "Data successfully grabbed.",
"data": {
"id": "3IgcGpynvKaxaACIxQOY",
"captain": "amanmibra",
"endTime": "tes",
"startTime": "tes",
"users": [
"amanmibra@gmail.com"
]
}
}
PUT - /shift
{
id: "3IgcGpynvKaxaACIxQOY", // this is the identfier, so this is [REQUIRED]
test: "test value",
}
{
"message": "Put is successful."
}
{
captain: "amanmibra@gmail.com",
startTime: DateObject,
endTime: DateObject,
users: [], // array of users identified by email/id
}
Note: At the moment, the captain
, startTime
, endTime
, and users
fields are all REQUIRED.
{
"message": "Post is successful."
}
Note: This will be updated to include shift data.