Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mgmt API and unit test improvements #61

Merged
merged 2 commits into from
Aug 29, 2024
Merged

Conversation

jgknight
Copy link
Contributor

Summary

Closes #42

Adds new API endpoints

  • /user/{screenname}/account - fetch profile html, email address, registration and confirmation status for a given account
  • /user/{screenname}/icon - fetch the users buddy icon (image/gif)
  • /session/{screenname} - filter session information to a given screen name

Modifies existing endpoints

  • /session - Now includes the online seconds, away message HTML, idle seconds

Centralizes fetching a user's buddy icon bart item as a function of the FeedBagManager.

Removes the xxxHandler functions in the mgmt api in favor of using new patterns available for the http.ServeMux.HandleFunc registrations that can now include the HTTP method.

Unit tests were updated with mockParams for all of the interfaces used throughout the tests. Unit tests were also added for the new endpoints.

Testing

Fetching account information for an AIM account

curl -s localhost:8080/user/testuser10/account | jq
{
  "id": "testuser10",
  "screen_name": "TestUser10",
  "profile": "<HTML><BODY BGCOLOR=\"#ffffff\"><B><FONT LANG=\"0\">Hello, %n!<BR></B></FONT><FONT>:-D</FONT></BODY></HTML>",
  "email_address": "<[email protected]>",
  "reg_status": 2,
  "confirmed": false,
  "is_icq": false
}

Fetching account information for an ICQ account

curl -s localhost:8080/user/100003/account | jq
{
  "id": "100003",
  "screen_name": "100003",
  "profile": "",
  "email_address": "",
  "reg_status": 3,
  "confirmed": false,
  "is_icq": true
}

Fetching the buddy icon for a given user in the browser
image

Fetching session data now outputs more information for each session

curl -s localhost:8080/session | jq
{
  "count": 2,
  "sessions": [
    {
      "id": "testuser10",
      "screen_name": "TestUser10",
      "online_seconds": 2714.50983925,
      "away_message": "I am not available because I am playing a computer game that takes up the whole screen.",
      "idle_seconds": 0,
      "is_icq": false
    },
    {
      "id": "testusertwo",
      "screen_name": "TestUserTwo",
      "online_seconds": 32.159343334,
      "away_message": "",
      "idle_seconds": 0,
      "is_icq": false
    }
  ]
}

Fetch session data for just a single screen name

curl -s localhost:8080/session/testuser10 | jq
{
  "count": 1,
  "sessions": [
    {
      "id": "testuser10",
      "screen_name": "TestUser10",
      "online_seconds": 2746.76254525,
      "away_message": "I am not available because I am playing a computer game that takes up the whole screen.",
      "idle_seconds": 0,
      "is_icq": false
    }
  ]
}

All unit tests pass

Allow for fetching additional account, session, and buddy icon data using the mgmt api

Centralize fetching of buddy icon BART items
@mk6i mk6i merged commit 2e0cf41 into mk6i:main Aug 29, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add API endpoint to get online/offline/away/idle status, plus away message if possible
2 participants