Add helper `needs_api_tokens()`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
Research direction
Start with helpers.php and the existing Formats\GitHub, Formats\Twitter, and Formats\Facebook matches_host methods. Decide whether the helper should return service names or credential names, as the issue offers both options. Done means needs_api_tokens($url) identifies the required tokens for those services and returns an empty result for other URLs.
Written by the indexing model from the issue text.
Description
Might it be a good idea to add this helper function to helpers.php, now that there are 3 silo's that need API keys?
function needs_api_tokens($url) {
if(Formats\GitHub::matches_host($url)) return 'github';
if(Formats\Twitter::matches_host($url)) return 'twitter';
if(Formats\Facebook::matches_host($url)) return 'facebook';
return false;
}
Instead of these strings, we can also return an array of the credentials we expect.
function needs_api_tokens($url) {
if(Formats\GitHub::matches_host($url)) return ['github_access_token'];
if(Formats\Twitter::matches_host($url)) return ['twitter_api_key','twitter_api_secret','twitter_access_token','twitter_access_token_secret'];
if(Formats\Facebook::matches_host($url)) return ['facebook_app_id','facebook_app_secret'];
return [];
}
- Dominant language
- PHP
- Stars
- 96
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aaronpk/XRay
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 54/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
bug-report bug-report-triage customer report
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Codeinwp/tweet-old-post#1177 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 Half a day Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 60/100
sonata-project/dev-kit#3119 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
🧠 Admin
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day