aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-03-06 16:21:30 -0500
committerPaul Duncan <pabs@pablotron.org>2016-03-06 16:21:30 -0500
commit7effc93a6f3da8ab7b37f274b2aac33bfd7ee4b1 (patch)
treee4273ba1b96a227a44cee6e9761f69c83947482d /src
parent1fe6de5ab9f97c027047743e10a0ce8676525916 (diff)
downloadold-guff-7effc93a6f3da8ab7b37f274b2aac33bfd7ee4b1.tar.bz2
old-guff-7effc93a6f3da8ab7b37f274b2aac33bfd7ee4b1.zip
add site methods
Diffstat (limited to 'src')
-rw-r--r--src/guff/api-handler.cr7
-rw-r--r--src/guff/api-methods.cr106
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 #
################