graphgit

package
v0.0.0-...-dcc6434 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DEBUG_ON = false

Variables

This section is empty.

Functions

This section is empty.

Types

type DependencyGraphManifestsResponse

type DependencyGraphManifestsResponse struct {
	Repository struct {
		DependencyGraphManifests struct {
			Edges []struct {
				Cursor string `json:"cursor"`
				Node   struct {
					Dependencies struct {
						Nodes []struct {
							PackageName string `json:"packageName"`
							Repository  struct {
								LicenseInfo struct {
									Name string `json:"name"`
								} `json:"licenseInfo"`
								PrimaryLanguage struct {
									Name string `json:"name"`
								} `json:"primaryLanguage"`
							} `json:"repository"`
						} `json:"nodes"`
						TotalCount int `json:"totalCount"`
					} `json:"dependencies"`
					DependenciesCount int `json:"dependenciesCount"`
				} `json:"node"`
			} `json:"edges"`
			PageInfo struct {
				EndCursor       string `json:"endCursor"`
				HasNextPage     bool   `json:"hasNextPage"`
				HasPreviousPage bool   `json:"hasPreviousPage"`
				StartCursor     string `json:"startCursor"`
			} `json:"pageInfo"`
			TotalCount int `json:"totalCount"`
		} `json:"dependencyGraphManifests"`
	} `json:"repository"`
}

DependencyGraphResponse is for the specific query performmed, anon struct types are used for the types.

type GithubRepositoriesResponse

type GithubRepositoriesResponse struct {
	Repos struct {
		RepositoryCount int `json:"repositoryCount"`
		PageInfo        struct {
			EndCursor   string `json:"endCursor"`
			StartCursor string `json:"startCursor"`
			HasNextPage bool   `json:"hasNextPage"`
		} `json:"pageInfo"`
		Edges []struct {
			Node struct {
				Name            string    `json:"name"`
				NameWithOwner   string    `json:"nameWithOwner"`
				CreatedAt       time.Time `json:"createdAt"`
				UpdatedAt       time.Time `json:"updatedAt"`
				PrimaryLanguage struct {
					Name string `json:"name"`
				} `json:"primaryLanguage"`
			} `json:"node"`
		} `json:"edges"`
	} `json:"repos"`
}

type ReposArg

type ReposArg struct {
	Org   string
	After string
	Since time.Time
}

ReposArg gets rid of a argument list and allows a refactor

type Service

type Service struct {
	// contains filtered or unexported fields
}

use graphql to get data from github for the repository

func NewService

func NewService() *Service

Return the Service

func (*Service) GHRequestJSON

func (service *Service) GHRequestJSON(org, after, since string) string

GHRequestJSON a helper function to build a graphql search query in string format The same query can be run at https://docs.github.com/en/graphql/overview/explorer

func (*Service) GetLicenses

func (service *Service) GetLicenses(owner, repo, after string) (*DependencyGraphManifestsResponse, error)

GetLicenses return the licenses

func (*Service) GetRepos

func (service *Service) GetRepos(in ReposArg) (*GithubRepositoriesResponse, error)

GetRepos make a http request to the graphql endpoint returning Repositories

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL