You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Randomly picks a name from the returned 5000 names
(by shuffling the returned array and picking the first element)
Tweeting the picked name
Having to query the API for 5000 names, only to pick one to tweet is very inefficient.
Another thing being omitted is the status of the name to be tweeted. Currently, there is no check in place to ensure that the randomly selected name is actually in a PUBLISHED state. Only names in PUBLISHED state should be tweeted as those are the ones publicly available in the dictionary.
This GitHub issue is to note this short-comings and to provide a fix by implementing a more efficient way to retrieve name to be tweeted while taking into consideration the published state.
The current API of YorubaName does not make it straightforward to randomly pick a name, but a suggestion that would be more efficient than the current implementation would be to:
Instead of using only the count query parameter on the /v1/names endpoint, use a combination of the following supported query parameters: page, count and state to build a more efficient query, eg:
v1/names?count=[random count with a reasonable upper limit]&page=[random selected page number]&state=PUBLISHED
The current implementation for picking a name from the YorubaName dictionary and tweeting it is not efficient.
Right now, the bot follows the following steps to tweet:
Having to query the API for 5000 names, only to pick one to tweet is very inefficient.
Another thing being omitted is the status of the name to be tweeted. Currently, there is no check in place to ensure that the randomly selected name is actually in a PUBLISHED state. Only names in PUBLISHED state should be tweeted as those are the ones publicly available in the dictionary.
This GitHub issue is to note this short-comings and to provide a fix by implementing a more efficient way to retrieve name to be tweeted while taking into consideration the published state.
The current API of YorubaName does not make it straightforward to randomly pick a name, but a suggestion that would be more efficient than the current implementation would be to:
count
query parameter on the/v1/names
endpoint, use a combination of the following supported query parameters:page
,count
andstate
to build a more efficient query, eg:Check the YorubaName Swagger API page to explore the available endpoints.
The text was updated successfully, but these errors were encountered: