Skip to content

Commit 20064a7

Browse files
author
muriloalvesdev
committed
Improving the name of the service, because now it is not only used to search for users. I improved it to be generic.
1 parent a3dca9d commit 20064a7

4 files changed

Lines changed: 43 additions & 43 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package br.com.developers.github.http.service.developer;
2+
3+
import javax.validation.constraints.NotNull;
4+
import org.springframework.http.ResponseEntity;
5+
6+
public interface GithubService {
7+
ResponseEntity<Object> search(@NotNull String endpoint, @NotNull String qualifier, String sort,
8+
String order, int perPage, int page);
9+
}

src/main/java/br/com/developers/github/http/service/developer/GithubUserService.java

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package br.com.developers.github.http.service.developer.impl;
2+
3+
import org.springframework.beans.factory.annotation.Value;
4+
import org.springframework.http.HttpMethod;
5+
import org.springframework.http.ResponseEntity;
6+
import org.springframework.stereotype.Service;
7+
import org.springframework.web.util.UriComponents;
8+
import br.com.developers.github.http.service.developer.GithubService;
9+
import br.com.developers.github.http.service.request.Send;
10+
import br.com.developers.github.http.utils.UrlUtils;
11+
12+
@Service
13+
class GithubServiceImpl implements GithubService {
14+
15+
private Send send;
16+
17+
private String baseUrl;
18+
19+
private String search;
20+
21+
GithubServiceImpl(Send send, @Value("${github.base.url}") String baseUrl,
22+
@Value("${github.search}") String search) {
23+
this.send = send;
24+
this.baseUrl = baseUrl;
25+
this.search = search;
26+
}
27+
28+
public ResponseEntity<Object> search(String endpoint, String qualifier, String sort, String order,
29+
int perPage, int page) {
30+
UriComponents url = UrlUtils.createUrl(endpoint, this.baseUrl, this.search, qualifier, sort,
31+
order, perPage, page);
32+
return this.send.sendRequest(url, HttpMethod.GET);
33+
}
34+
}

src/main/java/br/com/developers/github/http/service/developer/impl/GithubUserServiceImpl.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)