MCPcopy
hub / github.com/cli/cli / getRepositoryMeta

Method getRepositoryMeta

pkg/cmd/discussion/client/client.go:832–855  ·  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

830
831// getRepositoryMeta fetches the node ID, database ID, and discussion-enabled flag for a repository.
832func (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.
858func (c *discussionClient) ListLabels(repo ghrepo.Interface) ([]DiscussionLabel, error) {

Callers 4

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

Calls 5

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

Tested by

no test coverage detected