PHP Class WebsiteAPI, Halite

Inheritance: extends API
Show file Open project: HaliteChallenge/Halite Class Usage Examples

Public Methods

Method Description
__construct ( $request )

Protected Methods

Method Description
announcement ( ) * Announcement Endpoint
botFile ( ) * Bot File Endpoint
email ( ) * Email Endpoint
emailList ( ) * Email List Endpoint
errorLog ( ) * Error Log Endpoint
forums ( ) * Forums Endpoint
game ( ) * Game Endpoint
history ( ) * User History Endpoint
notification ( ) * User Notification Endpoint
session ( ) * Session Endpoint
stats ( ) * Stats endpoint
user ( ) * User Endpoint
worker ( ) * Worker Endpoint

Private Methods

Method Description
getForumsID ( $userID ) Gets the id of one of our users in the discourse forums system
getLoggedInUser ( )
getOrganizationForEmail ( $email )
getUsers ( $query, $privateInfo = false )
isLoggedIn ( )
logOutForums ( $forumsID ) Log a users out of forums.halite.io
sanitizeHTTPParameters ( ) * Apply MYSQL sanitization to all incoming parameters

Method Details

__construct() public method

public __construct ( $request )

announcement() protected method

Annoucements are used as 'news blasts' without requiring email. An alert with the annoucement's body and header is showed to users. Once it has been closed, it is never shown to that user again
protected announcement ( )

botFile() protected method

Handles the user's submission of a new bot
protected botFile ( )

email() protected method

Hitting this endpoint allows a user to handle the choosing of their email.
protected email ( )

emailList() protected method

Hitting this endpoint allows a user to subscribe and unsubscribe from all Halite emails.
protected emailList ( )

errorLog() protected method

When a users times-out or errors during a game of Halite on our server, we store their stdout and stderr output and make it available to them. Users may only see **their** error logs.
protected errorLog ( )

forums() protected method

Handle the Discourse forums (forums.halite.io) single sign on authentication.
protected forums ( )

game() protected method

Games are continuously run on our servers and exposed on our website
protected game ( )

history() protected method

We store the a history of user's bot submissions. This mitigates the 'stealth' submission problem, where users submit a bot, wait for their rank to stabilize, and take it down for the sake of secrecy.
protected history ( )

notification() protected method

Allows the downloading of all of the notifications a user has recieved over email. Notifications include "Compilation Success", "Bot received", etc
protected notification ( )

session() protected method

Encapsulates the logged in user's info
protected session ( )

stats() protected method

Provides a number of statistics about the competition, which would be expensive or impossible to determine using our generic endpoints.
protected stats ( )

user() protected method

Encapsulates user information.
protected user ( )

worker() protected method

Bots are compiled and run in games by a decentralized network of 'worker' servers. A few stats about each worker are recorded by our 'manager' server. These stats are exposed on our status page.
protected worker ( )