Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added missing request (RemoveTracksFromPlaylist request is still missing).
- Loading branch information
Wolftein
committed
Jan 5, 2015
1 parent
53c4656
commit cd16fa9
Showing
7 changed files
with
290 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
library/src/main/java/me/siegenthaler/spotify/webapi/android/model/Snapshot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (C) 2014 Siegenthaler Solutions. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package me.siegenthaler.spotify.webapi.android.model; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
public class Snapshot { | ||
@SerializedName("snapshot_id") | ||
private String mId; | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
final public String getId() { | ||
return mId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...rc/main/java/me/siegenthaler/spotify/webapi/android/request/PlaylistAddTracksRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (C) 2014 Siegenthaler Solutions. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package me.siegenthaler.spotify.webapi.android.request; | ||
|
||
import android.text.TextUtils; | ||
|
||
import com.android.volley.Request; | ||
|
||
import java.util.Locale; | ||
|
||
import me.siegenthaler.spotify.webapi.android.model.Snapshot; | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
public class PlaylistAddTracksRequest extends AbstractRequest.Builder<PlaylistAddTracksRequest, Snapshot> { | ||
/** | ||
* (non-doc) | ||
*/ | ||
public PlaylistAddTracksRequest() { | ||
super(Snapshot.class, Request.Method.POST); | ||
} | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
final public PlaylistAddTracksRequest setPlaylist(String user, String playlist) { | ||
return setPath(String.format(Locale.ENGLISH, "/v1/users/%s/playlists/%s/tracks", user, playlist)); | ||
} | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
final public PlaylistAddTracksRequest setTracks(int position, String... ids) { | ||
addParameter("position", String.valueOf(position)); | ||
return addParameter("uris", TextUtils.join(",", ids)); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...ain/java/me/siegenthaler/spotify/webapi/android/request/PlaylistChangeDetailsRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (C) 2014 Siegenthaler Solutions. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package me.siegenthaler.spotify.webapi.android.request; | ||
|
||
import com.android.volley.Request; | ||
|
||
import java.util.Locale; | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
public class PlaylistChangeDetailsRequest extends AbstractRequest.Builder<PlaylistChangeDetailsRequest, Void> { | ||
/** | ||
* (non-doc) | ||
*/ | ||
public PlaylistChangeDetailsRequest() { | ||
super(Void.class, Request.Method.PUT); | ||
setJsonBody(true); | ||
} | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
final public PlaylistChangeDetailsRequest setPlaylist(String user, String playlist) { | ||
return setPath(String.format(Locale.ENGLISH, "/v1/users/%s/playlists/%s", user, playlist)); | ||
} | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
final public PlaylistChangeDetailsRequest serName(String name) { | ||
return addParameter("name", name); | ||
} | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
final public PlaylistChangeDetailsRequest setPublic(boolean isPublic) { | ||
return addParameter("public", isPublic ? "true" : "false"); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...y/src/main/java/me/siegenthaler/spotify/webapi/android/request/PlaylistCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (C) 2014 Siegenthaler Solutions. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package me.siegenthaler.spotify.webapi.android.request; | ||
|
||
import com.android.volley.Request; | ||
|
||
import java.util.Locale; | ||
|
||
import me.siegenthaler.spotify.webapi.android.model.Playlist; | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
public class PlaylistCreateRequest extends AbstractRequest.Builder<PlaylistCreateRequest, Playlist> { | ||
/** | ||
* (non-doc) | ||
*/ | ||
public PlaylistCreateRequest() { | ||
super(Playlist.class, Request.Method.POST); | ||
setJsonBody(true); | ||
} | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
final public PlaylistCreateRequest setUser(String user) { | ||
return setPath(String.format(Locale.ENGLISH, "/v1/users/%s/playlists", user)); | ||
} | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
final public PlaylistCreateRequest serName(String name) { | ||
return addParameter("name", name); | ||
} | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
final public PlaylistCreateRequest setPublic(boolean isPublic) { | ||
return addParameter("public", isPublic ? "true" : "false"); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...ain/java/me/siegenthaler/spotify/webapi/android/request/PlaylistReplaceTracksRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (C) 2014 Siegenthaler Solutions. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package me.siegenthaler.spotify.webapi.android.request; | ||
|
||
import android.text.TextUtils; | ||
|
||
import com.android.volley.Request; | ||
|
||
import java.util.Locale; | ||
|
||
import me.siegenthaler.spotify.webapi.android.model.Snapshot; | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
public class PlaylistReplaceTracksRequest extends AbstractRequest.Builder<PlaylistReplaceTracksRequest, Snapshot> { | ||
/** | ||
* (non-doc) | ||
*/ | ||
public PlaylistReplaceTracksRequest() { | ||
super(Snapshot.class, Request.Method.PUT); | ||
} | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
final public PlaylistReplaceTracksRequest setPlaylist(String user, String playlist) { | ||
return setPath(String.format(Locale.ENGLISH, "/v1/users/%s/playlists/%s/tracks", user, playlist)); | ||
} | ||
|
||
/** | ||
* (non-doc) | ||
*/ | ||
final public PlaylistReplaceTracksRequest setTracks(String... ids) { | ||
return addParameter("uris", TextUtils.join(",", ids)); | ||
} | ||
} |