Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@SarahRoseLives
Copy link
Contributor

I'm sure this could use a better endpoint name but here is the new endpoint that provides json output similar to /ns INFO

#2260

➜ ~ curl -X POST
-H "Authorization: Bearer <YOUR_TOKEN_HERE>"
-H "Content-Type: application/json"
-d '{"nick":"SarahRose"}'
http://127.0.0.1:8089/v1/ns_info
{"success":true,"accountName":"SarahRose","registeredAt":"Mon, 05 May 2025 05:30:20 UTC","channels":["#test3","#test5","#reports","#admins","#work-day","#announcements","#triggering","#null","#hrt","#welcome"],"channelCount":10}

@SarahRoseLives
Copy link
Contributor Author

Added endpoint /healthcheck

#2257

➜ ~ curl -H "Authorization: <>" http://localhost:8089/v1/healthcheck
{"version":"ergo-2.17.0-unreleased","go_version":"go1.24.0","start_time":"2025-05-22T08:24:10Z","users":{"total":1,"invisible":1,"operators":0,"unknown":1,"max":1},"channels":11,"servers":1}

@SarahRoseLives
Copy link
Contributor Author

Added endpoint /account_list

Alright, I'm tired, off to bed.

➜ ~ curl -X GET http://localhost:8089/v1/account_list
-H "Authorization: Bearer "
-H "Content-Type: application/json"
-d '{"limit":10,"filter":""}'

{"accounts":[{"success":true,"accountName":"RoseBot"},{"success":true,"accountName":"Roze"},{"success":true,"accountName":"Roze2"},{"success":true,"accountName":"Roze_"},{"success":true,"accountName":"SarahRose"},{"success":true,"accountName":"spectrum"},{"success":true,"accountName":"thebirdwashere"}],"totalCount":7}

@slingamn
Copy link
Member

Thanks very much! Planning to review this on Sunday.

Copy link
Member

@slingamn slingamn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for this excellent contribution! I've made a bunch of requests for changes --- you're welcome to work on them yourself, obviously, but if you want me to do them I can do that as well.

To fix the linting issue you can run make gofmt. You can run make test and make irctest locally to check your work, including linting. (irctest requires that you have the Python pytest library installed; you can install it from a typical Linux distribution's package manager, but no worries if you don't want to, these changes here are not covered by irctest anyway.)

@SarahRoseLives
Copy link
Contributor Author

Thank you :)

I'll take a look at these when I have some more time to hammer away at it.
I really appreciate all your input. I have other ideas for possible endpoints but I want to make sure what I do is actually done right, per your spec.

Switched from GET to POST requests to follow existing documentation/api

Removed substring match/filter

Using SemVer instead of Ver

Switched to utils.IRCv3TimestampFormat

Renamed Health_Check endpoint to /status

updated API.md
@SarahRoseLives
Copy link
Contributor Author

SarahRoseLives commented May 24, 2025

Alright, I think I've about covered the updates you've requested. Let me know if anything else needs tweaking. :)

1e21914

Copy link
Member

@slingamn slingamn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

…on time and account channels to the endpoint.

renamed StatusResponse to apiStatusResponse

Using utils.IRCv3TimestampFormat for all dates within the api

updated API.md with the changes.
@SarahRoseLives
Copy link
Contributor Author

Thanks for your feedback, I'll try to keep these things in mind moving forward.

@slingamn
Copy link
Member

Thanks! I'm going to merge this, we can consider readding pagination for account_list later.

@slingamn slingamn merged commit e4aac56 into ergochat:master May 25, 2025
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.

2 participants