3
0

Rename resource translation routes

This commit is contained in:
Denis Arh
2021-09-14 20:42:52 +02:00
committed by Tomaž Jerman
parent 04fa1d47d2
commit cfd95a6682
12 changed files with 163 additions and 163 deletions

View File

@@ -149,20 +149,20 @@ endpoints:
type: string
title: Script to execute
required: true
- name: list resource
- name: listTranslations
method: GET
title: List resource translations
path: "/{namespaceID}/locale"
title: List translation
path: "/{namespaceID}/translation"
parameters:
path:
- type: uint64
name: namespaceID
required: true
title: ID
- name: update resource
- name: updateTranslations
method: PATCH
title: Update resource translations
path: "/{namespaceID}/locale"
title: Update translation
path: "/{namespaceID}/translation"
parameters:
path:
- type: uint64
@@ -170,9 +170,9 @@ endpoints:
required: true
title: ID
post:
- name: locale
- name: translation
type: locale.ResourceTranslationSet
title: Resource translations to upsert
title: Resource translation to upsert
required: true
- title: Pages
@@ -386,20 +386,20 @@ endpoints:
title: Script to execute
required: true
- name: list resource
- name: listTranslations
method: GET
title: List resource translations
path: "/{pageID}/locale"
title: List page translation
path: "/{pageID}/translation"
parameters:
path:
- type: uint64
name: pageID
required: true
title: ID
- name: update resource
- name: updateTranslations
method: PATCH
title: Update resource translations
path: "/{pageID}/locale"
title: Update page translation
path: "/{pageID}/translation"
parameters:
path:
- type: uint64
@@ -407,9 +407,9 @@ endpoints:
required: true
title: ID
post:
- name: locale
- name: translation
type: locale.ResourceTranslationSet
title: Resource translations to upsert
title: Resource translation to upsert
required: true
- title: Modules
@@ -557,20 +557,20 @@ endpoints:
type: string
title: Script to execute
required: true
- name: list resource
- name: listTranslations
method: GET
title: List resource translations
path: "/{moduleID}/locale"
title: List moudle translation
path: "/{moduleID}/translation"
parameters:
path:
- type: uint64
name: moduleID
required: true
title: ID
- name: update resource
- name: updateTranslations
method: PATCH
title: Update resource translations
path: "/{moduleID}/locale"
title: Update module translation
path: "/{moduleID}/translation"
parameters:
path:
- type: uint64
@@ -578,9 +578,9 @@ endpoints:
required: true
title: ID
post:
- name: locale
- name: translation
type: locale.ResourceTranslationSet
title: Resource translations to upsert
title: Resource translation to upsert
required: true
- title: Records

View File

