Energy-Price-News-API / energy-prices-api

A news site scraping API with a few different endpoints that provide links to articles related to energy prices
https://energy-price-news.mizouzie.dev
MIT License
47 stars 43 forks source link

Adding documentation for the pagination feature #143

Closed mumin-khan closed 2 years ago

mumin-khan commented 2 years ago

What would you like to share?

Here is the necessary information regaridng the pagination feature: By adding query parameters page and limit any route can be paginated . page parameter is necessary while limit is optional by default the value is 5 . If none of the parameters is passed , a dictionary of result is returned , else a dictionary of the following format is returned : { previous: link to the previous page if it exists, next : link to the next page if it exists , total : the numbers of total items for that route , pages : the total number of pages (total/limit), limit : the number of object to be returned in results, currentPage: current page number, results : { a dictionary of results , length is equal to the limit set } }

Additional information

See this https://github.com/Energy-Price-News-API/energy-prices-api/issues/127#issuecomment-1250223799 for returned object

takanome-dev commented 2 years ago

I think we should have API documentation like swagger or something to document each endpoint. For example, what are the parameters, the type of request and the expected answer?

@MizuzieE, what do you think?

MizouziE commented 2 years ago

That's definitely something to aim for! But we can keep it simple for now and build up to it.

Can we just do an API-DOCS.md for now and then I think we should be able to move that, along with other docs into a ./docs folder which we can then host free on github pages.

I've written an entire documentation for a work project that was super easy cos it was all on a Next.js utilising MarkDoc that parses markdown and builds out a nice website that is typical of the type of good documentation you get for popular frameworks. We could easily upgrade to a separately hosted full documentation when/if the project grows more.

takanome-dev commented 2 years ago

I'm all for it :rocket: