Skip to content

Commit

Permalink
don't always need organizer permissions for matches
Browse files Browse the repository at this point in the history
  • Loading branch information
BrentonPoke committed Apr 11, 2021
1 parent ef1777c commit b9039be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.brentonpoke</groupId>
<artifactId>toornamentclient</artifactId>
<version>2.0.7</version>
<version>2.0.8</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
17 changes: 11 additions & 6 deletions src/main/java/com/toornament/concepts/Matches.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,18 @@ public List<MatchDetails> getMatches(MatchQuery parameter,String headers) {
urlBuilder.addQueryParameter("sort", parameter.getSort().getName());

logger.debug("url: {}",urlBuilder.build().toString());
Request request = client.getAuthenticatedRequestBuilder()
.get()
.url(urlBuilder.build())
.addHeader("Range",headers)
.build();
Request.Builder request;
if(scope.equals("organizer"))
request = client.getAuthenticatedRequestBuilder();
else
request = client.getRequestBuilder();

request
.get()
.url(urlBuilder.build())
.addHeader("Range",headers);
try{
String responseBody = client.executeRequest(request).body().string();
String responseBody = client.executeRequest(request.build()).body().string();
return mapper.readValue(responseBody, mapper.getTypeFactory().constructCollectionType(List.class, MatchDetails.class));
} catch (IOException e) {
logger.error(e.getMessage());
Expand Down

0 comments on commit b9039be

Please sign in to comment.