From 4fd1206c7ff16e65f782508081fdc76af406f592 Mon Sep 17 00:00:00 2001 From: lpmatos Date: Fri, 17 Jun 2022 14:05:43 -0300 Subject: [PATCH] fix: type structure --- Makefile | 18 ------------------ internal/types/response.go | 30 ++++++++++++++++-------------- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 24a6c70..bc21561 100644 --- a/Makefile +++ b/Makefile @@ -97,24 +97,6 @@ install: $(GO) install -x $(MAIN) @echo "" -.PHONY: lint -lint: - @echo "==> Running lint..." - golint -set_exit_status ./... - -.PHONY: test -test: - @echo "==> Running test..." - go test -v ./... - -.PHONY: misspell -misspell: - @# misspell - Correct commonly misspelled English words in source files - @# go get -u github.com/client9/misspell/cmd/misspell - @echo "==> Runnig misspell ..." - find . -name '*.go' -not -path './vendor/*' -not -path './_repos/*' | xargs misspell -error - @echo "" - .PHONY: clean clean: @echo "==> Cleaning..." diff --git a/internal/types/response.go b/internal/types/response.go index d878700..e5575c9 100644 --- a/internal/types/response.go +++ b/internal/types/response.go @@ -7,8 +7,8 @@ type AnimeTitle struct { English string `json:"english"` } -// Anime struct - information about the anime passed in the request to trace.moe API -type Anime struct { +// Anilist struct - information about the anime passed in the request to trace.moe API +type Anilist struct { ID int `json:"id"` IDMal int `json:"idMal"` Title AnimeTitle `json:"title"` @@ -16,20 +16,22 @@ type Anime struct { IsAdult bool `json:"isAdult"` } +type Anime struct { + Anilist Anilist `json:"anilist"` + Filename string `json:"filename"` + Episode int `json:"episode"` + From float32 `json:"from"` + To float32 `json:"to"` + Similarity float64 `json:"similarity"` + Video string `json:"video"` + Image string `json:"image"` +} + // Response struct - content of trace.moe API request result type Response struct { - FrameCount int `json:"frameCount"` - Error string `json:"error"` - Result []struct { - Anilist Anime `json:"anilist"` - Filename string `json:"filename"` - Episode int `json:"episode"` - From float64 `json:"from"` - To float64 `json:"to"` - Similarity float64 `json:"similarity"` - Video string `json:"video"` - Image string `json:"image"` - } `json:"result"` + FrameCount int `json:"frameCount"` + Error string `json:"error"` + Result []Anime `json:"result"` } // UsageTraceMoe struct - content of request usage to trace moe