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

Method ProjectFields

pkg/cmd/project/shared/queries/queries.go:1083–1130  ·  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

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