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

Question: How to implement an enumeration type #67

Open
carstenmichel opened this issue Feb 9, 2021 · 1 comment
Open

Question: How to implement an enumeration type #67

carstenmichel opened this issue Feb 9, 2021 · 1 comment
Labels

Comments

@carstenmichel
Copy link

Hello,
the private API that I want to access needs an enumeration type in one of the parameters.
https://graphql.org/learn/schema/#enumeration-types
Is there a way to implement this with this library?
Many thanks

@dmitshur
Copy link
Member

Yes, enumeration types are supported. You can either define types and consts that correspond to the private API schema, for example:

type Episode string

const (
	EpisodeNewHope Episode = "NEWHOPE"
	EpisodeEmpire  Episode = "EMPIRE"
	EpisodeJedi    Episode = "JEDI"
)

And then use the type and individual values. Or you can use the const values directly.

Package githubv4, which builds on top of this general-purpose graphql package, defines Go identifiers for the GitHub API schema via code generation, see its enum.go file.

alexandear pushed a commit to alexandear/graphql that referenced this issue Jan 8, 2024
* support graphql-ws protocol
* add WithConnectionParamsFn method
* add tests and coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants