diff options
-rw-r--r-- | src/guff/api-handler.cr | 7 | ||||
-rw-r--r-- | src/guff/api-methods.cr | 106 |
2 files changed, 113 insertions, 0 deletions
diff --git a/src/guff/api-handler.cr b/src/guff/api-handler.cr index e4d7fc4..5327949 100644 --- a/src/guff/api-handler.cr +++ b/src/guff/api-handler.cr @@ -108,6 +108,13 @@ module Guff remove_tags, ], + site: [ + add_site, + remove_sites, + set_default, + set_domains, + ], + test: [ version, get_posts, diff --git a/src/guff/api-methods.cr b/src/guff/api-methods.cr index 03954c6..6cc3087 100644 --- a/src/guff/api-methods.cr +++ b/src/guff/api-methods.cr @@ -173,6 +173,76 @@ module Guff }, }, + "site": { + "add_site": { + text: "Create a new site", + + args: { + "name": { + text: "Name of this site", + type: :text, + required: true, + }, + + "default": { + text: "Is this the default site?", + type: :bool, + required: false, + default: "f", + }, + + "domains": { + text: "Array of domain matches.", + type: :domain_list, + required: true, + }, + }, + }, + + "remove_sites": { + text: "Remove one or more existing sites", + + args: { + "site_ids": { + text: "IDs of sites to remove", + type: :int_list, + required: true, + }, + }, + }, + + "set_default": { + text: "Set new default site", + + args: { + "site_id": { + text: "ID of new default site", + type: :int, + required: true, + }, + }, + }, + + "set_domains": { + text: "Set domains for given site", + + args: { + "site_id": { + text: "ID of site", + type: :int, + required: true, + }, + + "domains": { + text: "Domains for this site.", + type: :domain_list, + required: true, + }, + }, + }, + }, + + "test": { "version": { text: "Get version", @@ -338,6 +408,42 @@ module Guff end ################ + # site methods # + ################ + + private def do_site_add_site( + context : HTTP::Server::Context, + args : Hash(String, String) + ) + # TODO + {ok: true}.to_json + end + + private def do_site_remove_sites( + context : HTTP::Server::Context, + args : Hash(String, String) + ) + # TODO + {ok: true}.to_json + end + + private def do_site_set_default( + context : HTTP::Server::Context, + args : Hash(String, String) + ) + # TODO + {ok: true}.to_json + end + + private def do_site_set_domains( + context : HTTP::Server::Context, + args : Hash(String, String) + ) + # TODO + {ok: true}.to_json + end + + ################ # test methods # ################ |