Add missing raw&has for post&get

This commit is contained in:
Denis Arh
2020-04-08 17:02:07 +02:00
parent 5facc91fe8
commit 23bf0c52c7
32 changed files with 567 additions and 1 deletions
@@ -113,6 +113,8 @@ func (r *{name|expose}{call.name|capitalize}) Fill(req *http.Request) (err error
}
{elseif substr($param.type, 0, 2) !== '[]' && substr($param.type, -3) !== 'Set'}
if val, ok := {method|strtolower}["{param.name}"]; ok {
r.has{param.name|expose} = true
r.raw{param.name|expose} = val
{if substr($parsers[$param.type], -7) === 'WithErr'}
if r.{param.name|expose}, err = {$parsers[$param.type]}(val); err != nil {
return err
+38
View File
@@ -135,33 +135,53 @@ func (r *AttachmentList) Fill(req *http.Request) (err error) {
}
if val, ok := get["pageID"]; ok {
r.hasPageID = true
r.rawPageID = val
r.PageID = parseUInt64(val)
}
if val, ok := get["moduleID"]; ok {
r.hasModuleID = true
r.rawModuleID = val
r.ModuleID = parseUInt64(val)
}
if val, ok := get["recordID"]; ok {
r.hasRecordID = true
r.rawRecordID = val
r.RecordID = parseUInt64(val)
}
if val, ok := get["fieldName"]; ok {
r.hasFieldName = true
r.rawFieldName = val
r.FieldName = val
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["offset"]; ok {
r.hasOffset = true
r.rawOffset = val
r.Offset = parseUint(val)
}
if val, ok := get["page"]; ok {
r.hasPage = true
r.rawPage = val
r.Page = parseUint(val)
}
if val, ok := get["perPage"]; ok {
r.hasPerPage = true
r.rawPerPage = val
r.PerPage = parseUint(val)
}
if val, ok := get["sign"]; ok {
r.hasSign = true
r.rawSign = val
r.Sign = val
}
if val, ok := get["userID"]; ok {
r.hasUserID = true
r.rawUserID = val
r.UserID = parseUInt64(val)
}
r.hasKind = true
@@ -255,9 +275,13 @@ func (r *AttachmentRead) Fill(req *http.Request) (err error) {
r.rawNamespaceID = chi.URLParam(req, "namespaceID")
r.NamespaceID = parseUInt64(chi.URLParam(req, "namespaceID"))
if val, ok := get["sign"]; ok {
r.hasSign = true
r.rawSign = val
r.Sign = val
}
if val, ok := get["userID"]; ok {
r.hasUserID = true
r.rawUserID = val
r.UserID = parseUInt64(val)
}
@@ -345,9 +369,13 @@ func (r *AttachmentDelete) Fill(req *http.Request) (err error) {
r.rawNamespaceID = chi.URLParam(req, "namespaceID")
r.NamespaceID = parseUInt64(chi.URLParam(req, "namespaceID"))
if val, ok := get["sign"]; ok {
r.hasSign = true
r.rawSign = val
r.Sign = val
}
if val, ok := get["userID"]; ok {
r.hasUserID = true
r.rawUserID = val
r.UserID = parseUInt64(val)
}
@@ -436,12 +464,18 @@ func (r *AttachmentOriginal) Fill(req *http.Request) (err error) {
}
if val, ok := get["download"]; ok {
r.hasDownload = true
r.rawDownload = val
r.Download = parseBool(val)
}
if val, ok := get["sign"]; ok {
r.hasSign = true
r.rawSign = val
r.Sign = val
}
if val, ok := get["userID"]; ok {
r.hasUserID = true
r.rawUserID = val
r.UserID = parseUInt64(val)
}
r.hasAttachmentID = true
@@ -549,9 +583,13 @@ func (r *AttachmentPreview) Fill(req *http.Request) (err error) {
r.rawNamespaceID = chi.URLParam(req, "namespaceID")
r.NamespaceID = parseUInt64(chi.URLParam(req, "namespaceID"))
if val, ok := get["sign"]; ok {
r.hasSign = true
r.rawSign = val
r.Sign = val
}
if val, ok := get["userID"]; ok {
r.hasUserID = true
r.rawUserID = val
r.UserID = parseUInt64(val)
}
+8
View File
@@ -135,12 +135,18 @@ func (r *AutomationList) Fill(req *http.Request) (err error) {
}
if val, ok := get["excludeInvalid"]; ok {
r.hasExcludeInvalid = true
r.rawExcludeInvalid = val
r.ExcludeInvalid = parseBool(val)
}
if val, ok := get["excludeClientScripts"]; ok {
r.hasExcludeClientScripts = true
r.rawExcludeClientScripts = val
r.ExcludeClientScripts = parseBool(val)
}
if val, ok := get["excludeServerScripts"]; ok {
r.hasExcludeServerScripts = true
r.rawExcludeServerScripts = val
r.ExcludeServerScripts = parseBool(val)
}
@@ -273,6 +279,8 @@ func (r *AutomationTriggerScript) Fill(req *http.Request) (err error) {
}
if val, ok := post["script"]; ok {
r.hasScript = true
r.rawScript = val
r.Script = val
}
+28
View File
@@ -118,24 +118,38 @@ func (r *ChartList) Fill(req *http.Request) (err error) {
}
if val, ok := get["query"]; ok {
r.hasQuery = true
r.rawQuery = val
r.Query = val
}
if val, ok := get["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["offset"]; ok {
r.hasOffset = true
r.rawOffset = val
r.Offset = parseUint(val)
}
if val, ok := get["page"]; ok {
r.hasPage = true
r.rawPage = val
r.Page = parseUint(val)
}
if val, ok := get["perPage"]; ok {
r.hasPerPage = true
r.rawPerPage = val
r.PerPage = parseUint(val)
}
if val, ok := get["sort"]; ok {
r.hasSort = true
r.rawSort = val
r.Sort = val
}
r.hasNamespaceID = true
@@ -212,15 +226,21 @@ func (r *ChartCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["config"]; ok {
r.hasConfig = true
r.rawConfig = val
if r.Config, err = parseJSONTextWithErr(val); err != nil {
return err
}
}
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
r.hasNamespaceID = true
@@ -379,18 +399,26 @@ func (r *ChartUpdate) Fill(req *http.Request) (err error) {
r.rawNamespaceID = chi.URLParam(req, "namespaceID")
r.NamespaceID = parseUInt64(chi.URLParam(req, "namespaceID"))
if val, ok := post["config"]; ok {
r.hasConfig = true
r.rawConfig = val
if r.Config, err = parseJSONTextWithErr(val); err != nil {
return err
}
}
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := post["updatedAt"]; ok {
r.hasUpdatedAt = true
r.rawUpdatedAt = val
if r.UpdatedAt, err = parseISODatePtrWithErr(val); err != nil {
return err
+32
View File
@@ -124,27 +124,43 @@ func (r *ModuleList) Fill(req *http.Request) (err error) {
}
if val, ok := get["query"]; ok {
r.hasQuery = true
r.rawQuery = val
r.Query = val
}
if val, ok := get["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := get["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["offset"]; ok {
r.hasOffset = true
r.rawOffset = val
r.Offset = parseUint(val)
}
if val, ok := get["page"]; ok {
r.hasPage = true
r.rawPage = val
r.Page = parseUint(val)
}
if val, ok := get["perPage"]; ok {
r.hasPerPage = true
r.rawPerPage = val
r.PerPage = parseUint(val)
}
if val, ok := get["sort"]; ok {
r.hasSort = true
r.rawSort = val
r.Sort = val
}
r.hasNamespaceID = true
@@ -226,12 +242,18 @@ func (r *ModuleCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := post["meta"]; ok {
r.hasMeta = true
r.rawMeta = val
if r.Meta, err = parseJSONTextWithErr(val); err != nil {
return err
@@ -398,18 +420,26 @@ func (r *ModuleUpdate) Fill(req *http.Request) (err error) {
r.rawNamespaceID = chi.URLParam(req, "namespaceID")
r.NamespaceID = parseUInt64(chi.URLParam(req, "namespaceID"))
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := post["meta"]; ok {
r.hasMeta = true
r.rawMeta = val
if r.Meta, err = parseJSONTextWithErr(val); err != nil {
return err
}
}
if val, ok := post["updatedAt"]; ok {
r.hasUpdatedAt = true
r.rawUpdatedAt = val
if r.UpdatedAt, err = parseISODatePtrWithErr(val); err != nil {
return err
@@ -553,6 +583,8 @@ func (r *ModuleTriggerScript) Fill(req *http.Request) (err error) {
r.rawNamespaceID = chi.URLParam(req, "namespaceID")
r.NamespaceID = parseUInt64(chi.URLParam(req, "namespaceID"))
if val, ok := post["script"]; ok {
r.hasScript = true
r.rawScript = val
r.Script = val
}
+34
View File
@@ -113,24 +113,38 @@ func (r *NamespaceList) Fill(req *http.Request) (err error) {
}
if val, ok := get["query"]; ok {
r.hasQuery = true
r.rawQuery = val
r.Query = val
}
if val, ok := get["slug"]; ok {
r.hasSlug = true
r.rawSlug = val
r.Slug = val
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["offset"]; ok {
r.hasOffset = true
r.rawOffset = val
r.Offset = parseUint(val)
}
if val, ok := get["page"]; ok {
r.hasPage = true
r.rawPage = val
r.Page = parseUint(val)
}
if val, ok := get["perPage"]; ok {
r.hasPerPage = true
r.rawPerPage = val
r.PerPage = parseUint(val)
}
if val, ok := get["sort"]; ok {
r.hasSort = true
r.rawSort = val
r.Sort = val
}
@@ -204,15 +218,23 @@ func (r *NamespaceCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["slug"]; ok {
r.hasSlug = true
r.rawSlug = val
r.Slug = val
}
if val, ok := post["enabled"]; ok {
r.hasEnabled = true
r.rawEnabled = val
r.Enabled = parseBool(val)
}
if val, ok := post["meta"]; ok {
r.hasMeta = true
r.rawMeta = val
if r.Meta, err = parseJSONTextWithErr(val); err != nil {
return err
@@ -360,21 +382,31 @@ func (r *NamespaceUpdate) Fill(req *http.Request) (err error) {
r.rawNamespaceID = chi.URLParam(req, "namespaceID")
r.NamespaceID = parseUInt64(chi.URLParam(req, "namespaceID"))
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["slug"]; ok {
r.hasSlug = true
r.rawSlug = val
r.Slug = val
}
if val, ok := post["enabled"]; ok {
r.hasEnabled = true
r.rawEnabled = val
r.Enabled = parseBool(val)
}
if val, ok := post["meta"]; ok {
r.hasMeta = true
r.rawMeta = val
if r.Meta, err = parseJSONTextWithErr(val); err != nil {
return err
}
}
if val, ok := post["updatedAt"]; ok {
r.hasUpdatedAt = true
r.rawUpdatedAt = val
if r.UpdatedAt, err = parseISODatePtrWithErr(val); err != nil {
return err
@@ -502,6 +534,8 @@ func (r *NamespaceTriggerScript) Fill(req *http.Request) (err error) {
r.rawNamespaceID = chi.URLParam(req, "namespaceID")
r.NamespaceID = parseUInt64(chi.URLParam(req, "namespaceID"))
if val, ok := post["script"]; ok {
r.hasScript = true
r.rawScript = val
r.Script = val
}
+6
View File
@@ -119,12 +119,18 @@ func (r *NotificationEmailSend) Fill(req *http.Request) (err error) {
}
if val, ok := post["replyTo"]; ok {
r.hasReplyTo = true
r.rawReplyTo = val
r.ReplyTo = val
}
if val, ok := post["subject"]; ok {
r.hasSubject = true
r.rawSubject = val
r.Subject = val
}
if val, ok := post["content"]; ok {
r.hasContent = true
r.rawContent = val
if r.Content, err = parseJSONTextWithErr(val); err != nil {
return err
+48
View File
@@ -122,27 +122,43 @@ func (r *PageList) Fill(req *http.Request) (err error) {
}
if val, ok := get["selfID"]; ok {
r.hasSelfID = true
r.rawSelfID = val
r.SelfID = parseUInt64(val)
}
if val, ok := get["query"]; ok {
r.hasQuery = true
r.rawQuery = val
r.Query = val
}
if val, ok := get["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["offset"]; ok {
r.hasOffset = true
r.rawOffset = val
r.Offset = parseUint(val)
}
if val, ok := get["page"]; ok {
r.hasPage = true
r.rawPage = val
r.Page = parseUint(val)
}
if val, ok := get["perPage"]; ok {
r.hasPerPage = true
r.rawPerPage = val
r.PerPage = parseUint(val)
}
if val, ok := get["sort"]; ok {
r.hasSort = true
r.rawSort = val
r.Sort = val
}
r.hasNamespaceID = true
@@ -239,24 +255,38 @@ func (r *PageCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["selfID"]; ok {
r.hasSelfID = true
r.rawSelfID = val
r.SelfID = parseUInt64(val)
}
if val, ok := post["moduleID"]; ok {
r.hasModuleID = true
r.rawModuleID = val
r.ModuleID = parseUInt64(val)
}
if val, ok := post["title"]; ok {
r.hasTitle = true
r.rawTitle = val
r.Title = val
}
if val, ok := post["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := post["description"]; ok {
r.hasDescription = true
r.rawDescription = val
r.Description = val
}
if val, ok := post["visible"]; ok {
r.hasVisible = true
r.rawVisible = val
r.Visible = parseBool(val)
}
if val, ok := post["blocks"]; ok {
r.hasBlocks = true
r.rawBlocks = val
if r.Blocks, err = parseJSONTextWithErr(val); err != nil {
return err
@@ -496,27 +526,43 @@ func (r *PageUpdate) Fill(req *http.Request) (err error) {
r.rawNamespaceID = chi.URLParam(req, "namespaceID")
r.NamespaceID = parseUInt64(chi.URLParam(req, "namespaceID"))
if val, ok := post["selfID"]; ok {
r.hasSelfID = true
r.rawSelfID = val
r.SelfID = parseUInt64(val)
}
if val, ok := post["moduleID"]; ok {
r.hasModuleID = true
r.rawModuleID = val
r.ModuleID = parseUInt64(val)
}
if val, ok := post["title"]; ok {
r.hasTitle = true
r.rawTitle = val
r.Title = val
}
if val, ok := post["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := post["description"]; ok {
r.hasDescription = true
r.rawDescription = val
r.Description = val
}
if val, ok := post["weight"]; ok {
r.hasWeight = true
r.rawWeight = val
r.Weight = parseInt(val)
}
if val, ok := post["visible"]; ok {
r.hasVisible = true
r.rawVisible = val
r.Visible = parseBool(val)
}
if val, ok := post["blocks"]; ok {
r.hasBlocks = true
r.rawBlocks = val
if r.Blocks, err = parseJSONTextWithErr(val); err != nil {
return err
@@ -812,6 +858,8 @@ func (r *PageTriggerScript) Fill(req *http.Request) (err error) {
r.rawNamespaceID = chi.URLParam(req, "namespaceID")
r.NamespaceID = parseUInt64(chi.URLParam(req, "namespaceID"))
if val, ok := post["script"]; ok {
r.hasScript = true
r.rawScript = val
r.Script = val
}
+2
View File
@@ -131,6 +131,8 @@ func (r *PermissionsEffective) Fill(req *http.Request) (err error) {
}
if val, ok := get["resource"]; ok {
r.hasResource = true
r.rawResource = val
r.Resource = val
}
+34
View File
@@ -102,12 +102,18 @@ func (r *RecordReport) Fill(req *http.Request) (err error) {
}
if val, ok := get["metrics"]; ok {
r.hasMetrics = true
r.rawMetrics = val
r.Metrics = val
}
if val, ok := get["dimensions"]; ok {
r.hasDimensions = true
r.rawDimensions = val
r.Dimensions = val
}
if val, ok := get["filter"]; ok {
r.hasFilter = true
r.rawFilter = val
r.Filter = val
}
r.hasNamespaceID = true
@@ -207,21 +213,33 @@ func (r *RecordList) Fill(req *http.Request) (err error) {
}
if val, ok := get["filter"]; ok {
r.hasFilter = true
r.rawFilter = val
r.Filter = val
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["offset"]; ok {
r.hasOffset = true
r.rawOffset = val
r.Offset = parseUint(val)
}
if val, ok := get["page"]; ok {
r.hasPage = true
r.rawPage = val
r.Page = parseUint(val)
}
if val, ok := get["perPage"]; ok {
r.hasPerPage = true
r.rawPerPage = val
r.PerPage = parseUint(val)
}
if val, ok := get["sort"]; ok {
r.hasSort = true
r.rawSort = val
r.Sort = val
}
r.hasNamespaceID = true
@@ -392,9 +410,13 @@ func (r *RecordImportRun) Fill(req *http.Request) (err error) {
r.rawModuleID = chi.URLParam(req, "moduleID")
r.ModuleID = parseUInt64(chi.URLParam(req, "moduleID"))
if val, ok := post["fields"]; ok {
r.hasFields = true
r.rawFields = val
r.Fields = json.RawMessage(val)
}
if val, ok := post["onError"]; ok {
r.hasOnError = true
r.rawOnError = val
r.OnError = val
}
@@ -552,6 +574,8 @@ func (r *RecordExport) Fill(req *http.Request) (err error) {
}
if val, ok := get["filter"]; ok {
r.hasFilter = true
r.rawFilter = val
r.Filter = val
}
@@ -957,6 +981,8 @@ func (r *RecordBulkDelete) Fill(req *http.Request) (err error) {
}
if val, ok := post["truncate"]; ok {
r.hasTruncate = true
r.rawTruncate = val
r.Truncate = parseBool(val)
}
r.hasNamespaceID = true
@@ -1117,9 +1143,13 @@ func (r *RecordUpload) Fill(req *http.Request) (err error) {
}
if val, ok := post["recordID"]; ok {
r.hasRecordID = true
r.rawRecordID = val
r.RecordID = parseUInt64(val)
}
if val, ok := post["fieldName"]; ok {
r.hasFieldName = true
r.rawFieldName = val
r.FieldName = val
}
if _, r.Upload, err = req.FormFile("upload"); err != nil {
@@ -1217,6 +1247,8 @@ func (r *RecordTriggerScript) Fill(req *http.Request) (err error) {
r.rawModuleID = chi.URLParam(req, "moduleID")
r.ModuleID = parseUInt64(chi.URLParam(req, "moduleID"))
if val, ok := post["script"]; ok {
r.hasScript = true
r.rawScript = val
r.Script = val
}
@@ -1285,6 +1317,8 @@ func (r *RecordTriggerScriptOnList) Fill(req *http.Request) (err error) {
}
if val, ok := post["script"]; ok {
r.hasScript = true
r.rawScript = val
r.Script = val
}
r.hasNamespaceID = true
+4
View File
@@ -82,6 +82,8 @@ func (r *SettingsList) Fill(req *http.Request) (err error) {
}
if val, ok := get["prefix"]; ok {
r.hasPrefix = true
r.rawPrefix = val
r.Prefix = val
}
@@ -199,6 +201,8 @@ func (r *SettingsGet) Fill(req *http.Request) (err error) {
}
if val, ok := get["ownerID"]; ok {
r.hasOwnerID = true
r.rawOwnerID = val
r.OwnerID = parseUInt64(val)
}
r.hasKey = true
+6
View File
@@ -90,12 +90,18 @@ func (r *ActivitySend) Fill(req *http.Request) (err error) {
}
if val, ok := post["channelID"]; ok {
r.hasChannelID = true
r.rawChannelID = val
r.ChannelID = parseUInt64(val)
}
if val, ok := post["messageID"]; ok {
r.hasMessageID = true
r.rawMessageID = val
r.MessageID = parseUInt64(val)
}
if val, ok := post["kind"]; ok {
r.hasKind = true
r.rawKind = val
r.Kind = val
}
+10
View File
@@ -100,12 +100,18 @@ func (r *AttachmentOriginal) Fill(req *http.Request) (err error) {
}
if val, ok := get["download"]; ok {
r.hasDownload = true
r.rawDownload = val
r.Download = parseBool(val)
}
if val, ok := get["sign"]; ok {
r.hasSign = true
r.rawSign = val
r.Sign = val
}
if val, ok := get["userID"]; ok {
r.hasUserID = true
r.rawUserID = val
r.UserID = parseUInt64(val)
}
r.hasName = true
@@ -191,9 +197,13 @@ func (r *AttachmentPreview) Fill(req *http.Request) (err error) {
r.rawAttachmentID = chi.URLParam(req, "attachmentID")
r.AttachmentID = parseUInt64(chi.URLParam(req, "attachmentID"))
if val, ok := get["sign"]; ok {
r.hasSign = true
r.rawSign = val
r.Sign = val
}
if val, ok := get["userID"]; ok {
r.hasUserID = true
r.rawUserID = val
r.UserID = parseUInt64(val)
}
+26
View File
@@ -82,6 +82,8 @@ func (r *ChannelList) Fill(req *http.Request) (err error) {
}
if val, ok := get["query"]; ok {
r.hasQuery = true
r.rawQuery = val
r.Query = val
}
@@ -160,15 +162,23 @@ func (r *ChannelCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["topic"]; ok {
r.hasTopic = true
r.rawTopic = val
r.Topic = val
}
if val, ok := post["type"]; ok {
r.hasType = true
r.rawType = val
r.Type = val
}
if val, ok := post["membershipPolicy"]; ok {
r.hasMembershipPolicy = true
r.rawMembershipPolicy = val
r.MembershipPolicy = types.ChannelMembershipPolicy(val)
}
@@ -261,18 +271,28 @@ func (r *ChannelUpdate) Fill(req *http.Request) (err error) {
r.rawChannelID = chi.URLParam(req, "channelID")
r.ChannelID = parseUInt64(chi.URLParam(req, "channelID"))
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["topic"]; ok {
r.hasTopic = true
r.rawTopic = val
r.Topic = val
}
if val, ok := post["membershipPolicy"]; ok {
r.hasMembershipPolicy = true
r.rawMembershipPolicy = val
r.MembershipPolicy = types.ChannelMembershipPolicy(val)
}
if val, ok := post["type"]; ok {
r.hasType = true
r.rawType = val
r.Type = val
}
if val, ok := post["organisationID"]; ok {
r.hasOrganisationID = true
r.rawOrganisationID = val
r.OrganisationID = parseUInt64(val)
}
@@ -339,6 +359,8 @@ func (r *ChannelState) Fill(req *http.Request) (err error) {
r.rawChannelID = chi.URLParam(req, "channelID")
r.ChannelID = parseUInt64(chi.URLParam(req, "channelID"))
if val, ok := post["state"]; ok {
r.hasState = true
r.rawState = val
r.State = val
}
@@ -405,6 +427,8 @@ func (r *ChannelSetFlag) Fill(req *http.Request) (err error) {
r.rawChannelID = chi.URLParam(req, "channelID")
r.ChannelID = parseUInt64(chi.URLParam(req, "channelID"))
if val, ok := post["flag"]; ok {
r.hasFlag = true
r.rawFlag = val
r.Flag = val
}
@@ -852,6 +876,8 @@ func (r *ChannelAttach) Fill(req *http.Request) (err error) {
r.rawChannelID = chi.URLParam(req, "channelID")
r.ChannelID = parseUInt64(chi.URLParam(req, "channelID"))
if val, ok := post["replyTo"]; ok {
r.hasReplyTo = true
r.rawReplyTo = val
r.ReplyTo = parseUInt64(val)
}
if _, r.Upload, err = req.FormFile("upload"); err != nil {
+12
View File
@@ -86,6 +86,8 @@ func (r *MessageCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["message"]; ok {
r.hasMessage = true
r.rawMessage = val
r.Message = val
}
r.hasChannelID = true
@@ -168,6 +170,8 @@ func (r *MessageExecuteCommand) Fill(req *http.Request) (err error) {
r.rawChannelID = chi.URLParam(req, "channelID")
r.ChannelID = parseUInt64(chi.URLParam(req, "channelID"))
if val, ok := post["input"]; ok {
r.hasInput = true
r.rawInput = val
r.Input = val
}
@@ -242,9 +246,13 @@ func (r *MessageMarkAsRead) Fill(req *http.Request) (err error) {
}
if val, ok := get["threadID"]; ok {
r.hasThreadID = true
r.rawThreadID = val
r.ThreadID = parseUInt64(val)
}
if val, ok := get["lastReadMessageID"]; ok {
r.hasLastReadMessageID = true
r.rawLastReadMessageID = val
r.LastReadMessageID = parseUInt64(val)
}
r.hasChannelID = true
@@ -322,6 +330,8 @@ func (r *MessageEdit) Fill(req *http.Request) (err error) {
r.rawChannelID = chi.URLParam(req, "channelID")
r.ChannelID = parseUInt64(chi.URLParam(req, "channelID"))
if val, ok := post["message"]; ok {
r.hasMessage = true
r.rawMessage = val
r.Message = val
}
@@ -462,6 +472,8 @@ func (r *MessageReplyCreate) Fill(req *http.Request) (err error) {
r.rawChannelID = chi.URLParam(req, "channelID")
r.ChannelID = parseUInt64(chi.URLParam(req, "channelID"))
if val, ok := post["message"]; ok {
r.hasMessage = true
r.rawMessage = val
r.Message = val
}
+2
View File
@@ -131,6 +131,8 @@ func (r *PermissionsEffective) Fill(req *http.Request) (err error) {
}
if val, ok := get["resource"]; ok {
r.hasResource = true
r.rawResource = val
r.Resource = val
}
+20
View File
@@ -145,15 +145,23 @@ func (r *SearchMessages) Fill(req *http.Request) (err error) {
}
if val, ok := get["afterMessageID"]; ok {
r.hasAfterMessageID = true
r.rawAfterMessageID = val
r.AfterMessageID = parseUInt64(val)
}
if val, ok := get["beforeMessageID"]; ok {
r.hasBeforeMessageID = true
r.rawBeforeMessageID = val
r.BeforeMessageID = parseUInt64(val)
}
if val, ok := get["fromMessageID"]; ok {
r.hasFromMessageID = true
r.rawFromMessageID = val
r.FromMessageID = parseUInt64(val)
}
if val, ok := get["toMessageID"]; ok {
r.hasToMessageID = true
r.rawToMessageID = val
r.ToMessageID = parseUInt64(val)
}
@@ -188,15 +196,23 @@ func (r *SearchMessages) Fill(req *http.Request) (err error) {
}
if val, ok := get["pinnedOnly"]; ok {
r.hasPinnedOnly = true
r.rawPinnedOnly = val
r.PinnedOnly = parseBool(val)
}
if val, ok := get["bookmarkedOnly"]; ok {
r.hasBookmarkedOnly = true
r.rawBookmarkedOnly = val
r.BookmarkedOnly = parseBool(val)
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["query"]; ok {
r.hasQuery = true
r.rawQuery = val
r.Query = val
}
@@ -275,9 +291,13 @@ func (r *SearchThreads) Fill(req *http.Request) (err error) {
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["query"]; ok {
r.hasQuery = true
r.rawQuery = val
r.Query = val
}
+4
View File
@@ -82,6 +82,8 @@ func (r *SettingsList) Fill(req *http.Request) (err error) {
}
if val, ok := get["prefix"]; ok {
r.hasPrefix = true
r.rawPrefix = val
r.Prefix = val
}
@@ -199,6 +201,8 @@ func (r *SettingsGet) Fill(req *http.Request) (err error) {
}
if val, ok := get["ownerID"]; ok {
r.hasOwnerID = true
r.rawOwnerID = val
r.OwnerID = parseUInt64(val)
}
r.hasKey = true
+6
View File
@@ -139,12 +139,18 @@ func (r *StatusSet) Fill(req *http.Request) (err error) {
}
if val, ok := post["icon"]; ok {
r.hasIcon = true
r.rawIcon = val
r.Icon = val
}
if val, ok := post["message"]; ok {
r.hasMessage = true
r.rawMessage = val
r.Message = val
}
if val, ok := post["expires"]; ok {
r.hasExpires = true
r.rawExpires = val
r.Expires = val
}
+32
View File
@@ -87,9 +87,13 @@ func (r *WebhooksList) Fill(req *http.Request) (err error) {
}
if val, ok := get["channelID"]; ok {
r.hasChannelID = true
r.rawChannelID = val
r.ChannelID = parseUInt64(val)
}
if val, ok := get["userID"]; ok {
r.hasUserID = true
r.rawUserID = val
r.UserID = parseUInt64(val)
}
@@ -185,21 +189,33 @@ func (r *WebhooksCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["channelID"]; ok {
r.hasChannelID = true
r.rawChannelID = val
r.ChannelID = parseUInt64(val)
}
if val, ok := post["kind"]; ok {
r.hasKind = true
r.rawKind = val
r.Kind = types.WebhookKind(val)
}
if val, ok := post["userID"]; ok {
r.hasUserID = true
r.rawUserID = val
r.UserID = parseUInt64(val)
}
if val, ok := post["trigger"]; ok {
r.hasTrigger = true
r.rawTrigger = val
r.Trigger = val
}
if val, ok := post["url"]; ok {
r.hasUrl = true
r.rawUrl = val
r.Url = val
}
if val, ok := post["username"]; ok {
r.hasUsername = true
r.rawUsername = val
r.Username = val
}
if _, r.Avatar, err = req.FormFile("avatar"); err != nil {
@@ -207,6 +223,8 @@ func (r *WebhooksCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["avatarURL"]; ok {
r.hasAvatarURL = true
r.rawAvatarURL = val
r.AvatarURL = val
}
@@ -310,21 +328,33 @@ func (r *WebhooksUpdate) Fill(req *http.Request) (err error) {
r.rawWebhookID = chi.URLParam(req, "webhookID")
r.WebhookID = parseUInt64(chi.URLParam(req, "webhookID"))
if val, ok := post["channelID"]; ok {
r.hasChannelID = true
r.rawChannelID = val
r.ChannelID = parseUInt64(val)
}
if val, ok := post["kind"]; ok {
r.hasKind = true
r.rawKind = val
r.Kind = types.WebhookKind(val)
}
if val, ok := post["userID"]; ok {
r.hasUserID = true
r.rawUserID = val
r.UserID = parseUInt64(val)
}
if val, ok := post["trigger"]; ok {
r.hasTrigger = true
r.rawTrigger = val
r.Trigger = val
}
if val, ok := post["url"]; ok {
r.hasUrl = true
r.rawUrl = val
r.Url = val
}
if val, ok := post["username"]; ok {
r.hasUsername = true
r.rawUsername = val
r.Username = val
}
if _, r.Avatar, err = req.FormFile("avatar"); err != nil {
@@ -332,6 +362,8 @@ func (r *WebhooksUpdate) Fill(req *http.Request) (err error) {
}
if val, ok := post["avatarURL"]; ok {
r.hasAvatarURL = true
r.rawAvatarURL = val
r.AvatarURL = val
}
@@ -166,12 +166,18 @@ func (r *WebhooksPublicCreate) Fill(req *http.Request) (err error) {
}
if val, ok := get["username"]; ok {
r.hasUsername = true
r.rawUsername = val
r.Username = val
}
if val, ok := get["avatarURL"]; ok {
r.hasAvatarURL = true
r.rawAvatarURL = val
r.AvatarURL = val
}
if val, ok := get["content"]; ok {
r.hasContent = true
r.rawContent = val
r.Content = val
}
r.hasWebhookID = true
+34
View File
@@ -117,27 +117,43 @@ func (r *ApplicationList) Fill(req *http.Request) (err error) {
}
if val, ok := get["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := get["query"]; ok {
r.hasQuery = true
r.rawQuery = val
r.Query = val
}
if val, ok := get["deleted"]; ok {
r.hasDeleted = true
r.rawDeleted = val
r.Deleted = parseUint(val)
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["offset"]; ok {
r.hasOffset = true
r.rawOffset = val
r.Offset = parseUint(val)
}
if val, ok := get["page"]; ok {
r.hasPage = true
r.rawPage = val
r.Page = parseUint(val)
}
if val, ok := get["perPage"]; ok {
r.hasPerPage = true
r.rawPerPage = val
r.PerPage = parseUint(val)
}
if val, ok := get["sort"]; ok {
r.hasSort = true
r.rawSort = val
r.Sort = val
}
@@ -211,18 +227,26 @@ func (r *ApplicationCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["enabled"]; ok {
r.hasEnabled = true
r.rawEnabled = val
r.Enabled = parseBool(val)
}
if val, ok := post["unify"]; ok {
r.hasUnify = true
r.rawUnify = val
if r.Unify, err = parseJSONTextWithErr(val); err != nil {
return err
}
}
if val, ok := post["config"]; ok {
r.hasConfig = true
r.rawConfig = val
if r.Config, err = parseJSONTextWithErr(val); err != nil {
return err
@@ -307,18 +331,26 @@ func (r *ApplicationUpdate) Fill(req *http.Request) (err error) {
r.rawApplicationID = chi.URLParam(req, "applicationID")
r.ApplicationID = parseUInt64(chi.URLParam(req, "applicationID"))
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["enabled"]; ok {
r.hasEnabled = true
r.rawEnabled = val
r.Enabled = parseBool(val)
}
if val, ok := post["unify"]; ok {
r.hasUnify = true
r.rawUnify = val
if r.Unify, err = parseJSONTextWithErr(val); err != nil {
return err
}
}
if val, ok := post["config"]; ok {
r.hasConfig = true
r.rawConfig = val
if r.Config, err = parseJSONTextWithErr(val); err != nil {
return err
@@ -562,6 +594,8 @@ func (r *ApplicationTriggerScript) Fill(req *http.Request) (err error) {
r.rawApplicationID = chi.URLParam(req, "applicationID")
r.ApplicationID = parseUInt64(chi.URLParam(req, "applicationID"))
if val, ok := post["script"]; ok {
r.hasScript = true
r.rawScript = val
r.Script = val
}
+2
View File
@@ -178,6 +178,8 @@ func (r *AuthExchangeAuthToken) Fill(req *http.Request) (err error) {
}
if val, ok := post["token"]; ok {
r.hasToken = true
r.rawToken = val
r.Token = val
}
+28
View File
@@ -85,9 +85,13 @@ func (r *AuthInternalLogin) Fill(req *http.Request) (err error) {
}
if val, ok := post["email"]; ok {
r.hasEmail = true
r.rawEmail = val
r.Email = val
}
if val, ok := post["password"]; ok {
r.hasPassword = true
r.rawPassword = val
r.Password = val
}
@@ -167,18 +171,28 @@ func (r *AuthInternalSignup) Fill(req *http.Request) (err error) {
}
if val, ok := post["email"]; ok {
r.hasEmail = true
r.rawEmail = val
r.Email = val
}
if val, ok := post["username"]; ok {
r.hasUsername = true
r.rawUsername = val
r.Username = val
}
if val, ok := post["password"]; ok {
r.hasPassword = true
r.rawPassword = val
r.Password = val
}
if val, ok := post["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
@@ -237,6 +251,8 @@ func (r *AuthInternalRequestPasswordReset) Fill(req *http.Request) (err error) {
}
if val, ok := post["email"]; ok {
r.hasEmail = true
r.rawEmail = val
r.Email = val
}
@@ -295,6 +311,8 @@ func (r *AuthInternalExchangePasswordResetToken) Fill(req *http.Request) (err er
}
if val, ok := post["token"]; ok {
r.hasToken = true
r.rawToken = val
r.Token = val
}
@@ -358,9 +376,13 @@ func (r *AuthInternalResetPassword) Fill(req *http.Request) (err error) {
}
if val, ok := post["token"]; ok {
r.hasToken = true
r.rawToken = val
r.Token = val
}
if val, ok := post["password"]; ok {
r.hasPassword = true
r.rawPassword = val
r.Password = val
}
@@ -419,6 +441,8 @@ func (r *AuthInternalConfirmEmail) Fill(req *http.Request) (err error) {
}
if val, ok := post["token"]; ok {
r.hasToken = true
r.rawToken = val
r.Token = val
}
@@ -483,9 +507,13 @@ func (r *AuthInternalChangePassword) Fill(req *http.Request) (err error) {
}
if val, ok := post["oldPassword"]; ok {
r.hasOldPassword = true
r.rawOldPassword = val
r.OldPassword = val
}
if val, ok := post["newPassword"]; ok {
r.hasNewPassword = true
r.rawNewPassword = val
r.NewPassword = val
}
+8
View File
@@ -135,12 +135,18 @@ func (r *AutomationList) Fill(req *http.Request) (err error) {
}
if val, ok := get["excludeInvalid"]; ok {
r.hasExcludeInvalid = true
r.rawExcludeInvalid = val
r.ExcludeInvalid = parseBool(val)
}
if val, ok := get["excludeClientScripts"]; ok {
r.hasExcludeClientScripts = true
r.rawExcludeClientScripts = val
r.ExcludeClientScripts = parseBool(val)
}
if val, ok := get["excludeServerScripts"]; ok {
r.hasExcludeServerScripts = true
r.rawExcludeServerScripts = val
r.ExcludeServerScripts = parseBool(val)
}
@@ -273,6 +279,8 @@ func (r *AutomationTriggerScript) Fill(req *http.Request) (err error) {
}
if val, ok := post["script"]; ok {
r.hasScript = true
r.rawScript = val
r.Script = val
}
+6
View File
@@ -80,6 +80,8 @@ func (r *OrganisationList) Fill(req *http.Request) (err error) {
}
if val, ok := get["query"]; ok {
r.hasQuery = true
r.rawQuery = val
r.Query = val
}
@@ -138,6 +140,8 @@ func (r *OrganisationCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
@@ -204,6 +208,8 @@ func (r *OrganisationUpdate) Fill(req *http.Request) (err error) {
r.rawID = chi.URLParam(req, "id")
r.ID = parseUInt64(chi.URLParam(req, "id"))
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
+2
View File
@@ -131,6 +131,8 @@ func (r *PermissionsEffective) Fill(req *http.Request) (err error) {
}
if val, ok := get["resource"]; ok {
r.hasResource = true
r.rawResource = val
r.Resource = val
}
+40
View File
@@ -148,42 +148,64 @@ func (r *ReminderList) Fill(req *http.Request) (err error) {
}
if val, ok := get["resource"]; ok {
r.hasResource = true
r.rawResource = val
r.Resource = val
}
if val, ok := get["assignedTo"]; ok {
r.hasAssignedTo = true
r.rawAssignedTo = val
r.AssignedTo = parseUInt64(val)
}
if val, ok := get["scheduledFrom"]; ok {
r.hasScheduledFrom = true
r.rawScheduledFrom = val
if r.ScheduledFrom, err = parseISODatePtrWithErr(val); err != nil {
return err
}
}
if val, ok := get["scheduledUntil"]; ok {
r.hasScheduledUntil = true
r.rawScheduledUntil = val
if r.ScheduledUntil, err = parseISODatePtrWithErr(val); err != nil {
return err
}
}
if val, ok := get["scheduledOnly"]; ok {
r.hasScheduledOnly = true
r.rawScheduledOnly = val
r.ScheduledOnly = parseBool(val)
}
if val, ok := get["excludeDismissed"]; ok {
r.hasExcludeDismissed = true
r.rawExcludeDismissed = val
r.ExcludeDismissed = parseBool(val)
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["offset"]; ok {
r.hasOffset = true
r.rawOffset = val
r.Offset = parseUint(val)
}
if val, ok := get["page"]; ok {
r.hasPage = true
r.rawPage = val
r.Page = parseUint(val)
}
if val, ok := get["perPage"]; ok {
r.hasPerPage = true
r.rawPerPage = val
r.PerPage = parseUint(val)
}
if val, ok := get["sort"]; ok {
r.hasSort = true
r.rawSort = val
r.Sort = val
}
@@ -257,18 +279,26 @@ func (r *ReminderCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["resource"]; ok {
r.hasResource = true
r.rawResource = val
r.Resource = val
}
if val, ok := post["assignedTo"]; ok {
r.hasAssignedTo = true
r.rawAssignedTo = val
r.AssignedTo = parseUInt64(val)
}
if val, ok := post["payload"]; ok {
r.hasPayload = true
r.rawPayload = val
if r.Payload, err = parseJSONTextWithErr(val); err != nil {
return err
}
}
if val, ok := post["remindAt"]; ok {
r.hasRemindAt = true
r.rawRemindAt = val
if r.RemindAt, err = parseISODatePtrWithErr(val); err != nil {
return err
@@ -353,18 +383,26 @@ func (r *ReminderUpdate) Fill(req *http.Request) (err error) {
r.rawReminderID = chi.URLParam(req, "reminderID")
r.ReminderID = parseUInt64(chi.URLParam(req, "reminderID"))
if val, ok := post["resource"]; ok {
r.hasResource = true
r.rawResource = val
r.Resource = val
}
if val, ok := post["assignedTo"]; ok {
r.hasAssignedTo = true
r.rawAssignedTo = val
r.AssignedTo = parseUInt64(val)
}
if val, ok := post["payload"]; ok {
r.hasPayload = true
r.rawPayload = val
if r.Payload, err = parseJSONTextWithErr(val); err != nil {
return err
}
}
if val, ok := post["remindAt"]; ok {
r.hasRemindAt = true
r.rawRemindAt = val
if r.RemindAt, err = parseISODatePtrWithErr(val); err != nil {
return err
@@ -608,6 +646,8 @@ func (r *ReminderSnooze) Fill(req *http.Request) (err error) {
r.rawReminderID = chi.URLParam(req, "reminderID")
r.ReminderID = parseUInt64(chi.URLParam(req, "reminderID"))
if val, ok := post["remindAt"]; ok {
r.hasRemindAt = true
r.rawRemindAt = val
if r.RemindAt, err = parseISODatePtrWithErr(val); err != nil {
return err
+30
View File
@@ -115,27 +115,43 @@ func (r *RoleList) Fill(req *http.Request) (err error) {
}
if val, ok := get["query"]; ok {
r.hasQuery = true
r.rawQuery = val
r.Query = val
}
if val, ok := get["deleted"]; ok {
r.hasDeleted = true
r.rawDeleted = val
r.Deleted = parseUint(val)
}
if val, ok := get["archived"]; ok {
r.hasArchived = true
r.rawArchived = val
r.Archived = parseUint(val)
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["offset"]; ok {
r.hasOffset = true
r.rawOffset = val
r.Offset = parseUint(val)
}
if val, ok := get["page"]; ok {
r.hasPage = true
r.rawPage = val
r.Page = parseUint(val)
}
if val, ok := get["perPage"]; ok {
r.hasPerPage = true
r.rawPerPage = val
r.PerPage = parseUint(val)
}
if val, ok := get["sort"]; ok {
r.hasSort = true
r.rawSort = val
r.Sort = val
}
@@ -204,9 +220,13 @@ func (r *RoleCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
@@ -289,9 +309,13 @@ func (r *RoleUpdate) Fill(req *http.Request) (err error) {
r.rawRoleID = chi.URLParam(req, "roleID")
r.RoleID = parseUInt64(chi.URLParam(req, "roleID"))
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
@@ -654,6 +678,8 @@ func (r *RoleMove) Fill(req *http.Request) (err error) {
r.rawRoleID = chi.URLParam(req, "roleID")
r.RoleID = parseUInt64(chi.URLParam(req, "roleID"))
if val, ok := post["organisationID"]; ok {
r.hasOrganisationID = true
r.rawOrganisationID = val
r.OrganisationID = parseUInt64(val)
}
@@ -720,6 +746,8 @@ func (r *RoleMerge) Fill(req *http.Request) (err error) {
r.rawRoleID = chi.URLParam(req, "roleID")
r.RoleID = parseUInt64(chi.URLParam(req, "roleID"))
if val, ok := post["destination"]; ok {
r.hasDestination = true
r.rawDestination = val
r.Destination = parseUInt64(val)
}
@@ -976,6 +1004,8 @@ func (r *RoleTriggerScript) Fill(req *http.Request) (err error) {
r.rawRoleID = chi.URLParam(req, "roleID")
r.RoleID = parseUInt64(chi.URLParam(req, "roleID"))
if val, ok := post["script"]; ok {
r.hasScript = true
r.rawScript = val
r.Script = val
}
+4
View File
@@ -82,6 +82,8 @@ func (r *SettingsList) Fill(req *http.Request) (err error) {
}
if val, ok := get["prefix"]; ok {
r.hasPrefix = true
r.rawPrefix = val
r.Prefix = val
}
@@ -199,6 +201,8 @@ func (r *SettingsGet) Fill(req *http.Request) (err error) {
}
if val, ok := get["ownerID"]; ok {
r.hasOwnerID = true
r.rawOwnerID = val
r.OwnerID = parseUInt64(val)
}
r.hasKey = true
+48
View File
@@ -177,45 +177,73 @@ func (r *UserList) Fill(req *http.Request) (err error) {
}
if val, ok := get["query"]; ok {
r.hasQuery = true
r.rawQuery = val
r.Query = val
}
if val, ok := get["username"]; ok {
r.hasUsername = true
r.rawUsername = val
r.Username = val
}
if val, ok := get["email"]; ok {
r.hasEmail = true
r.rawEmail = val
r.Email = val
}
if val, ok := get["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := get["kind"]; ok {
r.hasKind = true
r.rawKind = val
r.Kind = types.UserKind(val)
}
if val, ok := get["incDeleted"]; ok {
r.hasIncDeleted = true
r.rawIncDeleted = val
r.IncDeleted = parseBool(val)
}
if val, ok := get["incSuspended"]; ok {
r.hasIncSuspended = true
r.rawIncSuspended = val
r.IncSuspended = parseBool(val)
}
if val, ok := get["deleted"]; ok {
r.hasDeleted = true
r.rawDeleted = val
r.Deleted = parseUint(val)
}
if val, ok := get["suspended"]; ok {
r.hasSuspended = true
r.rawSuspended = val
r.Suspended = parseUint(val)
}
if val, ok := get["limit"]; ok {
r.hasLimit = true
r.rawLimit = val
r.Limit = parseUint(val)
}
if val, ok := get["offset"]; ok {
r.hasOffset = true
r.rawOffset = val
r.Offset = parseUint(val)
}
if val, ok := get["page"]; ok {
r.hasPage = true
r.rawPage = val
r.Page = parseUint(val)
}
if val, ok := get["perPage"]; ok {
r.hasPerPage = true
r.rawPerPage = val
r.PerPage = parseUint(val)
}
if val, ok := get["sort"]; ok {
r.hasSort = true
r.rawSort = val
r.Sort = val
}
@@ -289,15 +317,23 @@ func (r *UserCreate) Fill(req *http.Request) (err error) {
}
if val, ok := post["email"]; ok {
r.hasEmail = true
r.rawEmail = val
r.Email = val
}
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := post["kind"]; ok {
r.hasKind = true
r.rawKind = val
r.Kind = types.UserKind(val)
}
@@ -379,15 +415,23 @@ func (r *UserUpdate) Fill(req *http.Request) (err error) {
r.rawUserID = chi.URLParam(req, "userID")
r.UserID = parseUInt64(chi.URLParam(req, "userID"))
if val, ok := post["email"]; ok {
r.hasEmail = true
r.rawEmail = val
r.Email = val
}
if val, ok := post["name"]; ok {
r.hasName = true
r.rawName = val
r.Name = val
}
if val, ok := post["handle"]; ok {
r.hasHandle = true
r.rawHandle = val
r.Handle = val
}
if val, ok := post["kind"]; ok {
r.hasKind = true
r.rawKind = val
r.Kind = types.UserKind(val)
}
@@ -744,6 +788,8 @@ func (r *UserSetPassword) Fill(req *http.Request) (err error) {
r.rawUserID = chi.URLParam(req, "userID")
r.UserID = parseUInt64(chi.URLParam(req, "userID"))
if val, ok := post["password"]; ok {
r.hasPassword = true
r.rawPassword = val
r.Password = val
}
@@ -1000,6 +1046,8 @@ func (r *UserTriggerScript) Fill(req *http.Request) (err error) {
r.rawUserID = chi.URLParam(req, "userID")
r.UserID = parseUInt64(chi.URLParam(req, "userID"))
if val, ok := post["script"]; ok {
r.hasScript = true
r.rawScript = val
r.Script = val
}
+5 -1
View File
@@ -2,7 +2,6 @@ package rest
import (
"context"
"github.com/pkg/errors"
"github.com/titpetric/factory/resputil"
@@ -19,6 +18,8 @@ var _ = errors.Wrap
type (
User struct {
settings *types.Settings
user service.UserService
role service.RoleService
}
@@ -31,6 +32,7 @@ type (
func (User) New() *User {
ctrl := &User{}
ctrl.settings = service.CurrentSettings
ctrl.user = service.DefaultUser
ctrl.role = service.DefaultRole
return ctrl
@@ -71,6 +73,8 @@ func (ctrl User) Create(ctx context.Context, r *request.UserCreate) (interface{}
Name: r.Name,
Handle: r.Handle,
Kind: r.Kind,
EmailConfirmed: r.HasEmailConfirmed() && r.EmailConfirmed,
}
return ctrl.user.With(ctx).Create(user)