From 049400e2be27682e41215791cd895ad177aa2ac7 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 7 Oct 2018 11:23:00 +0200 Subject: [PATCH] rename 'response' to 'api' --- {response => api}/arguments.go | 2 +- {response => api}/response.go | 4 ++-- {response => api}/types.go | 2 +- driver/generic.mockup.go | 12 ++++++------ driver/types.go | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) rename {response => api}/arguments.go (99%) rename {response => api}/response.go (92%) rename {response => api}/types.go (93%) diff --git a/response/arguments.go b/api/arguments.go similarity index 99% rename from response/arguments.go rename to api/arguments.go index 58963db..c8a19b1 100644 --- a/response/arguments.go +++ b/api/arguments.go @@ -1,4 +1,4 @@ -package response +package api import ( "errors" diff --git a/response/response.go b/api/response.go similarity index 92% rename from response/response.go rename to api/response.go index e54948c..27d0030 100644 --- a/response/response.go +++ b/api/response.go @@ -1,11 +1,11 @@ -package response +package api import ( "git.xdrm.io/go/aicra/err" ) // New creates an empty response -func New() *Response { +func NewResponse() *Response { return &Response{ data: make(map[string]interface{}), Err: err.Success, diff --git a/response/types.go b/api/types.go similarity index 93% rename from response/types.go rename to api/types.go index 93e255a..7faef5d 100644 --- a/response/types.go +++ b/api/types.go @@ -1,4 +1,4 @@ -package response +package api import ( "git.xdrm.io/go/aicra/err" diff --git a/driver/generic.mockup.go b/driver/generic.mockup.go index 8a0377b..8d27301 100644 --- a/driver/generic.mockup.go +++ b/driver/generic.mockup.go @@ -2,8 +2,8 @@ package driver import ( "encoding/json" + "git.xdrm.io/go/aicra/api" e "git.xdrm.io/go/aicra/err" - "git.xdrm.io/go/aicra/response" "net/http" "os/exec" "strings" @@ -12,9 +12,9 @@ import ( // genericController is the mockup for returning a controller with as a string the path type genericController string -func (path genericController) Get(d response.Arguments) response.Response { +func (path genericController) Get(d api.Arguments) api.Response { - res := response.New() + res := api.NewResponse() /* (1) Prepare stdin data */ stdin, err := json.Marshal(d) @@ -79,13 +79,13 @@ func (path genericController) Get(d response.Arguments) response.Response { } -func (path genericController) Post(d response.Arguments) response.Response { +func (path genericController) Post(d api.Arguments) api.Response { return path.Get(d) } -func (path genericController) Put(d response.Arguments) response.Response { +func (path genericController) Put(d api.Arguments) api.Response { return path.Get(d) } -func (path genericController) Delete(d response.Arguments) response.Response { +func (path genericController) Delete(d api.Arguments) api.Response { return path.Get(d) } diff --git a/driver/types.go b/driver/types.go index 4237fc6..f2d98f8 100644 --- a/driver/types.go +++ b/driver/types.go @@ -1,7 +1,7 @@ package driver import ( - "git.xdrm.io/go/aicra/response" + "git.xdrm.io/go/aicra/api" "net/http" ) @@ -27,10 +27,10 @@ type Checker interface { // Controller is the interface that controller implementation must follow // it is used by the 'Import' driver type Controller interface { - Get(d response.Arguments) response.Response - Post(d response.Arguments) response.Response - Put(d response.Arguments) response.Response - Delete(d response.Arguments) response.Response + Get(d api.Arguments) api.Response + Post(d api.Arguments) api.Response + Put(d api.Arguments) api.Response + Delete(d api.Arguments) api.Response } // Middleware is the interface that middleware implementation must follow