Get All User Tags
Endpoint: GET /api/user/{username}/tags
Parameters:
Parameter | Type | Description |
---|---|---|
username |
string |
Username of the user. (Required) |
Responses:
Status Code | Description |
---|---|
200 OK |
Successful response with a list of user tags. |
400 Bad Request |
Returned if the request method is not GET . |
401 Unauthorized |
Returned if the provided username does not exist. |
Description: This endpoint allows you to retrieve all tags associated with a specific user. It
requires a GET
request with the username
parameter in the URL. If the request is
successful, it returns a list of user tags in the response body.
Get All User Pomodoros Dates
Endpoint: GET /api/user/{username}/pomodoros/dates
Parameters:
Parameter | Type | Description |
---|---|---|
username |
string |
Username of the user. (Required) |
Responses:
Status Code | Description |
---|---|
200 OK |
Successful response with a list of pomodoro creation dates. |
400 Bad Request |
Returned if the request method is not GET . |
401 Unauthorized |
Returned if the provided username does not exist. |
Description: This endpoint allows you to retrieve the creation dates of all pomodoros associated
with a specific user. It requires a GET
request with the username
parameter in the URL. If
the request is successful, it returns a list of pomodoro creation dates in the response body.
Get All User Pomodoros
Endpoint: GET /api/user/{username}/pomodoros
Parameters:
Parameter | Type | Description |
---|---|---|
username |
string |
Username of the user. (Required) |
Responses:
Status Code | Description |
---|---|
200 OK |
Successful response with a list of user's pomodoros. |
400 Bad Request |
Returned if the request method is not GET . |
401 Unauthorized |
Returned if the provided username does not exist. |
Description: This endpoint allows you to retrieve all pomodoros associated with a specific user.
It requires a GET
request with the username
parameter in the URL. If the request is
successful, it returns a list of user's pomodoros in the response body.
Get All Pomodoros
Endpoint: GET /api/pomodoros
Responses:
Status Code | Description |
---|---|
200 OK |
Successful response with the total sum of pomodoros for all users. |
400 Bad Request |
Returned if the request method is not GET . |
Description: This endpoint allows you to retrieve the total sum of all pomodoros for all users. It
requires a GET
request. If the request is successful, it returns the total sum of pomodoros in the
response body.
Get User Settings
Endpoint: GET /api/settings/{token}
Parameters:
Parameter | Type | Description |
---|---|---|
token |
string |
User settings token. (Required) |
Responses:
Status Code | Description |
---|---|
200 OK |
Successful response with the user's settings. |
400 Bad Request |
Returned if the request method is not GET . |
401 Unauthorized |
Returned if the provided token is invalid. |
Description: This endpoint allows you to retrieve the settings of a specific user by providing
their user settings token in the URL. It requires a GET
request. If the request is successful, it
returns the user's settings in the response body.
Create a New Pomodoro
Endpoint: POST /api/pomodoros/create/{token}
Parameters:
Parameter | Type | Description |
---|---|---|
token |
string |
User settings token. (Required) |
Request Body:
The request body must be a JSON object with the following fields:
Field | Type | Description |
---|---|---|
tag |
string |
The tag for the new pomodoro. (e.g., "work") (Required) |
Responses:
Status Code | Description |
---|---|
201 Created |
Successful response indicating that the pomodoro has been created. |
400 Bad Request |
Returned if the request method is not POST or if the request body is missing or invalid. |
401 Unauthorized |
Returned if the provided token is invalid. |
422 Unprocessable Entity |
Returned if the pomodoro creation failed, typically due to overlapping with existing pomodoros. |
Description: This endpoint allows you to create a new pomodoro for a user by providing their user
settings token in the URL and specifying the pomodoro details in the request body. It requires a POST
request with a valid token and a JSON object containing the pomodoro's tag. The tag is converted to uppercase and
spaces are replaced with underscores. If the pomodoro creation is successful, it returns a 201 Created
response; otherwise, it returns an appropriate error response. If the pomodoro creation fails due to overlapping
with existing pomodoros, it returns a 422 Unprocessable Entity
response with an error message.
Update Pomodoro Tags
Endpoint: PATCH /api/pomodoros/tags/update/ {token}/{tag_to_replace}
Parameters:
Parameter | Type | Description |
---|---|---|
token |
string |
User settings token. (Required) |
tag_to_replace |
string |
The tag to be replaced. (Required) |
Request Body:
The request body must be a JSON object with the following field:
Field | Type | Description |
---|---|---|
tag |
string |
The new tag to replace the existing one. (e.g., "work") (Required) |
Responses:
Status Code | Description |
---|---|
201 Created |
Successful response indicating that the tags have been updated successfully. |
400 Bad Request |
Returned if the request method is not PATCH or if the request body is missing or invalid. |
401 Unauthorized |
Returned if the provided token is invalid. |
Description: This endpoint allows you to update the tags of all pomodoros associated with a
specific tag. To use this endpoint, send a PATCH
request with the user's settings token in the URL and
specify the tag to be replaced in the URL as well. Provide the new tag in the request body, which will replace the
existing tag in all relevant pomodoros. The tag values are converted to uppercase, and spaces are replaced with
underscores. If the update is successful, it returns a 201 Created
response; otherwise, it returns an
appropriate error response. If the provided token is invalid, it returns a 401 Unauthorized
response.
Update or Delete a Pomodoro
Endpoint: PUT /api/pomodoros/{token}/{pomodoro_id}
Endpoint: DELETE /api/pomodoros/{token}/{pomodoro_id}
Parameters:
Parameter | Type | Description |
---|---|---|
token |
string |
User settings token. (Required) |
pomodoro_id |
integer |
The ID of the pomodoro to update or delete. (Required) |
Request Body (PUT):
The request body must be a JSON object with the following field:
Field | Type | Description |
---|---|---|
tag |
string |
The new tag to update the pomodoro. (e.g., "work") (Required for PUT) |
Responses:
Status Code | Description |
---|---|
201 Created |
Returned when a pomodoro is successfully updated or deleted. |
400 Bad Request |
Returned if the request method is not PUT or DELETE or if the request body is
missing or invalid for the PUT request. |
401 Unauthorized |
Returned if the provided token is invalid. |
404 Not Found |
Returned if the pomodoro with the specified ID does not exist or if it does not belong to the user associated with the token. |
Description: This endpoint allows you to update or delete a specific pomodoro. To update a
pomodoro, send a PUT
request with the user's settings token in the URL and specify the pomodoro ID to
update. Provide the new tag in the request body, which will replace the existing tag of the pomodoro. The tag values
are converted to uppercase, and spaces are replaced with underscores. To delete a pomodoro, send a
DELETE
request with the user's settings token in the URL and specify the pomodoro ID to delete. If the
update or delete is successful, it returns a 201 Created
response; otherwise, it returns an appropriate
error response. If the provided token is invalid or the pomodoro does not exist or does not belong to the user, it
returns a 401 Unauthorized
or 404 Not Found
response, respectively.
Update User Settings
Endpoint: PUT /api/settings/{token}
Parameters:
Parameter | Type | Description |
---|---|---|
token |
string |
User settings token. (Required) |
Request Body (PUT):
The request body must be a JSON object with the following field:
Field | Type | Description |
---|---|---|
white_theme |
boolean |
The new theme setting for the user. Set to true for a white theme or false for a
dark theme. (Required for PUT) |
Responses:
Status Code | Description |
---|---|
201 Created |
Returned when the user settings are successfully updated. |
400 Bad Request |
Returned if the request method is not PUT or if the request body is missing or invalid for the
PUT request. |
401 Unauthorized |
Returned if the provided token is invalid. |
Description: This endpoint allows you to update the user settings for the theme. To update the
user settings, send a PUT
request with the user's settings token in the URL. Provide the new theme
setting in the request body as true
for a white theme or false
for a dark theme. If the
update is successful, it returns a 201 Created
response; otherwise, it returns an appropriate error
response. If the provided token is invalid, it returns a 401 Unauthorized
response.