Skip to content
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

Implement random page API #4

Closed
dopecodez opened this issue Dec 11, 2020 · 6 comments · Fixed by #11
Closed

Implement random page API #4

dopecodez opened this issue Dec 11, 2020 · 6 comments · Fixed by #11
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@dopecodez
Copy link
Owner

dopecodez commented Dec 11, 2020

There are a lot of new REST APIs for wikipedia present in the REST API docs.

We'll look through them one by one and implement the same. Any one who wants to pick up on any other REST API should ideally open a new issue.

The REST API has a /page​/random​/{format} endpoint which which gives a page in given format. This is something I would love to have in wikipedia. Find more details here.

Implementation for this should follow the summary or related method flow. Remember to write unit tests for all possible scenarios in your new functions, and try to use types as far as possible.

I'll be happy to help anyone who wants to pick this up.

@dopecodez dopecodez added enhancement New feature or request help wanted Extra attention is needed labels Dec 11, 2020
@dopecodez dopecodez added the good first issue Good for newcomers label Feb 3, 2021
@friendofdog
Copy link
Contributor

Are you still looking for help on this issue? If so, I'd like to pitch in.

I'm not sure what is meant by, "Implementation for this should follow the summary or related method flow". But I'm fine writing tests and using types.

@dopecodez
Copy link
Owner Author

Sure, @friendofdog , help with this would be welcome.

You only need to use types and write unit tests, you can ignore the other part

friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 6, 2021
Returns data from random Wikipedia page in format based on given
argument.

resolving dopecodez#4
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 6, 2021
@friendofdog
Copy link
Contributor

Understood, @dopecodez . I wrote tests and a basic implementation. (Pardon me for doing so, I borrowed much from existing tests. First time using Jest.)

As for types, the Wikipedia.org API returns six unique types: 5 kinds of JSON objects or an HTML string. Should I add the missing types to resultTypes.js or is this a bit overkill?

@dopecodez
Copy link
Owner Author

I think it's best to borrow from existing tests.

That's an interesting question, I think we can skip over the types not currently present in the package. We would ideally need to implement the method like mobile-sections and the rest before we support the same in random.

I will take a detailed look at your changes once you open an MR, @friendofdog , thanks.

friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 24, 2021
Added summary, HTML, title

resolving dopecodez#4
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 25, 2021
Added related, mobile-sections. mobile-sections-lead is another return
format, but is almost identical to mobile-sections (it has one extra
field, "geo"). Similar enough that no additional type written for
mobile-sections-lead.

resolving dopecodez#4
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 25, 2021
Returns data from random Wikipedia page in format based on given
argument.

resolving dopecodez#4
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 25, 2021
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 25, 2021
Added summary, HTML, title

resolving dopecodez#4
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 25, 2021
Added related, mobile-sections. mobile-sections-lead is another return
format, but is almost identical to mobile-sections (it has one extra
field, "geo"). Similar enough that no additional type written for
mobile-sections-lead.

resolving dopecodez#4
@friendofdog
Copy link
Contributor

Pardon the delay.

I took a look at the return formats from the API and they all looked fairly essential. So I just went ahead and creates types for all of them.

Just made a draft PR, #11. How does it look?

@dopecodez
Copy link
Owner Author

Looks good, @friendofdog . Lets continue this conversation there.

friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 27, 2021
relatedItem too redundant with wikiSummary. Added fields to wikiSummary

resolving dopecodez#4
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 27, 2021
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 27, 2021
Returns data from random Wikipedia page in format based on given
argument.

resolving dopecodez#4
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 27, 2021
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 27, 2021
Added summary, HTML, title

resolving dopecodez#4
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 27, 2021
Added related, mobile-sections. mobile-sections-lead is another return
format, but is almost identical to mobile-sections (it has one extra
field, "geo"). Similar enough that no additional type written for
mobile-sections-lead.

resolving dopecodez#4
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 27, 2021
relatedItem too redundant with wikiSummary. Added fields to wikiSummary

resolving dopecodez#4
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 27, 2021
friendofdog added a commit to friendofdog/Wikipedia that referenced this issue Mar 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants