feat: add Shikimori metadata service endpoint

Co-authored-by: aider (openrouter/deepseek/deepseek-chat) <aider@aider.chat>
This commit is contained in:
2026-02-03 22:58:57 +05:00
parent 3223d689c2
commit 6b2479b455
8 changed files with 85 additions and 0 deletions

View File

@ -39,6 +39,14 @@
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-rest</artifactId> <artifactId>quarkus-rest</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.microprofile.rest.client</groupId>
<artifactId>microprofile-rest-client-api</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client</artifactId>
</dependency>
<dependency> <dependency>
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-junit</artifactId> <artifactId>quarkus-junit</artifactId>

View File

@ -0,0 +1,13 @@
package com.backend.metadata.shikimori.model;
import java.util.List;
public class AnimeMetadata {
public int shikimori_id;
public String title;
public String poster;
public String description;
public List<Character> characters;
public List<RelatedAnime> related;
public List<VoiceActor> voice_actors;
}

View File

@ -0,0 +1,8 @@
package com.backend.metadata.shikimori.model;
public class Character {
public String name;
public String role;
public String poster;
public String seiyuu;
}

View File

@ -0,0 +1,7 @@
package com.backend.metadata.shikimori.model;
public class RelatedAnime {
public int shikimori_id;
public String relation;
public String title;
}

View File

@ -0,0 +1,7 @@
package com.backend.metadata.shikimori.model;
public class VoiceActor {
public String name;
public String language;
public String character;
}

View File

@ -0,0 +1,22 @@
package com.backend.metadata.shikimori.service;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import org.eclipse.microprofile.rest.client.inject.RestClient;
@Path("/metadata")
public class MetadataResource {
@RestClient
ShikimoriService shikimoriService;
@GET
@Path("/{shikimori_id}")
@Produces(MediaType.APPLICATION_JSON)
public AnimeMetadata getMetadata(@PathParam("shikimori_id") int shikimoriId) {
return shikimoriService.getMetadata(shikimoriId);
}
}

View File

@ -0,0 +1,17 @@
package com.backend.metadata.shikimori.service;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@RegisterRestClient(configKey = "shikimori-api")
public interface ShikimoriService {
@GET
@Path("/api/graphql")
@Produces(MediaType.APPLICATION_JSON)
AnimeMetadata getMetadata(@PathParam("id") int shikimoriId);
}

View File

@ -0,0 +1,3 @@
# Shikimori API configuration
shikimori-api/mp-rest/url=https://shikimori.one
shikimori-api/mp-rest/scope=jakarta.inject.Singleton