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

Method getRepositoryMeta

pkg/cmd/discussion/client/client.go:829–852  ·  view source on GitHub ↗

getRepositoryMeta fetches the node ID, database ID, and discussion-enabled flag for a repository.

(repo ghrepo.Interface)

Source from the content-addressed store, hash-verified

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

Callers 4

GetByNumberMethod · 0.95
GetWithCommentsMethod · 0.95
CreateMethod · 0.95
ResolveCommentNodeIDMethod · 0.95

Calls 5

StringMethod · 0.65
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
QueryMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected