hackclub / hack-hour

Every Hour = More Power. Keep track of each hour of work you get done on your project.
https://hackhour.hackclub.com
12 stars 15 forks source link
hackclub

Hack Hour (Arcade)

Hack Hour is a project tracker & time management tool for hacking on projects. It's currently being used to track hours as a part of Hack Club's Arcade and is on slack as @hakkuun (but her name is heidi 😊).

API

Note: There is no guarantee for the reliability of the API. If data is lost and/or is not registered for Arcade, there's not much we can do - use at your own risk.

GET /ping

Returns with pong. Check if the thing is alive

GET /status

Get specific details on the status of hack hour (heidi)

Example Response:

{
    "activeSessions": -1,
    "airtableConnected": false,
    "slackConnected": false,
}

GET /api/clock/:slackId

Depreciated. Use /api/session/:slackId instead.

Responds with unix timestamp of the expected end time of the current session for the user.

GET /api/session/:slackId

Gets the latest session for the user.

Example Response:

{
    "ok": true,
    "data": {
        "id": "slackId",
        "createdAt": "2024-06-23T02:49:17.900Z",
        "time": 60,
        "elapsed": 12,
        "remaining": 48,
        "endTime": "2024-06-23T03:08:00.000Z",
        "goal": "No Goal",
        "paused": true,
        "completed": false,
        "messageTs": "messageTs",
    }
}

GET /api/stats/:slackId

Gets the stats for the user.

Example Response:

{
    "ok": true,
    "data": {
        "sessions": 0,
        "total": 0,
    }
}

GET /api/goals/:slackId

Gets the goals for the user.

Example Response:

{
    "ok": true,
    "data": {
        "goals": [
            {
                "name": "No Goal",
                "minutes": 0,
            }
        ]
    }
}

GET /api/history/:slackId

Gets the history for the user.

Example Response:

{
    "ok": true,
    "data": [
        {
            "createdAt": "2024-06-23T05:09:04.105Z",
            "time": 60,
            "elapsed": 23,
            "goal": "No Goal",
            "ended": false,
            "work": "123"
        }
    ]
}

POST /api/start

Starts a new session for the user.

Requires a JSON body with the following fields:

Requires an authorization header with the api key, as such: Authorization: Bearer <apikey>

Example Response:

{
    "ok": true,
    "data": {
        "id": "sessionId",
        "slackId": "slackId",
        "createdAt": "createdAt",
    }
}

POST /api/pauses

Pauses or resumes the current session for the user, depending on the current state.

Requires an authorization header with the api key, as such: Authorization: Bearer <apikey>

Example Response:

{
    "ok": true,
    "data": {
        "id": "sessionId",
        "slackId": "slackId",
        "createdAt": "createdAt",
        "paused": true,
    }
}

POST /api/cancel

Cancels the current session for the user.

Requires an authorization header with the api key, as such: Authorization Bearer <apikey>

Example Response:

{
    "ok": true,
    "data": {
        "id": "sessionId",
        "slackId": "slackId",
        "createdAt": "createdAt",
    }
}