From 81a6b01e90b6f65520cc2d832f5336124c1818da Mon Sep 17 00:00:00 2001
From: Kieran Klukas <92754843+kcoderhtml@users.noreply.github.com>
Date: Fri, 8 Nov 2024 12:31:32 -0500
Subject: [PATCH] chore: remove references to wakapi.dev
---
DOCS.md | 6 +-
README.md | 16 +-
config/config.go | 2 +-
etc/Caddyfile | 2 +-
models/compat/shields/v1/badge.go | 2 +-
scripts/download_heartbeats.py | 2 +-
scripts/get.sh | 8 +-
services/activity.go | 4 +-
services/mail/smtp_test.go | 2 +-
testing/config.sqlite.yml | 2 +-
.../wakapi_api_tests.postman_collection.json | 7015 ++++++++---------
11 files changed, 3505 insertions(+), 3556 deletions(-)
diff --git a/DOCS.md b/DOCS.md
index 964bc73d..0e6b2991 100644
--- a/DOCS.md
+++ b/DOCS.md
@@ -101,7 +101,7 @@ argument) or via environment variables. Here is an overview of all options.
| `app.avatar_url_template` /
`WAKAPI_AVATAR_URL_TEMPLATE` | (see [`config.default.yml`](config.default.yml)) | URL template for external user avatar images (e.g. from [Dicebear](https://dicebear.com) or [Gravatar](https://gravatar.com)) |
| `app.date_format` /
`WAKAPI_DATE_FORMAT` | `Mon, 02 Jan 2006` | Go time format strings to format human-readable date (see [`Time.Format`](https://pkg.go.dev/time#Time.Format)) |
| `app.datetime_format` /
`WAKAPI_DATETIME_FORMAT` | `Mon, 02 Jan 2006 15:04` | Go time format strings to format human-readable datetime (see [`Time.Format`](https://pkg.go.dev/time#Time.Format)) |
-| `app.support_contact` /
`WAKAPI_SUPPORT_CONTACT` | `hostmaster@wakapi.dev` | E-Mail address to display as a support contact on the page |
+| `app.support_contact` /
`WAKAPI_SUPPORT_CONTACT` | `hostmaster@waka.hackclub.com` | E-Mail address to display as a support contact on the page |
| `app.data_retention_months` /
`WAKAPI_DATA_RETENTION_MONTHS` | `-1` | Maximum retention period in months for user data (heartbeats) (-1 for unlimited) |
| `app.max_inactive_months` /
`WAKAPI_MAX_INACTIVE_MONTHS` | `12` | Maximum number of inactive months after which to delete user accounts without data (-1 for unlimited) |
| `server.port` /
`WAKAPI_PORT` | `3000` | Port to listen on |
@@ -141,7 +141,7 @@ argument) or via environment variables. Here is an overview of all options.
| `db.automgirate_fail_silently` /
`WAKAPI_DB_AUTOMIGRATE_FAIL_SILENTLY` | `false` | Whether to ignore schema auto-migration failures when starting up |
| `mail.enabled` /
`WAKAPI_MAIL_ENABLED` | `true` | Whether to allow Hackatime to send e-mail (e.g. for password resets) |
| `mail.welcome_enabled` /
`WAKAPI_WELCOME_ENABLED` | `true` | Whether Hackatime should send an e-mail on user signup |
-| `mail.sender` /
`WAKAPI_MAIL_SENDER` | `Hackatime ` | Default sender address for outgoing mails |
+| `mail.sender` /
`WAKAPI_MAIL_SENDER` | `Hackatime ` | Default sender address for outgoing mails |
| `mail.provider` /
`WAKAPI_MAIL_PROVIDER` | `smtp` | Implementation to use for sending mails (one of [`smtp`]) |
| `mail.smtp.host` /
`WAKAPI_MAIL_SMTP_HOST` | - | SMTP server address for sending mail (if using `smtp` mail provider) |
| `mail.smtp.port` /
`WAKAPI_MAIL_SMTP_PORT` | - | SMTP server port (usually 465) |
@@ -261,7 +261,7 @@ $ python scripts/download_heartbeats.py --api_key API_KEY [--url URL] [--from FR
```bash
python scripts/download_heartbeats.py --api_key 04648d14-15c9-432b-b901-dbeec70d4eaf \
- --url https://wakapi.dev/api \
+ --url https://waka.hackclub.com/api \
--from 2023-01-01 \
--to 2023-01-31 \
--output wakapi_export.csv
diff --git a/README.md b/README.md
index d395f201..3546a514 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,7 @@ Clone the repo run `go build` and then `./hackatime -config config.yml`. More in
## 🔧 API endpoints
-See our [Swagger API Documentation](https://wakapi.dev/swagger-ui).
+See our [Swagger API Documentation](https://waka.hackclub.com/swagger-ui).
For signing up user programaticaly you can use the `/signup` endpoint with the admin token as Bearer and it will return a json object similar to the following:
@@ -93,15 +93,15 @@ section of your Hackatime instance's settings page.
Hackatime also integrates
with [GitHub Readme Stats](https://github.com/anuraghazra/github-readme-stats#wakatime-week-stats) to generate fancy
cards for you. Here is an example. To use this, don't forget to **enable public data**
-under [Settings -> Permissions](https://wakapi.dev/settings#permissions).
+under [Settings -> Permissions](https://waka.hackclub.com/settings#permissions).
-![](https://github-readme-stats.vercel.app/api/wakatime?username=n1try&api_domain=wakapi.dev&bg_color=2D3748&title_color=2F855A&icon_color=2F855A&text_color=ffffff&custom_title=Hackatime%20Week%20Stats&layout=compact&range=last_7_days)
+![](https://github-readme-stats.vercel.app/api/wakatime?username=U062UG485EE&api_domain=waka.hackclub.com&bg_color=2D3748&title_color=2F855A&icon_color=2F855A&text_color=ffffff&custom_title=Hackatime%20Week%20Stats&layout=compact&range=last_7_days)
Click to view code
```markdown
-![](https://github-readme-stats.vercel.app/api/wakatime?username={yourusername}&api_domain=wakapi.dev&bg_color=2D3748&title_color=2F855A&icon_color=2F855A&text_color=ffffff&custom_title=Hackatime%20Week%20Stats&layout=compact)
+![](https://github-readme-stats.vercel.app/api/wakatime?username={yourusername}&api_domain=waka.hackclub.com&bg_color=2D3748&title_color=2F855A&icon_color=2F855A&text_color=ffffff&custom_title=Hackatime%20Week%20Stats&layout=compact)
```
@@ -111,7 +111,7 @@ under [Settings -> Permissions](https://wakapi.dev/settings#permissions).
There is a [WakaTime plugin](https://github.com/lowlighter/metrics/tree/master/source/plugins/wakatime) for
GitHub [Metrics](https://github.com/lowlighter/metrics/) that is also compatible with Hackatime. To use this, don't forget
-to **enable public data** under [Settings -> Permissions](https://wakapi.dev/settings#permissions).
+to **enable public data** under [Settings -> Permissions](https://waka.hackclub.com/settings#permissions).
Preview:
@@ -129,7 +129,7 @@ Preview:
plugin_wakatime_days: 7 # Display last week stats
plugin_wakatime_sections: time, projects, projects-graphs # Display time and projects sections, along with projects graphs
plugin_wakatime_limit: 4 # Show 4 entries per graph
- plugin_wakatime_url: http://wakapi.dev # Wakatime url endpoint
+ plugin_wakatime_url: http://waka.hackclub.com # Wakatime url endpoint
plugin_wakatime_user: .user.login # User
```
@@ -146,9 +146,9 @@ get started:
store ([Firefox](https://addons.mozilla.org/en-US/firefox/addon/wakatimes), [Chrome](https://chrome.google.com/webstore/detail/wakatime/jnbbnacmeggbgdjgaoojpmhdlkkpblgi?hl=de))
2. Open the extension settings dialog
3. Configure it like so (see screenshot below):
- - API Key: Your personal API key (get it at [wakapi.dev](https://wakapi.dev))
+ - API Key: Your personal API key (get it at [waka.hackclub.com](https://waka.hackclub.com))
- Logging Type: _Only the domain_
- - API URL: `https://wakapi.dev/api/compat/wakatime/v1` (alternatively, replace _wakapi.dev_ with your self-hosted
+ - API URL: `https://waka.hackclub.com/api/compat/wakatime/v1` (alternatively, replace _waka.hackclub.com_ with your self-hosted
instance hostname)
4. Save
5. Start browsing!
diff --git a/config/config.go b/config/config.go
index 2232ab47..d48c4396 100644
--- a/config/config.go
+++ b/config/config.go
@@ -98,7 +98,7 @@ type appConfig struct {
DataCleanupDryRun bool `yaml:"data_cleanup_dry_run" default:"false" env:"WAKAPI_DATA_CLEANUP_DRY_RUN"` // for debugging only
MaxInactiveMonths int `yaml:"max_inactive_months" default:"-1" env:"WAKAPI_MAX_INACTIVE_MONTHS"`
AvatarURLTemplate string `yaml:"avatar_url_template" default:"api/avatar/{username_hash}.svg" env:"WAKAPI_AVATAR_URL_TEMPLATE"`
- SupportContact string `yaml:"support_contact" default:"hostmaster@wakapi.dev" env:"WAKAPI_SUPPORT_CONTACT"`
+ SupportContact string `yaml:"support_contact" default:"hostmaster@waka.hackclub.com" env:"WAKAPI_SUPPORT_CONTACT"`
DateFormat string `yaml:"date_format" default:"Mon, 02 Jan 2006" env:"WAKAPI_DATE_FORMAT"`
DateTimeFormat string `yaml:"datetime_format" default:"Mon, 02 Jan 2006 15:04" env:"WAKAPI_DATETIME_FORMAT"`
CustomLanguages map[string]string `yaml:"custom_languages"`
diff --git a/etc/Caddyfile b/etc/Caddyfile
index da5d1347..c85874af 100644
--- a/etc/Caddyfile
+++ b/etc/Caddyfile
@@ -6,7 +6,7 @@ wakapi.yourdomain.tld {
}
log {
- output file /var/log/caddy/wakapi.dev.access.log
+ output file /var/log/caddy/waka.hackclub.com.access.log
}
reverse_proxy http://[::1]:3000
diff --git a/models/compat/shields/v1/badge.go b/models/compat/shields/v1/badge.go
index daf96493..d7e79f1b 100644
--- a/models/compat/shields/v1/badge.go
+++ b/models/compat/shields/v1/badge.go
@@ -8,7 +8,7 @@ import (
// https://shields.io/endpoint
const (
- defaultLabel = "wakapi.dev"
+ defaultLabel = "waka.hackclub.com"
defaultColor = "2F855A"
)
diff --git a/scripts/download_heartbeats.py b/scripts/download_heartbeats.py
index 0b00d2b4..bcb83d08 100644
--- a/scripts/download_heartbeats.py
+++ b/scripts/download_heartbeats.py
@@ -19,7 +19,7 @@
# globals
http: requests.Session = requests.Session()
-api_url: str = 'https://wakapi.dev/api'
+api_url: str = 'https://waka.hackclub.com/api'
Heartbeats = List[Dict[str, Any]]
diff --git a/scripts/get.sh b/scripts/get.sh
index 5b9114b3..83b20491 100644
--- a/scripts/get.sh
+++ b/scripts/get.sh
@@ -2,11 +2,11 @@
# This script installs Wakapi.
#
-# Quick install: `curl https://wakapi.dev/get | bash`
+# Quick install: `curl https://waka.hackclub.com/get | bash`
#
# This script will install Wakapi to the directory you're in. To install
# somewhere else (e.g. /usr/local/bin), cd there and make sure you can write to
-# that directory, e.g. `cd /usr/local/bin; curl https://wakapi.dev/get | sudo bash`
+# that directory, e.g. `cd /usr/local/bin; curl https://waka.hackclub.com/get | sudo bash`
#
# Acknowledgments:
# - Micro Editor for this script: https://micro-editor.github.io/
@@ -75,9 +75,9 @@ B. Define GETWAKAPI_HTTP to be a command (with arguments deliminated by spaces)
For examples of option B, this script uses the below values for wget and curl:
- $ curl https://wakapi.dev/get | GETWAKAPI_HTTP="curl -L" sh
+ $ curl https://waka.hackclub.com/get | GETWAKAPI_HTTP="curl -L" sh
- $ wget -O- https://wakapi.dev/get | GETWAKAPI_HTTP="wget -O-" sh
+ $ wget -O- https://waka.hackclub.com/get | GETWAKAPI_HTTP="wget -O-" sh
EOA
exit 1
diff --git a/services/activity.go b/services/activity.go
index 94503d0f..9ce2424e 100644
--- a/services/activity.go
+++ b/services/activity.go
@@ -139,8 +139,8 @@ func (s *ActivityService) getChartPastYear(user *models.User, darkTheme, hideAtt
if !hideAttribution {
canvas.Group()
- canvas.Title("Wakapi.dev")
- canvas.Image(w-60, h-24, 60, 24, "https://wakapi.dev/assets/images/logo-gh.svg")
+ canvas.Title("waka.hackclub.com")
+ canvas.Image(w-60, h-24, 60, 24, "https://waka.hackclub.com/assets/images/logo-gh.svg")
canvas.Gend()
}
diff --git a/services/mail/smtp_test.go b/services/mail/smtp_test.go
index 5521683a..6b65c1d5 100644
--- a/services/mail/smtp_test.go
+++ b/services/mail/smtp_test.go
@@ -119,7 +119,7 @@ func (suite *SmtpTestSuite) TestSMTPSendingService_SendStartTLS() {
func createTestMail() *models.Mail {
mail := models.Mail{
- From: "Wakapi ",
+ From: "Wakapi ",
To: []models.MailAddress{"Kieran Klukas "},
Subject: "Wakapi Test Mail",
Body: "This is just a test",
diff --git a/testing/config.sqlite.yml b/testing/config.sqlite.yml
index ea9ebe54..5ef777f9 100644
--- a/testing/config.sqlite.yml
+++ b/testing/config.sqlite.yml
@@ -50,7 +50,7 @@ sentry:
mail:
enabled: false
provider: smtp
- sender: Wakapi
+ sender: Wakapi
smtp:
host:
diff --git a/testing/wakapi_api_tests.postman_collection.json b/testing/wakapi_api_tests.postman_collection.json
index 8250ac2a..98f84f48 100644
--- a/testing/wakapi_api_tests.postman_collection.json
+++ b/testing/wakapi_api_tests.postman_collection.json
@@ -1,3535 +1,3484 @@
{
- "info": {
- "_postman_id": "e0534bd9-167f-48a1-a47d-2c02296f9e52",
- "name": "Wakapi API Tests",
- "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
- "_exporter_id": "15969615"
- },
- "item": [
- {
- "name": "Auth",
- "item": [
- {
- "name": "Sign up user",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Body matches string\", function () {",
- " pm.expect(pm.response.text()).to.include(\"Account created successfully\");",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "urlencoded",
- "urlencoded": [
- {
- "key": "location",
- "value": "{{TZ}}",
- "type": "text"
- },
- {
- "key": "username",
- "value": "testuser",
- "type": "text"
- },
- {
- "key": "email",
- "value": "testuser@wakapi.dev",
- "type": "text"
- },
- {
- "key": "password",
- "value": "testpassword",
- "type": "text"
- },
- {
- "key": "password_repeat",
- "value": "testpassword",
- "type": "text"
- }
- ]
- },
- "url": {
- "raw": "{{BASE_URL}}/signup",
- "host": ["{{BASE_URL}}"],
- "path": ["signup"]
- }
- },
- "response": []
- },
- {
- "name": "Sign up existing user (conflict)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 409\", function () {",
- " pm.response.to.have.status(409);",
- "});",
- "",
- "pm.test(\"Body matches string\", function () {",
- " pm.expect(pm.response.text()).to.include(\"User already existing\");",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "urlencoded",
- "urlencoded": [
- {
- "key": "location",
- "value": "{{TZ}}",
- "type": "text"
- },
- {
- "key": "username",
- "value": "testuser",
- "type": "text"
- },
- {
- "key": "email",
- "value": "testuser@wakapi.dev",
- "type": "text"
- },
- {
- "key": "password",
- "value": "testpassword",
- "type": "text"
- },
- {
- "key": "password_repeat",
- "value": "testpassword",
- "type": "text"
- }
- ]
- },
- "url": {
- "raw": "{{BASE_URL}}/signup",
- "host": ["{{BASE_URL}}"],
- "path": ["signup"]
- }
- },
- "response": []
- },
- {
- "name": "Login",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 302\", function () {",
- " pm.response.to.have.status(302);",
- "});",
- "",
- "pm.test(\"Redirect to summary\", function () {",
- " pm.expect(pm.response.headers.get(\"Location\")).to.eql(\"/summary\");",
- "});",
- "",
- "pm.test(\"Sets cookie\", function () {",
- " pm.expect(pm.response.headers.get(\"Set-Cookie\")).to.include(\"wakapi_auth=\");",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true,
- "followRedirects": false
- },
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "urlencoded",
- "urlencoded": [
- {
- "key": "username",
- "value": "testuser",
- "type": "text"
- },
- {
- "key": "password",
- "value": "testpassword",
- "type": "text"
- }
- ]
- },
- "url": {
- "raw": "{{BASE_URL}}/login",
- "host": ["{{BASE_URL}}"],
- "path": ["login"]
- }
- },
- "response": []
- },
- {
- "name": "Login (wrong password)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 401\", function () {",
- " pm.response.to.have.status(401);",
- "});",
- "",
- "pm.test(\"No redirect\", function () {",
- " pm.response.to.not.have.header(\"Location\");",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true,
- "followRedirects": false
- },
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "urlencoded",
- "urlencoded": [
- {
- "key": "username",
- "value": "testuser",
- "type": "text"
- },
- {
- "key": "password",
- "value": "wrongpassword",
- "type": "text"
- }
- ]
- },
- "url": {
- "raw": "{{BASE_URL}}/login",
- "host": ["{{BASE_URL}}"],
- "path": ["login"]
- }
- },
- "response": []
- },
- {
- "name": "Authenticate (header)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true,
- "followRedirects": false
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?interval=today",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "interval",
- "value": "today"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "Authenticate (query param)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true,
- "followRedirects": false
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?interval=today&api_key={{WRITEUSER_API_KEY}}",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "interval",
- "value": "today"
- },
- {
- "key": "api_key",
- "value": "{{WRITEUSER_API_KEY}}"
- }
- ]
- }
- },
- "response": []
- }
- ]
- },
- {
- "name": "Heartbeats",
- "item": [
- {
- "name": "Create heartbeats",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 201\", function () {",
- " pm.response.to.have.status(201);",
- "});",
- "",
- "pm.test(\"Response body is correct\", function () {",
- " var jsonData = pm.response.json();",
- " pm.expect(jsonData.responses.length).to.eql(2);",
- " pm.expect(jsonData.responses[0].length).to.eql(2);",
- " pm.expect(jsonData.responses[1].length).to.eql(2);",
- " pm.expect(jsonData.responses[0][1]).to.eql(201);",
- " pm.expect(jsonData.responses[1][1]).to.eql(201);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "[{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts3}}\n}]",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "{{BASE_URL}}/api/heartbeat",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "heartbeat"]
- }
- },
- "response": []
- },
- {
- "name": "Create heartbeats (alt 1)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 201\", function () {",
- " pm.response.to.have.status(201);",
- "});",
- "",
- "pm.test(\"Response body is correct\", function () {",
- " var jsonData = pm.response.json();",
- " pm.expect(jsonData.responses.length).to.eql(2);",
- " pm.expect(jsonData.responses[0].length).to.eql(2);",
- " pm.expect(jsonData.responses[1].length).to.eql(2);",
- " pm.expect(jsonData.responses[0][1]).to.eql(201);",
- " pm.expect(jsonData.responses[1][1]).to.eql(201);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "[{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts2}}\n}]",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "{{BASE_URL}}/api/v1/users/current/heartbeats.bulk",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "v1",
- "users",
- "current",
- "heartbeats.bulk"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Create heartbeats (alt 2)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 201\", function () {",
- " pm.response.to.have.status(201);",
- "});",
- "",
- "pm.test(\"Response body is correct\", function () {",
- " var jsonData = pm.response.json();",
- " pm.expect(jsonData.responses.length).to.eql(2);",
- " pm.expect(jsonData.responses[0].length).to.eql(2);",
- " pm.expect(jsonData.responses[1].length).to.eql(2);",
- " pm.expect(jsonData.responses[0][1]).to.eql(201);",
- " pm.expect(jsonData.responses[1][1]).to.eql(201);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "[{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts2}}\n}]",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/heartbeats",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "current",
- "heartbeats"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Create heartbeats (alt 3)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 201\", function () {",
- " pm.response.to.have.status(201);",
- "});",
- "",
- "pm.test(\"Response body is correct\", function () {",
- " var jsonData = pm.response.json();",
- " pm.expect(jsonData.responses.length).to.eql(2);",
- " pm.expect(jsonData.responses[0].length).to.eql(2);",
- " pm.expect(jsonData.responses[1].length).to.eql(2);",
- " pm.expect(jsonData.responses[0][1]).to.eql(201);",
- " pm.expect(jsonData.responses[1][1]).to.eql(201);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "[{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts2}}\n}]",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "{{BASE_URL}}/api/users/current/heartbeats.bulk",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "users",
- "current",
- "heartbeats.bulk"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Create heartbeats (alt 4, single)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 201\", function () {",
- " pm.response.to.have.status(201);",
- "});",
- "",
- "pm.test(\"Response body is correct\", function () {",
- " var jsonData = pm.response.json();",
- " pm.expect(jsonData.responses.length).to.eql(1);",
- " pm.expect(jsonData.responses[0].length).to.eql(2);",
- " pm.expect(jsonData.responses[0][1]).to.eql(201);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "{{BASE_URL}}/api/heartbeat",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "heartbeat"]
- }
- },
- "response": []
- },
- {
- "name": "Create heartbeats (alt 5, single)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 201\", function () {",
- " pm.response.to.have.status(201);",
- "});",
- "",
- "pm.test(\"Response body is correct\", function () {",
- " var jsonData = pm.response.json();",
- " pm.expect(jsonData.responses.length).to.eql(1);",
- " pm.expect(jsonData.responses[0].length).to.eql(2);",
- " pm.expect(jsonData.responses[0][1]).to.eql(201);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "{{BASE_URL}}/api/v1/users/current/heartbeats",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "v1",
- "users",
- "current",
- "heartbeats"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Create heartbeats (alt 6, single)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 201\", function () {",
- " pm.response.to.have.status(201);",
- "});",
- "",
- "pm.test(\"Response body is correct\", function () {",
- " var jsonData = pm.response.json();",
- " pm.expect(jsonData.responses.length).to.eql(1);",
- " pm.expect(jsonData.responses[0].length).to.eql(2);",
- " pm.expect(jsonData.responses[0][1]).to.eql(201);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/heartbeats",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "current",
- "heartbeats"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Create heartbeats (alt 7, single)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 201\", function () {",
- " pm.response.to.have.status(201);",
- "});",
- "",
- "pm.test(\"Response body is correct\", function () {",
- " var jsonData = pm.response.json();",
- " pm.expect(jsonData.responses.length).to.eql(1);",
- " pm.expect(jsonData.responses[0].length).to.eql(2);",
- " pm.expect(jsonData.responses[0][1]).to.eql(201);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "{{BASE_URL}}/api/users/current/heartbeats",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "users", "current", "heartbeats"]
- }
- },
- "response": []
- },
- {
- "name": "Create heartbeats (non-matching)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 404\", function () {",
- " pm.response.to.have.status(404);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{ts1}}\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "{{BASE_URL}}/api/v2/users/current/heartbeats",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "v2",
- "users",
- "current",
- "heartbeats"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Create heartbeats (unauthorized)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 401\", function () {",
- " pm.response.to.have.status(401);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "[{\n \"entity\": \"/home/user1/dev/proejct1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": {{tsNowMinus1Min}}\n}]",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "{{BASE_URL}}/api/heartbeat",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "heartbeat"]
- }
- },
- "response": []
- },
- {
- "name": "Create heartbeats (get heartbeats test)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 201\", function () {",
- " pm.response.to.have.status(201);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [],
- "body": {
- "mode": "raw",
- "raw": "[{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": 1640995200\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": 1641074400\n},\n{\n \"entity\": \"/home/user1/dev/project1/main.go\",\n \"project\": \"wakapi\",\n \"language\": \"Go\",\n \"is_write\": true,\n \"type\": \"file\",\n \"category\": null,\n \"branch\": null,\n \"time\": 1641081600\n}]",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
- "url": {
- "raw": "{{BASE_URL}}/api/heartbeat",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "heartbeat"]
- }
- },
- "response": []
- },
- {
- "name": "Get heartbeats",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Response body is correct\", function () {",
- " var jsonData = pm.response.json();",
- " pm.expect(jsonData.timezone).to.eql(pm.collectionVariables.get('TZ'));",
- " var date = new Date(\"2022-01-01T00:00:00+0100\")",
- " pm.expect(new Date(jsonData.start)).to.eql(date);",
- " pm.expect(new Date(jsonData.end)).to.eql(new Date(date.getTime() + 3600 * 1000 * 24 - 1000));",
- " pm.expect(jsonData.data.length).to.eql(2);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/heartbeats?date=2022-01-01",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "current",
- "heartbeats"
- ],
- "query": [
- {
- "key": "date",
- "value": "2022-01-01"
- }
- ]
- }
- },
- "response": []
- }
- ]
- },
- {
- "name": "Summary",
- "item": [
- {
- "name": "Get summary (today)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "const moment = require('moment')",
- "",
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct user\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
- "});",
- "",
- "pm.test(\"Correct summary data\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.projects.length).to.eql(1);",
- " pm.expect(jsonData.languages.length).to.eql(1);",
- " pm.expect(jsonData.editors.length).to.eql(1);",
- " pm.expect(jsonData.operating_systems.length).to.eql(1);",
- " pm.expect(jsonData.machines.length).to.eql(1);",
- " pm.expect(jsonData.branches).to.be.null;",
- "});",
- "",
- "/*",
- "// This is something the unit tests are supposed to check",
- "pm.test(\"Correct summary range\", function () {",
- " const jsonData = pm.response.json();",
- " const from = moment(jsonData.from)",
- " const to = moment(jsonData.to)",
- "",
- " pm.expect(moment.duration(moment().diff(from.add(2, 'm'))).asSeconds()).to.lt(10); // first heartbeat is now minus 1 min minus some latency",
- " pm.expect(moment.duration(moment().diff(to.add(1, 'm'))).asSeconds()).to.lt(10); // first heartbeat is now minus 1 min minus some latency",
- "});",
- "*/"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?interval=today",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "interval",
- "value": "today"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get summary (last 7 days)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "const moment = require('moment')",
- "",
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct user\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
- "});",
- "",
- "pm.test(\"Correct summary data\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.projects.length).to.eql(1);",
- " pm.expect(jsonData.languages.length).to.eql(1);",
- " pm.expect(jsonData.editors.length).to.eql(1);",
- " pm.expect(jsonData.operating_systems.length).to.eql(1);",
- " pm.expect(jsonData.machines.length).to.eql(1);",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?interval=last_7_days",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "interval",
- "value": "last_7_days"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get summary (week)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "const moment = require('moment')",
- "",
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct user\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
- "});",
- "",
- "pm.test(\"Correct summary data\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.projects.length).to.eql(1);",
- " pm.expect(jsonData.languages.length).to.eql(1);",
- " pm.expect(jsonData.editors.length).to.eql(1);",
- " pm.expect(jsonData.operating_systems.length).to.eql(1);",
- " pm.expect(jsonData.machines.length).to.eql(1);",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?start=week",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "start",
- "value": "week"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get summary (range)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "const moment = require('moment')",
- "",
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct user\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
- "});",
- "",
- "pm.test(\"Correct summary data\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.projects.length).to.eql(1);",
- " pm.expect(jsonData.languages.length).to.eql(1);",
- " pm.expect(jsonData.editors.length).to.eql(1);",
- " pm.expect(jsonData.operating_systems.length).to.eql(1);",
- " pm.expect(jsonData.machines.length).to.eql(1);",
- "});",
- "",
- "pm.test(\"Correct dates\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(moment(jsonData.from).unix()).to.gte(moment(pm.variables.get('tsStartOfDayIso')).unix())",
- " pm.expect(moment(jsonData.to).unix()).to.lte(moment(pm.variables.get('tsEndOfDayIso')).unix())",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?from={{tsStartOfDayIso}}&to={{tsEndOfDayIso}}",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "from",
- "value": "{{tsStartOfDayIso}}"
- },
- {
- "key": "to",
- "value": "{{tsEndOfDayIso}}"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get summary (default tz)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "const moment = require('moment')",
- "",
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct time zone\", function () {",
- " const jsonData = pm.response.json();",
- " const targetDateTz = moment(`2021-05-28T00:00:00${pm.variables.get('TZ_OFFSET')}`)",
- " pm.expect(moment(jsonData.from).isSame(targetDateTz)).to.eql(true)",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true,
- "disableUrlEncoding": false
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?from=2021-05-28&to=2021-05-28",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "from",
- "value": "2021-05-28"
- },
- {
- "key": "to",
- "value": "2021-05-28"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get summary (parse tz)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "const moment = require('moment')",
- "",
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct time zone\", function () {",
- " const jsonData = pm.response.json();",
- " // when it was midnight in UTC+3, it was still 11 pm in Germany",
- " const targetDateTz = moment(`2021-05-28T00:00:00${pm.variables.get('TZ_OFFSET')}`).add(-1, 'h')",
- " pm.expect(moment(jsonData.from).isSame(targetDateTz)).to.eql(true)",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?from=2021-05-28T00:00:00%2B03:00&to=2021-05-28T00:00:00%2B03:00",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "from",
- "value": "2021-05-28T00:00:00%2B03:00"
- },
- {
- "key": "to",
- "value": "2021-05-28T00:00:00%2B03:00"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get summary (unauthenticated)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 401\", function () {",
- " pm.response.to.have.status(401);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?interval=today",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "interval",
- "value": "today"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get summary (today, filtered)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "const moment = require('moment')",
- "",
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct user\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
- "});",
- "",
- "pm.test(\"Correct summary data\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.projects.length).to.eql(1);",
- " pm.expect(jsonData.languages.length).to.eql(1);",
- " pm.expect(jsonData.editors.length).to.eql(1);",
- " pm.expect(jsonData.operating_systems.length).to.eql(1);",
- " pm.expect(jsonData.machines.length).to.eql(1);",
- " pm.expect(jsonData.branches.length).to.eql(1);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?interval=today&project=wakapi&language=Go",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "interval",
- "value": "today"
- },
- {
- "key": "project",
- "value": "wakapi"
- },
- {
- "key": "language",
- "value": "Go"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get summary (today, filtered non-matching)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "const moment = require('moment')",
- "",
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct user\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.user_id).to.eql(\"writeuser\");",
- "});",
- "",
- "pm.test(\"Correct summary data\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.projects.length).to.eql(0);",
- " pm.expect(jsonData.languages.length).to.eql(0);",
- " pm.expect(jsonData.editors.length).to.eql(0);",
- " pm.expect(jsonData.operating_systems.length).to.eql(0);",
- " pm.expect(jsonData.machines.length).to.eql(0);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?interval=today&project=wakapi&language=JavaScript",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "interval",
- "value": "today"
- },
- {
- "key": "project",
- "value": "wakapi"
- },
- {
- "key": "language",
- "value": "JavaScript"
- }
- ]
- }
- },
- "response": []
- }
- ]
- },
- {
- "name": "Metrics",
- "item": [
- {
- "name": "Get admin metrics",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct Content-Type\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.eql(\"text/plain; charset=utf-8\");",
- "});",
- "",
- "pm.test(\"Body matches string\", function () {",
- " pm.expect(pm.response.text()).to.include(\"wakatime_heartbeats_total\");",
- " pm.expect(pm.response.text()).to.include(\"wakatime_admin_heartbeats_total\");",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{READUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/metrics",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "metrics"]
- }
- },
- "response": []
- },
- {
- "name": "Get user metrics",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct Content-Type\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.eql(\"text/plain; charset=utf-8\");",
- "});",
- "",
- "pm.test(\"Body matches string\", function () {",
- " pm.expect(pm.response.text()).to.include(\"wakatime_heartbeats_total\");",
- " pm.expect(pm.response.text()).to.not.include(\"wakatime_admin_heartbeats_total\");",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/metrics",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "metrics"]
- }
- },
- "response": []
- },
- {
- "name": "Get metrics (unauthorized)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 401\", function () {",
- " pm.response.to.have.status(401);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/metrics",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "metrics"]
- }
- },
- "response": []
- }
- ]
- },
- {
- "name": "Shields",
- "item": [
- {
- "name": "Get shields",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.message).to.eql('0 hrs 2 mins');",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/shields/v1/writeuser/interval:last_7_days/project:wakapi",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "shields",
- "v1",
- "writeuser",
- "interval:last_7_days",
- "project:wakapi"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get shields (filter)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.message).to.eql('0 hrs 0 mins');",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/shields/v1/writeuser/interval:last_7_days/project:nonexisting",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "shields",
- "v1",
- "writeuser",
- "interval:last_7_days",
- "project:nonexisting"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get shields (invalid range)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 403\", function () {",
- " pm.response.to.have.status(403);",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/shields/v1/writeuser/interval:last_30_days",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "shields",
- "v1",
- "writeuser",
- "interval:last_30_days"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get shields (not sharing)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 403\", function () {",
- " pm.response.to.have.status(403);",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/shields/v1/readuser/interval:today",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "shields",
- "v1",
- "readuser",
- "interval:today"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get shields (non-shared entity type)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 403\", function () {",
- " pm.response.to.have.status(403);",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/shields/v1/writeuser/interval:today/language:Go",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "shields",
- "v1",
- "writeuser",
- "interval:today",
- "language:Go"
- ]
- }
- },
- "response": []
- }
- ]
- },
- {
- "name": "WakaTime",
- "item": [
- {
- "name": "Get all time",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.data.text).to.eql('0 hrs 4 mins');",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/all_time_since_today",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "current",
- "all_time_since_today"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get all time (unauthenticated)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 401\", function () {",
- " pm.response.to.have.status(401);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser/all_time_since_today",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "writeuser",
- "all_time_since_today"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get stats (current)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.data.languages.length).to.eql(1); // share_languages is false, but user is authorized",
- " pm.expect(jsonData.data.projects.length).to.eql(1);",
- " pm.expect(jsonData.data.branches).to.be.undefined;",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/stats",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "current",
- "stats"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get stats (filtered)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.data.projects.length).to.eql(1);",
- " pm.expect(jsonData.data.total_seconds).to.gt(0);",
- " pm.expect(jsonData.data.branches.length).to.eql(1);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/stats?project=wakapi&language=Go",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "current",
- "stats"
- ],
- "query": [
- {
- "key": "project",
- "value": "wakapi"
- },
- {
- "key": "language",
- "value": "Go"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get stats (filtered non-matching)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.data.projects.length).to.eql(0);",
- " pm.expect(jsonData.data.total_seconds).to.eql(0);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/stats?project=wakapi&language=JavaScript",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "current",
- "stats"
- ],
- "query": [
- {
- "key": "project",
- "value": "wakapi"
- },
- {
- "key": "language",
- "value": "JavaScript"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get statusbar (current)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.data.grand_total.text).to.contains(\"0 hrs\");",
- " pm.expect(jsonData.data.categories).to.instanceOf(Array);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/statusbar/today",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "current",
- "statusbar",
- "today"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get stats (by user)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.data.languages.length).to.eql(0); // share_languages is false",
- " pm.expect(jsonData.data.projects.length).to.eql(1);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser/stats",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "writeuser",
- "stats"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get stats (current, alt 1)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.data.languages.length).to.eql(1); // share_languages is false, but user is authorized",
- " pm.expect(jsonData.data.projects.length).to.eql(1);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/v1/users/current/stats/today",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "v1",
- "users",
- "current",
- "stats",
- "today"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get stats (range)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.data.projects.length).to.eql(1);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser/stats/last_7_days",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "writeuser",
- "stats",
- "last_7_days"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get stats (out of range)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 403\", function () {",
- " pm.response.to.have.status(403);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser/stats/30_days",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "writeuser",
- "stats",
- "30_days"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get stats (not sharing)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 403\", function () {",
- " pm.response.to.have.status(403);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/readuser/stats/today",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "readuser",
- "stats",
- "today"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get projects",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.data.length).to.eql(1);",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current/projects",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "current",
- "projects"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get projects (unauthenticated)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 401\", function () {",
- " pm.response.to.have.status(401);",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser/projects",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "writeuser",
- "projects"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get user (current)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct content\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.data.id).to.eql('writeuser');",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "current"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get user (forbidden user)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 401\", function () {",
- " pm.response.to.have.status(401);",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/readuser",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "readuser"
- ]
- }
- },
- "response": []
- },
- {
- "name": "Get user (unauthenticated)",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 401\", function () {",
- " pm.response.to.have.status(401);",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "noauth"
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/writeuser",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "writeuser"
- ]
- }
- },
- "response": []
- }
- ]
- },
- {
- "name": "Settings",
- "item": [
- {
- "name": "Use Case: Custom Mappings",
- "item": [
- {
- "name": "1. Login",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Body contains string\", function () {",
- " pm.expect(pm.response.text()).to.include(\"Total Time\");",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": false,
- "followRedirects": true
- },
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "urlencoded",
- "urlencoded": [
- {
- "key": "username",
- "value": "writeuser",
- "type": "text"
- },
- {
- "key": "password",
- "value": "{{WRITEUSER_PASSWORD}}",
- "type": "text"
- }
- ]
- },
- "url": {
- "raw": "{{BASE_URL}}/login",
- "host": ["{{BASE_URL}}"],
- "path": ["login"]
- }
- },
- "response": []
- },
- {
- "name": "2. Add custom mapping",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Body contains string\", function () {",
- " pm.expect(pm.response.text()).to.include(\"Mapping added successfully\");",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": false,
- "followRedirects": true
- },
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "urlencoded",
- "urlencoded": [
- {
- "key": "action",
- "value": "add_mapping",
- "type": "text"
- },
- {
- "key": "extension",
- "value": "go",
- "type": "text"
- },
- {
- "key": "language",
- "value": "Gogo",
- "type": "text"
- }
- ]
- },
- "url": {
- "raw": "{{BASE_URL}}/settings",
- "host": ["{{BASE_URL}}"],
- "path": ["settings"]
- }
- },
- "response": []
- },
- {
- "name": "3. Check summary",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct language\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.languages.length).to.eql(1);",
- " pm.expect(jsonData.languages[0].key).to.eql('Gogo');",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?interval=today",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "interval",
- "value": "today"
- }
- ]
- }
- },
- "response": []
- },
- {
- "name": "4. Remove custom mapping",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Body contains string\", function () {",
- " pm.expect(pm.response.text()).to.include(\"Mapping deleted successfully\");",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": false,
- "followRedirects": true
- },
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "urlencoded",
- "urlencoded": [
- {
- "key": "action",
- "value": "delete_mapping",
- "type": "text"
- },
- {
- "key": "mapping_id",
- "value": "0",
- "type": "text"
- }
- ]
- },
- "url": {
- "raw": "{{BASE_URL}}/settings",
- "host": ["{{BASE_URL}}"],
- "path": ["settings"]
- }
- },
- "response": []
- },
- {
- "name": "5. Check summary again",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct language\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.languages.length).to.eql(1);",
- " pm.expect(jsonData.languages[0].key).to.eql('Go');",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/summary?interval=today",
- "host": ["{{BASE_URL}}"],
- "path": ["api", "summary"],
- "query": [
- {
- "key": "interval",
- "value": "today"
- }
- ]
- }
- },
- "response": []
- }
- ]
- },
- {
- "name": "Use Case: Change E-Mail",
- "item": [
- {
- "name": "1. Login",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Body contains string\", function () {",
- " pm.expect(pm.response.text()).to.include(\"Total Time\");",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": false,
- "followRedirects": true
- },
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "urlencoded",
- "urlencoded": [
- {
- "key": "username",
- "value": "writeuser",
- "type": "text"
- },
- {
- "key": "password",
- "value": "{{WRITEUSER_PASSWORD}}",
- "type": "text"
- }
- ]
- },
- "url": {
- "raw": "{{BASE_URL}}/login",
- "host": ["{{BASE_URL}}"],
- "path": ["login"]
- }
- },
- "response": []
- },
- {
- "name": "2. Set e-mail",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Body contains string\", function () {",
- " pm.expect(pm.response.text()).to.include(\"User updated successfully\");",
- "});"
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "disableCookies": false,
- "followRedirects": true
- },
- "request": {
- "method": "POST",
- "header": [],
- "body": {
- "mode": "urlencoded",
- "urlencoded": [
- {
- "key": "action",
- "value": "update_user",
- "type": "text"
- },
- {
- "key": "location",
- "value": "Europe/Berlin",
- "type": "text"
- },
- {
- "key": "email",
- "value": "foo@example.org",
- "type": "text"
- }
- ]
- },
- "url": {
- "raw": "{{BASE_URL}}/settings",
- "host": ["{{BASE_URL}}"],
- "path": ["settings"]
- }
- },
- "response": []
- },
- {
- "name": "3. Check e-mail",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Status code is 200\", function () {",
- " pm.response.to.have.status(200);",
- "});",
- "",
- "pm.test(\"Correct e-mail address\", function () {",
- " const jsonData = pm.response.json();",
- " pm.expect(jsonData.data.email).to.eql('foo@example.org');",
- "});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "protocolProfileBehavior": {
- "tlsPreferServerCiphers": true,
- "disableCookies": true
- },
- "request": {
- "auth": {
- "type": "bearer",
- "bearer": [
- {
- "key": "token",
- "value": "{{WRITEUSER_TOKEN}}",
- "type": "string"
- }
- ]
- },
- "method": "GET",
- "header": [],
- "url": {
- "raw": "{{BASE_URL}}/api/compat/wakatime/v1/users/current",
- "host": ["{{BASE_URL}}"],
- "path": [
- "api",
- "compat",
- "wakatime",
- "v1",
- "users",
- "current"
- ]
- }
- },
- "response": []
- }
- ]
- }
- ]
- },
- {
- "name": "Web Views",
- "item": [
- {
- "name": "Login",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "pm.test(\"Full template is rendered\", function() {",
- " pm.expect(pm.response.text()).to.include(\"