-
Notifications
You must be signed in to change notification settings - Fork 483
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
Initial proposed new routes #3388
base: master
Are you sure you want to change the base?
Conversation
I have started going through and defining the new endpoints that I think will be useful. It will be a bit before these are ready to review. |
I don't have enough context / code base knowledge to have an input on the grand scheme of things here, but I wanted to add some thoughts on what I consider "nice" when creating API's that others might use one response type per entityI agree that this is the way to go, and I have no objections here, just wanted to bring it up and say that I think you are completely on the right track here! EDIT: looks like you put it under the libraries only, but I'll leave my comment here anyway entities should be in pluralI generally think that the entities should be in plural (ie granted you do not have a create new book endpoint att (ie reduce the amount of
|
Thanks for the feedback! I'll try and address everything here.
We will probably move away from having everything under the library endpoints (so like We would still have an endpoint like ETA: Not sure if you were just reading my above table or actually looking at the modified files. The changes in
I agree with this, but we already have
Books can have multiple covers and can be switched between in the web interface. I agree that editing metadata like in
This makes sense as well. |
Ah, I see, I started by just looking at the table, but then went to check the files, therefore thought it would be only under the library endpoint.
This is also completely normal, and what I meant by my original "both" (you can either get something like
Ah 🤔 I didn't know that, but that makes sense then as well i guess, I would probably go for |
I am mostly done with the endpoints for a new spec. The main ones I have left are:
I hope to have these done in the next week or so. The file routes and session endpoints will be the most difficult, but shouldn't be too terrible. |
I think this PR is ready for general review. I have not done the My thought is to get the main components of the web client, like tables and cards, to use the new endpoints and create the new "library level" endpoints to make better use of the data model without converting everything back to the old model, and then support the old API endpoints for a few months to give 3rd-party apps a chance to update to the new data model, then eventually deprecate the old routes. EDIT: This does not include websocket descriptions, I could not find a good way to describe those using OpenAPI. |
This PR is an attempt at proposing some new API endpoints to better facilitate an OpenAPI spec and allow for easier changes to the API to match more closely with the new data model.
From the perspective of the OpenAPI spec, we want each endpoint to have only one return type. While the OpenAPI specification is able to include different return schemas for a single endpoint, support for this varies by tool and language generator. Many (all?) tools do not fully implement all aspects of OpenAPI 3.0. In order to achieve this goal, I propose that new endpoints are defined for each media media type (book, podcast, and podcast episode).
For example, if we can split the
/libraries/{id}/items
endpoint into 3 different endpoints with distinct return types, this will make the OpenAPI spec much simpler and reduce the information loaded and sent to the client. If a client needs more information about a specific book, podcast, or episode, the relevant endpoints would be queried./libraries/{id}/books
/libraries/{id}/podcasts
/libraries/{id}/podcast-episodes
Here is a list of what I think the new routes could be. Note that all of these are new endpoints so they can be developed as their own controller without breaking existing endpoints, and then switching the web client over to using the new endpoints to ensure everything is working correctly before deprecating any other endpoints. Some of these endpoints will be a little clunky with the current database, but once migrations are set up #3378 then we can migrate some things around (like simplifying the file endpoints).
/book/{id}
GET
PATCH
libraryItem
and themedia
objects.DELETE
/book/{id}/download
GET
/book/{id}/cover
GET
POST
PATCH
DELETE
/book/{id}/match
POST
/book/{id}/play
POST
/book/{id}/tracks
PATCH
/book/{id}/scan
POST
/book/{id}/metadata-object
GET
/book/{id}/chapters
POST
/book/{id}/ebook
GET
fileId
instead of having it as part of the path, otherwise default to primary ebook if it exists.PATCH
fileId
and requestBody includes whether it should be primary or not./podcast/{id}
GET
PATCH
libraryItem
and themedia
objects.DELETE
/podcast/{id}/download
GET
/podcast/{id}/cover
GET
POST
PATCH
DELETE
/podcast/{id}/match
POST
/podcast/{id}/play
POST
/podcast/{id}/scan
POST
/podcast/{id}/metadata-object
GET
/podcast-episode/{id}
GET
PATCH
DELETE
/podcast-episode/{id}/download
GET
/file/{id}/download
endpoint./podcast-episode/{id}/match
POST
/podcast-episode/{id}/play
POST
/file/{id}
GET
/file/{id}/ffprobe
GET
/file/{id}/download
GET