aboutsummaryrefslogtreecommitdiff
path: root/errhandlers/validators.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-13 14:12:45 +0530
committerVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-13 14:12:45 +0530
commit937f3b8ada85274dfe3842f3dde8aef45c4f3ae7 (patch)
tree7de3ab75005620e33f8aac32554695b7eecd552c /errhandlers/validators.go
parent1d3f72c1b48998b86fd1740e893559b6dcaf7663 (diff)
completed (?) the GetAnimeList function
Diffstat (limited to 'errhandlers/validators.go')
-rw-r--r--errhandlers/validators.go30
1 files changed, 29 insertions, 1 deletions
diff --git a/errhandlers/validators.go b/errhandlers/validators.go
index f9baea1..6bf7a3f 100644
--- a/errhandlers/validators.go
+++ b/errhandlers/validators.go
@@ -86,7 +86,8 @@ func IsValidSeason(season string) bool {
}
// Checks if given sort is valid
-func IsValidSort(sort string) bool {
+// For seasonal anime lists
+func IsValidSeasonalSort(sort string) bool {
switch sort {
case
"anime_score",
@@ -94,3 +95,30 @@ func IsValidSort(sort string) bool {
}
return false
}
+
+// Checks if given sort is valid
+// for user anime lists
+func IsValidListSort(sort string) bool {
+ switch sort {
+ case
+ "list_score",
+ "list_updated_at",
+ "anime_title",
+ "anime_start_date",
+ "anime_id": return true
+ }
+ return false
+}
+
+// Checks if given anime list status is valid
+func IsValidListStatus(status string) bool {
+ switch status {
+ case
+ "watching",
+ "completed",
+ "on_hold",
+ "dropped",
+ "plan_to_watch": return true
+ }
+ return false
+}