Skip to content

Commit

Permalink
Feat: implement external api handlers (#66)
Browse files Browse the repository at this point in the history
만드신 구현체 기준으로 타입마다 사용될 구현체들을 더 선언했습니다.
  • Loading branch information
jaekkang authored Oct 29, 2023
1 parent 6c06da0 commit 995fd36
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class ExternalApiHandlerResolver {
public ExternalApiHandlerResolver(List<ExternalApiHandler> handlers) {
handlers.forEach(handler -> handlerMap.put(handler.getSourceType(), handler));
}

/**
* 핸들러를 검색하여 반환.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@Component
@Slf4j
public class FacebookApiHandler implements ExternalApiHandler{
public class FacebookApiHandler implements ExternalApiHandler {
@Override
public ContentSourceType getSourceType() {
return ContentSourceType.FACEBOOK;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package beforespring.socialfeed.content.service;

import beforespring.socialfeed.content.domain.ContentSourceType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class InstagramApiHandler implements ExternalApiHandler {
@Override
public ContentSourceType getSourceType() {
return ContentSourceType.INSTAGRAM;
}

@Override
public void like(String contentSourceId) {
log.info("Instagram like contentSourceId: {}", contentSourceId);
}

@Override
public void share(String contentSourceId) {
log.info("Instagram share contentSourceId: {}", contentSourceId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package beforespring.socialfeed.content.service;

import beforespring.socialfeed.content.domain.ContentSourceType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ThreadsApiHandler implements ExternalApiHandler {
@Override
public ContentSourceType getSourceType() {
return ContentSourceType.THREADS;
}

@Override
public void like(String contentSourceId) {
log.info("Threads like contentSourceId: {}", contentSourceId);
}

@Override
public void share(String contentSourceId) {
log.info("Threads share contentSourceId: {}", contentSourceId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package beforespring.socialfeed.content.service;

import beforespring.socialfeed.content.domain.ContentSourceType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class TwitterApiHandler implements ExternalApiHandler {
@Override
public ContentSourceType getSourceType() {
return ContentSourceType.TWITTER;
}

@Override
public void like(String contentSourceId) {
log.info("Twitter like contentSourceId: {}", contentSourceId);
}

@Override
public void share(String contentSourceId) {
log.info("Twitter share contentSourceId: {}", contentSourceId);
}
}

0 comments on commit 995fd36

Please sign in to comment.