getRepositoryMeta fetches the node ID, database ID, and discussion-enabled flag for a repository.
(repo ghrepo.Interface)
| 830 | |
| 831 | // getRepositoryMeta fetches the node ID, database ID, and discussion-enabled flag for a repository. |
| 832 | func (c *discussionClient) getRepositoryMeta(repo ghrepo.Interface) (*repositoryMeta, error) { |
| 833 | var query struct { |
| 834 | Repository struct { |
| 835 | ID string |
| 836 | DatabaseId int64 |
| 837 | HasDiscussionsEnabled bool |
| 838 | } `graphql:"repository(owner: $owner, name: $name)"` |
| 839 | } |
| 840 | |
| 841 | variables := map[string]interface{}{ |
| 842 | "owner": githubv4.String(repo.RepoOwner()), |
| 843 | "name": githubv4.String(repo.RepoName()), |
| 844 | } |
| 845 | |
| 846 | if err := c.gql.Query(repo.RepoHost(), "RepositoryMetaForDiscussions", &query, variables); err != nil { |
| 847 | return nil, err |
| 848 | } |
| 849 | |
| 850 | return &repositoryMeta{ |
| 851 | ID: query.Repository.ID, |
| 852 | DatabaseId: query.Repository.DatabaseId, |
| 853 | HasDiscussionsEnabled: query.Repository.HasDiscussionsEnabled, |
| 854 | }, nil |
| 855 | } |
| 856 | |
| 857 | // ListLabels fetches all labels for a repository, ordered alphabetically by name. |
| 858 | func (c *discussionClient) ListLabels(repo ghrepo.Interface) ([]DiscussionLabel, error) { |
no test coverage detected