parKING is a desktop app that helps drivers choose the best place to park via the Command Line Interface (CLI). parKING allows users to search, save and look at car park availability information at a glance, while interfacing with LTA’s real-time API.
Below are my contribution to the project:
Api
class: implemented the class that communicates with the LTA data mall API services, to receive the most updated
carpark availability slots whenever we need it. The Api
class supports asynchronous requests to prevent speed
bottlenecks in the user side and also supports pagination fetch (where we can only receive at most 500 data set at once)
. The class is also responsible for ensuring any bad responses from the external API is handled (for example: no internet,
API service unavailable, wrong credentials). Upon successful retrieval of the datas, the class is responsible for
concatenating the different datas from different fetches, and package it into a readable format for the parser to read
through the local data file.update
and auth
commands from the parser. Since we are working with an API, we
allow user to use their own API key to use our services. However, for the purposes of CS2113, we also provide a default
key for testing purposes. This API key is stored inside the source code (assuming a normal user with no access to our
source code) and can be invoked by calling auth default
. The update
command does the entire fetching sequence and
rewrite the entire local data file.jansi
to enable this behaviour where we can show
red colour output for warnings and errors, green colour for successful messages and many more to highlight differences.auth
commands and update
command.Api
, update
which includes class diagram and sequence diagram to explain
how the api is loaded and how the data fetching process is implemented.