Initial codebase commit
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
package com.backend.extractor.kodik.service.anyame_backend;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class AnyameBackendApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AnyameBackendApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.backend.extractor.kodik.service.anyame_backend.api;
|
||||
|
||||
import com.backend.extractor.kodik.service.anyame_backend.api.model.KodikPlayerResponse;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface KodikPlayerAPI {
|
||||
String BASE_PLAYER_URL = "https%3A%2F%2Fkodikdb.com%2Ffind-player%3F";
|
||||
|
||||
default String shikimoriURL(String id) {
|
||||
return BASE_PLAYER_URL + "shikimoriID%3D" + id;
|
||||
}
|
||||
|
||||
default String kinopoiskURL(String id) {
|
||||
return BASE_PLAYER_URL + "kinopoiskID%3D";
|
||||
}
|
||||
|
||||
default String imdbURL(String id) {
|
||||
return BASE_PLAYER_URL + "kinopoiskID%3D";
|
||||
}
|
||||
|
||||
@GET("get-player")
|
||||
Call<KodikPlayerResponse> getPlayer(
|
||||
@Query("title") String title,
|
||||
@Query("hasPlayer") Boolean hasPlayer,
|
||||
@Query("url") String url,
|
||||
@Query("token") String token,
|
||||
@Query("shikimoriID") String shikimoriID,
|
||||
@Query("kinopoiskID") String kinopoiskID,
|
||||
@Query("imdbID") String imdbID
|
||||
);
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.backend.extractor.kodik.service.anyame_backend.api.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class KodikPlayerResponse {
|
||||
private String link;
|
||||
private String title;
|
||||
private Boolean hasPlayer;
|
||||
private String error;
|
||||
|
||||
public String getLink() { return link; }
|
||||
public void setLink(String link) { this.link = link; }
|
||||
|
||||
public String getTitle() { return title; }
|
||||
public void setTitle(String title) { this.title = title; }
|
||||
|
||||
public Boolean getHasPlayer() { return hasPlayer; }
|
||||
public void setHasPlayer(Boolean hasPlayer) { this.hasPlayer = hasPlayer; }
|
||||
|
||||
public String getError() { return error; }
|
||||
public void setError(String error) { this.error = error; }
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.backend.extractor.kodik.service.anyame_backend.component;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class KodikAPITokenProvider {
|
||||
@Value("${KODIK_TOKEN}")
|
||||
private String kodikToken;
|
||||
|
||||
public String getKodikToken() {
|
||||
return kodikToken;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.backend.extractor.kodik.service.anyame_backend.config;
|
||||
|
||||
import com.backend.extractor.kodik.service.anyame_backend.api.KodikPlayerAPI;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.jackson.JacksonConverterFactory;
|
||||
|
||||
@Configuration
|
||||
public class APIConfig {
|
||||
|
||||
private static final String KODIK_API_URL = "https://kodikapi.com/";
|
||||
|
||||
@Bean
|
||||
public Retrofit retrofit() {
|
||||
return new Retrofit.Builder()
|
||||
.baseUrl(KODIK_API_URL)
|
||||
.addConverterFactory(JacksonConverterFactory.create())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public KodikPlayerAPI kodikPlayerAPI(Retrofit retrofit) {
|
||||
return retrofit.create(KodikPlayerAPI.class);
|
||||
}
|
||||
|
||||
}
|
1
src/main/resources/application.properties
Normal file
1
src/main/resources/application.properties
Normal file
@ -0,0 +1 @@
|
||||
spring.application.name=anyame-backend
|
@ -0,0 +1,13 @@
|
||||
package com.backend.extractor.kodik.service.anyame_backend;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class AnyameBackendApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user