@@ -25,20 +25,20 @@ type (
Update(context.Context, *request.ModuleUpdate) (interface{}, error)
Delete(context.Context, *request.ModuleDelete) (interface{}, error)
TriggerScript(context.Context, *request.ModuleTriggerScript) (interface{}, error)
ListLocale(context.Context, *request.ModuleListLocale) (interface{}, error)
UpdateLocale(context.Context, *request.ModuleUpdateLocale) (interface{}, error)
ListTranslations(context.Context, *request.ModuleListTranslations) (interface{}, error)
UpdateTranslations(context.Context, *request.ModuleUpdateTranslations) (interface{}, error)
}
// HTTP API interface
Module struct {
List func(http.ResponseWriter, *http.Request)
Create func(http.ResponseWriter, *http.Request)
Read func(http.ResponseWriter, *http.Request)
Update func(http.ResponseWriter, *http.Request)
Delete func(http.ResponseWriter, *http.Request)
TriggerScript func(http.ResponseWriter, *http.Request)
ListLocale func(http.ResponseWriter, *http.Request)
UpdateLocale func(http.ResponseWriter, *http.Request)
List func(http.ResponseWriter, *http.Request)
Create func(http.ResponseWriter, *http.Request)
Read func(http.ResponseWriter, *http.Request)
Update func(http.ResponseWriter, *http.Request)
Delete func(http.ResponseWriter, *http.Request)
TriggerScript func(http.ResponseWriter, *http.Request)
ListTranslations func(http.ResponseWriter, *http.Request)
UpdateTranslations func(http.ResponseWriter, *http.Request)
}
)
@@ -140,15 +140,15 @@ func NewModule(h ModuleAPI) *Module {
api.Send(w, r, value)
},
ListLocale: func(w http.ResponseWriter, r *http.Request) {
ListTranslations: func(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close()
params := request.NewModuleListLocale()
params := request.NewModuleListTranslations()
if err := params.Fill(r); err != nil {
api.Send(w, r, err)
return
}
value, err := h.ListLocale(r.Context(), params)
value, err := h.ListTranslations(r.Context(), params)
if err != nil {
api.Send(w, r, err)
return
@@ -156,15 +156,15 @@ func NewModule(h ModuleAPI) *Module {
api.Send(w, r, value)
},
UpdateLocale: func(w http.ResponseWriter, r *http.Request) {
UpdateTranslations: func(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close()
params := request.NewModuleUpdateLocale()
params := request.NewModuleUpdateTranslations()
if err := params.Fill(r); err != nil {
api.Send(w, r, err)
return
}
value, err := h.UpdateLocale(r.Context(), params)
value, err := h.UpdateTranslations(r.Context(), params)
if err != nil {
api.Send(w, r, err)
return
@@ -184,7 +184,7 @@ func (h Module) MountRoutes(r chi.Router, middlewares ...func(http.Handler) http
r.Post("/namespace/{namespaceID}/module/{moduleID}", h.Update)
r.Delete("/namespace/{namespaceID}/module/{moduleID}", h.Delete)
r.Post("/namespace/{namespaceID}/module/{moduleID}/trigger", h.TriggerScript)
r.Get("/namespace/{namespaceID}/module/{moduleID}/locale", h.ListLocale)
r.Patch("/namespace/{namespaceID}/module/{moduleID}/locale", h.UpdateLocale)
r.Get("/namespace/{namespaceID}/module/{moduleID}/translation", h.ListTranslations)
r.Patch("/namespace/{namespaceID}/module/{moduleID}/translation", h.UpdateTranslations)
})
}

View File

@@ -26,21 +26,21 @@ type (
Delete(context.Context, *request.NamespaceDelete) (interface{}, error)
Upload(context.Context, *request.NamespaceUpload) (interface{}, error)
TriggerScript(context.Context, *request.NamespaceTriggerScript) (interface{}, error)
ListLocale(context.Context, *request.NamespaceListLocale) (interface{}, error)
UpdateLocale(context.Context, *request.NamespaceUpdateLocale) (interface{}, error)
ListTranslations(context.Context, *request.NamespaceListTranslations) (interface{}, error)
UpdateTranslations(context.Context, *request.NamespaceUpdateTranslations) (interface{}, error)
}
// HTTP API interface
Namespace struct {
List func(http.ResponseWriter, *http.Request)
Create func(http.ResponseWriter, *http.Request)
Read func(http.ResponseWriter, *http.Request)
Update func(http.ResponseWriter, *http.Request)
Delete func(http.ResponseWriter, *http.Request)
Upload func(http.ResponseWriter, *http.Request)
TriggerScript func(http.ResponseWriter, *http.Request)
ListLocale func(http.ResponseWriter, *http.Request)
UpdateLocale func(http.ResponseWriter, *http.Request)
List func(http.ResponseWriter, *http.Request)
Create func(http.ResponseWriter, *http.Request)
Read func(http.ResponseWriter, *http.Request)
Update func(http.ResponseWriter, *http.Request)
Delete func(http.ResponseWriter, *http.Request)
Upload func(http.ResponseWriter, *http.Request)
TriggerScript func(http.ResponseWriter, *http.Request)
ListTranslations func(http.ResponseWriter, *http.Request)
UpdateTranslations func(http.ResponseWriter, *http.Request)
}
)
@@ -158,15 +158,15 @@ func NewNamespace(h NamespaceAPI) *Namespace {
api.Send(w, r, value)
},
ListLocale: func(w http.ResponseWriter, r *http.Request) {
ListTranslations: func(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close()
params := request.NewNamespaceListLocale()
params := request.NewNamespaceListTranslations()
if err := params.Fill(r); err != nil {
api.Send(w, r, err)
return
}
value, err := h.ListLocale(r.Context(), params)
value, err := h.ListTranslations(r.Context(), params)
if err != nil {
api.Send(w, r, err)
return
@@ -174,15 +174,15 @@ func NewNamespace(h NamespaceAPI) *Namespace {
api.Send(w, r, value)
},
UpdateLocale: func(w http.ResponseWriter, r *http.Request) {
UpdateTranslations: func(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close()
params := request.NewNamespaceUpdateLocale()
params := request.NewNamespaceUpdateTranslations()
if err := params.Fill(r); err != nil {
api.Send(w, r, err)
return
}
value, err := h.UpdateLocale(r.Context(), params)
value, err := h.UpdateTranslations(r.Context(), params)
if err != nil {
api.Send(w, r, err)
return
@@ -203,7 +203,7 @@ func (h Namespace) MountRoutes(r chi.Router, middlewares ...func(http.Handler) h
r.Delete("/namespace/{namespaceID}", h.Delete)
r.Post("/namespace/upload", h.Upload)
r.Post("/namespace/{namespaceID}/trigger", h.TriggerScript)
r.Get("/namespace/{namespaceID}/locale", h.ListLocale)
r.Patch("/namespace/{namespaceID}/locale", h.UpdateLocale)
r.Get("/namespace/{namespaceID}/translation", h.ListTranslations)
r.Patch("/namespace/{namespaceID}/translation", h.UpdateTranslations)
})
}

View File

@@ -28,23 +28,23 @@ type (
Delete(context.Context, *request.PageDelete) (interface{}, error)
Upload(context.Context, *request.PageUpload) (interface{}, error)
TriggerScript(context.Context, *request.PageTriggerScript) (interface{}, error)
ListLocale(context.Context, *request.PageListLocale) (interface{}, error)
UpdateLocale(context.Context, *request.PageUpdateLocale) (interface{}, error)
ListTranslations(context.Context, *request.PageListTranslations) (interface{}, error)
UpdateTranslations(context.Context, *request.PageUpdateTranslations) (interface{}, error)
}
// HTTP API interface
Page struct {
List func(http.ResponseWriter, *http.Request)
Create func(http.ResponseWriter, *http.Request)
Read func(http.ResponseWriter, *http.Request)
Tree func(http.ResponseWriter, *http.Request)
Update func(http.ResponseWriter, *http.Request)
Reorder func(http.ResponseWriter, *http.Request)
Delete func(http.ResponseWriter, *http.Request)
Upload func(http.ResponseWriter, *http.Request)
TriggerScript func(http.ResponseWriter, *http.Request)
ListLocale func(http.ResponseWriter, *http.Request)
UpdateLocale func(http.ResponseWriter, *http.Request)
List func(http.ResponseWriter, *http.Request)
Create func(http.ResponseWriter, *http.Request)
Read func(http.ResponseWriter, *http.Request)
Tree func(http.ResponseWriter, *http.Request)
Update func(http.ResponseWriter, *http.Request)
Reorder func(http.ResponseWriter, *http.Request)
Delete func(http.ResponseWriter, *http.Request)
Upload func(http.ResponseWriter, *http.Request)
TriggerScript func(http.ResponseWriter, *http.Request)
ListTranslations func(http.ResponseWriter, *http.Request)
UpdateTranslations func(http.ResponseWriter, *http.Request)
}
)
@@ -194,15 +194,15 @@ func NewPage(h PageAPI) *Page {
api.Send(w, r, value)
},
ListLocale: func(w http.ResponseWriter, r *http.Request) {
ListTranslations: func(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close()
params := request.NewPageListLocale()
params := request.NewPageListTranslations()
if err := params.Fill(r); err != nil {
api.Send(w, r, err)
return
}
value, err := h.ListLocale(r.Context(), params)
value, err := h.ListTranslations(r.Context(), params)
if err != nil {
api.Send(w, r, err)
return
@@ -210,15 +210,15 @@ func NewPage(h PageAPI) *Page {
api.Send(w, r, value)
},
UpdateLocale: func(w http.ResponseWriter, r *http.Request) {
UpdateTranslations: func(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close()
params := request.NewPageUpdateLocale()
params := request.NewPageUpdateTranslations()
if err := params.Fill(r); err != nil {
api.Send(w, r, err)
return
}
value, err := h.UpdateLocale(r.Context(), params)
value, err := h.UpdateTranslations(r.Context(), params)
if err != nil {
api.Send(w, r, err)
return
@@ -241,7 +241,7 @@ func (h Page) MountRoutes(r chi.Router, middlewares ...func(http.Handler) http.H
r.Delete("/namespace/{namespaceID}/page/{pageID}", h.Delete)
r.Post("/namespace/{namespaceID}/page/{pageID}/attachment", h.Upload)
r.Post("/namespace/{namespaceID}/page/{pageID}/trigger", h.TriggerScript)
r.Get("/namespace/{namespaceID}/page/{pageID}/locale", h.ListLocale)
r.Patch("/namespace/{namespaceID}/page/{pageID}/locale", h.UpdateLocale)
r.Get("/namespace/{namespaceID}/page/{pageID}/translation", h.ListTranslations)
r.Patch("/namespace/{namespaceID}/page/{pageID}/translation", h.UpdateTranslations)
})
}

View File

@@ -94,12 +94,12 @@ func (ctrl *Module) Read(ctx context.Context, r *request.ModuleRead) (interface{
return ctrl.makePayload(ctx, mod, err)
}
func (ctrl *Module) ListLocale(ctx context.Context, r *request.ModuleListLocale) (interface{}, error) {
func (ctrl *Module) ListTranslations(ctx context.Context, r *request.ModuleListTranslations) (interface{}, error) {
return ctrl.locale.Module(ctx, r.NamespaceID, r.ModuleID)
}
func (ctrl *Module) UpdateLocale(ctx context.Context, r *request.ModuleUpdateLocale) (interface{}, error) {
return api.OK(), ctrl.locale.Upsert(ctx, r.Locale)
func (ctrl *Module) UpdateTranslations(ctx context.Context, r *request.ModuleUpdateTranslations) (interface{}, error) {
return api.OK(), ctrl.locale.Upsert(ctx, r.Translation)
}
func (ctrl *Module) Create(ctx context.Context, r *request.ModuleCreate) (interface{}, error) {

View File

@@ -105,12 +105,12 @@ func (ctrl Namespace) Read(ctx context.Context, r *request.NamespaceRead) (inter
return ctrl.makePayload(ctx, ns, err)
}
func (ctrl Namespace) ListLocale(ctx context.Context, r *request.NamespaceListLocale) (interface{}, error) {
func (ctrl Namespace) ListTranslations(ctx context.Context, r *request.NamespaceListTranslations) (interface{}, error) {
return ctrl.locale.Namespace(ctx, r.NamespaceID)
}
func (ctrl Namespace) UpdateLocale(ctx context.Context, r *request.NamespaceUpdateLocale) (interface{}, error) {
return api.OK(), ctrl.locale.Upsert(ctx, r.Locale)
func (ctrl Namespace) UpdateTranslations(ctx context.Context, r *request.NamespaceUpdateTranslations) (interface{}, error) {
return api.OK(), ctrl.locale.Upsert(ctx, r.Translation)
}
func (ctrl Namespace) Update(ctx context.Context, r *request.NamespaceUpdate) (interface{}, error) {

View File

@@ -129,12 +129,12 @@ func (ctrl *Page) Read(ctx context.Context, r *request.PageRead) (interface{}, e
return ctrl.makePayload(ctx, mod, err)
}
func (ctrl *Page) ListLocale(ctx context.Context, r *request.PageListLocale) (interface{}, error) {
func (ctrl *Page) ListTranslations(ctx context.Context, r *request.PageListTranslations) (interface{}, error) {
return ctrl.locale.Page(ctx, r.NamespaceID, r.PageID)
}
func (ctrl *Page) UpdateLocale(ctx context.Context, r *request.PageUpdateLocale) (interface{}, error) {
return api.OK(), ctrl.locale.Upsert(ctx, r.Locale)
func (ctrl *Page) UpdateTranslations(ctx context.Context, r *request.PageUpdateTranslations) (interface{}, error) {
return api.OK(), ctrl.locale.Upsert(ctx, r.Translation)
}
func (ctrl *Page) Reorder(ctx context.Context, r *request.PageReorder) (interface{}, error) {

View File

@@ -195,7 +195,7 @@ type (
Script string
}
ModuleListLocale struct {
ModuleListTranslations struct {
// NamespaceID PATH parameter
//
// Namespace ID
@@ -207,7 +207,7 @@ type (
ModuleID uint64 `json:",string"`
}
ModuleUpdateLocale struct {
ModuleUpdateTranslations struct {
// NamespaceID PATH parameter
//
// Namespace ID
@@ -218,10 +218,10 @@ type (
// ID
ModuleID uint64 `json:",string"`
// Locale POST parameter
// Translation POST parameter
//
// ...
Locale locale.ResourceTranslationSet
// Resource translation to upsert
Translation locale.ResourceTranslationSet
}
)
@@ -801,13 +801,13 @@ func (r *ModuleTriggerScript) Fill(req *http.Request) (err error) {
return err
}
// NewModuleListLocale request
func NewModuleListLocale() *ModuleListLocale {
return &ModuleListLocale{}
// NewModuleListTranslations request
func NewModuleListTranslations() *ModuleListTranslations {
return &ModuleListTranslations{}
}
// Auditable returns all auditable/loggable parameters
func (r ModuleListLocale) Auditable() map[string]interface{} {
func (r ModuleListTranslations) Auditable() map[string]interface{} {
return map[string]interface{}{
"namespaceID": r.NamespaceID,
"moduleID": r.ModuleID,
@@ -815,17 +815,17 @@ func (r ModuleListLocale) Auditable() map[string]interface{} {
}
// Auditable returns all auditable/loggable parameters
func (r ModuleListLocale) GetNamespaceID() uint64 {
func (r ModuleListTranslations) GetNamespaceID() uint64 {
return r.NamespaceID
}
// Auditable returns all auditable/loggable parameters
func (r ModuleListLocale) GetModuleID() uint64 {
func (r ModuleListTranslations) GetModuleID() uint64 {
return r.ModuleID
}
// Fill processes request and fills internal variables
func (r *ModuleListLocale) Fill(req *http.Request) (err error) {
func (r *ModuleListTranslations) Fill(req *http.Request) (err error) {
{
var val string
@@ -848,37 +848,37 @@ func (r *ModuleListLocale) Fill(req *http.Request) (err error) {
return err
}
// NewModuleUpdateLocale request
func NewModuleUpdateLocale() *ModuleUpdateLocale {
return &ModuleUpdateLocale{}
// NewModuleUpdateTranslations request
func NewModuleUpdateTranslations() *ModuleUpdateTranslations {
return &ModuleUpdateTranslations{}
}
// Auditable returns all auditable/loggable parameters
func (r ModuleUpdateLocale) Auditable() map[string]interface{} {
func (r ModuleUpdateTranslations) Auditable() map[string]interface{} {
return map[string]interface{}{
"namespaceID": r.NamespaceID,
"moduleID": r.ModuleID,
"locale": r.Locale,
"translation": r.Translation,
}
}
// Auditable returns all auditable/loggable parameters
func (r ModuleUpdateLocale) GetNamespaceID() uint64 {
func (r ModuleUpdateTranslations) GetNamespaceID() uint64 {
return r.NamespaceID
}
// Auditable returns all auditable/loggable parameters
func (r ModuleUpdateLocale) GetModuleID() uint64 {
func (r ModuleUpdateTranslations) GetModuleID() uint64 {
return r.ModuleID
}
// Auditable returns all auditable/loggable parameters
func (r ModuleUpdateLocale) GetLocale() locale.ResourceTranslationSet {
return r.Locale
func (r ModuleUpdateTranslations) GetTranslation() locale.ResourceTranslationSet {
return r.Translation
}
// Fill processes request and fills internal variables
func (r *ModuleUpdateLocale) Fill(req *http.Request) (err error) {
func (r *ModuleUpdateTranslations) Fill(req *http.Request) (err error) {
if strings.ToLower(req.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(req.Body).Decode(r)
@@ -898,8 +898,8 @@ func (r *ModuleUpdateLocale) Fill(req *http.Request) (err error) {
// POST params
//if val, ok := req.Form["locale[]"]; ok && len(val) > 0 {
// r.Locale, err = locale.ResourceTranslationSet(val), nil
//if val, ok := req.Form["translation[]"]; ok && len(val) > 0 {
// r.Translation, err = locale.ResourceTranslationSet(val), nil
// if err != nil {
// return err
// }

View File

@@ -166,23 +166,23 @@ type (
Script string
}
NamespaceListLocale struct {
NamespaceListTranslations struct {
// NamespaceID PATH parameter
//
// ID
NamespaceID uint64 `json:",string"`
}
NamespaceUpdateLocale struct {
NamespaceUpdateTranslations struct {
// NamespaceID PATH parameter
//
// ID
NamespaceID uint64 `json:",string"`
// Locale POST parameter
// Translation POST parameter
//
// ...
Locale locale.ResourceTranslationSet
// Resource translation to upsert
Translation locale.ResourceTranslationSet
}
)
@@ -713,25 +713,25 @@ func (r *NamespaceTriggerScript) Fill(req *http.Request) (err error) {
return err
}
// NewNamespaceListLocale request
func NewNamespaceListLocale() *NamespaceListLocale {
return &NamespaceListLocale{}
// NewNamespaceListTranslations request
func NewNamespaceListTranslations() *NamespaceListTranslations {
return &NamespaceListTranslations{}
}
// Auditable returns all auditable/loggable parameters
func (r NamespaceListLocale) Auditable() map[string]interface{} {
func (r NamespaceListTranslations) Auditable() map[string]interface{} {
return map[string]interface{}{
"namespaceID": r.NamespaceID,
}
}
// Auditable returns all auditable/loggable parameters
func (r NamespaceListLocale) GetNamespaceID() uint64 {
func (r NamespaceListTranslations) GetNamespaceID() uint64 {
return r.NamespaceID
}
// Fill processes request and fills internal variables
func (r *NamespaceListLocale) Fill(req *http.Request) (err error) {
func (r *NamespaceListTranslations) Fill(req *http.Request) (err error) {
{
var val string
@@ -748,31 +748,31 @@ func (r *NamespaceListLocale) Fill(req *http.Request) (err error) {
return err
}
// NewNamespaceUpdateLocale request
func NewNamespaceUpdateLocale() *NamespaceUpdateLocale {
return &NamespaceUpdateLocale{}
// NewNamespaceUpdateTranslations request
func NewNamespaceUpdateTranslations() *NamespaceUpdateTranslations {
return &NamespaceUpdateTranslations{}
}
// Auditable returns all auditable/loggable parameters
func (r NamespaceUpdateLocale) Auditable() map[string]interface{} {
func (r NamespaceUpdateTranslations) Auditable() map[string]interface{} {
return map[string]interface{}{
"namespaceID": r.NamespaceID,
"locale": r.Locale,
"translation": r.Translation,
}
}
// Auditable returns all auditable/loggable parameters
func (r NamespaceUpdateLocale) GetNamespaceID() uint64 {
func (r NamespaceUpdateTranslations) GetNamespaceID() uint64 {
return r.NamespaceID
}
// Auditable returns all auditable/loggable parameters
func (r NamespaceUpdateLocale) GetLocale() locale.ResourceTranslationSet {
return r.Locale
func (r NamespaceUpdateTranslations) GetTranslation() locale.ResourceTranslationSet {
return r.Translation
}
// Fill processes request and fills internal variables
func (r *NamespaceUpdateLocale) Fill(req *http.Request) (err error) {
func (r *NamespaceUpdateTranslations) Fill(req *http.Request) (err error) {
if strings.ToLower(req.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(req.Body).Decode(r)
@@ -792,8 +792,8 @@ func (r *NamespaceUpdateLocale) Fill(req *http.Request) (err error) {
// POST params
//if val, ok := req.Form["locale[]"]; ok && len(val) > 0 {
// r.Locale, err = locale.ResourceTranslationSet(val), nil
//if val, ok := req.Form["translation[]"]; ok && len(val) > 0 {
// r.Translation, err = locale.ResourceTranslationSet(val), nil
// if err != nil {
// return err
// }

View File

@@ -274,7 +274,7 @@ type (
Script string
}
PageListLocale struct {
PageListTranslations struct {
// NamespaceID PATH parameter
//
// Namespace ID
@@ -286,7 +286,7 @@ type (
PageID uint64 `json:",string"`
}
PageUpdateLocale struct {
PageUpdateTranslations struct {
// NamespaceID PATH parameter
//
// Namespace ID
@@ -297,10 +297,10 @@ type (
// ID
PageID uint64 `json:",string"`
// Locale POST parameter
// Translation POST parameter
//
// ...
Locale locale.ResourceTranslationSet
// Resource translation to upsert
Translation locale.ResourceTranslationSet
}
)
@@ -1174,13 +1174,13 @@ func (r *PageTriggerScript) Fill(req *http.Request) (err error) {
return err
}
// NewPageListLocale request
func NewPageListLocale() *PageListLocale {
return &PageListLocale{}
// NewPageListTranslations request
func NewPageListTranslations() *PageListTranslations {
return &PageListTranslations{}
}
// Auditable returns all auditable/loggable parameters
func (r PageListLocale) Auditable() map[string]interface{} {
func (r PageListTranslations) Auditable() map[string]interface{} {
return map[string]interface{}{
"namespaceID": r.NamespaceID,
"pageID": r.PageID,
@@ -1188,17 +1188,17 @@ func (r PageListLocale) Auditable() map[string]interface{} {
}
// Auditable returns all auditable/loggable parameters
func (r PageListLocale) GetNamespaceID() uint64 {
func (r PageListTranslations) GetNamespaceID() uint64 {
return r.NamespaceID
}
// Auditable returns all auditable/loggable parameters
func (r PageListLocale) GetPageID() uint64 {
func (r PageListTranslations) GetPageID() uint64 {
return r.PageID
}
// Fill processes request and fills internal variables
func (r *PageListLocale) Fill(req *http.Request) (err error) {
func (r *PageListTranslations) Fill(req *http.Request) (err error) {
{
var val string
@@ -1221,37 +1221,37 @@ func (r *PageListLocale) Fill(req *http.Request) (err error) {
return err
}
// NewPageUpdateLocale request
func NewPageUpdateLocale() *PageUpdateLocale {
return &PageUpdateLocale{}
// NewPageUpdateTranslations request
func NewPageUpdateTranslations() *PageUpdateTranslations {
return &PageUpdateTranslations{}
}
// Auditable returns all auditable/loggable parameters
func (r PageUpdateLocale) Auditable() map[string]interface{} {
func (r PageUpdateTranslations) Auditable() map[string]interface{} {
return map[string]interface{}{
"namespaceID": r.NamespaceID,
"pageID": r.PageID,
"locale": r.Locale,
"translation": r.Translation,
}
}
// Auditable returns all auditable/loggable parameters
func (r PageUpdateLocale) GetNamespaceID() uint64 {
func (r PageUpdateTranslations) GetNamespaceID() uint64 {
return r.NamespaceID
}
// Auditable returns all auditable/loggable parameters
func (r PageUpdateLocale) GetPageID() uint64 {
func (r PageUpdateTranslations) GetPageID() uint64 {
return r.PageID
}
// Auditable returns all auditable/loggable parameters
func (r PageUpdateLocale) GetLocale() locale.ResourceTranslationSet {
return r.Locale
func (r PageUpdateTranslations) GetTranslation() locale.ResourceTranslationSet {
return r.Translation
}
// Fill processes request and fills internal variables
func (r *PageUpdateLocale) Fill(req *http.Request) (err error) {
func (r *PageUpdateTranslations) Fill(req *http.Request) (err error) {
if strings.ToLower(req.Header.Get("content-type")) == "application/json" {
err = json.NewDecoder(req.Body).Decode(r)
@@ -1271,8 +1271,8 @@ func (r *PageUpdateLocale) Fill(req *http.Request) (err error) {
// POST params
//if val, ok := req.Form["locale[]"]; ok && len(val) > 0 {
// r.Locale, err = locale.ResourceTranslationSet(val), nil
//if val, ok := req.Form["translation[]"]; ok && len(val) > 0 {
// r.Translation, err = locale.ResourceTranslationSet(val), nil
// if err != nil {
// return err
// }

View File

@@ -1780,7 +1780,7 @@ endpoints:
- { name: resource, type: string, title: Resource }
- { name: resourceType, type: string, title: Resource type }
- { name: ownerID, type: uint64, title: OwnerID }
- { name: deleted, type: "uint64", title: "Exclude (0, default), include (1) or return only (2) deleted routes" }
- { name: deleted, type: "uint64", title: "Exclude (0, default), include (1) or return only (2) deleted resource translations" }
- { name: limit, type: "uint", title: "Limit" }
- { name: pageCursor, type: "string", title: "Page cursor" }
- { name: sort, type: "string", title: "Sort items" }

View File

@@ -56,7 +56,7 @@ type (
// Deleted GET parameter
//
// Exclude (0, default), include (1) or return only (2) deleted routes
// Exclude (0, default), include (1) or return only (2) deleted resource translations
Deleted uint64 `json:",string"`
// Limit GET parameter