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
26 changes: 9 additions & 17 deletions actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ package forge
import (
"context"
"iter"
"net/url"
"strconv"

core "dappco.re/go/core"
"dappco.re/go/core/forge/types"
"dappco.re/go/forge/types"
)

// ActionsService handles CI/CD actions operations across repositories and
Expand Down Expand Up @@ -213,19 +210,14 @@ func (s *ActionsService) ListRepoTasks(ctx context.Context, owner, repo string,
path := ResolvePath("/api/v1/repos/{owner}/{repo}/actions/tasks", pathParams("owner", owner, "repo", repo))

if opts.Page > 0 || opts.Limit > 0 {
u, err := url.Parse(path)
if err != nil {
return nil, core.E("ActionsService.ListRepoTasks", "forge: parse path", err)
}
q := u.Query()
if opts.Page > 0 {
q.Set("page", strconv.Itoa(opts.Page))
}
if opts.Limit > 0 {
q.Set("limit", strconv.Itoa(opts.Limit))
}
u.RawQuery = q.Encode()
path = u.String()
path = appendQuery(path, func(q *queryBuilder) {
if opts.Page > 0 {
q.Set("page", intString(opts.Page))
}
if opts.Limit > 0 {
q.Set("limit", intString(opts.Limit))
}
})
}

var out types.ActionTaskResponse
Expand Down
2 changes: 1 addition & 1 deletion actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"dappco.re/go/core/forge/types"
"dappco.re/go/forge/types"
)

func TestActionsService_ListRepoSecrets_Good(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion activitypub.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package forge
import (
"context"

"dappco.re/go/core/forge/types"
"dappco.re/go/forge/types"
)

// ActivityPubService handles ActivityPub actor and inbox endpoints.
Expand Down
2 changes: 1 addition & 1 deletion activitypub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"dappco.re/go/core/forge/types"
"dappco.re/go/forge/types"
)

func TestActivityPubService_GetInstanceActor_Good(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strconv"

core "dappco.re/go/core"
"dappco.re/go/core/forge/types"
"dappco.re/go/forge/types"
)

// AdminService handles site administration operations.
Expand Down
2 changes: 1 addition & 1 deletion admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"dappco.re/go/core/forge/types"
"dappco.re/go/forge/types"
)

func TestAdminService_ListUsers_Good(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions ax_stringer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func TestParams_String_NilSafe(t *testing.T) {
}

func TestListOptions_String_Good(t *testing.T) {
opts := ListOptions{Page: 2, Limit: 25}
want := "forge.ListOptions{page=2, limit=25}"
opts := ListOptions{Page: 2, PageSize: 25}
want := "forge.ListOptions{page=2, page_size=25}"
if got := opts.String(); got != want {
t.Fatalf("got String()=%q, want %q", got, want)
}
Expand Down
8 changes: 7 additions & 1 deletion branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"iter"

"dappco.re/go/core/forge/types"
"dappco.re/go/forge/types"
)

// BranchService handles branch operations within a repository.
Expand All @@ -25,6 +25,12 @@ func newBranchService(c *Client) *BranchService {
}
}

// ListBranchesPage returns a single page of branches for a repository.
func (s *BranchService) ListBranchesPage(ctx context.Context, owner, repo string, opts ListOptions) (*PagedResult[types.Branch], error) {
path := ResolvePath("/api/v1/repos/{owner}/{repo}/branches", pathParams("owner", owner, "repo", repo))
return ListPage[types.Branch](ctx, s.client, path, nil, opts)
}

// ListBranches returns all branches for a repository.
func (s *BranchService) ListBranches(ctx context.Context, owner, repo string) ([]types.Branch, error) {
path := ResolvePath("/api/v1/repos/{owner}/{repo}/branches", pathParams("owner", owner, "repo", repo))
Expand Down
2 changes: 1 addition & 1 deletion branches_extra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"dappco.re/go/core/forge/types"
"dappco.re/go/forge/types"
)

func TestBranchService_ListBranches_Good(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion branches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"dappco.re/go/core/forge/types"
"dappco.re/go/forge/types"
)

func TestBranchService_List_Good(t *testing.T) {
Expand Down
Loading
Loading