Nik Afiq 88f4ee3d4a Add Danime episode metadata fetching and related API endpoint
- Implemented FetchEpisode function to retrieve episode metadata from dアニメストア.
- Added /api/v1/danime GET endpoint to fetch episode details by partId.
- Updated Swagger documentation for the new endpoint and response structure.
- Created DanimeEpisodeResponse type for API responses.
- Added tests for the new functionality and handlers.
2025-12-06 19:26:45 +09:00

38 lines
610 B
Go

package main
import (
"context"
"encoding/json"
"flag"
"fmt"
"log"
"os"
"watch-party-backend/internal/danime"
)
func main() {
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s <partId>\n", os.Args[0])
flag.PrintDefaults()
}
flag.Parse()
if flag.NArg() != 1 {
flag.Usage()
os.Exit(1)
}
partID := flag.Arg(0)
ep, err := danime.FetchEpisode(context.Background(), partID)
if err != nil {
log.Fatalf("fetch failed: %v", err)
}
buf, err := json.MarshalIndent(ep, "", " ")
if err != nil {
log.Fatalf("marshal failed: %v", err)
}
fmt.Println(string(buf))
}