Append suffix to receiver name to avoid naming colision
Names starting with letter r colided with r for *http.Request
This commit is contained in:
@@ -33,9 +33,9 @@ func New{name|expose}{call.name|capitalize}() *{name|expose}{call.name|capitaliz
|
||||
return &{name|expose}{call.name|capitalize}{}
|
||||
}
|
||||
|
||||
func ({self} *{name|expose}{call.name|capitalize}) Fill(r *http.Request) (err error) {
|
||||
func ({self}Req *{name|expose}{call.name|capitalize}) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode({self})
|
||||
err = json.NewDecoder(r.Body).Decode({self}Req)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -64,21 +64,21 @@ func ({self} *{name|expose}{call.name|capitalize}) Fill(r *http.Request) (err er
|
||||
{foreach $call.parameters as $method => $params}
|
||||
{foreach $params as $param}
|
||||
{if strtolower($method) === "path"}
|
||||
{self}.{param.name|expose} = {if ($param.type !== "string")}{$parsers[$param.type]}({/if}chi.URLParam(r, "{param.name}"){if ($param.type !== "string")}){/if}
|
||||
{self}Req.{param.name|expose} = {if ($param.type !== "string")}{$parsers[$param.type]}({/if}chi.URLParam(r, "{param.name}"){if ($param.type !== "string")}){/if}
|
||||
{elseif (substr($param.type, 0, 2) === '[]' || substr($param.type, -3) === "Set") && isset($parsers[$param.type])}
|
||||
{self}.{param.name|expose} = {$parsers[$param.type]}({if $method === "post"}r.Form["{param.name}"]{else}urlQuery["{param.name}"]{/if})
|
||||
{self}Req.{param.name|expose} = {$parsers[$param.type]}({if $method === "post"}r.Form["{param.name}"]{else}urlQuery["{param.name}"]{/if})
|
||||
{elseif $param.type === "*multipart.FileHeader"}
|
||||
if _, {self}.{param.name|expose}, err = r.FormFile("{$param.name}"); err != nil {
|
||||
if _, {self}Req.{param.name|expose}, err = r.FormFile("{$param.name}"); err != nil {
|
||||
return errors.Wrap(err, "error procesing uploaded file")
|
||||
}
|
||||
{elseif substr($param.type, 0, 2) !== '[]' && substr($param.type, -3) !== 'Set'}
|
||||
if val, ok := {method|strtolower}["{param.name}"]; ok {
|
||||
{if substr($parsers[$param.type], -7) === 'WithErr'}
|
||||
if {self}.{param.name|expose}, err = {$parsers[$param.type]}(val); err != nil {
|
||||
if {self}Req.{param.name|expose}, err = {$parsers[$param.type]}(val); err != nil {
|
||||
return err
|
||||
}
|
||||
{else}
|
||||
{self}.{param.name|expose} = {if ($param.type !== "string")}{$parsers[$param.type]}(val){else}val{/if}{EOL}
|
||||
{self}Req.{param.name|expose} = {if ($param.type !== "string")}{$parsers[$param.type]}(val){else}val{/if}{EOL}
|
||||
{/if}
|
||||
}{/if}
|
||||
{/foreach}
|
||||
|
||||
+17
-17
@@ -39,9 +39,9 @@ func NewChartList() *ChartList {
|
||||
return &ChartList{}
|
||||
}
|
||||
|
||||
func (c *ChartList) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChartList) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -81,9 +81,9 @@ func NewChartCreate() *ChartCreate {
|
||||
return &ChartCreate{}
|
||||
}
|
||||
|
||||
func (c *ChartCreate) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChartCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -110,13 +110,13 @@ func (c *ChartCreate) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := post["config"]; ok {
|
||||
|
||||
if c.Config, err = parseJSONTextWithErr(val); err != nil {
|
||||
if cReq.Config, err = parseJSONTextWithErr(val); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
c.Name = val
|
||||
cReq.Name = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -133,9 +133,9 @@ func NewChartRead() *ChartRead {
|
||||
return &ChartRead{}
|
||||
}
|
||||
|
||||
func (c *ChartRead) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChartRead) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -160,7 +160,7 @@ func (c *ChartRead) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChartID = parseUInt64(chi.URLParam(r, "chartID"))
|
||||
cReq.ChartID = parseUInt64(chi.URLParam(r, "chartID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -178,9 +178,9 @@ func NewChartUpdate() *ChartUpdate {
|
||||
return &ChartUpdate{}
|
||||
}
|
||||
|
||||
func (c *ChartUpdate) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChartUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -205,16 +205,16 @@ func (c *ChartUpdate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChartID = parseUInt64(chi.URLParam(r, "chartID"))
|
||||
cReq.ChartID = parseUInt64(chi.URLParam(r, "chartID"))
|
||||
if val, ok := post["config"]; ok {
|
||||
|
||||
if c.Config, err = parseJSONTextWithErr(val); err != nil {
|
||||
if cReq.Config, err = parseJSONTextWithErr(val); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
c.Name = val
|
||||
cReq.Name = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -231,9 +231,9 @@ func NewChartDelete() *ChartDelete {
|
||||
return &ChartDelete{}
|
||||
}
|
||||
|
||||
func (c *ChartDelete) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChartDelete) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -258,7 +258,7 @@ func (c *ChartDelete) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChartID = parseUInt64(chi.URLParam(r, "chartID"))
|
||||
cReq.ChartID = parseUInt64(chi.URLParam(r, "chartID"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
+107
-46
@@ -41,9 +41,9 @@ func NewModuleList() *ModuleList {
|
||||
return &ModuleList{}
|
||||
}
|
||||
|
||||
func (m *ModuleList) Fill(r *http.Request) (err error) {
|
||||
func (mReq *ModuleList) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -70,7 +70,7 @@ func (m *ModuleList) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["query"]; ok {
|
||||
|
||||
m.Query = val
|
||||
mReq.Query = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -89,9 +89,9 @@ func NewModuleCreate() *ModuleCreate {
|
||||
return &ModuleCreate{}
|
||||
}
|
||||
|
||||
func (m *ModuleCreate) Fill(r *http.Request) (err error) {
|
||||
func (mReq *ModuleCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -118,11 +118,11 @@ func (m *ModuleCreate) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
m.Name = val
|
||||
mReq.Name = val
|
||||
}
|
||||
if val, ok := post["meta"]; ok {
|
||||
|
||||
if m.Meta, err = parseJSONTextWithErr(val); err != nil {
|
||||
if mReq.Meta, err = parseJSONTextWithErr(val); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -141,9 +141,9 @@ func NewModuleRead() *ModuleRead {
|
||||
return &ModuleRead{}
|
||||
}
|
||||
|
||||
func (m *ModuleRead) Fill(r *http.Request) (err error) {
|
||||
func (mReq *ModuleRead) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -168,13 +168,74 @@ func (m *ModuleRead) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
mReq.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
var _ RequestFiller = NewModuleRead()
|
||||
|
||||
// Module attachments request parameters
|
||||
type ModuleAttachments struct {
|
||||
Filter string
|
||||
Page int
|
||||
PerPage int
|
||||
Sort string
|
||||
}
|
||||
|
||||
func NewModuleAttachments() *ModuleAttachments {
|
||||
return &ModuleAttachments{}
|
||||
}
|
||||
|
||||
func (mReq *ModuleAttachments) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
err = nil
|
||||
case err != nil:
|
||||
return errors.Wrap(err, "error parsing http request body")
|
||||
}
|
||||
}
|
||||
|
||||
if err = r.ParseForm(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
get := map[string]string{}
|
||||
post := map[string]string{}
|
||||
urlQuery := r.URL.Query()
|
||||
for name, param := range urlQuery {
|
||||
get[name] = string(param[0])
|
||||
}
|
||||
postVars := r.Form
|
||||
for name, param := range postVars {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
if val, ok := get["filter"]; ok {
|
||||
|
||||
mReq.Filter = val
|
||||
}
|
||||
if val, ok := get["page"]; ok {
|
||||
|
||||
mReq.Page = parseInt(val)
|
||||
}
|
||||
if val, ok := get["perPage"]; ok {
|
||||
|
||||
mReq.PerPage = parseInt(val)
|
||||
}
|
||||
if val, ok := get["sort"]; ok {
|
||||
|
||||
mReq.Sort = val
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
var _ RequestFiller = NewModuleAttachments()
|
||||
|
||||
// Module update request parameters
|
||||
type ModuleUpdate struct {
|
||||
ModuleID uint64 `json:",string"`
|
||||
@@ -187,9 +248,9 @@ func NewModuleUpdate() *ModuleUpdate {
|
||||
return &ModuleUpdate{}
|
||||
}
|
||||
|
||||
func (m *ModuleUpdate) Fill(r *http.Request) (err error) {
|
||||
func (mReq *ModuleUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -214,14 +275,14 @@ func (m *ModuleUpdate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
mReq.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
m.Name = val
|
||||
mReq.Name = val
|
||||
}
|
||||
if val, ok := post["meta"]; ok {
|
||||
|
||||
if m.Meta, err = parseJSONTextWithErr(val); err != nil {
|
||||
if mReq.Meta, err = parseJSONTextWithErr(val); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -240,9 +301,9 @@ func NewModuleDelete() *ModuleDelete {
|
||||
return &ModuleDelete{}
|
||||
}
|
||||
|
||||
func (m *ModuleDelete) Fill(r *http.Request) (err error) {
|
||||
func (mReq *ModuleDelete) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -267,7 +328,7 @@ func (m *ModuleDelete) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
mReq.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -286,9 +347,9 @@ func NewModuleRecordReport() *ModuleRecordReport {
|
||||
return &ModuleRecordReport{}
|
||||
}
|
||||
|
||||
func (m *ModuleRecordReport) Fill(r *http.Request) (err error) {
|
||||
func (mReq *ModuleRecordReport) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -315,17 +376,17 @@ func (m *ModuleRecordReport) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["metrics"]; ok {
|
||||
|
||||
m.Metrics = val
|
||||
mReq.Metrics = val
|
||||
}
|
||||
if val, ok := get["dimensions"]; ok {
|
||||
|
||||
m.Dimensions = val
|
||||
mReq.Dimensions = val
|
||||
}
|
||||
if val, ok := get["filter"]; ok {
|
||||
|
||||
m.Filter = val
|
||||
mReq.Filter = val
|
||||
}
|
||||
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
mReq.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -345,9 +406,9 @@ func NewModuleRecordList() *ModuleRecordList {
|
||||
return &ModuleRecordList{}
|
||||
}
|
||||
|
||||
func (m *ModuleRecordList) Fill(r *http.Request) (err error) {
|
||||
func (mReq *ModuleRecordList) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -374,21 +435,21 @@ func (m *ModuleRecordList) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["filter"]; ok {
|
||||
|
||||
m.Filter = val
|
||||
mReq.Filter = val
|
||||
}
|
||||
if val, ok := get["page"]; ok {
|
||||
|
||||
m.Page = parseInt(val)
|
||||
mReq.Page = parseInt(val)
|
||||
}
|
||||
if val, ok := get["perPage"]; ok {
|
||||
|
||||
m.PerPage = parseInt(val)
|
||||
mReq.PerPage = parseInt(val)
|
||||
}
|
||||
if val, ok := get["sort"]; ok {
|
||||
|
||||
m.Sort = val
|
||||
mReq.Sort = val
|
||||
}
|
||||
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
mReq.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -405,9 +466,9 @@ func NewModuleRecordCreate() *ModuleRecordCreate {
|
||||
return &ModuleRecordCreate{}
|
||||
}
|
||||
|
||||
func (m *ModuleRecordCreate) Fill(r *http.Request) (err error) {
|
||||
func (mReq *ModuleRecordCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -432,7 +493,7 @@ func (m *ModuleRecordCreate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
mReq.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -449,9 +510,9 @@ func NewModuleRecordRead() *ModuleRecordRead {
|
||||
return &ModuleRecordRead{}
|
||||
}
|
||||
|
||||
func (m *ModuleRecordRead) Fill(r *http.Request) (err error) {
|
||||
func (mReq *ModuleRecordRead) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -476,8 +537,8 @@ func (m *ModuleRecordRead) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
m.RecordID = parseUInt64(chi.URLParam(r, "recordID"))
|
||||
mReq.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
mReq.RecordID = parseUInt64(chi.URLParam(r, "recordID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -495,9 +556,9 @@ func NewModuleRecordUpdate() *ModuleRecordUpdate {
|
||||
return &ModuleRecordUpdate{}
|
||||
}
|
||||
|
||||
func (m *ModuleRecordUpdate) Fill(r *http.Request) (err error) {
|
||||
func (mReq *ModuleRecordUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -522,8 +583,8 @@ func (m *ModuleRecordUpdate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
m.RecordID = parseUInt64(chi.URLParam(r, "recordID"))
|
||||
mReq.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
mReq.RecordID = parseUInt64(chi.URLParam(r, "recordID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -540,9 +601,9 @@ func NewModuleRecordDelete() *ModuleRecordDelete {
|
||||
return &ModuleRecordDelete{}
|
||||
}
|
||||
|
||||
func (m *ModuleRecordDelete) Fill(r *http.Request) (err error) {
|
||||
func (mReq *ModuleRecordDelete) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -567,8 +628,8 @@ func (m *ModuleRecordDelete) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
m.RecordID = parseUInt64(chi.URLParam(r, "recordID"))
|
||||
mReq.ModuleID = parseUInt64(chi.URLParam(r, "moduleID"))
|
||||
mReq.RecordID = parseUInt64(chi.URLParam(r, "recordID"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ func NewNotificationEmailSend() *NotificationEmailSend {
|
||||
return &NotificationEmailSend{}
|
||||
}
|
||||
|
||||
func (n *NotificationEmailSend) Fill(r *http.Request) (err error) {
|
||||
func (nReq *NotificationEmailSend) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(n)
|
||||
err = json.NewDecoder(r.Body).Decode(nReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -73,15 +73,15 @@ func (n *NotificationEmailSend) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := post["replyTo"]; ok {
|
||||
|
||||
n.ReplyTo = val
|
||||
nReq.ReplyTo = val
|
||||
}
|
||||
if val, ok := post["subject "]; ok {
|
||||
|
||||
n.Subject = val
|
||||
nReq.Subject = val
|
||||
}
|
||||
if val, ok := post["content"]; ok {
|
||||
|
||||
if n.Content, err = parseJSONTextWithErr(val); err != nil {
|
||||
if nReq.Content, err = parseJSONTextWithErr(val); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
+92
-31
@@ -40,9 +40,9 @@ func NewPageList() *PageList {
|
||||
return &PageList{}
|
||||
}
|
||||
|
||||
func (p *PageList) Fill(r *http.Request) (err error) {
|
||||
func (pReq *PageList) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(p)
|
||||
err = json.NewDecoder(r.Body).Decode(pReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -69,7 +69,7 @@ func (p *PageList) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["selfID"]; ok {
|
||||
|
||||
p.SelfID = parseUInt64(val)
|
||||
pReq.SelfID = parseUInt64(val)
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -91,9 +91,9 @@ func NewPageCreate() *PageCreate {
|
||||
return &PageCreate{}
|
||||
}
|
||||
|
||||
func (p *PageCreate) Fill(r *http.Request) (err error) {
|
||||
func (pReq *PageCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(p)
|
||||
err = json.NewDecoder(r.Body).Decode(pReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -120,27 +120,27 @@ func (p *PageCreate) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := post["selfID"]; ok {
|
||||
|
||||
p.SelfID = parseUInt64(val)
|
||||
pReq.SelfID = parseUInt64(val)
|
||||
}
|
||||
if val, ok := post["moduleID"]; ok {
|
||||
|
||||
p.ModuleID = parseUInt64(val)
|
||||
pReq.ModuleID = parseUInt64(val)
|
||||
}
|
||||
if val, ok := post["title"]; ok {
|
||||
|
||||
p.Title = val
|
||||
pReq.Title = val
|
||||
}
|
||||
if val, ok := post["description"]; ok {
|
||||
|
||||
p.Description = val
|
||||
pReq.Description = val
|
||||
}
|
||||
if val, ok := post["visible"]; ok {
|
||||
|
||||
p.Visible = parseBool(val)
|
||||
pReq.Visible = parseBool(val)
|
||||
}
|
||||
if val, ok := post["blocks"]; ok {
|
||||
|
||||
if p.Blocks, err = parseJSONTextWithErr(val); err != nil {
|
||||
if pReq.Blocks, err = parseJSONTextWithErr(val); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -159,9 +159,9 @@ func NewPageRead() *PageRead {
|
||||
return &PageRead{}
|
||||
}
|
||||
|
||||
func (p *PageRead) Fill(r *http.Request) (err error) {
|
||||
func (pReq *PageRead) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(p)
|
||||
err = json.NewDecoder(r.Body).Decode(pReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -186,13 +186,74 @@ func (p *PageRead) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
p.PageID = parseUInt64(chi.URLParam(r, "pageID"))
|
||||
pReq.PageID = parseUInt64(chi.URLParam(r, "pageID"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
var _ RequestFiller = NewPageRead()
|
||||
|
||||
// Page attachments request parameters
|
||||
type PageAttachments struct {
|
||||
Filter string
|
||||
Page int
|
||||
PerPage int
|
||||
Sort string
|
||||
}
|
||||
|
||||
func NewPageAttachments() *PageAttachments {
|
||||
return &PageAttachments{}
|
||||
}
|
||||
|
||||
func (pReq *PageAttachments) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(pReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
err = nil
|
||||
case err != nil:
|
||||
return errors.Wrap(err, "error parsing http request body")
|
||||
}
|
||||
}
|
||||
|
||||
if err = r.ParseForm(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
get := map[string]string{}
|
||||
post := map[string]string{}
|
||||
urlQuery := r.URL.Query()
|
||||
for name, param := range urlQuery {
|
||||
get[name] = string(param[0])
|
||||
}
|
||||
postVars := r.Form
|
||||
for name, param := range postVars {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
if val, ok := get["filter"]; ok {
|
||||
|
||||
pReq.Filter = val
|
||||
}
|
||||
if val, ok := get["page"]; ok {
|
||||
|
||||
pReq.Page = parseInt(val)
|
||||
}
|
||||
if val, ok := get["perPage"]; ok {
|
||||
|
||||
pReq.PerPage = parseInt(val)
|
||||
}
|
||||
if val, ok := get["sort"]; ok {
|
||||
|
||||
pReq.Sort = val
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
var _ RequestFiller = NewPageAttachments()
|
||||
|
||||
// Page tree request parameters
|
||||
type PageTree struct {
|
||||
}
|
||||
@@ -201,9 +262,9 @@ func NewPageTree() *PageTree {
|
||||
return &PageTree{}
|
||||
}
|
||||
|
||||
func (p *PageTree) Fill(r *http.Request) (err error) {
|
||||
func (pReq *PageTree) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(p)
|
||||
err = json.NewDecoder(r.Body).Decode(pReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -248,9 +309,9 @@ func NewPageUpdate() *PageUpdate {
|
||||
return &PageUpdate{}
|
||||
}
|
||||
|
||||
func (p *PageUpdate) Fill(r *http.Request) (err error) {
|
||||
func (pReq *PageUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(p)
|
||||
err = json.NewDecoder(r.Body).Decode(pReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -275,30 +336,30 @@ func (p *PageUpdate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
p.PageID = parseUInt64(chi.URLParam(r, "pageID"))
|
||||
pReq.PageID = parseUInt64(chi.URLParam(r, "pageID"))
|
||||
if val, ok := post["selfID"]; ok {
|
||||
|
||||
p.SelfID = parseUInt64(val)
|
||||
pReq.SelfID = parseUInt64(val)
|
||||
}
|
||||
if val, ok := post["moduleID"]; ok {
|
||||
|
||||
p.ModuleID = parseUInt64(val)
|
||||
pReq.ModuleID = parseUInt64(val)
|
||||
}
|
||||
if val, ok := post["title"]; ok {
|
||||
|
||||
p.Title = val
|
||||
pReq.Title = val
|
||||
}
|
||||
if val, ok := post["description"]; ok {
|
||||
|
||||
p.Description = val
|
||||
pReq.Description = val
|
||||
}
|
||||
if val, ok := post["visible"]; ok {
|
||||
|
||||
p.Visible = parseBool(val)
|
||||
pReq.Visible = parseBool(val)
|
||||
}
|
||||
if val, ok := post["blocks"]; ok {
|
||||
|
||||
if p.Blocks, err = parseJSONTextWithErr(val); err != nil {
|
||||
if pReq.Blocks, err = parseJSONTextWithErr(val); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -318,9 +379,9 @@ func NewPageReorder() *PageReorder {
|
||||
return &PageReorder{}
|
||||
}
|
||||
|
||||
func (p *PageReorder) Fill(r *http.Request) (err error) {
|
||||
func (pReq *PageReorder) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(p)
|
||||
err = json.NewDecoder(r.Body).Decode(pReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -345,7 +406,7 @@ func (p *PageReorder) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
p.SelfID = parseUInt64(chi.URLParam(r, "selfID"))
|
||||
pReq.SelfID = parseUInt64(chi.URLParam(r, "selfID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -361,9 +422,9 @@ func NewPageDelete() *PageDelete {
|
||||
return &PageDelete{}
|
||||
}
|
||||
|
||||
func (p *PageDelete) Fill(r *http.Request) (err error) {
|
||||
func (pReq *PageDelete) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(p)
|
||||
err = json.NewDecoder(r.Body).Decode(pReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -388,7 +449,7 @@ func (p *PageDelete) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
p.PageID = parseUInt64(chi.URLParam(r, "pageID"))
|
||||
pReq.PageID = parseUInt64(chi.URLParam(r, "pageID"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
+22
-22
@@ -38,9 +38,9 @@ func NewTriggerList() *TriggerList {
|
||||
return &TriggerList{}
|
||||
}
|
||||
|
||||
func (t *TriggerList) Fill(r *http.Request) (err error) {
|
||||
func (tReq *TriggerList) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(t)
|
||||
err = json.NewDecoder(r.Body).Decode(tReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -67,7 +67,7 @@ func (t *TriggerList) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["moduleID"]; ok {
|
||||
|
||||
t.ModuleID = parseUInt64(val)
|
||||
tReq.ModuleID = parseUInt64(val)
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -88,9 +88,9 @@ func NewTriggerCreate() *TriggerCreate {
|
||||
return &TriggerCreate{}
|
||||
}
|
||||
|
||||
func (t *TriggerCreate) Fill(r *http.Request) (err error) {
|
||||
func (tReq *TriggerCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(t)
|
||||
err = json.NewDecoder(r.Body).Decode(tReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -117,19 +117,19 @@ func (t *TriggerCreate) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := post["moduleID"]; ok {
|
||||
|
||||
t.ModuleID = parseUInt64(val)
|
||||
tReq.ModuleID = parseUInt64(val)
|
||||
}
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
t.Name = val
|
||||
tReq.Name = val
|
||||
}
|
||||
if val, ok := post["enabled"]; ok {
|
||||
|
||||
t.Enabled = parseBool(val)
|
||||
tReq.Enabled = parseBool(val)
|
||||
}
|
||||
if val, ok := post["source"]; ok {
|
||||
|
||||
t.Source = val
|
||||
tReq.Source = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -146,9 +146,9 @@ func NewTriggerRead() *TriggerRead {
|
||||
return &TriggerRead{}
|
||||
}
|
||||
|
||||
func (t *TriggerRead) Fill(r *http.Request) (err error) {
|
||||
func (tReq *TriggerRead) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(t)
|
||||
err = json.NewDecoder(r.Body).Decode(tReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -173,7 +173,7 @@ func (t *TriggerRead) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
t.TriggerID = parseUInt64(chi.URLParam(r, "triggerID"))
|
||||
tReq.TriggerID = parseUInt64(chi.URLParam(r, "triggerID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -194,9 +194,9 @@ func NewTriggerUpdate() *TriggerUpdate {
|
||||
return &TriggerUpdate{}
|
||||
}
|
||||
|
||||
func (t *TriggerUpdate) Fill(r *http.Request) (err error) {
|
||||
func (tReq *TriggerUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(t)
|
||||
err = json.NewDecoder(r.Body).Decode(tReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -221,22 +221,22 @@ func (t *TriggerUpdate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
t.TriggerID = parseUInt64(chi.URLParam(r, "triggerID"))
|
||||
tReq.TriggerID = parseUInt64(chi.URLParam(r, "triggerID"))
|
||||
if val, ok := post["moduleID"]; ok {
|
||||
|
||||
t.ModuleID = parseUInt64(val)
|
||||
tReq.ModuleID = parseUInt64(val)
|
||||
}
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
t.Name = val
|
||||
tReq.Name = val
|
||||
}
|
||||
if val, ok := post["enabled"]; ok {
|
||||
|
||||
t.Enabled = parseBool(val)
|
||||
tReq.Enabled = parseBool(val)
|
||||
}
|
||||
if val, ok := post["source"]; ok {
|
||||
|
||||
t.Source = val
|
||||
tReq.Source = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -253,9 +253,9 @@ func NewTriggerDelete() *TriggerDelete {
|
||||
return &TriggerDelete{}
|
||||
}
|
||||
|
||||
func (t *TriggerDelete) Fill(r *http.Request) (err error) {
|
||||
func (tReq *TriggerDelete) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(t)
|
||||
err = json.NewDecoder(r.Body).Decode(tReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -280,7 +280,7 @@ func (t *TriggerDelete) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
t.TriggerID = parseUInt64(chi.URLParam(r, "triggerID"))
|
||||
tReq.TriggerID = parseUInt64(chi.URLParam(r, "triggerID"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ func NewAttachmentOriginal() *AttachmentOriginal {
|
||||
return &AttachmentOriginal{}
|
||||
}
|
||||
|
||||
func (a *AttachmentOriginal) Fill(r *http.Request) (err error) {
|
||||
func (aReq *AttachmentOriginal) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(a)
|
||||
err = json.NewDecoder(r.Body).Decode(aReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -69,10 +69,10 @@ func (a *AttachmentOriginal) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["download"]; ok {
|
||||
|
||||
a.Download = parseBool(val)
|
||||
aReq.Download = parseBool(val)
|
||||
}
|
||||
a.Name = chi.URLParam(r, "name")
|
||||
a.AttachmentID = parseUInt64(chi.URLParam(r, "attachmentID"))
|
||||
aReq.Name = chi.URLParam(r, "name")
|
||||
aReq.AttachmentID = parseUInt64(chi.URLParam(r, "attachmentID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -89,9 +89,9 @@ func NewAttachmentPreview() *AttachmentPreview {
|
||||
return &AttachmentPreview{}
|
||||
}
|
||||
|
||||
func (a *AttachmentPreview) Fill(r *http.Request) (err error) {
|
||||
func (aReq *AttachmentPreview) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(a)
|
||||
err = json.NewDecoder(r.Body).Decode(aReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -116,8 +116,8 @@ func (a *AttachmentPreview) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
a.Ext = chi.URLParam(r, "ext")
|
||||
a.AttachmentID = parseUInt64(chi.URLParam(r, "attachmentID"))
|
||||
aReq.Ext = chi.URLParam(r, "ext")
|
||||
aReq.AttachmentID = parseUInt64(chi.URLParam(r, "attachmentID"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ func NewChannelList() *ChannelList {
|
||||
return &ChannelList{}
|
||||
}
|
||||
|
||||
func (c *ChannelList) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelList) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -67,7 +67,7 @@ func (c *ChannelList) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["query"]; ok {
|
||||
|
||||
c.Query = val
|
||||
cReq.Query = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -87,9 +87,9 @@ func NewChannelCreate() *ChannelCreate {
|
||||
return &ChannelCreate{}
|
||||
}
|
||||
|
||||
func (c *ChannelCreate) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -116,15 +116,15 @@ func (c *ChannelCreate) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
c.Name = val
|
||||
cReq.Name = val
|
||||
}
|
||||
if val, ok := post["topic"]; ok {
|
||||
|
||||
c.Topic = val
|
||||
cReq.Topic = val
|
||||
}
|
||||
if val, ok := post["type"]; ok {
|
||||
|
||||
c.Type = val
|
||||
cReq.Type = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -145,9 +145,9 @@ func NewChannelUpdate() *ChannelUpdate {
|
||||
return &ChannelUpdate{}
|
||||
}
|
||||
|
||||
func (c *ChannelUpdate) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -172,22 +172,22 @@ func (c *ChannelUpdate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
cReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
c.Name = val
|
||||
cReq.Name = val
|
||||
}
|
||||
if val, ok := post["topic"]; ok {
|
||||
|
||||
c.Topic = val
|
||||
cReq.Topic = val
|
||||
}
|
||||
if val, ok := post["type"]; ok {
|
||||
|
||||
c.Type = val
|
||||
cReq.Type = val
|
||||
}
|
||||
if val, ok := post["organisationID"]; ok {
|
||||
|
||||
c.OrganisationID = parseUInt64(val)
|
||||
cReq.OrganisationID = parseUInt64(val)
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -205,9 +205,9 @@ func NewChannelState() *ChannelState {
|
||||
return &ChannelState{}
|
||||
}
|
||||
|
||||
func (c *ChannelState) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelState) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -232,10 +232,10 @@ func (c *ChannelState) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
cReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
if val, ok := post["state"]; ok {
|
||||
|
||||
c.State = val
|
||||
cReq.State = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -253,9 +253,9 @@ func NewChannelSetFlag() *ChannelSetFlag {
|
||||
return &ChannelSetFlag{}
|
||||
}
|
||||
|
||||
func (c *ChannelSetFlag) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelSetFlag) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -280,10 +280,10 @@ func (c *ChannelSetFlag) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
cReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
if val, ok := post["flag"]; ok {
|
||||
|
||||
c.Flag = val
|
||||
cReq.Flag = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -300,9 +300,9 @@ func NewChannelRemoveFlag() *ChannelRemoveFlag {
|
||||
return &ChannelRemoveFlag{}
|
||||
}
|
||||
|
||||
func (c *ChannelRemoveFlag) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelRemoveFlag) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -327,7 +327,7 @@ func (c *ChannelRemoveFlag) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
cReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -343,9 +343,9 @@ func NewChannelRead() *ChannelRead {
|
||||
return &ChannelRead{}
|
||||
}
|
||||
|
||||
func (c *ChannelRead) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelRead) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -370,7 +370,7 @@ func (c *ChannelRead) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
cReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -386,9 +386,9 @@ func NewChannelMembers() *ChannelMembers {
|
||||
return &ChannelMembers{}
|
||||
}
|
||||
|
||||
func (c *ChannelMembers) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelMembers) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -413,7 +413,7 @@ func (c *ChannelMembers) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
cReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -430,9 +430,9 @@ func NewChannelJoin() *ChannelJoin {
|
||||
return &ChannelJoin{}
|
||||
}
|
||||
|
||||
func (c *ChannelJoin) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelJoin) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -457,8 +457,8 @@ func (c *ChannelJoin) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
c.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
cReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
cReq.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -475,9 +475,9 @@ func NewChannelPart() *ChannelPart {
|
||||
return &ChannelPart{}
|
||||
}
|
||||
|
||||
func (c *ChannelPart) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelPart) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -502,8 +502,8 @@ func (c *ChannelPart) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
c.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
cReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
cReq.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -520,9 +520,9 @@ func NewChannelInvite() *ChannelInvite {
|
||||
return &ChannelInvite{}
|
||||
}
|
||||
|
||||
func (c *ChannelInvite) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelInvite) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -547,8 +547,8 @@ func (c *ChannelInvite) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
c.UserID = parseUInt64A(r.Form["userID"])
|
||||
cReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
cReq.UserID = parseUInt64A(r.Form["userID"])
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -566,9 +566,9 @@ func NewChannelAttach() *ChannelAttach {
|
||||
return &ChannelAttach{}
|
||||
}
|
||||
|
||||
func (c *ChannelAttach) Fill(r *http.Request) (err error) {
|
||||
func (cReq *ChannelAttach) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(c)
|
||||
err = json.NewDecoder(r.Body).Decode(cReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -593,12 +593,12 @@ func (c *ChannelAttach) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
c.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
cReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
if val, ok := post["replyTo"]; ok {
|
||||
|
||||
c.ReplyTo = parseUInt64(val)
|
||||
cReq.ReplyTo = parseUInt64(val)
|
||||
}
|
||||
if _, c.Upload, err = r.FormFile("upload"); err != nil {
|
||||
if _, cReq.Upload, err = r.FormFile("upload"); err != nil {
|
||||
return errors.Wrap(err, "error procesing uploaded file")
|
||||
}
|
||||
|
||||
|
||||
@@ -39,9 +39,9 @@ func NewMessageCreate() *MessageCreate {
|
||||
return &MessageCreate{}
|
||||
}
|
||||
|
||||
func (m *MessageCreate) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessageCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -68,9 +68,9 @@ func (m *MessageCreate) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := post["message"]; ok {
|
||||
|
||||
m.Message = val
|
||||
mReq.Message = val
|
||||
}
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -87,9 +87,9 @@ func NewMessageHistory() *MessageHistory {
|
||||
return &MessageHistory{}
|
||||
}
|
||||
|
||||
func (m *MessageHistory) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessageHistory) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -116,9 +116,9 @@ func (m *MessageHistory) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["lastMessageID"]; ok {
|
||||
|
||||
m.LastMessageID = parseUInt64(val)
|
||||
mReq.LastMessageID = parseUInt64(val)
|
||||
}
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -136,9 +136,9 @@ func NewMessageMarkAsRead() *MessageMarkAsRead {
|
||||
return &MessageMarkAsRead{}
|
||||
}
|
||||
|
||||
func (m *MessageMarkAsRead) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessageMarkAsRead) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -163,14 +163,14 @@ func (m *MessageMarkAsRead) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
if val, ok := post["threadID"]; ok {
|
||||
|
||||
m.ThreadID = parseUInt64(val)
|
||||
mReq.ThreadID = parseUInt64(val)
|
||||
}
|
||||
if val, ok := post["lastReadMessageID"]; ok {
|
||||
|
||||
m.LastReadMessageID = parseUInt64(val)
|
||||
mReq.LastReadMessageID = parseUInt64(val)
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -189,9 +189,9 @@ func NewMessageEdit() *MessageEdit {
|
||||
return &MessageEdit{}
|
||||
}
|
||||
|
||||
func (m *MessageEdit) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessageEdit) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -216,11 +216,11 @@ func (m *MessageEdit) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
if val, ok := post["message"]; ok {
|
||||
|
||||
m.Message = val
|
||||
mReq.Message = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -238,9 +238,9 @@ func NewMessageDelete() *MessageDelete {
|
||||
return &MessageDelete{}
|
||||
}
|
||||
|
||||
func (m *MessageDelete) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessageDelete) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -265,8 +265,8 @@ func (m *MessageDelete) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -283,9 +283,9 @@ func NewMessageReplyGet() *MessageReplyGet {
|
||||
return &MessageReplyGet{}
|
||||
}
|
||||
|
||||
func (m *MessageReplyGet) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessageReplyGet) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -310,8 +310,8 @@ func (m *MessageReplyGet) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -329,9 +329,9 @@ func NewMessageReplyCreate() *MessageReplyCreate {
|
||||
return &MessageReplyCreate{}
|
||||
}
|
||||
|
||||
func (m *MessageReplyCreate) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessageReplyCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -356,11 +356,11 @@ func (m *MessageReplyCreate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
if val, ok := post["message"]; ok {
|
||||
|
||||
m.Message = val
|
||||
mReq.Message = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -378,9 +378,9 @@ func NewMessagePinCreate() *MessagePinCreate {
|
||||
return &MessagePinCreate{}
|
||||
}
|
||||
|
||||
func (m *MessagePinCreate) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessagePinCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -405,8 +405,8 @@ func (m *MessagePinCreate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -423,9 +423,9 @@ func NewMessagePinRemove() *MessagePinRemove {
|
||||
return &MessagePinRemove{}
|
||||
}
|
||||
|
||||
func (m *MessagePinRemove) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessagePinRemove) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -450,8 +450,8 @@ func (m *MessagePinRemove) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -468,9 +468,9 @@ func NewMessageBookmarkCreate() *MessageBookmarkCreate {
|
||||
return &MessageBookmarkCreate{}
|
||||
}
|
||||
|
||||
func (m *MessageBookmarkCreate) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessageBookmarkCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -495,8 +495,8 @@ func (m *MessageBookmarkCreate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -513,9 +513,9 @@ func NewMessageBookmarkRemove() *MessageBookmarkRemove {
|
||||
return &MessageBookmarkRemove{}
|
||||
}
|
||||
|
||||
func (m *MessageBookmarkRemove) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessageBookmarkRemove) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -540,8 +540,8 @@ func (m *MessageBookmarkRemove) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -559,9 +559,9 @@ func NewMessageReactionCreate() *MessageReactionCreate {
|
||||
return &MessageReactionCreate{}
|
||||
}
|
||||
|
||||
func (m *MessageReactionCreate) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessageReactionCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -586,9 +586,9 @@ func (m *MessageReactionCreate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
m.Reaction = chi.URLParam(r, "reaction")
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
mReq.Reaction = chi.URLParam(r, "reaction")
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -606,9 +606,9 @@ func NewMessageReactionRemove() *MessageReactionRemove {
|
||||
return &MessageReactionRemove{}
|
||||
}
|
||||
|
||||
func (m *MessageReactionRemove) Fill(r *http.Request) (err error) {
|
||||
func (mReq *MessageReactionRemove) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(m)
|
||||
err = json.NewDecoder(r.Body).Decode(mReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -633,9 +633,9 @@ func (m *MessageReactionRemove) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
m.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
m.Reaction = chi.URLParam(r, "reaction")
|
||||
m.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
mReq.MessageID = parseUInt64(chi.URLParam(r, "messageID"))
|
||||
mReq.Reaction = chi.URLParam(r, "reaction")
|
||||
mReq.ChannelID = parseUInt64(chi.URLParam(r, "channelID"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ func NewSearchMessages() *SearchMessages {
|
||||
return &SearchMessages{}
|
||||
}
|
||||
|
||||
func (s *SearchMessages) Fill(r *http.Request) (err error) {
|
||||
func (sReq *SearchMessages) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(s)
|
||||
err = json.NewDecoder(r.Body).Decode(sReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -71,23 +71,23 @@ func (s *SearchMessages) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["inChannel"]; ok {
|
||||
|
||||
s.InChannel = parseUInt64(val)
|
||||
sReq.InChannel = parseUInt64(val)
|
||||
}
|
||||
if val, ok := get["fromUser"]; ok {
|
||||
|
||||
s.FromUser = parseUInt64(val)
|
||||
sReq.FromUser = parseUInt64(val)
|
||||
}
|
||||
if val, ok := get["firstID"]; ok {
|
||||
|
||||
s.FirstID = parseUInt64(val)
|
||||
sReq.FirstID = parseUInt64(val)
|
||||
}
|
||||
if val, ok := get["lastID"]; ok {
|
||||
|
||||
s.LastID = parseUInt64(val)
|
||||
sReq.LastID = parseUInt64(val)
|
||||
}
|
||||
if val, ok := get["query"]; ok {
|
||||
|
||||
s.Query = val
|
||||
sReq.Query = val
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
@@ -37,9 +37,9 @@ func NewAuthCheck() *AuthCheck {
|
||||
return &AuthCheck{}
|
||||
}
|
||||
|
||||
func (au *AuthCheck) Fill(r *http.Request) (err error) {
|
||||
func (auReq *AuthCheck) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(au)
|
||||
err = json.NewDecoder(r.Body).Decode(auReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -79,9 +79,9 @@ func NewAuthLogin() *AuthLogin {
|
||||
return &AuthLogin{}
|
||||
}
|
||||
|
||||
func (au *AuthLogin) Fill(r *http.Request) (err error) {
|
||||
func (auReq *AuthLogin) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(au)
|
||||
err = json.NewDecoder(r.Body).Decode(auReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -108,11 +108,11 @@ func (au *AuthLogin) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := post["username"]; ok {
|
||||
|
||||
au.Username = val
|
||||
auReq.Username = val
|
||||
}
|
||||
if val, ok := post["password"]; ok {
|
||||
|
||||
au.Password = val
|
||||
auReq.Password = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -128,9 +128,9 @@ func NewAuthLogout() *AuthLogout {
|
||||
return &AuthLogout{}
|
||||
}
|
||||
|
||||
func (au *AuthLogout) Fill(r *http.Request) (err error) {
|
||||
func (auReq *AuthLogout) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(au)
|
||||
err = json.NewDecoder(r.Body).Decode(auReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
|
||||
@@ -38,9 +38,9 @@ func NewOrganisationList() *OrganisationList {
|
||||
return &OrganisationList{}
|
||||
}
|
||||
|
||||
func (or *OrganisationList) Fill(r *http.Request) (err error) {
|
||||
func (orReq *OrganisationList) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(or)
|
||||
err = json.NewDecoder(r.Body).Decode(orReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -67,7 +67,7 @@ func (or *OrganisationList) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["query"]; ok {
|
||||
|
||||
or.Query = val
|
||||
orReq.Query = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -84,9 +84,9 @@ func NewOrganisationCreate() *OrganisationCreate {
|
||||
return &OrganisationCreate{}
|
||||
}
|
||||
|
||||
func (or *OrganisationCreate) Fill(r *http.Request) (err error) {
|
||||
func (orReq *OrganisationCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(or)
|
||||
err = json.NewDecoder(r.Body).Decode(orReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -113,7 +113,7 @@ func (or *OrganisationCreate) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
or.Name = val
|
||||
orReq.Name = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -131,9 +131,9 @@ func NewOrganisationUpdate() *OrganisationUpdate {
|
||||
return &OrganisationUpdate{}
|
||||
}
|
||||
|
||||
func (or *OrganisationUpdate) Fill(r *http.Request) (err error) {
|
||||
func (orReq *OrganisationUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(or)
|
||||
err = json.NewDecoder(r.Body).Decode(orReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -158,10 +158,10 @@ func (or *OrganisationUpdate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
or.ID = parseUInt64(chi.URLParam(r, "id"))
|
||||
orReq.ID = parseUInt64(chi.URLParam(r, "id"))
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
or.Name = val
|
||||
orReq.Name = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -178,9 +178,9 @@ func NewOrganisationDelete() *OrganisationDelete {
|
||||
return &OrganisationDelete{}
|
||||
}
|
||||
|
||||
func (or *OrganisationDelete) Fill(r *http.Request) (err error) {
|
||||
func (orReq *OrganisationDelete) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(or)
|
||||
err = json.NewDecoder(r.Body).Decode(orReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -205,7 +205,7 @@ func (or *OrganisationDelete) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
or.ID = parseUInt64(chi.URLParam(r, "id"))
|
||||
orReq.ID = parseUInt64(chi.URLParam(r, "id"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -221,9 +221,9 @@ func NewOrganisationRead() *OrganisationRead {
|
||||
return &OrganisationRead{}
|
||||
}
|
||||
|
||||
func (or *OrganisationRead) Fill(r *http.Request) (err error) {
|
||||
func (orReq *OrganisationRead) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(or)
|
||||
err = json.NewDecoder(r.Body).Decode(orReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -250,7 +250,7 @@ func (or *OrganisationRead) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["id"]; ok {
|
||||
|
||||
or.ID = parseUInt64(val)
|
||||
orReq.ID = parseUInt64(val)
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -267,9 +267,9 @@ func NewOrganisationArchive() *OrganisationArchive {
|
||||
return &OrganisationArchive{}
|
||||
}
|
||||
|
||||
func (or *OrganisationArchive) Fill(r *http.Request) (err error) {
|
||||
func (orReq *OrganisationArchive) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(or)
|
||||
err = json.NewDecoder(r.Body).Decode(orReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -294,7 +294,7 @@ func (or *OrganisationArchive) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
or.ID = parseUInt64(chi.URLParam(r, "id"))
|
||||
orReq.ID = parseUInt64(chi.URLParam(r, "id"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ func NewPermissionsList() *PermissionsList {
|
||||
return &PermissionsList{}
|
||||
}
|
||||
|
||||
func (pe *PermissionsList) Fill(r *http.Request) (err error) {
|
||||
func (peReq *PermissionsList) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(pe)
|
||||
err = json.NewDecoder(r.Body).Decode(peReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -80,9 +80,9 @@ func NewPermissionsRead() *PermissionsRead {
|
||||
return &PermissionsRead{}
|
||||
}
|
||||
|
||||
func (pe *PermissionsRead) Fill(r *http.Request) (err error) {
|
||||
func (peReq *PermissionsRead) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(pe)
|
||||
err = json.NewDecoder(r.Body).Decode(peReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -107,7 +107,7 @@ func (pe *PermissionsRead) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
pe.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
peReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -123,9 +123,9 @@ func NewPermissionsDelete() *PermissionsDelete {
|
||||
return &PermissionsDelete{}
|
||||
}
|
||||
|
||||
func (pe *PermissionsDelete) Fill(r *http.Request) (err error) {
|
||||
func (peReq *PermissionsDelete) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(pe)
|
||||
err = json.NewDecoder(r.Body).Decode(peReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -150,7 +150,7 @@ func (pe *PermissionsDelete) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
pe.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
peReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -167,9 +167,9 @@ func NewPermissionsUpdate() *PermissionsUpdate {
|
||||
return &PermissionsUpdate{}
|
||||
}
|
||||
|
||||
func (pe *PermissionsUpdate) Fill(r *http.Request) (err error) {
|
||||
func (peReq *PermissionsUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(pe)
|
||||
err = json.NewDecoder(r.Body).Decode(peReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -194,7 +194,7 @@ func (pe *PermissionsUpdate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
pe.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
peReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
+38
-38
@@ -38,9 +38,9 @@ func NewRoleList() *RoleList {
|
||||
return &RoleList{}
|
||||
}
|
||||
|
||||
func (ro *RoleList) Fill(r *http.Request) (err error) {
|
||||
func (roReq *RoleList) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(ro)
|
||||
err = json.NewDecoder(r.Body).Decode(roReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -67,7 +67,7 @@ func (ro *RoleList) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["query"]; ok {
|
||||
|
||||
ro.Query = val
|
||||
roReq.Query = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -85,9 +85,9 @@ func NewRoleCreate() *RoleCreate {
|
||||
return &RoleCreate{}
|
||||
}
|
||||
|
||||
func (ro *RoleCreate) Fill(r *http.Request) (err error) {
|
||||
func (roReq *RoleCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(ro)
|
||||
err = json.NewDecoder(r.Body).Decode(roReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -114,7 +114,7 @@ func (ro *RoleCreate) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
ro.Name = val
|
||||
roReq.Name = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -133,9 +133,9 @@ func NewRoleUpdate() *RoleUpdate {
|
||||
return &RoleUpdate{}
|
||||
}
|
||||
|
||||
func (ro *RoleUpdate) Fill(r *http.Request) (err error) {
|
||||
func (roReq *RoleUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(ro)
|
||||
err = json.NewDecoder(r.Body).Decode(roReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -160,10 +160,10 @@ func (ro *RoleUpdate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
ro.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
roReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
ro.Name = val
|
||||
roReq.Name = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -180,9 +180,9 @@ func NewRoleRead() *RoleRead {
|
||||
return &RoleRead{}
|
||||
}
|
||||
|
||||
func (ro *RoleRead) Fill(r *http.Request) (err error) {
|
||||
func (roReq *RoleRead) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(ro)
|
||||
err = json.NewDecoder(r.Body).Decode(roReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -207,7 +207,7 @@ func (ro *RoleRead) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
ro.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
roReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -223,9 +223,9 @@ func NewRoleDelete() *RoleDelete {
|
||||
return &RoleDelete{}
|
||||
}
|
||||
|
||||
func (ro *RoleDelete) Fill(r *http.Request) (err error) {
|
||||
func (roReq *RoleDelete) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(ro)
|
||||
err = json.NewDecoder(r.Body).Decode(roReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -250,7 +250,7 @@ func (ro *RoleDelete) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
ro.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
roReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -266,9 +266,9 @@ func NewRoleArchive() *RoleArchive {
|
||||
return &RoleArchive{}
|
||||
}
|
||||
|
||||
func (ro *RoleArchive) Fill(r *http.Request) (err error) {
|
||||
func (roReq *RoleArchive) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(ro)
|
||||
err = json.NewDecoder(r.Body).Decode(roReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -293,7 +293,7 @@ func (ro *RoleArchive) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
ro.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
roReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -310,9 +310,9 @@ func NewRoleMove() *RoleMove {
|
||||
return &RoleMove{}
|
||||
}
|
||||
|
||||
func (ro *RoleMove) Fill(r *http.Request) (err error) {
|
||||
func (roReq *RoleMove) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(ro)
|
||||
err = json.NewDecoder(r.Body).Decode(roReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -337,10 +337,10 @@ func (ro *RoleMove) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
ro.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
roReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
if val, ok := post["organisationID"]; ok {
|
||||
|
||||
ro.OrganisationID = parseUInt64(val)
|
||||
roReq.OrganisationID = parseUInt64(val)
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -358,9 +358,9 @@ func NewRoleMerge() *RoleMerge {
|
||||
return &RoleMerge{}
|
||||
}
|
||||
|
||||
func (ro *RoleMerge) Fill(r *http.Request) (err error) {
|
||||
func (roReq *RoleMerge) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(ro)
|
||||
err = json.NewDecoder(r.Body).Decode(roReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -385,10 +385,10 @@ func (ro *RoleMerge) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
ro.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
roReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
if val, ok := post["destination"]; ok {
|
||||
|
||||
ro.Destination = parseUInt64(val)
|
||||
roReq.Destination = parseUInt64(val)
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -405,9 +405,9 @@ func NewRoleMemberList() *RoleMemberList {
|
||||
return &RoleMemberList{}
|
||||
}
|
||||
|
||||
func (ro *RoleMemberList) Fill(r *http.Request) (err error) {
|
||||
func (roReq *RoleMemberList) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(ro)
|
||||
err = json.NewDecoder(r.Body).Decode(roReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -432,7 +432,7 @@ func (ro *RoleMemberList) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
ro.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
roReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -449,9 +449,9 @@ func NewRoleMemberAdd() *RoleMemberAdd {
|
||||
return &RoleMemberAdd{}
|
||||
}
|
||||
|
||||
func (ro *RoleMemberAdd) Fill(r *http.Request) (err error) {
|
||||
func (roReq *RoleMemberAdd) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(ro)
|
||||
err = json.NewDecoder(r.Body).Decode(roReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -476,8 +476,8 @@ func (ro *RoleMemberAdd) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
ro.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
ro.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
roReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
roReq.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -494,9 +494,9 @@ func NewRoleMemberRemove() *RoleMemberRemove {
|
||||
return &RoleMemberRemove{}
|
||||
}
|
||||
|
||||
func (ro *RoleMemberRemove) Fill(r *http.Request) (err error) {
|
||||
func (roReq *RoleMemberRemove) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(ro)
|
||||
err = json.NewDecoder(r.Body).Decode(roReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -521,8 +521,8 @@ func (ro *RoleMemberRemove) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
ro.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
ro.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
roReq.RoleID = parseUInt64(chi.URLParam(r, "roleID"))
|
||||
roReq.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
+30
-30
@@ -40,9 +40,9 @@ func NewUserList() *UserList {
|
||||
return &UserList{}
|
||||
}
|
||||
|
||||
func (us *UserList) Fill(r *http.Request) (err error) {
|
||||
func (usReq *UserList) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(us)
|
||||
err = json.NewDecoder(r.Body).Decode(usReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -69,15 +69,15 @@ func (us *UserList) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := get["query"]; ok {
|
||||
|
||||
us.Query = val
|
||||
usReq.Query = val
|
||||
}
|
||||
if val, ok := get["username"]; ok {
|
||||
|
||||
us.Username = val
|
||||
usReq.Username = val
|
||||
}
|
||||
if val, ok := get["email"]; ok {
|
||||
|
||||
us.Email = val
|
||||
usReq.Email = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -97,9 +97,9 @@ func NewUserCreate() *UserCreate {
|
||||
return &UserCreate{}
|
||||
}
|
||||
|
||||
func (us *UserCreate) Fill(r *http.Request) (err error) {
|
||||
func (usReq *UserCreate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(us)
|
||||
err = json.NewDecoder(r.Body).Decode(usReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -126,19 +126,19 @@ func (us *UserCreate) Fill(r *http.Request) (err error) {
|
||||
|
||||
if val, ok := post["email"]; ok {
|
||||
|
||||
us.Email = val
|
||||
usReq.Email = val
|
||||
}
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
us.Name = val
|
||||
usReq.Name = val
|
||||
}
|
||||
if val, ok := post["handle"]; ok {
|
||||
|
||||
us.Handle = val
|
||||
usReq.Handle = val
|
||||
}
|
||||
if val, ok := post["kind"]; ok {
|
||||
|
||||
us.Kind = val
|
||||
usReq.Kind = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -159,9 +159,9 @@ func NewUserUpdate() *UserUpdate {
|
||||
return &UserUpdate{}
|
||||
}
|
||||
|
||||
func (us *UserUpdate) Fill(r *http.Request) (err error) {
|
||||
func (usReq *UserUpdate) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(us)
|
||||
err = json.NewDecoder(r.Body).Decode(usReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -186,22 +186,22 @@ func (us *UserUpdate) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
us.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
usReq.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
if val, ok := post["email"]; ok {
|
||||
|
||||
us.Email = val
|
||||
usReq.Email = val
|
||||
}
|
||||
if val, ok := post["name"]; ok {
|
||||
|
||||
us.Name = val
|
||||
usReq.Name = val
|
||||
}
|
||||
if val, ok := post["handle"]; ok {
|
||||
|
||||
us.Handle = val
|
||||
usReq.Handle = val
|
||||
}
|
||||
if val, ok := post["kind"]; ok {
|
||||
|
||||
us.Kind = val
|
||||
usReq.Kind = val
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -218,9 +218,9 @@ func NewUserRead() *UserRead {
|
||||
return &UserRead{}
|
||||
}
|
||||
|
||||
func (us *UserRead) Fill(r *http.Request) (err error) {
|
||||
func (usReq *UserRead) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(us)
|
||||
err = json.NewDecoder(r.Body).Decode(usReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -245,7 +245,7 @@ func (us *UserRead) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
us.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
usReq.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -261,9 +261,9 @@ func NewUserDelete() *UserDelete {
|
||||
return &UserDelete{}
|
||||
}
|
||||
|
||||
func (us *UserDelete) Fill(r *http.Request) (err error) {
|
||||
func (usReq *UserDelete) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(us)
|
||||
err = json.NewDecoder(r.Body).Decode(usReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -288,7 +288,7 @@ func (us *UserDelete) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
us.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
usReq.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -304,9 +304,9 @@ func NewUserSuspend() *UserSuspend {
|
||||
return &UserSuspend{}
|
||||
}
|
||||
|
||||
func (us *UserSuspend) Fill(r *http.Request) (err error) {
|
||||
func (usReq *UserSuspend) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(us)
|
||||
err = json.NewDecoder(r.Body).Decode(usReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -331,7 +331,7 @@ func (us *UserSuspend) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
us.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
usReq.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -347,9 +347,9 @@ func NewUserUnsuspend() *UserUnsuspend {
|
||||
return &UserUnsuspend{}
|
||||
}
|
||||
|
||||
func (us *UserUnsuspend) Fill(r *http.Request) (err error) {
|
||||
func (usReq *UserUnsuspend) Fill(r *http.Request) (err error) {
|
||||
if strings.ToLower(r.Header.Get("content-type")) == "application/json" {
|
||||
err = json.NewDecoder(r.Body).Decode(us)
|
||||
err = json.NewDecoder(r.Body).Decode(usReq)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
@@ -374,7 +374,7 @@ func (us *UserUnsuspend) Fill(r *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
us.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
usReq.UserID = parseUInt64(chi.URLParam(r, "userID"))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user