torrust-tracker
torrust-tracker copied to clipboard
Extract Tracker API Client packages
We are using a Tracker API Client in test code.
See: https://github.com/torrust/torrust-tracker/blob/develop/tests/servers/api/v1/client.rs
That client is duplicated in the Index because the Index calls the Tracker API:
https://github.com/torrust/torrust-index/blob/develop/src/tracker/api.rs
We should extract that login into an independent package so that the Index can use it and we remove that duplicate code.
Before extracting the package we should clean it and make it ready for production. Currently, is not ready because
- The URL schema is hardcoded to
http://. - It panics if the HTTP fails. We should return an error and let the user handle it.
- We should decide if we expose
requesterrors or we wrap them.
I propose to create this packages:
- folder (crates.io package name)
packages/api-types(torrust-tracker-api-types)packages/api-client(torrust-tracker-api-client) <- depends ontorrust-tracker-api-typespackages/api-server(torrust-tracker-api-server) <- depends ontorrust-tracker-api-types. Maybe in the future
Relates to: https://github.com/torrust/torrust-tracker/issues/255#issuecomment-1477478212