Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Github GraphQL #14

Open
maogaz opened this issue Jul 8, 2021 · 2 comments
Open

Problems with Github GraphQL #14

maogaz opened this issue Jul 8, 2021 · 2 comments

Comments

@maogaz
Copy link

maogaz commented Jul 8, 2021

Im having problems using the gem to make queries with nodes inside. The next query doesnt work:

github_gql = GQLi::Github.create(github_access_token)
query = GQLi::DSL.query{
  organization(login: owner) {
    repository(name: name) {
      refs(last: 100, refPrefix: "refs/heads/") {
        totalCount ##-> This works
        nodes { ##-> Here doesnt work
          name
        }
      }
    }
  }
}
data = github_gql.execute(query)

But the next one works:

github_gql = GQLi::Github.create(github_access_token)
query = GQLi::DSL.query{
      organization(login: owner) {
        repository(name: name) {
          pullRequests(last: 100) {
            edges {
              node { ##-> It doesnt fall here
                headRefName
                commits(first: 100) {
                  totalCount
                  nodes{ ##-> it doesnt fall here
                    commit{
                      message
                      author{
                        user{ 
                          login
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
data = github_gql.execute(query)

With owner, name and github_access_token as parameters.

@dlitvakb
Copy link
Contributor

dlitvakb commented Jul 8, 2021

What is the error?

@maogaz
Copy link
Author

maogaz commented Jul 8, 2021

For example, i want to get all the branches of a repository, this is the Graphql Explorer query that works:

image
¨
And this is my query in my Ruby on Rails project:

image

and this is the error:

  • Console
    image

  • Postman
    image

Inside refs, nodes or node it can't be read, and i don't know why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants