MCPcopy Create free account
hub / github.com/cli/cli / ProjectFields

Method ProjectFields

pkg/cmd/project/shared/queries/queries.go:1080–1124  ·  view source on GitHub ↗

ProjectFields returns a project with fields. If the OwnerType is VIEWER, no login is required. If limit is 0, the default limit is used.

(o *Owner, number int32, limit int)

Source from the content-addressed store, hash-verified

1078// ProjectFields returns a project with fields. If the OwnerType is VIEWER, no login is required.
1079// If limit is 0, the default limit is used.
1080func (c *Client) ProjectFields(o *Owner, number int32, limit int) (*Project, error) {
1081 project := &Project{}
1082 if limit == 0 {
1083 limit = LimitDefault
1084 }
1085
1086 // set first to the min of limit and LimitMax
1087 first := min(limit, LimitMax)
1088 variables := map[string]any{
1089 "firstItems": githubv4.Int(LimitMax),
1090 "afterItems": (*githubv4.String)(nil),
1091 "firstFields": githubv4.Int(first),
1092 "afterFields": (*githubv4.String)(nil),
1093 "number": githubv4.Int(number),
1094 }
1095
1096 var query pager[ProjectField]
1097 var queryName string
1098 switch o.Type {
1099 case UserOwner:
1100 variables["login"] = githubv4.String(o.Login)
1101 query = &userOwnerWithFields{}
1102 queryName = "UserProjectWithFields"
1103 case OrgOwner:
1104 variables["login"] = githubv4.String(o.Login)
1105 query = &orgOwnerWithFields{}
1106 queryName = "OrgProjectWithFields"
1107 case ViewerOwner:
1108 query = &viewerOwnerWithFields{}
1109 queryName = "ViewerProjectWithFields"
1110 }
1111 err := c.doQueryWithProgressIndicator(queryName, query, variables)
1112 if err != nil {
1113 return project, err
1114 }
1115 project = query.Project()
1116
1117 fields, err := paginateAttributes(c, query, variables, queryName, "firstFields", "afterFields", limit, query.Nodes())
1118 if err != nil {
1119 return project, err
1120 }
1121
1122 project.Fields.Nodes = fields
1123 return project, nil
1124}
1125
1126// viewerLogin is used to query the Login of the viewer.
1127type viewerLogin struct {

Callers 6

runListFunction · 0.80
runListFunction · 0.80
resolveItemEditNamesFunction · 0.80

Calls 5

paginateAttributesFunction · 0.85
StringMethod · 0.65
ProjectMethod · 0.65
NodesMethod · 0.65

Tested by 3