1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
// Copyright Earl Warren <contact@earl-warren.org>
// Copyright Loïc Dachary <loic@dachary.org>
// SPDX-License-Identifier: MIT
package forgejo
import (
"context"
"code.forgejo.org/f3/gof3/v3/id"
"code.forgejo.org/f3/gof3/v3/kind"
options_http "code.forgejo.org/f3/gof3/v3/options/http"
f3_tree "code.forgejo.org/f3/gof3/v3/tree/f3"
"code.forgejo.org/f3/gof3/v3/tree/generic"
forgejo_sdk "code.forgejo.org/f3/gof3/v3/forges/forgejo/sdk"
"github.com/hashicorp/go-version"
)
func maybeMilestoneID(milestone *forgejo_sdk.Milestone) *int64 {
if milestone != nil {
id := milestone.ID
return &id
}
return nil
}
func labelListToIDs(labels []*forgejo_sdk.Label) []int64 {
ids := make([]int64, 0, len(labels))
for _, label := range labels {
ids = append(ids, label.ID)
}
return ids
}
type common struct {
generic.NullDriver
}
func (o *common) GetHelper() any {
panic("not implemented")
}
func (o *common) ListPage(ctx context.Context, page int) generic.ChildrenSlice {
return generic.NewChildrenSlice(0)
}
func (o *common) getTree() generic.TreeInterface {
return o.GetNode().GetTree()
}
func (o *common) getForge() *forge {
return o.getTree().GetRoot().GetChild(id.NewNodeID(f3_tree.KindForge)).GetDriver().(*forge)
}
func (o *common) getPageSize() int {
return o.getTreeDriver().GetPageSize()
}
func (o *common) getF3Tree() f3_tree.TreeInterface {
return o.getTree().(f3_tree.TreeInterface)
}
func (o *common) getKind() kind.Kind {
return o.GetNode().GetKind()
}
func (o *common) getChildDriver(kind kind.Kind) generic.NodeDriverInterface {
return o.GetNode().GetChild(id.NewNodeID(kind)).GetDriver()
}
func (o *common) getProject() *project {
return f3_tree.GetProject(o.GetNode()).GetDriver().(*project)
}
func (o *common) isContainer() bool {
return o.getF3Tree().IsContainer(o.getKind())
}
func (o *common) getPushURL() string {
return o.getTreeDriver().options.GetPushURL()
}
func (o *common) getNewMigrationHTTPClient() options_http.NewMigrationHTTPClientFun {
return o.getTreeDriver().options.GetNewMigrationHTTPClient()
}
func (o *common) getTreeDriver() *treeDriver {
return o.GetTreeDriver().(*treeDriver)
}
func (o *common) getIsAdmin() bool {
return o.getTreeDriver().GetIsAdmin()
}
func (o *common) getClient() *forgejo_sdk.Client {
return o.getTreeDriver().GetClient()
}
func (o *common) maybeSudoName(name string) {
o.getTreeDriver().MaybeSudoName(name)
}
func (o *common) maybeSudoID(ctx context.Context, id int64) {
o.getTreeDriver().maybeSudoID(ctx, id)
}
func (o *common) notSudo() {
o.getTreeDriver().NotSudo()
}
func (o *common) getVersion() *version.Version {
return o.getTreeDriver().GetVersion()
}
func (o *common) IsNull() bool { return false }
|