8000 Query to get project planning board · Issue #119 · shurcooL/githubv4 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Query to get project planning board  #119
Open
@Kartikey-star

Description

@Kartikey-star

I am trying to follow the https://docs.github.com/en/issues/planning-and-tracking-with-projects/automating-your-project/using-the-api-to-manage-projects?tool=cli [Finding the node ID of a field](https://docs.github.com/en/issues/planning-and-tracking-with-projects/automating-your-project/using-the-api-to-manage-projects?tool=cli#finding-the-node-id-of-a-field).

The query being used here is :

gh api graphql -f query='
query{
node(id: "PROJECT_ID") {
... on ProjectV2 {
fields(first: 20) {
nodes {
... on ProjectV2Field {
id
name
}
... on ProjectV2IterationField {
id
name
configuration {
iterations {
startDate
id
}
}
}
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}'

I am trying to convert this query to a golang struct and use the following:

type (
ProjectV2IterationFieldFragment struct {
id string
name string
configuration struct {
iterations struct {
startDate string
id string
}
}
}
ProjectV2SingleSelectFieldFragment struct {
id string
name string
options struct {
id string
name string
}
}
)

var projquery struct {
	Node struct {
		fields struct {
			Nodes struct {
				Id    string
				Title string
			} `graphql:"... on ProjectV2Field "`
			ProjectV2IterationFieldFragment    `graphql:"... on ProjectV2IterationField "`
			ProjectV2SingleSelectFieldFragment `graphql:"... on ProjectV2SingleSelectField "`
		} `graphql:"... on ProjectV2"`
	} `graphql:"node(id:\"my_project_id\")"`
}

The error which i get here is Fragment on ProjectV2Field can't be spread inside ProjectV2. What wrong am i doing here?

Other than that do you have a recommended resource which can help us getting familiar with converting graphql queries to structs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0