Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apis/templates/v1/resourcesrefs.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
package v1

type Slice struct {
Continue bool
Offset int
Page int
PerPage int
}

// ResourceRef defines a template for an action.
type ResourceRef struct {
// ID for the action.
Expand All @@ -14,6 +21,8 @@ type ResourceRef struct {
APIVersion string `json:"apiVersion,omitempty"`
// Verb is the HTTP request verb.
Verb string `json:"verb,omitempty"`
// Slice is used for pagination
Slice *Slice `json:"slice,omitempty"`
}

// ResourceRefResult defines the action result after evaluating a template.
Expand Down
22 changes: 21 additions & 1 deletion apis/templates/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/handlers/dispatchers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func fetchObject(req *http.Request) (got objects.Result) {
func paginationInfo(log *slog.Logger, req *http.Request) (perPage, page int) {
perPage, page = -1, -1

if val := req.URL.Query().Get("per_page"); val != "" {
if val := req.URL.Query().Get("perpage"); val != "" {
var err error
perPage, err = strconv.Atoi(val)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/resolvers/restactions/api/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func jsonHandler(ctx context.Context, opts jsonHandlerOptions) func(io.ReadClose
pig := map[string]any{
opts.key: tmp,
}
if si, ok := opts.out["_slice_"]; ok {
pig["_slice_"] = si
if si, ok := opts.out["slice"]; ok {
pig["slice"] = si
}

if opts.filter != nil {
Expand Down
71 changes: 0 additions & 71 deletions internal/resolvers/restactions/api/helpers.go

This file was deleted.

192 changes: 0 additions & 192 deletions internal/resolvers/restactions/api/helpers_test.go

This file was deleted.

Loading
Loading