rename 'response' to 'api'

This commit is contained in:
Adrien Marquès 2018-10-07 11:23:00 +02:00
parent 5e7ece3f30
commit 049400e2be
5 changed files with 15 additions and 15 deletions

View File

@ -1,4 +1,4 @@
package response package api
import ( import (
"errors" "errors"

View File

@ -1,11 +1,11 @@
package response package api
import ( import (
"git.xdrm.io/go/aicra/err" "git.xdrm.io/go/aicra/err"
) )
// New creates an empty response // New creates an empty response
func New() *Response { func NewResponse() *Response {
return &Response{ return &Response{
data: make(map[string]interface{}), data: make(map[string]interface{}),
Err: err.Success, Err: err.Success,

View File

@ -1,4 +1,4 @@
package response package api
import ( import (
"git.xdrm.io/go/aicra/err" "git.xdrm.io/go/aicra/err"

View File

@ -2,8 +2,8 @@ package driver
import ( import (
"encoding/json" "encoding/json"
"git.xdrm.io/go/aicra/api"
e "git.xdrm.io/go/aicra/err" e "git.xdrm.io/go/aicra/err"
"git.xdrm.io/go/aicra/response"
"net/http" "net/http"
"os/exec" "os/exec"
"strings" "strings"
@ -12,9 +12,9 @@ import (
// genericController is the mockup for returning a controller with as a string the path // genericController is the mockup for returning a controller with as a string the path
type genericController string 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 */ /* (1) Prepare stdin data */
stdin, err := json.Marshal(d) 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) 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) 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) return path.Get(d)
} }

View File

@ -1,7 +1,7 @@
package driver package driver
import ( import (
"git.xdrm.io/go/aicra/response" "git.xdrm.io/go/aicra/api"
"net/http" "net/http"
) )
@ -27,10 +27,10 @@ type Checker interface {
// Controller is the interface that controller implementation must follow // Controller is the interface that controller implementation must follow
// it is used by the 'Import' driver // it is used by the 'Import' driver
type Controller interface { type Controller interface {
Get(d response.Arguments) response.Response Get(d api.Arguments) api.Response
Post(d response.Arguments) response.Response Post(d api.Arguments) api.Response
Put(d response.Arguments) response.Response Put(d api.Arguments) api.Response
Delete(d response.Arguments) response.Response Delete(d api.Arguments) api.Response
} }
// Middleware is the interface that middleware implementation must follow // Middleware is the interface that middleware implementation must follow