Giter Site home page Giter Site logo

galeforce-functions's Introduction

galeforce-functions

Setup and information

Launch firebase emulator with firebase emulators:start

The emulator dashboard will open on http://localhost:4000

Send test requests to http://localhost:5001/savedblocks/us-central1/galeforce/endpoint

Deploy to firebase with firebase deploy --only functions

Live function at https://us-central1-savedblocks.cloudfunctions.net/galeforce/endpoint


Endpoints

Create Session

Creates a new session in Firestore. This is the only time session_secret will be retuned.

POST /createsession

Response:

{
    "session_code": "ABCDE",
    "session_secret": "12345"
}

Session

Returns all public information for a session.

GET /session

Request:

?session_code=ABCDE

Response:

{
    "auto_play": false,
    "mute": false,
    "player_locations": [],
    "screen_url": "https://docs.google.com",
    "session_code": "ABCDE",
    "teams": [
        {
            "completed_missions": [],
            "control_stage": "Learn to Drive",
            "team_name": "team1",
            "training_stage": "Learn to Drive"
        },
        {
            "completed_missions": [],
            "control_stage": "Learn to Drive",
            "team_name": "team2",
            "training_stage": "Learn to Drive"
        },
        {
            "completed_missions": [],
            "control_stage": "Learn to Drive",
            "team_name": "team3",
            "training_stage": "Learn to Drive"
        },
        {
            "completed_missions": [],
            "control_stage": "Learn to Drive",
            "team_name": "team4",
            "training_stage": "Learn to Drive"
        }
    ],
    "unlock_map": false
}

Settings

Set settings for a session. Anything you put in the settings object will overwrite the settings for that group

POST /settings

Body:

{
    "session_code": "ABCDE",
    "session_secret": "12345",
    "settings": {
        "auto_play": true,
        "mute": true,
        ...
    }
}

Response:

{
    "auto_play": true,
    "mute": true,
    ...
}

or

{
    "error": "error"
}

Player location

Sets the location of a player

POST /playerlocation

Request:

?session_code=ABCDE&player_name=Jacob&location=ControlRoom

Response:

[
    {
        "location": "TrainingComplex",
        "player_name": "Jacob",
        "timestamp": 1630331133628
    },
    {
        "location": "ControlRoom",
        "player_name": "Sam",
        "timestamp": 1630331092038
    }
]

or

{
    "error": "error"
}

Complete Mission

Sets the location of a player

POST /completemission

Request:

?session_code=ABCDE&team_name=team1&mission_id=A1

Response:

{
    "training_stage": "Learn to Drive",
    "team_name": "team4",
    "completed_missions": [
        "B3"
    ],
    "control_stage": "Learn to Drive"
}

or

{
    "error": "error"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.