Merge branch 'origin/main' into 'next-release/main'

This commit is contained in:
oauth 2024-11-27 06:56:29 +00:00
commit 9c693b58f8
16 changed files with 286 additions and 512 deletions

View file

@ -23,6 +23,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/cli/common" "go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
) )
var registryListCmd = &cli.Command{ var registryListCmd = &cli.Command{
@ -42,7 +43,9 @@ func registryList(ctx context.Context, c *cli.Command) error {
return err return err
} }
list, err := client.GlobalRegistryList() opt := woodpecker.RegistryListOptions{}
list, err := client.GlobalRegistryList(opt)
if err != nil { if err != nil {
return err return err
} }

View file

@ -23,6 +23,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/cli/common" "go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
) )
var cronListCmd = &cli.Command{ var cronListCmd = &cli.Command{
@ -52,7 +53,8 @@ func cronList(ctx context.Context, c *cli.Command) error {
if err != nil { if err != nil {
return err return err
} }
list, err := client.CronList(repoID) opt := woodpecker.CronListOptions{}
list, err := client.CronList(repoID, opt)
if err != nil { if err != nil {
return err return err
} }

View file

@ -23,6 +23,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/cli/common" "go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
) )
var registryListCmd = &cli.Command{ var registryListCmd = &cli.Command{
@ -49,7 +50,9 @@ func registryList(ctx context.Context, c *cli.Command) error {
return err return err
} }
list, err := client.OrgRegistryList(orgID) opt := woodpecker.RegistryListOptions{}
list, err := client.OrgRegistryList(orgID, opt)
if err != nil { if err != nil {
return err return err
} }

View file

@ -23,6 +23,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/cli/common" "go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
) )
var registryListCmd = &cli.Command{ var registryListCmd = &cli.Command{
@ -49,7 +50,9 @@ func registryList(ctx context.Context, c *cli.Command) error {
return err return err
} }
list, err := client.RegistryList(repoID) opt := woodpecker.RegistryListOptions{}
list, err := client.RegistryList(repoID, opt)
if err != nil { if err != nil {
return err return err
} }

View file

@ -56,20 +56,22 @@ func secretList(ctx context.Context, c *cli.Command) error {
return err return err
} }
opt := woodpecker.SecretListOptions{}
var list []*woodpecker.Secret var list []*woodpecker.Secret
switch { switch {
case global: case global:
list, err = client.GlobalSecretList() list, err = client.GlobalSecretList(opt)
if err != nil { if err != nil {
return err return err
} }
case orgID != -1: case orgID != -1:
list, err = client.OrgSecretList(orgID) list, err = client.OrgSecretList(orgID, opt)
if err != nil { if err != nil {
return err return err
} }
default: default:
list, err = client.SecretList(repoID) list, err = client.SecretList(repoID, opt)
if err != nil { if err != nil {
return err return err
} }

View file

@ -23,6 +23,7 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/cli/common" "go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/internal" "go.woodpecker-ci.org/woodpecker/v2/cli/internal"
"go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker"
) )
var userListCmd = &cli.Command{ var userListCmd = &cli.Command{
@ -39,7 +40,9 @@ func userList(ctx context.Context, c *cli.Command) error {
return err return err
} }
users, err := client.UserList() opt := woodpecker.UserListOptions{}
users, err := client.UserList(opt)
if err != nil || len(users) == 0 { if err != nil || len(users) == 0 {
return err return err
} }

View file

@ -15,8 +15,8 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.1 // protoc-gen-go v1.35.2
// protoc v4.25.4 // protoc v4.24.4
// source: woodpecker.proto // source: woodpecker.proto
package proto package proto
@ -50,11 +50,9 @@ type StepState struct {
func (x *StepState) Reset() { func (x *StepState) Reset() {
*x = StepState{} *x = StepState{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[0]
mi := &file_woodpecker_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *StepState) String() string { func (x *StepState) String() string {
@ -65,7 +63,7 @@ func (*StepState) ProtoMessage() {}
func (x *StepState) ProtoReflect() protoreflect.Message { func (x *StepState) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[0] mi := &file_woodpecker_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -134,11 +132,9 @@ type WorkflowState struct {
func (x *WorkflowState) Reset() { func (x *WorkflowState) Reset() {
*x = WorkflowState{} *x = WorkflowState{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[1]
mi := &file_woodpecker_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *WorkflowState) String() string { func (x *WorkflowState) String() string {
@ -149,7 +145,7 @@ func (*WorkflowState) ProtoMessage() {}
func (x *WorkflowState) ProtoReflect() protoreflect.Message { func (x *WorkflowState) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[1] mi := &file_woodpecker_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -199,11 +195,9 @@ type LogEntry struct {
func (x *LogEntry) Reset() { func (x *LogEntry) Reset() {
*x = LogEntry{} *x = LogEntry{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[2]
mi := &file_woodpecker_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *LogEntry) String() string { func (x *LogEntry) String() string {
@ -214,7 +208,7 @@ func (*LogEntry) ProtoMessage() {}
func (x *LogEntry) ProtoReflect() protoreflect.Message { func (x *LogEntry) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[2] mi := &file_woodpecker_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -274,11 +268,9 @@ type Filter struct {
func (x *Filter) Reset() { func (x *Filter) Reset() {
*x = Filter{} *x = Filter{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[3]
mi := &file_woodpecker_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *Filter) String() string { func (x *Filter) String() string {
@ -289,7 +281,7 @@ func (*Filter) ProtoMessage() {}
func (x *Filter) ProtoReflect() protoreflect.Message { func (x *Filter) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[3] mi := &file_woodpecker_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -323,11 +315,9 @@ type Workflow struct {
func (x *Workflow) Reset() { func (x *Workflow) Reset() {
*x = Workflow{} *x = Workflow{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[4]
mi := &file_woodpecker_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *Workflow) String() string { func (x *Workflow) String() string {
@ -338,7 +328,7 @@ func (*Workflow) ProtoMessage() {}
func (x *Workflow) ProtoReflect() protoreflect.Message { func (x *Workflow) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[4] mi := &file_woodpecker_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -384,11 +374,9 @@ type NextRequest struct {
func (x *NextRequest) Reset() { func (x *NextRequest) Reset() {
*x = NextRequest{} *x = NextRequest{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[5]
mi := &file_woodpecker_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *NextRequest) String() string { func (x *NextRequest) String() string {
@ -399,7 +387,7 @@ func (*NextRequest) ProtoMessage() {}
func (x *NextRequest) ProtoReflect() protoreflect.Message { func (x *NextRequest) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[5] mi := &file_woodpecker_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -432,11 +420,9 @@ type InitRequest struct {
func (x *InitRequest) Reset() { func (x *InitRequest) Reset() {
*x = InitRequest{} *x = InitRequest{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[6]
mi := &file_woodpecker_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *InitRequest) String() string { func (x *InitRequest) String() string {
@ -447,7 +433,7 @@ func (*InitRequest) ProtoMessage() {}
func (x *InitRequest) ProtoReflect() protoreflect.Message { func (x *InitRequest) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[6] mi := &file_woodpecker_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -486,11 +472,9 @@ type WaitRequest struct {
func (x *WaitRequest) Reset() { func (x *WaitRequest) Reset() {
*x = WaitRequest{} *x = WaitRequest{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[7]
mi := &file_woodpecker_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *WaitRequest) String() string { func (x *WaitRequest) String() string {
@ -501,7 +485,7 @@ func (*WaitRequest) ProtoMessage() {}
func (x *WaitRequest) ProtoReflect() protoreflect.Message { func (x *WaitRequest) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[7] mi := &file_woodpecker_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -534,11 +518,9 @@ type DoneRequest struct {
func (x *DoneRequest) Reset() { func (x *DoneRequest) Reset() {
*x = DoneRequest{} *x = DoneRequest{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[8]
mi := &file_woodpecker_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *DoneRequest) String() string { func (x *DoneRequest) String() string {
@ -549,7 +531,7 @@ func (*DoneRequest) ProtoMessage() {}
func (x *DoneRequest) ProtoReflect() protoreflect.Message { func (x *DoneRequest) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[8] mi := &file_woodpecker_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -588,11 +570,9 @@ type ExtendRequest struct {
func (x *ExtendRequest) Reset() { func (x *ExtendRequest) Reset() {
*x = ExtendRequest{} *x = ExtendRequest{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[9]
mi := &file_woodpecker_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *ExtendRequest) String() string { func (x *ExtendRequest) String() string {
@ -603,7 +583,7 @@ func (*ExtendRequest) ProtoMessage() {}
func (x *ExtendRequest) ProtoReflect() protoreflect.Message { func (x *ExtendRequest) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[9] mi := &file_woodpecker_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -636,11 +616,9 @@ type UpdateRequest struct {
func (x *UpdateRequest) Reset() { func (x *UpdateRequest) Reset() {
*x = UpdateRequest{} *x = UpdateRequest{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[10]
mi := &file_woodpecker_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *UpdateRequest) String() string { func (x *UpdateRequest) String() string {
@ -651,7 +629,7 @@ func (*UpdateRequest) ProtoMessage() {}
func (x *UpdateRequest) ProtoReflect() protoreflect.Message { func (x *UpdateRequest) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[10] mi := &file_woodpecker_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -690,11 +668,9 @@ type LogRequest struct {
func (x *LogRequest) Reset() { func (x *LogRequest) Reset() {
*x = LogRequest{} *x = LogRequest{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[11]
mi := &file_woodpecker_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *LogRequest) String() string { func (x *LogRequest) String() string {
@ -705,7 +681,7 @@ func (*LogRequest) ProtoMessage() {}
func (x *LogRequest) ProtoReflect() protoreflect.Message { func (x *LogRequest) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[11] mi := &file_woodpecker_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -735,11 +711,9 @@ type Empty struct {
func (x *Empty) Reset() { func (x *Empty) Reset() {
*x = Empty{} *x = Empty{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[12]
mi := &file_woodpecker_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *Empty) String() string { func (x *Empty) String() string {
@ -750,7 +724,7 @@ func (*Empty) ProtoMessage() {}
func (x *Empty) ProtoReflect() protoreflect.Message { func (x *Empty) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[12] mi := &file_woodpecker_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -775,11 +749,9 @@ type ReportHealthRequest struct {
func (x *ReportHealthRequest) Reset() { func (x *ReportHealthRequest) Reset() {
*x = ReportHealthRequest{} *x = ReportHealthRequest{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[13]
mi := &file_woodpecker_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *ReportHealthRequest) String() string { func (x *ReportHealthRequest) String() string {
@ -790,7 +762,7 @@ func (*ReportHealthRequest) ProtoMessage() {}
func (x *ReportHealthRequest) ProtoReflect() protoreflect.Message { func (x *ReportHealthRequest) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[13] mi := &file_woodpecker_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -826,11 +798,9 @@ type AgentInfo struct {
func (x *AgentInfo) Reset() { func (x *AgentInfo) Reset() {
*x = AgentInfo{} *x = AgentInfo{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[14]
mi := &file_woodpecker_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *AgentInfo) String() string { func (x *AgentInfo) String() string {
@ -841,7 +811,7 @@ func (*AgentInfo) ProtoMessage() {}
func (x *AgentInfo) ProtoReflect() protoreflect.Message { func (x *AgentInfo) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[14] mi := &file_woodpecker_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -901,11 +871,9 @@ type RegisterAgentRequest struct {
func (x *RegisterAgentRequest) Reset() { func (x *RegisterAgentRequest) Reset() {
*x = RegisterAgentRequest{} *x = RegisterAgentRequest{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[15]
mi := &file_woodpecker_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *RegisterAgentRequest) String() string { func (x *RegisterAgentRequest) String() string {
@ -916,7 +884,7 @@ func (*RegisterAgentRequest) ProtoMessage() {}
func (x *RegisterAgentRequest) ProtoReflect() protoreflect.Message { func (x *RegisterAgentRequest) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[15] mi := &file_woodpecker_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -949,11 +917,9 @@ type VersionResponse struct {
func (x *VersionResponse) Reset() { func (x *VersionResponse) Reset() {
*x = VersionResponse{} *x = VersionResponse{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[16]
mi := &file_woodpecker_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *VersionResponse) String() string { func (x *VersionResponse) String() string {
@ -964,7 +930,7 @@ func (*VersionResponse) ProtoMessage() {}
func (x *VersionResponse) ProtoReflect() protoreflect.Message { func (x *VersionResponse) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[16] mi := &file_woodpecker_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -1003,11 +969,9 @@ type NextResponse struct {
func (x *NextResponse) Reset() { func (x *NextResponse) Reset() {
*x = NextResponse{} *x = NextResponse{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[17]
mi := &file_woodpecker_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *NextResponse) String() string { func (x *NextResponse) String() string {
@ -1018,7 +982,7 @@ func (*NextResponse) ProtoMessage() {}
func (x *NextResponse) ProtoReflect() protoreflect.Message { func (x *NextResponse) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[17] mi := &file_woodpecker_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -1050,11 +1014,9 @@ type RegisterAgentResponse struct {
func (x *RegisterAgentResponse) Reset() { func (x *RegisterAgentResponse) Reset() {
*x = RegisterAgentResponse{} *x = RegisterAgentResponse{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[18]
mi := &file_woodpecker_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *RegisterAgentResponse) String() string { func (x *RegisterAgentResponse) String() string {
@ -1065,7 +1027,7 @@ func (*RegisterAgentResponse) ProtoMessage() {}
func (x *RegisterAgentResponse) ProtoReflect() protoreflect.Message { func (x *RegisterAgentResponse) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[18] mi := &file_woodpecker_proto_msgTypes[18]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -1098,11 +1060,9 @@ type AuthRequest struct {
func (x *AuthRequest) Reset() { func (x *AuthRequest) Reset() {
*x = AuthRequest{} *x = AuthRequest{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[19]
mi := &file_woodpecker_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *AuthRequest) String() string { func (x *AuthRequest) String() string {
@ -1113,7 +1073,7 @@ func (*AuthRequest) ProtoMessage() {}
func (x *AuthRequest) ProtoReflect() protoreflect.Message { func (x *AuthRequest) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[19] mi := &file_woodpecker_proto_msgTypes[19]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -1154,11 +1114,9 @@ type AuthResponse struct {
func (x *AuthResponse) Reset() { func (x *AuthResponse) Reset() {
*x = AuthResponse{} *x = AuthResponse{}
if protoimpl.UnsafeEnabled { mi := &file_woodpecker_proto_msgTypes[20]
mi := &file_woodpecker_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *AuthResponse) String() string { func (x *AuthResponse) String() string {
@ -1169,7 +1127,7 @@ func (*AuthResponse) ProtoMessage() {}
func (x *AuthResponse) ProtoReflect() protoreflect.Message { func (x *AuthResponse) ProtoReflect() protoreflect.Message {
mi := &file_woodpecker_proto_msgTypes[20] mi := &file_woodpecker_proto_msgTypes[20]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -1379,7 +1337,7 @@ func file_woodpecker_proto_rawDescGZIP() []byte {
} }
var file_woodpecker_proto_msgTypes = make([]protoimpl.MessageInfo, 23) var file_woodpecker_proto_msgTypes = make([]protoimpl.MessageInfo, 23)
var file_woodpecker_proto_goTypes = []interface{}{ var file_woodpecker_proto_goTypes = []any{
(*StepState)(nil), // 0: proto.StepState (*StepState)(nil), // 0: proto.StepState
(*WorkflowState)(nil), // 1: proto.WorkflowState (*WorkflowState)(nil), // 1: proto.WorkflowState
(*LogEntry)(nil), // 2: proto.LogEntry (*LogEntry)(nil), // 2: proto.LogEntry
@ -1450,260 +1408,6 @@ func file_woodpecker_proto_init() {
if File_woodpecker_proto != nil { if File_woodpecker_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled {
file_woodpecker_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StepState); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WorkflowState); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LogEntry); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Filter); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Workflow); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NextRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InitRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WaitRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DoneRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ExtendRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LogRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Empty); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReportHealthRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AgentInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RegisterAgentRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*VersionResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NextResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RegisterAgentResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AuthRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_woodpecker_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AuthResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{

View file

@ -15,8 +15,8 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.4.0 // - protoc-gen-go-grpc v1.5.1
// - protoc v4.25.4 // - protoc v4.24.4
// source: woodpecker.proto // source: woodpecker.proto
package proto package proto
@ -30,8 +30,8 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.62.0 or later. // Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion8 const _ = grpc.SupportPackageIsVersion9
const ( const (
Woodpecker_Version_FullMethodName = "/proto.Woodpecker/Version" Woodpecker_Version_FullMethodName = "/proto.Woodpecker/Version"
@ -186,7 +186,7 @@ func (c *woodpeckerClient) ReportHealth(ctx context.Context, in *ReportHealthReq
// WoodpeckerServer is the server API for Woodpecker service. // WoodpeckerServer is the server API for Woodpecker service.
// All implementations must embed UnimplementedWoodpeckerServer // All implementations must embed UnimplementedWoodpeckerServer
// for forward compatibility // for forward compatibility.
// //
// Woodpecker Server Service // Woodpecker Server Service
type WoodpeckerServer interface { type WoodpeckerServer interface {
@ -204,9 +204,12 @@ type WoodpeckerServer interface {
mustEmbedUnimplementedWoodpeckerServer() mustEmbedUnimplementedWoodpeckerServer()
} }
// UnimplementedWoodpeckerServer must be embedded to have forward compatible implementations. // UnimplementedWoodpeckerServer must be embedded to have
type UnimplementedWoodpeckerServer struct { // forward compatible implementations.
} //
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedWoodpeckerServer struct{}
func (UnimplementedWoodpeckerServer) Version(context.Context, *Empty) (*VersionResponse, error) { func (UnimplementedWoodpeckerServer) Version(context.Context, *Empty) (*VersionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") return nil, status.Errorf(codes.Unimplemented, "method Version not implemented")
@ -242,6 +245,7 @@ func (UnimplementedWoodpeckerServer) ReportHealth(context.Context, *ReportHealth
return nil, status.Errorf(codes.Unimplemented, "method ReportHealth not implemented") return nil, status.Errorf(codes.Unimplemented, "method ReportHealth not implemented")
} }
func (UnimplementedWoodpeckerServer) mustEmbedUnimplementedWoodpeckerServer() {} func (UnimplementedWoodpeckerServer) mustEmbedUnimplementedWoodpeckerServer() {}
func (UnimplementedWoodpeckerServer) testEmbeddedByValue() {}
// UnsafeWoodpeckerServer may be embedded to opt out of forward compatibility for this service. // UnsafeWoodpeckerServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to WoodpeckerServer will // Use of this interface is not recommended, as added methods to WoodpeckerServer will
@ -251,6 +255,13 @@ type UnsafeWoodpeckerServer interface {
} }
func RegisterWoodpeckerServer(s grpc.ServiceRegistrar, srv WoodpeckerServer) { func RegisterWoodpeckerServer(s grpc.ServiceRegistrar, srv WoodpeckerServer) {
// If the following call pancis, it indicates UnimplementedWoodpeckerServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Woodpecker_ServiceDesc, srv) s.RegisterService(&Woodpecker_ServiceDesc, srv)
} }
@ -539,20 +550,24 @@ func (c *woodpeckerAuthClient) Auth(ctx context.Context, in *AuthRequest, opts .
// WoodpeckerAuthServer is the server API for WoodpeckerAuth service. // WoodpeckerAuthServer is the server API for WoodpeckerAuth service.
// All implementations must embed UnimplementedWoodpeckerAuthServer // All implementations must embed UnimplementedWoodpeckerAuthServer
// for forward compatibility // for forward compatibility.
type WoodpeckerAuthServer interface { type WoodpeckerAuthServer interface {
Auth(context.Context, *AuthRequest) (*AuthResponse, error) Auth(context.Context, *AuthRequest) (*AuthResponse, error)
mustEmbedUnimplementedWoodpeckerAuthServer() mustEmbedUnimplementedWoodpeckerAuthServer()
} }
// UnimplementedWoodpeckerAuthServer must be embedded to have forward compatible implementations. // UnimplementedWoodpeckerAuthServer must be embedded to have
type UnimplementedWoodpeckerAuthServer struct { // forward compatible implementations.
} //
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedWoodpeckerAuthServer struct{}
func (UnimplementedWoodpeckerAuthServer) Auth(context.Context, *AuthRequest) (*AuthResponse, error) { func (UnimplementedWoodpeckerAuthServer) Auth(context.Context, *AuthRequest) (*AuthResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Auth not implemented") return nil, status.Errorf(codes.Unimplemented, "method Auth not implemented")
} }
func (UnimplementedWoodpeckerAuthServer) mustEmbedUnimplementedWoodpeckerAuthServer() {} func (UnimplementedWoodpeckerAuthServer) mustEmbedUnimplementedWoodpeckerAuthServer() {}
func (UnimplementedWoodpeckerAuthServer) testEmbeddedByValue() {}
// UnsafeWoodpeckerAuthServer may be embedded to opt out of forward compatibility for this service. // UnsafeWoodpeckerAuthServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to WoodpeckerAuthServer will // Use of this interface is not recommended, as added methods to WoodpeckerAuthServer will
@ -562,6 +577,13 @@ type UnsafeWoodpeckerAuthServer interface {
} }
func RegisterWoodpeckerAuthServer(s grpc.ServiceRegistrar, srv WoodpeckerAuthServer) { func RegisterWoodpeckerAuthServer(s grpc.ServiceRegistrar, srv WoodpeckerAuthServer) {
// If the following call pancis, it indicates UnimplementedWoodpeckerAuthServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&WoodpeckerAuth_ServiceDesc, srv) s.RegisterService(&WoodpeckerAuth_ServiceDesc, srv)
} }

View file

@ -1,6 +1,9 @@
package woodpecker package woodpecker
import "fmt" import (
"fmt"
"net/url"
)
const ( const (
pathGlobalRegistries = "%s/api/registries" pathGlobalRegistries = "%s/api/registries"
@ -16,10 +19,11 @@ func (c *client) GlobalRegistry(registry string) (*Registry, error) {
} }
// GlobalRegistryList returns a list of all global registries. // GlobalRegistryList returns a list of all global registries.
func (c *client) GlobalRegistryList() ([]*Registry, error) { func (c *client) GlobalRegistryList(opt RegistryListOptions) ([]*Registry, error) {
var out []*Registry var out []*Registry
uri := fmt.Sprintf(pathGlobalRegistries, c.addr) uri, _ := url.Parse(fmt.Sprintf(pathGlobalRegistries, c.addr))
err := c.get(uri, &out) uri.RawQuery = opt.getURLQuery().Encode()
err := c.get(uri.String(), &out)
return out, err return out, err
} }

View file

@ -1,6 +1,9 @@
package woodpecker package woodpecker
import "fmt" import (
"fmt"
"net/url"
)
const ( const (
pathGlobalSecrets = "%s/api/secrets" pathGlobalSecrets = "%s/api/secrets"
@ -16,10 +19,11 @@ func (c *client) GlobalSecret(secret string) (*Secret, error) {
} }
// GlobalSecretList returns a list of all global secrets. // GlobalSecretList returns a list of all global secrets.
func (c *client) GlobalSecretList() ([]*Secret, error) { func (c *client) GlobalSecretList(opt SecretListOptions) ([]*Secret, error) {
var out []*Secret var out []*Secret
uri := fmt.Sprintf(pathGlobalSecrets, c.addr) uri, _ := url.Parse(fmt.Sprintf(pathGlobalSecrets, c.addr))
err := c.get(uri, &out) uri.RawQuery = opt.getURLQuery().Encode()
err := c.get(uri.String(), &out)
return out, err return out, err
} }

View file

@ -35,7 +35,7 @@ type Client interface {
User(string) (*User, error) User(string) (*User, error)
// UserList returns a list of all registered users. // UserList returns a list of all registered users.
UserList() ([]*User, error) UserList(opt UserListOptions) ([]*User, error)
// UserPost creates a new user account. // UserPost creates a new user account.
UserPost(*User) (*User, error) UserPost(*User) (*User, error)
@ -125,7 +125,7 @@ type Client interface {
Registry(repoID int64, hostname string) (*Registry, error) Registry(repoID int64, hostname string) (*Registry, error)
// RegistryList returns a list of all repository registries. // RegistryList returns a list of all repository registries.
RegistryList(repoID int64) ([]*Registry, error) RegistryList(repoID int64, opt RegistryListOptions) ([]*Registry, error)
// RegistryCreate creates a registry. // RegistryCreate creates a registry.
RegistryCreate(repoID int64, registry *Registry) (*Registry, error) RegistryCreate(repoID int64, registry *Registry) (*Registry, error)
@ -140,7 +140,7 @@ type Client interface {
OrgRegistry(orgID int64, registry string) (*Registry, error) OrgRegistry(orgID int64, registry string) (*Registry, error)
// OrgRegistryList returns a list of all organization registries. // OrgRegistryList returns a list of all organization registries.
OrgRegistryList(orgID int64) ([]*Registry, error) OrgRegistryList(orgID int64, opt RegistryListOptions) ([]*Registry, error)
// OrgRegistryCreate creates an organization registry. // OrgRegistryCreate creates an organization registry.
OrgRegistryCreate(orgID int64, registry *Registry) (*Registry, error) OrgRegistryCreate(orgID int64, registry *Registry) (*Registry, error)
@ -155,7 +155,7 @@ type Client interface {
GlobalRegistry(registry string) (*Registry, error) GlobalRegistry(registry string) (*Registry, error)
// GlobalRegistryList returns a list of all global registries. // GlobalRegistryList returns a list of all global registries.
GlobalRegistryList() ([]*Registry, error) GlobalRegistryList(opt RegistryListOptions) ([]*Registry, error)
// GlobalRegistryCreate creates a global registry. // GlobalRegistryCreate creates a global registry.
GlobalRegistryCreate(registry *Registry) (*Registry, error) GlobalRegistryCreate(registry *Registry) (*Registry, error)
@ -170,7 +170,7 @@ type Client interface {
Secret(repoID int64, secret string) (*Secret, error) Secret(repoID int64, secret string) (*Secret, error)
// SecretList returns a list of all repository secrets. // SecretList returns a list of all repository secrets.
SecretList(repoID int64) ([]*Secret, error) SecretList(repoID int64, opt SecretListOptions) ([]*Secret, error)
// SecretCreate creates a secret. // SecretCreate creates a secret.
SecretCreate(repoID int64, secret *Secret) (*Secret, error) SecretCreate(repoID int64, secret *Secret) (*Secret, error)
@ -191,7 +191,7 @@ type Client interface {
OrgSecret(orgID int64, secret string) (*Secret, error) OrgSecret(orgID int64, secret string) (*Secret, error)
// OrgSecretList returns a list of all organization secrets. // OrgSecretList returns a list of all organization secrets.
OrgSecretList(orgID int64) ([]*Secret, error) OrgSecretList(orgID int64, opt SecretListOptions) ([]*Secret, error)
// OrgSecretCreate creates an organization secret. // OrgSecretCreate creates an organization secret.
OrgSecretCreate(orgID int64, secret *Secret) (*Secret, error) OrgSecretCreate(orgID int64, secret *Secret) (*Secret, error)
@ -206,7 +206,7 @@ type Client interface {
GlobalSecret(secret string) (*Secret, error) GlobalSecret(secret string) (*Secret, error)
// GlobalSecretList returns a list of all global secrets. // GlobalSecretList returns a list of all global secrets.
GlobalSecretList() ([]*Secret, error) GlobalSecretList(opt SecretListOptions) ([]*Secret, error)
// GlobalSecretCreate creates a global secret. // GlobalSecretCreate creates a global secret.
GlobalSecretCreate(secret *Secret) (*Secret, error) GlobalSecretCreate(secret *Secret) (*Secret, error)
@ -227,7 +227,7 @@ type Client interface {
SetLogLevel(logLevel *LogLevel) (*LogLevel, error) SetLogLevel(logLevel *LogLevel) (*LogLevel, error)
// CronList list all cron jobs of a repo. // CronList list all cron jobs of a repo.
CronList(repoID int64) ([]*Cron, error) CronList(repoID int64, opt CronListOptions) ([]*Cron, error)
// CronGet get a specific cron job of a repo by id. // CronGet get a specific cron job of a repo by id.
CronGet(repoID, cronID int64) (*Cron, error) CronGet(repoID, cronID int64) (*Cron, error)

View file

@ -263,9 +263,9 @@ func (_m *Client) CronGet(repoID int64, cronID int64) (*woodpecker.Cron, error)
return r0, r1 return r0, r1
} }
// CronList provides a mock function with given fields: repoID // CronList provides a mock function with given fields: repoID, opt
func (_m *Client) CronList(repoID int64) ([]*woodpecker.Cron, error) { func (_m *Client) CronList(repoID int64, opt woodpecker.CronListOptions) ([]*woodpecker.Cron, error) {
ret := _m.Called(repoID) ret := _m.Called(repoID, opt)
if len(ret) == 0 { if len(ret) == 0 {
panic("no return value specified for CronList") panic("no return value specified for CronList")
@ -273,19 +273,19 @@ func (_m *Client) CronList(repoID int64) ([]*woodpecker.Cron, error) {
var r0 []*woodpecker.Cron var r0 []*woodpecker.Cron
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(int64) ([]*woodpecker.Cron, error)); ok { if rf, ok := ret.Get(0).(func(int64, woodpecker.CronListOptions) ([]*woodpecker.Cron, error)); ok {
return rf(repoID) return rf(repoID, opt)
} }
if rf, ok := ret.Get(0).(func(int64) []*woodpecker.Cron); ok { if rf, ok := ret.Get(0).(func(int64, woodpecker.CronListOptions) []*woodpecker.Cron); ok {
r0 = rf(repoID) r0 = rf(repoID, opt)
} else { } else {
if ret.Get(0) != nil { if ret.Get(0) != nil {
r0 = ret.Get(0).([]*woodpecker.Cron) r0 = ret.Get(0).([]*woodpecker.Cron)
} }
} }
if rf, ok := ret.Get(1).(func(int64) error); ok { if rf, ok := ret.Get(1).(func(int64, woodpecker.CronListOptions) error); ok {
r1 = rf(repoID) r1 = rf(repoID, opt)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
} }
@ -431,9 +431,9 @@ func (_m *Client) GlobalRegistryDelete(registry string) error {
return r0 return r0
} }
// GlobalRegistryList provides a mock function with given fields: // GlobalRegistryList provides a mock function with given fields: opt
func (_m *Client) GlobalRegistryList() ([]*woodpecker.Registry, error) { func (_m *Client) GlobalRegistryList(opt woodpecker.RegistryListOptions) ([]*woodpecker.Registry, error) {
ret := _m.Called() ret := _m.Called(opt)
if len(ret) == 0 { if len(ret) == 0 {
panic("no return value specified for GlobalRegistryList") panic("no return value specified for GlobalRegistryList")
@ -441,19 +441,19 @@ func (_m *Client) GlobalRegistryList() ([]*woodpecker.Registry, error) {
var r0 []*woodpecker.Registry var r0 []*woodpecker.Registry
var r1 error var r1 error
if rf, ok := ret.Get(0).(func() ([]*woodpecker.Registry, error)); ok { if rf, ok := ret.Get(0).(func(woodpecker.RegistryListOptions) ([]*woodpecker.Registry, error)); ok {
return rf() return rf(opt)
} }
if rf, ok := ret.Get(0).(func() []*woodpecker.Registry); ok { if rf, ok := ret.Get(0).(func(woodpecker.RegistryListOptions) []*woodpecker.Registry); ok {
r0 = rf() r0 = rf(opt)
} else { } else {
if ret.Get(0) != nil { if ret.Get(0) != nil {
r0 = ret.Get(0).([]*woodpecker.Registry) r0 = ret.Get(0).([]*woodpecker.Registry)
} }
} }
if rf, ok := ret.Get(1).(func() error); ok { if rf, ok := ret.Get(1).(func(woodpecker.RegistryListOptions) error); ok {
r1 = rf() r1 = rf(opt)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
} }
@ -569,9 +569,9 @@ func (_m *Client) GlobalSecretDelete(secret string) error {
return r0 return r0
} }
// GlobalSecretList provides a mock function with given fields: // GlobalSecretList provides a mock function with given fields: opt
func (_m *Client) GlobalSecretList() ([]*woodpecker.Secret, error) { func (_m *Client) GlobalSecretList(opt woodpecker.SecretListOptions) ([]*woodpecker.Secret, error) {
ret := _m.Called() ret := _m.Called(opt)
if len(ret) == 0 { if len(ret) == 0 {
panic("no return value specified for GlobalSecretList") panic("no return value specified for GlobalSecretList")
@ -579,19 +579,19 @@ func (_m *Client) GlobalSecretList() ([]*woodpecker.Secret, error) {
var r0 []*woodpecker.Secret var r0 []*woodpecker.Secret
var r1 error var r1 error
if rf, ok := ret.Get(0).(func() ([]*woodpecker.Secret, error)); ok { if rf, ok := ret.Get(0).(func(woodpecker.SecretListOptions) ([]*woodpecker.Secret, error)); ok {
return rf() return rf(opt)
} }
if rf, ok := ret.Get(0).(func() []*woodpecker.Secret); ok { if rf, ok := ret.Get(0).(func(woodpecker.SecretListOptions) []*woodpecker.Secret); ok {
r0 = rf() r0 = rf(opt)
} else { } else {
if ret.Get(0) != nil { if ret.Get(0) != nil {
r0 = ret.Get(0).([]*woodpecker.Secret) r0 = ret.Get(0).([]*woodpecker.Secret)
} }
} }
if rf, ok := ret.Get(1).(func() error); ok { if rf, ok := ret.Get(1).(func(woodpecker.SecretListOptions) error); ok {
r1 = rf() r1 = rf(opt)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
} }
@ -815,9 +815,9 @@ func (_m *Client) OrgRegistryDelete(orgID int64, registry string) error {
return r0 return r0
} }
// OrgRegistryList provides a mock function with given fields: orgID // OrgRegistryList provides a mock function with given fields: orgID, opt
func (_m *Client) OrgRegistryList(orgID int64) ([]*woodpecker.Registry, error) { func (_m *Client) OrgRegistryList(orgID int64, opt woodpecker.RegistryListOptions) ([]*woodpecker.Registry, error) {
ret := _m.Called(orgID) ret := _m.Called(orgID, opt)
if len(ret) == 0 { if len(ret) == 0 {
panic("no return value specified for OrgRegistryList") panic("no return value specified for OrgRegistryList")
@ -825,19 +825,19 @@ func (_m *Client) OrgRegistryList(orgID int64) ([]*woodpecker.Registry, error) {
var r0 []*woodpecker.Registry var r0 []*woodpecker.Registry
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(int64) ([]*woodpecker.Registry, error)); ok { if rf, ok := ret.Get(0).(func(int64, woodpecker.RegistryListOptions) ([]*woodpecker.Registry, error)); ok {
return rf(orgID) return rf(orgID, opt)
} }
if rf, ok := ret.Get(0).(func(int64) []*woodpecker.Registry); ok { if rf, ok := ret.Get(0).(func(int64, woodpecker.RegistryListOptions) []*woodpecker.Registry); ok {
r0 = rf(orgID) r0 = rf(orgID, opt)
} else { } else {
if ret.Get(0) != nil { if ret.Get(0) != nil {
r0 = ret.Get(0).([]*woodpecker.Registry) r0 = ret.Get(0).([]*woodpecker.Registry)
} }
} }
if rf, ok := ret.Get(1).(func(int64) error); ok { if rf, ok := ret.Get(1).(func(int64, woodpecker.RegistryListOptions) error); ok {
r1 = rf(orgID) r1 = rf(orgID, opt)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
} }
@ -953,9 +953,9 @@ func (_m *Client) OrgSecretDelete(orgID int64, secret string) error {
return r0 return r0
} }
// OrgSecretList provides a mock function with given fields: orgID // OrgSecretList provides a mock function with given fields: orgID, opt
func (_m *Client) OrgSecretList(orgID int64) ([]*woodpecker.Secret, error) { func (_m *Client) OrgSecretList(orgID int64, opt woodpecker.SecretListOptions) ([]*woodpecker.Secret, error) {
ret := _m.Called(orgID) ret := _m.Called(orgID, opt)
if len(ret) == 0 { if len(ret) == 0 {
panic("no return value specified for OrgSecretList") panic("no return value specified for OrgSecretList")
@ -963,19 +963,19 @@ func (_m *Client) OrgSecretList(orgID int64) ([]*woodpecker.Secret, error) {
var r0 []*woodpecker.Secret var r0 []*woodpecker.Secret
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(int64) ([]*woodpecker.Secret, error)); ok { if rf, ok := ret.Get(0).(func(int64, woodpecker.SecretListOptions) ([]*woodpecker.Secret, error)); ok {
return rf(orgID) return rf(orgID, opt)
} }
if rf, ok := ret.Get(0).(func(int64) []*woodpecker.Secret); ok { if rf, ok := ret.Get(0).(func(int64, woodpecker.SecretListOptions) []*woodpecker.Secret); ok {
r0 = rf(orgID) r0 = rf(orgID, opt)
} else { } else {
if ret.Get(0) != nil { if ret.Get(0) != nil {
r0 = ret.Get(0).([]*woodpecker.Secret) r0 = ret.Get(0).([]*woodpecker.Secret)
} }
} }
if rf, ok := ret.Get(1).(func(int64) error); ok { if rf, ok := ret.Get(1).(func(int64, woodpecker.SecretListOptions) error); ok {
r1 = rf(orgID) r1 = rf(orgID, opt)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
} }
@ -1427,9 +1427,9 @@ func (_m *Client) RegistryDelete(repoID int64, hostname string) error {
return r0 return r0
} }
// RegistryList provides a mock function with given fields: repoID // RegistryList provides a mock function with given fields: repoID, opt
func (_m *Client) RegistryList(repoID int64) ([]*woodpecker.Registry, error) { func (_m *Client) RegistryList(repoID int64, opt woodpecker.RegistryListOptions) ([]*woodpecker.Registry, error) {
ret := _m.Called(repoID) ret := _m.Called(repoID, opt)
if len(ret) == 0 { if len(ret) == 0 {
panic("no return value specified for RegistryList") panic("no return value specified for RegistryList")
@ -1437,19 +1437,19 @@ func (_m *Client) RegistryList(repoID int64) ([]*woodpecker.Registry, error) {
var r0 []*woodpecker.Registry var r0 []*woodpecker.Registry
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(int64) ([]*woodpecker.Registry, error)); ok { if rf, ok := ret.Get(0).(func(int64, woodpecker.RegistryListOptions) ([]*woodpecker.Registry, error)); ok {
return rf(repoID) return rf(repoID, opt)
} }
if rf, ok := ret.Get(0).(func(int64) []*woodpecker.Registry); ok { if rf, ok := ret.Get(0).(func(int64, woodpecker.RegistryListOptions) []*woodpecker.Registry); ok {
r0 = rf(repoID) r0 = rf(repoID, opt)
} else { } else {
if ret.Get(0) != nil { if ret.Get(0) != nil {
r0 = ret.Get(0).([]*woodpecker.Registry) r0 = ret.Get(0).([]*woodpecker.Registry)
} }
} }
if rf, ok := ret.Get(1).(func(int64) error); ok { if rf, ok := ret.Get(1).(func(int64, woodpecker.RegistryListOptions) error); ok {
r1 = rf(repoID) r1 = rf(repoID, opt)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
} }
@ -1799,9 +1799,9 @@ func (_m *Client) SecretDelete(repoID int64, secret string) error {
return r0 return r0
} }
// SecretList provides a mock function with given fields: repoID // SecretList provides a mock function with given fields: repoID, opt
func (_m *Client) SecretList(repoID int64) ([]*woodpecker.Secret, error) { func (_m *Client) SecretList(repoID int64, opt woodpecker.SecretListOptions) ([]*woodpecker.Secret, error) {
ret := _m.Called(repoID) ret := _m.Called(repoID, opt)
if len(ret) == 0 { if len(ret) == 0 {
panic("no return value specified for SecretList") panic("no return value specified for SecretList")
@ -1809,19 +1809,19 @@ func (_m *Client) SecretList(repoID int64) ([]*woodpecker.Secret, error) {
var r0 []*woodpecker.Secret var r0 []*woodpecker.Secret
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(int64) ([]*woodpecker.Secret, error)); ok { if rf, ok := ret.Get(0).(func(int64, woodpecker.SecretListOptions) ([]*woodpecker.Secret, error)); ok {
return rf(repoID) return rf(repoID, opt)
} }
if rf, ok := ret.Get(0).(func(int64) []*woodpecker.Secret); ok { if rf, ok := ret.Get(0).(func(int64, woodpecker.SecretListOptions) []*woodpecker.Secret); ok {
r0 = rf(repoID) r0 = rf(repoID, opt)
} else { } else {
if ret.Get(0) != nil { if ret.Get(0) != nil {
r0 = ret.Get(0).([]*woodpecker.Secret) r0 = ret.Get(0).([]*woodpecker.Secret)
} }
} }
if rf, ok := ret.Get(1).(func(int64) error); ok { if rf, ok := ret.Get(1).(func(int64, woodpecker.SecretListOptions) error); ok {
r1 = rf(repoID) r1 = rf(repoID, opt)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
} }
@ -2025,9 +2025,9 @@ func (_m *Client) UserDel(_a0 string) error {
return r0 return r0
} }
// UserList provides a mock function with given fields: // UserList provides a mock function with given fields: opt
func (_m *Client) UserList() ([]*woodpecker.User, error) { func (_m *Client) UserList(opt woodpecker.UserListOptions) ([]*woodpecker.User, error) {
ret := _m.Called() ret := _m.Called(opt)
if len(ret) == 0 { if len(ret) == 0 {
panic("no return value specified for UserList") panic("no return value specified for UserList")
@ -2035,19 +2035,19 @@ func (_m *Client) UserList() ([]*woodpecker.User, error) {
var r0 []*woodpecker.User var r0 []*woodpecker.User
var r1 error var r1 error
if rf, ok := ret.Get(0).(func() ([]*woodpecker.User, error)); ok { if rf, ok := ret.Get(0).(func(woodpecker.UserListOptions) ([]*woodpecker.User, error)); ok {
return rf() return rf(opt)
} }
if rf, ok := ret.Get(0).(func() []*woodpecker.User); ok { if rf, ok := ret.Get(0).(func(woodpecker.UserListOptions) []*woodpecker.User); ok {
r0 = rf() r0 = rf(opt)
} else { } else {
if ret.Get(0) != nil { if ret.Get(0) != nil {
r0 = ret.Get(0).([]*woodpecker.User) r0 = ret.Get(0).([]*woodpecker.User)
} }
} }
if rf, ok := ret.Get(1).(func() error); ok { if rf, ok := ret.Get(1).(func(woodpecker.UserListOptions) error); ok {
r1 = rf() r1 = rf(opt)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
} }

View file

@ -1,6 +1,9 @@
package woodpecker package woodpecker
import "fmt" import (
"fmt"
"net/url"
)
const ( const (
pathOrg = "%s/api/orgs/%d" pathOrg = "%s/api/orgs/%d"
@ -36,10 +39,11 @@ func (c *client) OrgSecret(orgID int64, secret string) (*Secret, error) {
} }
// OrgSecretList returns a list of all organization secrets. // OrgSecretList returns a list of all organization secrets.
func (c *client) OrgSecretList(orgID int64) ([]*Secret, error) { func (c *client) OrgSecretList(orgID int64, opt SecretListOptions) ([]*Secret, error) {
var out []*Secret var out []*Secret
uri := fmt.Sprintf(pathOrgSecrets, c.addr, orgID) uri, _ := url.Parse(fmt.Sprintf(pathOrgSecrets, c.addr, orgID))
err := c.get(uri, &out) uri.RawQuery = opt.getURLQuery().Encode()
err := c.get(uri.String(), &out)
return out, err return out, err
} }
@ -74,10 +78,11 @@ func (c *client) OrgRegistry(orgID int64, registry string) (*Registry, error) {
} }
// OrgRegistryList returns a list of all organization registries. // OrgRegistryList returns a list of all organization registries.
func (c *client) OrgRegistryList(orgID int64) ([]*Registry, error) { func (c *client) OrgRegistryList(orgID int64, opt RegistryListOptions) ([]*Registry, error) {
var out []*Registry var out []*Registry
uri := fmt.Sprintf(pathOrgRegistries, c.addr, orgID) uri, _ := url.Parse(fmt.Sprintf(pathOrgRegistries, c.addr, orgID))
err := c.get(uri, &out) uri.RawQuery = opt.getURLQuery().Encode()
err := c.get(uri.String(), &out)
return out, err return out, err
} }

View file

@ -35,6 +35,18 @@ type PipelineListOptions struct {
After time.Time After time.Time
} }
type CronListOptions struct {
ListOptions
}
type RegistryListOptions struct {
ListOptions
}
type SecretListOptions struct {
ListOptions
}
type DeployOptions struct { type DeployOptions struct {
DeployTo string // override the target deploy value DeployTo string // override the target deploy value
Params map[string]string // custom KEY=value parameters to be injected into the step environment Params map[string]string // custom KEY=value parameters to be injected into the step environment
@ -128,7 +140,6 @@ func (c *client) RepoPost(opt RepoPostOptions) (*Repo, error) {
out := new(Repo) out := new(Repo)
uri, _ := url.Parse(fmt.Sprintf(pathRepoPost, c.addr)) uri, _ := url.Parse(fmt.Sprintf(pathRepoPost, c.addr))
uri.RawQuery = opt.QueryEncode() uri.RawQuery = opt.QueryEncode()
fmt.Println("!!!!!!!!!!", uri.String())
err := c.post(uri.String(), nil, out) err := c.post(uri.String(), nil, out)
return out, err return out, err
} }
@ -178,10 +189,11 @@ func (c *client) Registry(repoID int64, hostname string) (*Registry, error) {
} }
// RegistryList returns a list of all repository registries. // RegistryList returns a list of all repository registries.
func (c *client) RegistryList(repoID int64) ([]*Registry, error) { func (c *client) RegistryList(repoID int64, opt RegistryListOptions) ([]*Registry, error) {
var out []*Registry var out []*Registry
uri := fmt.Sprintf(pathRepoRegistries, c.addr, repoID) uri, _ := url.Parse(fmt.Sprintf(pathRepoRegistries, c.addr, repoID))
err := c.get(uri, &out) uri.RawQuery = opt.getURLQuery().Encode()
err := c.get(uri.String(), &out)
return out, err return out, err
} }
@ -216,10 +228,11 @@ func (c *client) Secret(repoID int64, secret string) (*Secret, error) {
} }
// SecretList returns a list of all repository secrets. // SecretList returns a list of all repository secrets.
func (c *client) SecretList(repoID int64) ([]*Secret, error) { func (c *client) SecretList(repoID int64, opt SecretListOptions) ([]*Secret, error) {
var out []*Secret var out []*Secret
uri := fmt.Sprintf(pathRepoSecrets, c.addr, repoID) uri, _ := url.Parse(fmt.Sprintf(pathRepoSecrets, c.addr, repoID))
err := c.get(uri, &out) uri.RawQuery = opt.getURLQuery().Encode()
err := c.get(uri.String(), &out)
return out, err return out, err
} }
@ -246,10 +259,11 @@ func (c *client) SecretDelete(repoID int64, secret string) error {
} }
// CronList returns a list of cronjobs for the specified repository. // CronList returns a list of cronjobs for the specified repository.
func (c *client) CronList(repoID int64) ([]*Cron, error) { func (c *client) CronList(repoID int64, opt CronListOptions) ([]*Cron, error) {
out := make([]*Cron, 0, 5) out := make([]*Cron, 0, 5)
uri := fmt.Sprintf(pathRepoCrons, c.addr, repoID) uri, _ := url.Parse(fmt.Sprintf(pathRepoCrons, c.addr, repoID))
return out, c.get(uri, &out) uri.RawQuery = opt.getURLQuery().Encode()
return out, c.get(uri.String(), &out)
} }
// CronCreate creates a new cron job for the specified repository. // CronCreate creates a new cron job for the specified repository.

View file

@ -16,6 +16,10 @@ type RepoListOptions struct {
All bool // query all repos, including inactive ones All bool // query all repos, including inactive ones
} }
type UserListOptions struct {
ListOptions
}
// QueryEncode returns the URL query parameters for the RepoListOptions. // QueryEncode returns the URL query parameters for the RepoListOptions.
func (opt *RepoListOptions) QueryEncode() string { func (opt *RepoListOptions) QueryEncode() string {
query := make(url.Values) query := make(url.Values)
@ -42,10 +46,11 @@ func (c *client) User(login string) (*User, error) {
} }
// UserList returns a list of all registered users. // UserList returns a list of all registered users.
func (c *client) UserList() ([]*User, error) { func (c *client) UserList(opt UserListOptions) ([]*User, error) {
var out []*User var out []*User
uri := fmt.Sprintf(pathUsers, c.addr) uri, _ := url.Parse(fmt.Sprintf(pathUsers, c.addr))
err := c.get(uri, &out) uri.RawQuery = opt.getURLQuery().Encode()
err := c.get(uri.String(), &out)
return out, err return out, err
} }

View file

@ -52,7 +52,7 @@ func TestClient_UserList(t *testing.T) {
defer ts.Close() defer ts.Close()
client := NewClient(ts.URL, http.DefaultClient) client := NewClient(ts.URL, http.DefaultClient)
users, err := client.UserList() users, err := client.UserList(UserListOptions{})
if tt.wantErr { if tt.wantErr {
assert.Error(t, err) assert.Error(t, err)