github

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MessageForEvent

func MessageForEvent(action string) string

MessageForEvent returns a description string with format specifiers for the passed GitHub action. To avoid confusion, the user who initiated an action (the actor) should always appear before the user affected by the action (the user).

Types

type Actor

type Actor struct {
	Type  string `json:"__typename"`
	Login string `json:"login,omitempty"` // Bot
	Name  string `json:"name,omitempty"`  // Organization or User
}

Actor represents the GitHub user who initiated the audit action.

type Client

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

Client wraps a GraphQL client for communicating with the GitHub API.

func NewClient

func NewClient(token string) *Client

NewClient instantiates a new GraphQL client.

func (Client) FetchAllAuditEvents

func (c Client) FetchAllAuditEvents(organisation string) (events []Node, err error)

FetchAllAuditEvents returns all audit log events for the passed organisation. The returned logs are sorted by their createdAt timestamp.

func (Client) Run

func (c Client) Run(request *graphql.Request, response interface{}) error

Run wraps the underlying graphql.Run function, authomatically adding an authentication header and background context.

type Node

type Node struct {
	ID                   string `json:"id"`
	Action               string `json:"action"`
	Actor                Actor
	BlockedUser          Actor
	CreatedAt            string `json:"createdAt"`
	Email                string `json:"email,omitempty"`
	MergeType            string `json:"mergeType,omitempty"`
	OauthApplicationName string `json:"oauthApplicationName,omitempty"`
	OrganizationName     string `json:"organizationName,omitempty"`
	ParentTeamName       string `json:"parentTeamName,omitempty"`
	Permission           string `json:"permission,omitempty"`
	PermissionWas        string `json:"permissionWas,omitempty"`
	RepositoryName       string `json:"repositoryName,omitempty"`
	TeamName             string `json:"teamName,omitempty"`
	TopicName            string `json:"topicName,omitempty"`
	User                 Actor
	Visibility           string `json:"visibility,omitempty"`
}

Node represents a node in the returned results graph.

type Organization

type Organization struct {
	AuditLog struct {
		TotalCount int
		PageInfo   PageInfo
		Nodes      []Node
	}
}

Organization represents a GitHub organisation.

type PageInfo

type PageInfo struct {
	StartCursor     string
	EndCursor       string
	HasPreviousPage bool
	HasNextPage     bool
}

PageInfo represents the pagination information returned from the query.

Jump to

Keyboard shortcuts

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