At the frontend, we are going to create a new module called Feeds
, modify the API
module, and also the layout.phtml
file inside the Common
module. The folder structure is as follows:
As we did before, we need to extend the ApiClient.php
class and add the required methods to interact with the new endpoint we just created on the API side of the app.
The following three changes will allow us to interface the functionality provided at the frontend with the corresponding actions in the API.
The file will be modified to add three new methods: getFeeds()
, addFeedSubscription()
, and removeFeedSubscription()
. The definition of the getFeeds()
method is as follows:
public static function getFeeds($username) { $url = self::$endpointHost . sprintf( self::$endpointFeeds, $username ); return self::doRequest($url); }
The first method will just issue a GET request at the endpoint using the username
parameter on the URL. This will...