diff options
| author | Bobby <[email protected]> | 2026-02-05 16:47:26 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-02-05 16:47:26 +0530 |
| commit | 3980ea772e3895c127ac147ec07d69a2ab9b71a7 (patch) | |
| tree | 11ac3a3f12b8e148beda55686db7d42dcad0c6c2 /utils/api/malsync/types.go | |
| parent | c1b751e33f3e2859f203dc1e1e6e530eb0d09199 (diff) | |
| download | metachan-3980ea772e3895c127ac147ec07d69a2ab9b71a7.tar.xz metachan-3980ea772e3895c127ac147ec07d69a2ab9b71a7.zip | |
Refactor MALSync API client: enhance request handling with retry logic and error management, and introduce Malsync types for streaming site and anime response
Diffstat (limited to 'utils/api/malsync/types.go')
| -rw-r--r-- | utils/api/malsync/types.go | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/utils/api/malsync/types.go b/utils/api/malsync/types.go index 9944166..6d4303c 100644 --- a/utils/api/malsync/types.go +++ b/utils/api/malsync/types.go @@ -1,31 +1,12 @@ package malsync -// MALSyncStreamingSite represents a single streaming site entry in the MALSync API -type MALSyncStreamingSite struct { - ID int `json:"id,omitempty"` - Identifier any `json:"identifier"` - Image string `json:"image,omitempty"` - MalID int `json:"malId,omitempty"` - AniID int `json:"aniId,omitempty"` - Page string `json:"page"` - Title string `json:"title"` - Type string `json:"type"` - URL string `json:"url"` - External bool `json:"external,omitempty"` -} - -// MALSyncSitesCollection represents the nested structure of streaming sites -// Format: map[platformName]map[identifier]siteObject -type MALSyncSitesCollection map[string]map[string]MALSyncStreamingSite +import ( + "net/http" + "time" +) -// MALSyncAnimeResponse is the top-level response from the MALSync API -type MALSyncAnimeResponse struct { - ID int `json:"id"` - Type string `json:"type"` - Title string `json:"title"` - URL string `json:"url"` - Total int `json:"total"` - Image string `json:"image"` - AnidbID int `json:"anidbId,omitempty"` - Sites MALSyncSitesCollection `json:"Sites"` +type client struct { + httpClient *http.Client + maxRetries int + backoff time.Duration } |
