require "json" module Guff module API module Util private def get_site(context : HTTP::Server::Context) : Int? @models.site.to_site(context.request.headers["host"]?) end private def get_tags( s : String? ) : Array(String) if s && s.size > 0 Array(String).from_json(s) else [] of String end end private def get_posts_tags( s : String? ) : Array(Array(String)) if s && s.size > 0 Array(Array(String)).from_json(s) else [] of Array(String) end end private def get_posts_sort( s : String? ) : Array(Hash(String, String))? if s && s.size > 0 Array(Hash(String, String)).from_json(s) end end end end end