aboutsummaryrefslogtreecommitdiff
path: root/errhandlers/validators.go
diff options
context:
space:
mode:
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
+}