This week, I used my Open Source project FireLinker to interact with Telescope.Last week, I wrote a blog about my first contribution to telescope in that blog I already had setup telescope on my local machine and I also talked about working with it more in the future. So, here we are I am using my FireLinker to check links in the posts API for telescope.
previous blog about telescope with setup: https://dev.to/zg3d/telescope-my-first-contribution-19en
The way the posts API works is every time you go to /posts on the backend server you get a JSON of the 10 latest post with a relative URL and post id.
I made a new command for my FireLinker So it can interact with APIs. I tried to generalize it but my goal was to connect with the telescope API. So, I did make some assumptions like I knew it was a relative path, so I found the base URL and added it. I also made an assumption that there was a attribute for URL in the API. But with those assumptions I got it working on my local machine. FireLinker basically uses the given API URL and fetch it with a get request and from there the code parses the JSON and checks on the URL links.
This was a very quick and dirty way of doing things. I still need to add check to see id the API URL is valid and proper error code messaging. This was a simple thing to do as I am comfortable with working with API like rest. And this was a basic API.
So, I also made it so that FireLinker check all links in the 10 recent posts. Which made my code more modular and now I am happy with the state of my code.