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

added recently-played endpoint #67

Closed
wants to merge 1 commit into from
Closed

added recently-played endpoint #67

wants to merge 1 commit into from

Conversation

hycday
Copy link
Contributor

@hycday hycday commented Mar 2, 2017

not sure if the test on after vs before is correct (if one is set, the other must not be specified)

Copy link
Contributor Author

@hycday hycday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed two lines to reflect the correct format of the after and before cursors

}

if (isset($options['before'])) {
$options['after'] = '';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to that instead:

        $options['after'] = NULL;

}

if (isset($options['after'])) {
$options['before'] = '';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to that instead:

        $options['before'] = NULL;

$options = (array) $options;

if (isset($options['limit'])) {
$options['limit'] = checkLimit($options['limit'], 1, 50) ? $options['limit'] : 20;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can leave these checks to Spotify. We try to avoid having defaults in our code (in case Spotify decides to change it). So just passing $options straight through should be fine.

*
* @param array|object $options Optional. Options to get tracks history.
* - int limit Optional. Maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50
* - float after Optional. Unix timestamp in ms. Returns all items after (but not including) this cursor position. If after is specified, before must not be specified
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are a bit too long (failing the linting), I think we can remove "If after is specified, before must not be specified" and "If before is specified, after must not be specified" since that's stated in Spotify docs and enforced there.

* - float after Optional. Unix timestamp in ms. Returns all items after (but not including) this cursor position. If after is specified, before must not be specified
* - float before Optional. Unix timestamp in ms. Returns all items before (but not including) this cursor position. If before is specified, after must not be specified
*
* @return array|object The most recent 50 tracks played (more than 30seconds) by a user. Type is controlled by `SpotifyWebAPI::setReturnType()`.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, "(more than 30seconds)" can be removed. And something else too probably, not sure what though.


$headers = $this->authHeaders();

$uri = '/v1/me/player/recently-played' ;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove the space before ;?

@jwilsson
Copy link
Owner

jwilsson commented Mar 2, 2017

This mostly looks good, thanks for the PR!

A test is needed, though. If you need some inspiration, testGetFeaturedPlaylists is a good one. Let me know if you need any help!

@hycday
Copy link
Contributor Author

hycday commented Mar 2, 2017

Thanks for the comments, will apply the changes and provide a test.

Just need to know how to make changes/edits to the PR. It says that I need "push access" to the patch-1 branch... (first time I do that on github :) )
Also, about the test I am not sure if I get what they are and how to...test them, but I should also do a PR for it, right ?

@jwilsson
Copy link
Owner

jwilsson commented Mar 2, 2017

It looks like you deleted your fork of this repository. I'm not sure if it's possible to continue working in this PR. Perhaps if you fork this repository again and create a branch named patch-1 again. But clone the fork to your computer so you don't have to work in the GitHub UI :)

If it's impossible to continue working on this PR, just submit a new one with the changes and a test in the same one :)

@jwilsson
Copy link
Owner

jwilsson commented Mar 2, 2017

@hycday Sorry, I forgot. You can run the tests with composer test. It will print some warnings about deprecated methods, but those can be safely ignored.

@hycday
Copy link
Contributor Author

hycday commented Mar 2, 2017

forked it again, added the changes in patch-1 and patch-1-1 for the test. let me know

@jwilsson
Copy link
Owner

jwilsson commented Mar 2, 2017

It looks like you need to open a new PR, so I'm gonna close this one.

But merge those two branches first so we get the test and the new method at the same time.

Thanks!

@jwilsson jwilsson closed this Mar 2, 2017
@hycday
Copy link
Contributor Author

hycday commented Mar 2, 2017

I opened a new PR (finally kinda understood how that works :)) #68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants