From 7effc93a6f3da8ab7b37f274b2aac33bfd7ee4b1 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 6 Mar 2016 16:21:30 -0500 Subject: add site methods --- src/guff/api-handler.cr | 7 ++++ src/guff/api-methods.cr | 106 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) 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", @@ -337,6 +407,42 @@ module Guff true.to_json 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 # ################ -- cgit v1.2.3