### Clone and Configure Hackatime Project Source: https://github.com/hackclub/hackatime/blob/main/README.md This snippet demonstrates the initial steps to clone the Hackatime repository and set up the local environment by copying the example environment file. ```sh # Set it up... $ git clone https://github.com/hackclub/hackatime && cd hackatime # Set your config $ cp .env.example .env ``` -------------------------------- ### Example of Successful Hackatime API Response Source: https://github.com/hackclub/hackatime/blob/main/docs/api/authentication.md This is an example of the JSON response you can expect when successfully querying the Hackatime API with a valid API key. It includes total recorded time and arrays for languages and projects. ```json { "total_seconds": 12345, "languages": [...], "projects": [...] } ``` -------------------------------- ### Install Hack Club Terminal-Wakatime Plugin (Bash) Source: https://github.com/hackclub/hackatime/blob/main/docs/editors/terminal.md This command installs the terminal-wakatime plugin for Hackatime. It automatically configures the plugin for bash, zsh, or fish shells and uses your existing Hackatime configuration. Ensure you have completed the Hackatime setup page before running this command. ```bash curl -fsSL https://hack.club/terminal-wakatime.sh | bash ``` -------------------------------- ### Configure Hackatime in .wakatime.cfg Source: https://github.com/hackclub/hackatime/blob/main/docs/getting-started/quick-start.md This configuration snippet shows how to manually set up the Hackatime client by editing the `~/.wakatime.cfg` file. It specifies the API URL and your unique API key for Hackatime, along with a heartbeat rate limit. ```ini [settings] api_url = https://hackatime.hackclub.com/api/hackatime/v1 api_key = YOUR_API_KEY_HERE heartbeat_rate_limit_seconds = 30 ``` -------------------------------- ### Build and Run Hackatime with Docker Compose Source: https://github.com/hackclub/hackatime/blob/main/README.md This snippet details the commands to build and run the Hackatime project using Docker Compose. It includes steps for setting up the database schema, seeding data, and starting the development server, as well as accessing an interactive Rails console. ```sh $ docker compose run --service-ports web /bin/bash # Now, setup the database using: app# bin/rails db:create db:schema:load db:seed # Now start up the app: app# bin/dev # This hosts the server on your computer w/ default port 3000 # Want to do other things? app# bin/rails c # start an interactive irb! app# bin/rails db:migrate # migrate the database ``` -------------------------------- ### Perform Initial Docker Development Setup Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Execute commands for the initial setup of the Rails development environment within Docker. This includes creating the database, loading the schema, and seeding initial data. ```bash docker compose run web bin/rails db:create db:schema:load db:seed ``` -------------------------------- ### Reset Hackatime Database within Docker Source: https://github.com/hackclub/hackatime/blob/main/README.md This snippet provides the commands to completely reset and re-seed the Hackatime database when running inside the Docker container. This is useful for starting with a clean slate. ```sh # inside the docker container, reset the db app# $ bin/rails db:drop db:create db:migrate db:seed ``` -------------------------------- ### Install Unity Hackatime Plugin from Git URL Source: https://github.com/hackclub/hackatime/blob/main/docs/editors/unity.md This code snippet shows the Git URL used to install the Hackatime plugin for Unity via the Package Manager. It points to a specific GitHub repository and branch/tag for the package. ```giturl https://github.com/daniel-geo/unity-hackatime.git#package ``` -------------------------------- ### Install vim-wakatime Plugin and Restart Vim Source: https://github.com/hackclub/hackatime/blob/main/docs/editors/vim.md This command-line snippet adds the 'vim-wakatime' plugin to your .vimrc file and then attempts to install it and restart Vim. This is a quick way to set up the plugin if you prefer not to manually edit the .vimrc file. ```bash echo "Plugin 'wakatime/vim-wakatime'" >> ~/.vimrc && vim +PluginInstall ``` -------------------------------- ### Swift Playgrounds Wakatime Debug Message Source: https://github.com/hackclub/hackatime/blob/main/docs/editors/swift-playgrounds.md This snippet represents a debug message indicating a successful request received by the Wakatime application. It's part of the confirmation process to ensure the app is tracking and sending data correctly. No specific dependencies are mentioned, and the output is a console log. ```swift DEBUG: 202 Request Received ``` -------------------------------- ### Start Rails Development Server Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Launch the Rails development server on all available network interfaces within the Docker environment. This is useful for local development and testing. ```bash docker compose run --service-ports web rails s -b 0.0.0.0 ``` -------------------------------- ### Fetch Coding Stats using Curl Source: https://github.com/hackclub/hackatime/blob/main/docs/api/overview.md An example using curl to fetch your coding statistics from the Hackatime API. This command utilizes the Authorization header for authentication and targets the `/stats` endpoint. ```bash curl -H "Authorization: Bearer YOUR_API_KEY" \ https://hackatime.hackclub.com/api/v1/stats ``` -------------------------------- ### Environment Variable Configuration for Hackatime Source: https://github.com/hackclub/hackatime/blob/main/README.md This snippet shows the essential environment variables required for local development, including database connection strings and secret keys. It highlights the need to generate certain keys and advises on disabling email sending during local development. ```env # Database configurations - these work with the Docker setup DATABASE_URL=postgres://postgres:secureorpheus123@db:5432/app_development WAKATIME_DATABASE_URL=postgres://postgres:secureorpheus123@db:5432/app_development SAILORS_LOG_DATABASE_URL=postgres://postgres:secureorpheus123@db:5432/app_development # Generate these with `rails secret` or use these for development SECRET_KEY_BASE=alallalalallalalallalalalladlalllalal ENCRYPTION_PRIMARY_KEY=32characterrandomstring12345678901 ENCRYPTION_DETERMINISTIC_KEY=32characterrandomstring12345678902 ENCRYPTION_KEY_DERIVATION_SALT=16charssalt1234 ``` -------------------------------- ### Get User's Overall Coding Statistics Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Fetches the overall coding statistics for the authenticated user. This provides a summary of total coding time and language/project breakdowns. ```bash GET /api/v1/stats ``` -------------------------------- ### Include Only Projects with WakaTime Project File Configuration Source: https://github.com/hackclub/hackatime/blob/main/docs/getting-started/configuration.md Instruct WakaTime to only track projects that contain a .wakatime-project file. This is achieved by setting the `include_only_with_project_file` option to `true` within the .wakatime-project configuration file. ```ini [settings] include_only_with_project_file = true ``` -------------------------------- ### Get Your Coding Stats Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Retrieves your overall coding statistics. ```APIDOC ## GET /api/v1/stats ### Description Get how much you've coded overall. ### Method GET ### Endpoint /api/v1/stats ### Response #### Success Response (200) - **user** (string) - Your username. - **total_seconds** (number) - Total seconds coded. - **languages** (array) - Array of objects, each containing language name and total seconds coded in that language. - **projects** (array) - Array of objects, each containing project name and total seconds coded in that project. #### Response Example ```json { "user": "username", "total_seconds": 86400, "languages": [ { "name": "Python", "seconds": 43200 }, { "name": "JavaScript", "seconds": 28800 } ], "projects": [{ "name": "my-app", "seconds": 36000 }] } ``` ``` -------------------------------- ### Hackatime API Error Response: Invalid API Key Source: https://github.com/hackclub/hackatime/blob/main/docs/api/authentication.md This JSON snippet illustrates the error message returned by the Hackatime API when an invalid or incorrect API key is provided in the request. ```json { "error": "Invalid API key" } ``` -------------------------------- ### Exclude Files in WakaTime Project Configuration Source: https://github.com/hackclub/hackatime/blob/main/docs/getting-started/configuration.md Configure WakaTime to ignore specific files and directories by creating a .wakatime-project file. This file uses an INI format to specify patterns for exclusion. It's useful for preventing tracking of build artifacts, dependencies, or temporary files. ```ini [settings] exclude = /node_modules/ /vendor/ *.log /temp/ ``` -------------------------------- ### Access Hackatime API Stats with URL Parameter Source: https://github.com/hackclub/hackatime/blob/main/docs/api/authentication.md This snippet shows an alternative method for authenticating with the Hackatime API by including the API key directly in the URL as a query parameter. While functional, this method is less secure than using the Authorization header. ```bash curl "https://hackatime.hackclub.com/api/v1/stats?api_key=YOUR_API_KEY" ``` -------------------------------- ### Get Your Raw Activity Data Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Retrieves your raw coding activity data, including timestamps and duration of coding sessions. ```APIDOC ## GET /api/v1/my/heartbeats ## GET /api/v1/my/heartbeats/most_recent ### Description Get the raw data about when you coded. ### Method GET ### Endpoint /api/v1/my/heartbeats /api/v1/my/heartbeats/most_recent ### Parameters #### Query Parameters - **start** (string) - Optional - Start date for filtering activity (e.g., 'YYYY-MM-DD'). - **end** (string) - Optional - End date for filtering activity (e.g., 'YYYY-MM-DD'). - **limit** (integer) - Optional - Maximum number of results to return (max 100). ### Request Example ```bash curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://hackatime.hackclub.com/api/v1/my/heartbeats?limit=10" ``` ``` -------------------------------- ### Add vim-wakatime Plugin using vim-plug Source: https://github.com/hackclub/hackatime/blob/main/docs/editors/vim.md This snippet shows how to add the 'vim-wakatime' plugin to your Vim configuration using the vim-plug plugin manager. Ensure vim-plug is installed before using this. ```vimscript Plug 'wakatime/vim-wakatime' ``` -------------------------------- ### Access Hackatime API Stats with Authorization Header Source: https://github.com/hackclub/hackatime/blob/main/docs/api/authentication.md This snippet demonstrates how to make a request to the Hackatime API to retrieve statistics using an API key placed in the Authorization header. This is the recommended and more secure method for authentication. ```bash curl -H "Authorization: Bearer YOUR_API_KEY" \ https://hackatime.hackclub.com/api/v1/stats ``` -------------------------------- ### Get User Trust Factor Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Retrieves the trust factor for a given user. ```APIDOC ## GET /api/v1/users/{username}/trust_factor ### Description Get a user's trust factor. ### Method GET ### Endpoint /api/v1/users/{username}/trust_factor ### Parameters #### Path Parameters - **username** (string) - Required - The username of the user. ### Response #### Success Response (200) - **trust_level** (string) - The trust level of the user (e.g., "yellow"). - **trust_value** (integer) - The numerical trust value. #### Response Example ```json { "trust_level": "yellow", "trust_value": 0 } ``` ``` -------------------------------- ### Hackatime API Error Response: API Key Required Source: https://github.com/hackclub/hackatime/blob/main/docs/api/authentication.md This JSON snippet shows the error message returned by the Hackatime API when a request is made without providing any API key for authentication. ```json { "error": "API key required" } ``` -------------------------------- ### Get Today's Coding Time (WakaTime) Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Retrieves the total coding time for the current day using the WakaTime integration. This endpoint is compatible with existing WakaTime tools and libraries. ```bash GET /api/hackatime/v1/users/{user_id}/statusbar/today ``` ```bash curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://hackatime.hackclub.com/api/hackatime/v1/users/current/statusbar/today" ``` -------------------------------- ### Get Today's Coding Time Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Retrieves the total coding time for the current day for a specific user. ```APIDOC ## GET /api/hackatime/v1/users/{user_id}/statusbar/today ### Description Shows how much you've coded today. ### Method GET ### Endpoint /api/hackatime/v1/users/{user_id}/statusbar/today ### Parameters #### Path Parameters - **user_id** (string) - Required - The ID of the user. ### Response #### Success Response (200) - **data.grand_total.total_seconds** (number) - Total seconds coded today. - **data.grand_total.text** (string) - Formatted string of total seconds (e.g., "2 hrs"). #### Response Example ```json { "data": { "grand_total": { "total_seconds": 7200.0, "text": "2 hrs" } } } ``` ``` -------------------------------- ### Get Someone Else's Coding Stats Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Retrieves the public coding statistics for another user. ```APIDOC ## GET /api/v1/users/{username}/stats ### Description See someone else's public coding stats. ### Method GET ### Endpoint /api/v1/users/{username}/stats ### Parameters #### Path Parameters - **username** (string) - Required - The username of the user whose stats you want to retrieve. ### Response #### Success Response (200) - **user** (string) - The requested username. - **total_seconds** (number) - Total seconds coded by the user. - **languages** (array) - Array of objects, each containing language name and total seconds coded in that language. - **projects** (array) - Array of objects, each containing project name and total seconds coded in that project. #### Response Example ```json { "user": "username", "total_seconds": 86400, "languages": [ { "name": "Python", "seconds": 43200 }, { "name": "JavaScript", "seconds": 28800 } ], "projects": [{ "name": "my-app", "seconds": 36000 }] } ``` ``` -------------------------------- ### Get User's Trust Factor Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Retrieves the 'trust factor' for a given user. This metric is specific to Hackatime and may indicate a user's contribution or reliability. ```bash GET /api/v1/users/{username}/trust_factor ``` -------------------------------- ### Get Raw Coding Activity Data Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Fetches the raw heartbeat data, which represents individual coding sessions. Supports filtering by date and limiting the number of results. Useful for detailed analysis. ```bash GET /api/v1/my/heartbeats ``` ```bash GET /api/v1/my/heartbeats/most_recent ``` ```bash curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://hackatime.hackclub.com/api/v1/my/heartbeats?limit=10" ``` -------------------------------- ### Get Another User's Public Coding Statistics Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Retrieves the public coding statistics for a specified user. This allows viewing activity data of other users, provided their data is public. ```bash GET /api/v1/users/{username}/stats ``` -------------------------------- ### Git Add Specific Files or Directories Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Demonstrates the recommended Git practice of adding files or directories individually rather than using `git add .`. This prevents accidental commits of sensitive or unwanted files. ```git git add git add / ``` -------------------------------- ### Authenticate with Hackatime API using URL Parameter Source: https://github.com/hackclub/hackatime/blob/main/docs/api/overview.md Shows an alternative method for API authentication by including the API key as a URL query parameter. While functional, using the Authorization header is generally preferred for security reasons. ```text ?api_key=YOUR_API_KEY ``` -------------------------------- ### Manage Rails Database with Docker Compose Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Perform common database operations such as migrations, creation, schema loading, and seeding using Docker Compose. These commands are essential for setting up and maintaining the application's database. ```bash docker compose run web rails db:migrate docker compose run web rails db:create docker compose run web rails db:schema:load docker compose run web rails db:seed ``` -------------------------------- ### Authenticate with Hackatime API using Authorization Header Source: https://github.com/hackclub/hackatime/blob/main/docs/api/overview.md Demonstrates how to authenticate API requests using an API key via the Authorization Bearer header. This is the recommended method for secure access to your coding data. ```text Authorization: Bearer YOUR_API_KEY ``` -------------------------------- ### Cleanup Docker Resources Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Remove unused Docker containers and images to free up resources. The `--remove-orphans` flag is used to ensure a thorough cleanup. ```bash docker compose --remove-orphans up ``` -------------------------------- ### Scan JavaScript Dependencies for Security Issues Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Scan JavaScript dependencies for known security vulnerabilities using the `importmap audit` command within the Docker environment. This is crucial for maintaining supply chain security. ```bash docker compose run web bin/importmap audit ``` -------------------------------- ### Execute All CI Checks Locally Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Run all required Continuous Integration checks locally before marking a task as complete. This includes linting, security scans, autoloader checks, and the full test suite. ```bash docker compose run web bundle exec rubocop docker compose run web bundle exec brakeman docker compose run web bin/importmap audit docker compose run web bin/rails zeitwerk:check docker compose run web rails test ``` -------------------------------- ### Perform Security Audit with Brakeman Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Run Brakeman, a static analysis tool, to audit the Rails application for security vulnerabilities. This command helps identify potential security weaknesses. ```bash docker compose run web bundle exec brakeman ``` -------------------------------- ### Basic CSS Styling for Hackatime Error Page Source: https://github.com/hackclub/hackatime/blob/main/public/422.html This CSS code sets up the fundamental styling for the Hackatime error page, including box-sizing, margins, font sizes, background, text colors, font family, layout using CSS Grid, and responsive adjustments for line height and text rendering. It also styles links and basic text elements. ```css * { box-sizing: border-box; margin: 0; } html { font-size: 16px; } body { background: #FFF; color: #261B23; display: grid; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: clamp(1rem, 2.5vw, 2rem); -webkit-font-smoothing: antialiased; font-style: normal; font-weight: 400; letter-spacing: -0.0025em; line-height: 1.4; min-height: 100vh; place-items: center; text-rendering: optimizeLegibility; -webkit-text-size-adjust: 100%; } a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 0.0925em; } b, strong { font-weight: 700; } i, em { font-style: italic; } main { display: grid; gap: 1em; padding: 2em; place-items: center; text-align: center; } main header { width: min(100%, 12em); } main header svg { height: auto; max-width: 100%; width: 100%; } main article { width: min(100%, 30em); } main article p { font-size: 75%; } main article br { display: none; } @media (min-width: 48em) { main article br { display: inline; } } ``` -------------------------------- ### User Statistics Source: https://github.com/hackclub/hackatime/blob/main/docs/api/overview.md Retrieve your overall coding statistics. This endpoint provides a summary of your coding activity. ```APIDOC ## GET /api/v1/stats ### Description Get your coding stats. This endpoint returns a summary of your coding activity. ### Method GET ### Endpoint /api/v1/stats ### Parameters #### Query Parameters - **api_key** (string) - Optional - Your API key to authenticate the request. It's recommended to use the Authorization header instead. ### Request Example ```bash curl -H "Authorization: Bearer YOUR_API_KEY" \ https://hackatime.hackclub.com/api/v1/stats ``` ### Response #### Success Response (200) - **data** (object) - Contains detailed statistics about your coding activity. - **total_seconds_coded** (integer) - Total seconds coded. - **best_day** (object) - The best day for coding. - **week** (object) - Weekly coding statistics. - **month** (object) - Monthly coding statistics. - **languages** (array) - Array of languages used. - **editors** (array) - Array of editors used. - **operating_systems** (array) - Array of operating systems used. - **projects** (array) - Array of projects worked on. #### Response Example ```json { "data": { "total_seconds_coded": 123456, "best_day": { "date": "2023-10-27", "total_seconds": 5400 }, "week": { "total_seconds": 30000, "average_daily_seconds": 4285, "project_counts": 5 }, "month": { "total_seconds": 150000, "average_daily_seconds": 5000, "project_counts": 10 }, "languages": [ { "name": "Python", "total_seconds": 70000 } ], "editors": [ { "name": "VS Code", "total_seconds": 100000 } ], "operating_systems": [ { "name": "macOS", "total_seconds": 120000 } ], "projects": [ { "name": "my-project", "total_seconds": 50000 } ] } } ``` ``` -------------------------------- ### Check Rails Autoloader with Zeitwerk Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Verify the Zeitwerk autoloader configuration and behavior in the Rails application. This command ensures that code is loaded correctly and efficiently. ```bash docker compose run web bin/rails zeitwerk:check ``` -------------------------------- ### Run Rails Tests with Docker Compose Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Execute the full test suite or specific tests within the Rails application using Docker Compose. This command ensures tests are run in a consistent environment. Limited test coverage may exist. ```bash docker compose run web rails test docker compose run web rails test test/models/user_test.rb docker compose run web rails test test/models/user_test.rb -n test_method_name ``` -------------------------------- ### Access Rails Interactive Console Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Open an interactive Rails console session within the Docker container. This allows for direct interaction with the application's models and methods. ```bash docker compose run web rails c ``` -------------------------------- ### User Authentication Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md All requests require authentication using an API key. This can be provided either in the Authorization header or as a query parameter. ```APIDOC ## Authentication All requests need your API key: - **Best way**: `Authorization: Bearer YOUR_API_KEY` in the header - **Other way**: Add `?api_key=YOUR_API_KEY` to the URL Get your API key from [Hackatime settings](https://hackatime.hackclub.com/my/settings). ``` -------------------------------- ### Lint and Auto-fix Code with RuboCop Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Perform code linting and automatically fix style violations using RuboCop within the Dockerized Rails environment. This helps maintain code consistency and quality. ```bash docker compose run web bundle exec rubocop docker compose run web bundle exec rubocop -A ``` -------------------------------- ### Access Interactive Shell in Docker Container Source: https://github.com/hackclub/hackatime/blob/main/AGENT.md Open an interactive bash shell within the web service container using Docker Compose. This provides direct access to the container's filesystem and environment for debugging or manual operations. ```bash docker compose run --service-ports web /bin/bash ``` -------------------------------- ### User Heartbeats Source: https://github.com/hackclub/hackatime/blob/main/docs/api/overview.md Retrieve raw coding activity data (heartbeats). This endpoint provides detailed logs of your coding sessions. ```APIDOC ## GET /api/v1/my/heartbeats ### Description Get your raw coding activity (heartbeats). This endpoint returns a list of individual coding sessions. ### Method GET ### Endpoint /api/v1/my/heartbeats ### Parameters #### Query Parameters - **api_key** (string) - Optional - Your API key to authenticate the request. It's recommended to use the Authorization header instead. - **start_date** (string) - Optional - Filter heartbeats from this date (YYYY-MM-DD). - **end_date** (string) - Optional - Filter heartbeats up to this date (YYYY-MM-DD). - **limit** (integer) - Optional - Number of heartbeats to return (default is 500). ### Request Example ```bash curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://hackatime.hackclub.com/api/v1/my/heartbeats?start_date=2023-10-26&end_date=2023-10-27" ``` ### Response #### Success Response (200) - **data** (array) - An array of heartbeat objects, each representing a coding activity log. - **time** (string) - Timestamp of the heartbeat (ISO 8601 format). - **duration** (integer) - Duration of the coding session in seconds. - **project** (string) - The project being worked on. - **language** (string) - The programming language used. - **editor** (string) - The editor used. - **operating_system** (string) - The operating system used. #### Response Example ```json { "data": [ { "time": "2023-10-27T10:30:00Z", "duration": 300, "project": "hackatime-api", "language": "Python", "editor": "VS Code", "operating_system": "macOS" }, { "time": "2023-10-27T10:35:00Z", "duration": 120, "project": "hackatime-api", "language": "Python", "editor": "VS Code", "operating_system": "macOS" } ] } ``` ``` -------------------------------- ### Find Users by Slack UID Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Looks up a user by their Slack User ID. ```APIDOC ## GET /api/v1/users/lookup_slack_uid/{slack_uid} ### Description Find users by their Slack ID. ### Method GET ### Endpoint /api/v1/users/lookup_slack_uid/{slack_uid} ### Parameters #### Path Parameters - **slack_uid** (string) - Required - The Slack User ID of the user to find. ``` -------------------------------- ### Find Users by Email or Slack ID Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Provides endpoints to look up users within the Hackatime system using their email address or Slack user ID. Useful for integrating with other services. ```bash GET /api/v1/users/lookup_email/{email} ``` ```bash GET /api/v1/users/lookup_slack_uid/{slack_uid} ``` -------------------------------- ### Error Response Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Details on the structure of error responses returned by the API. ```APIDOC ## Error Handling Errors look like this: ```json { "error": "Invalid API key" } ``` Common problems: - `401` - Bad or missing API key - `404` - That thing doesn't exist - `500` - Something broke on our end ``` -------------------------------- ### Find Users by Email Source: https://github.com/hackclub/hackatime/blob/main/docs/api/endpoints.md Looks up a user by their email address. ```APIDOC ## GET /api/v1/users/lookup_email/{email} ### Description Find users by their email. ### Method GET ### Endpoint /api/v1/users/lookup_email/{email} ### Parameters #### Path Parameters - **email** (string) - Required - The email address of the user to find. ``` -------------------------------- ### User Public Stats Source: https://github.com/hackclub/hackatime/blob/main/docs/api/overview.md Retrieve public coding statistics for a specified user. This endpoint allows viewing the coding activity of others if their profile is public. ```APIDOC ## GET /api/v1/users/{username}/stats ### Description Get a specific user's public coding statistics. This endpoint allows you to view the coding activity of another user if their profile is public. ### Method GET ### Endpoint /api/v1/users/{username}/stats ### Parameters #### Path Parameters - **username** (string) - Required - The username of the user whose stats you want to retrieve. #### Query Parameters - **api_key** (string) - Optional - Your API key to authenticate the request. It's recommended to use the Authorization header instead. ### Request Example ```bash curl -H "Authorization: Bearer YOUR_API_KEY" \ https://hackatime.hackclub.com/api/v1/users/someuser/stats ``` ### Response #### Success Response (200) - **data** (object) - Contains detailed statistics about the user's coding activity. The structure is similar to the `/api/v1/stats` endpoint. #### Response Example ```json { "data": { "total_seconds_coded": 98765, "best_day": { "date": "2023-10-25", "total_seconds": 4500 }, "week": { "total_seconds": 25000, "average_daily_seconds": 3571, "project_counts": 4 }, "month": { "total_seconds": 120000, "average_daily_seconds": 4000, "project_counts": 8 }, "languages": [ { "name": "JavaScript", "total_seconds": 50000 } ], "editors": [ { "name": "VS Code", "total_seconds": 80000 } ], "operating_systems": [ { "name": "Linux", "total_seconds": 90000 } ], "projects": [ { "name": "public-project", "total_seconds": 30000 } ] } } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.