Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>com.spotstat</groupId>
<artifactId>S4J</artifactId>
<version>1.1a</version>
<version>1.1.1a</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/spotify/requests/AbstractRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,12 @@ public String buildRequestUrl() {
}

String parameter = Util.join(strings, ",");
parameter = parameter.replace(" ", "%20");
sb.append(parameter);
sb.append("&");
} else {
sb.append(o);
String v = o.toString().replace(" ", "%20");
sb.append(v);
sb.append("&");
}
field.setAccessible(false);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/spotify/requests/search/SearchGet.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.spotify.requests.SpotifyRequest;
import com.spotify.requests.SpotifyRequestField;
import com.spotify.requests.util.Market;
import com.spotify.requests.util.Type;


@SpotifyRequest("search")
Expand All @@ -13,7 +14,7 @@ public class SearchGet extends AbstractRequest {
private final String q;

@SpotifyRequestField
private final String type;
private final Type[] type;

@SpotifyRequestField
private String include_external;
Expand All @@ -27,7 +28,7 @@ public class SearchGet extends AbstractRequest {
@SpotifyRequestField
private int offset;

public SearchGet(String q, String type) {
public SearchGet(String q, Type... type) {
this.q = q;
this.type = type;
this.include_external = null;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/spotify/requests/util/Type.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

public enum Type {

ARTISTS,
TRACKS;
ARTIST,
TRACK;


@Override
Expand Down
13 changes: 7 additions & 6 deletions src/test/java/com/spotify/Main.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package com.spotify;

import com.spotify.json.JSONObject;
import com.spotify.requests.AbstractRequest;
import com.spotify.requests.tracks.SeveralTrackAudioFeaturesGet;
import com.spotify.requests.search.SearchGet;
import com.spotify.requests.util.Type;

public class Main {


public static void main(String[] args) throws IllegalAccessException {
SpotifyClient sc = new SpotifyClientBuilderTester().getBuiltClient();
SpotifyClient sc = new SpotifyClientBuilderTester().printAccessToken().getBuiltClient();

SearchGet searchGet = new SearchGet("Don't Stop artist:Fleetwood Mac", Type.TRACK);
// AbstractRequest al = new SeveralTrackAudioFeaturesGet("05lBXOMA1uHpVPEQZyjoh3", "1ljziaoMnRH95aPeOSGAtr1");

AbstractRequest al = new SeveralTrackAudioFeaturesGet("05lBXOMA1uHpVPEQZyjoh3", "1ljziaoMnRH95aPeOSGAtr1");

JSONObject jsonObject = sc.executeRequest(al).ok();
System.out.println(searchGet.buildRequestUrl());
JSONObject jsonObject = sc.executeRequest(searchGet).ok();
System.out.println(jsonObject.toString(4));


Expand Down