Split api_controller actions into their own controllers #2160
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been planning on a refactoring of api-related controllers for a while. For further background reading, see gravitystorm#27.
I want to refactor the api-related controllers to inherit from a common controller (in the same way that regular controllers normally inherit from ApplicationController). The only convention that I found has this base controller named as "ApiController", but we're already using that name. So I thought about renaming our current ApiController, to free up the name for reuse, but I couldn't figure out a good descriptive name for the actions in the current ApiController. And then I realised that's because they are mostly unrelated to each other, and so I could split them into separate controllers instead.
So that's what this PR does - it splits the ApiController into separate controllers for each unrelated action.
I've chosen to put them in an "api" namespace (aka subdirectory) since I plan to do this for the rest of the api-related controllers. It is also the end-goal for other work that I'm doing on supporting multiple API versions (see gravitystorm#28), so creating the new controllers in the subdirectory should avoid further renaming.