github

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthRoundTripperFromAppCredentials

func AuthRoundTripperFromAppCredentials(ctx context.Context, base http.RoundTripper, appId, installationId int64, pKey []byte) (http.RoundTripper, error)

func AuthRoundTripperFromToken

func AuthRoundTripperFromToken(ctx context.Context, base http.RoundTripper, token string) (http.RoundTripper, error)

func RateLimitRoundTripper

func RateLimitRoundTripper(ctx context.Context, base http.RoundTripper, opts ...github_ratelimit.Option) (http.RoundTripper, error)

Types

type App

type App struct {
	Id         string
	DatabaseId int64
	Slug       string
}

type BranchActorAllowanceActor

type BranchActorAllowanceActor struct {
	App  App  `graphql:"... on App"`
	Team Team `graphql:"... on Team"`
	User User `graphql:"... on User"`
}

Used for: - BypassPullRequestAllowance - BypassForcePushAllowance

type BranchActorAllowanceActors

type BranchActorAllowanceActors struct {
	Users []User
	Apps  []App
	Teams []Team
}

TODO: these are distinct in GitHub, but can probably reduce redundancy

type BranchProtection

type BranchProtection struct {
	AllowsDeletions             bool
	AllowsForcePushes           bool
	BlocksCreations             bool
	BypassForcePushAllowances   BypassForcePushAllowances   `graphql:"bypassForcePushAllowances(first: 100)"`
	BypassPullRequestAllowances BypassPullRequestAllowances `graphql:"bypassPullRequestAllowances(first: 100)"`
	DismissesStaleReviews       bool
	Id                          string
	IsAdminEnforced             bool
	LockAllowsFetchAndMerge     bool
	LockBranch                  bool
	// TODO: future feature
	// MatchingRefs
	Pattern        string
	PushAllowances PushAllowances `graphql:"pushAllowances(first: 100)"`
	Repository     struct {
		Id         string
		DatabaseId int64
		Name       string
		Owner      struct {
			Login string
			Id    string
		}
	}
	RequireLastPushApproval        bool
	RequiredApprovingReviewCount   int64
	RequiredDeploymentEnvironments []string
	RequiredStatusCheckContexts    []string
	RequiredStatusChecks           []RequiredStatusCheckDescription
	RequiresApprovingReviews       bool
	RequiresCodeOwnerReviews       bool
	RequiresCommitSignatures       bool
	RequiresConversationResolution bool
	RequiresDeployments            bool
	RequiresLinearHistory          bool
	RequiresStatusChecks           bool
	RequiresStrictStatusChecks     bool
	RestrictsPushes                bool
	RestrictsReviewDismissals      bool
	ReviewDismissalAllowances      ReviewDismissalAllowances `graphql:"reviewDismissalAllowances(first: 100)"`
}

func (*BranchProtection) GetBypassForcePushAllowances

func (bp *BranchProtection) GetBypassForcePushAllowances() *BranchActorAllowanceActors

func (*BranchProtection) GetBypassPullRequestAllowances

func (bp *BranchProtection) GetBypassPullRequestAllowances() *BranchActorAllowanceActors

func (*BranchProtection) GetPushAllowances

func (bp *BranchProtection) GetPushAllowances() *PushAllowanceActors

func (*BranchProtection) GetReviewDismissalAllowances

func (bp *BranchProtection) GetReviewDismissalAllowances() *ReviewDismissalAllowanceActors

type BypassForcePushAllowances

type BypassForcePushAllowances struct {
	Nodes []struct {
		Actor BranchActorAllowanceActor
	}
	PageInfo PageInfo
}

type BypassPullRequestAllowances

type BypassPullRequestAllowances struct {
	Nodes []struct {
		Actor BranchActorAllowanceActor
	}
	PageInfo PageInfo
}

type Client

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

func NewClient

func NewClient(opts ...ClientOption) (*Client, error)

func (*Client) CreateBranchProtection

func (c *Client) CreateBranchProtection(ctx context.Context, input *githubv4.CreateBranchProtectionRuleInput) (*BranchProtection, error)

func (*Client) CreateRepository

func (c *Client) CreateRepository(ctx context.Context, org string, create *github.Repository) (*github.Repository, error)

Pass empty string as org to create a user-owned repo

func (*Client) CreateRepositoryFromTemplate

func (c *Client) CreateRepositoryFromTemplate(ctx context.Context, templateOwner string, templateRepository string, req *github.TemplateRepoRequest) (*github.Repository, error)

Pass empty string as org to create a user-owned repo

func (*Client) CreateTeam

func (c *Client) CreateTeam(ctx context.Context, org string, newTeam github.NewTeam) (*github.Team, error)

func (*Client) DeleteBranchProtection

func (c *Client) DeleteBranchProtection(ctx context.Context, input *githubv4.DeleteBranchProtectionRuleInput) error

func (*Client) DeleteOrganization

func (c *Client) DeleteOrganization(ctx context.Context, login string) error

func (*Client) DeleteRepositoryByName

func (c *Client) DeleteRepositoryByName(ctx context.Context, owner, name string) error

func (*Client) DeleteTeamById

func (c *Client) DeleteTeamById(ctx context.Context, org, slug int64) error

func (*Client) DeleteTeamBySlug

func (c *Client) DeleteTeamBySlug(ctx context.Context, org, slug string) error

func (*Client) GetBranchProtection

func (c *Client) GetBranchProtection(ctx context.Context, nodeId string) (*BranchProtection, error)

func (*Client) GetBranchProtectionByOwnerRepoPattern

func (c *Client) GetBranchProtectionByOwnerRepoPattern(ctx context.Context, repositoryOwner, repositoryName, pattern string) (*BranchProtection, error)

this is inefficient and should ideally not be used

func (*Client) GetOrganization

func (c *Client) GetOrganization(ctx context.Context, login string) (*github.Organization, error)

func (*Client) GetOrganizationByDatabaseId

func (c *Client) GetOrganizationByDatabaseId(ctx context.Context, dbId int64) (*github.Organization, error)

func (*Client) GetOrganizationByNodeId

func (c *Client) GetOrganizationByNodeId(ctx context.Context, nodeId string) (*github.Organization, error)

func (*Client) GetRepositoryByDatabaseId

func (c *Client) GetRepositoryByDatabaseId(ctx context.Context, dbId int64) (*github.Repository, error)

func (*Client) GetRepositoryByName

func (c *Client) GetRepositoryByName(ctx context.Context, owner string, name string) (*github.Repository, error)

Repositories

func (*Client) GetRepositoryByNodeId

func (c *Client) GetRepositoryByNodeId(ctx context.Context, nodeId string) (*github.Repository, error)

func (*Client) GetTeamById

func (c *Client) GetTeamById(ctx context.Context, orgId, teamId int64) (*github.Team, error)

func (*Client) GetTeamByNodeId

func (c *Client) GetTeamByNodeId(ctx context.Context, nodeId string) (*github.Team, error)

func (*Client) GetTeamBySlug

func (c *Client) GetTeamBySlug(ctx context.Context, org, slug string) (*github.Team, error)

Teams

func (*Client) GetTeamRepositoryPermission

func (c *Client) GetTeamRepositoryPermission(ctx context.Context, org, slug, repoName string) (*TeamRepositoryPermission, error)

assume repo is in the same org as team

func (*Client) GetTeamRepositoryPermissions

func (c *Client) GetTeamRepositoryPermissions(ctx context.Context, org, slug string) ([]*TeamRepositoryPermission, error)

assume repo is in the same org as team

func (*Client) RemoveTeamRepositoryPermissions

func (c *Client) RemoveTeamRepositoryPermissions(ctx context.Context, org, slug string, repoName string) error

func (*Client) UpdateBranchProtection

func (c *Client) UpdateBranchProtection(ctx context.Context, input *githubv4.UpdateBranchProtectionRuleInput) (*BranchProtection, error)

func (*Client) UpdateOrganization

func (c *Client) UpdateOrganization(ctx context.Context, login string, updateOrg *github.Organization) (*github.Organization, error)

func (*Client) UpdateRepositoryByName

func (c *Client) UpdateRepositoryByName(ctx context.Context, owner, name string, update *github.Repository) (*github.Repository, error)

func (*Client) UpdateRepositoryTopics

func (c *Client) UpdateRepositoryTopics(ctx context.Context, owner string, repo string, topics []string) ([]string, error)

func (*Client) UpdateTeamById

func (c *Client) UpdateTeamById(ctx context.Context, org, teamId int64, newTeam github.NewTeam) (*github.Team, error)

func (*Client) UpdateTeamBySlug

func (c *Client) UpdateTeamBySlug(ctx context.Context, org, slug string, newTeam github.NewTeam) (*github.Team, error)

func (*Client) UpdateTeamRepositoryPermissions

func (c *Client) UpdateTeamRepositoryPermissions(ctx context.Context, org, slug string, repoName, permission string) error

type ClientOption

type ClientOption = func(*Client) error

func WithHttpClient

func WithHttpClient(client *http.Client) ClientOption

func WithRoundTripper

func WithRoundTripper(rt http.RoundTripper) ClientOption

type Conflict

type Conflict struct {
	ConflictingPattern string
	ConflictingRefName string
}

type OrganizationNotFoundError

type OrganizationNotFoundError struct {
	Login      *string
	DatabaseId *int64
}

func (*OrganizationNotFoundError) Error

func (e *OrganizationNotFoundError) Error() string

type PageInfo

type PageInfo struct {
	EndCursor   string
	HasNextPage bool
}

type PushAllowanceActor

type PushAllowanceActor struct {
	App  App  `graphql:"... on App"`
	Team Team `graphql:"... on Team"`
	User User `graphql:"... on User"`
}

Used for: - PushAllowances

type PushAllowanceActors

type PushAllowanceActors struct {
	Users []User
	Apps  []App
	Teams []Team
}

type PushAllowances

type PushAllowances struct {
	Nodes []struct {
		Actor PushAllowanceActor
	}
	PageInfo PageInfo
}

type RepositoryNotFoundError

type RepositoryNotFoundError struct {
	OwnerLogin *string
	OwnerId    *int64
	Slug       *string
	Id         *int64
}

func (*RepositoryNotFoundError) Error

func (e *RepositoryNotFoundError) Error() string

type RequiredStatusCheckDescription

type RequiredStatusCheckDescription struct {
	App     App
	Context string
}

type ReviewDismissalAllowanceActor

type ReviewDismissalAllowanceActor struct {
	App  App  `graphql:"... on App"`
	Team Team `graphql:"... on Team"`
	User User `graphql:"... on User"`
}

Used for: - ReviewDismissalAllowances

type ReviewDismissalAllowanceActors

type ReviewDismissalAllowanceActors struct {
	Users []User
	Apps  []App
	Teams []Team
}

type ReviewDismissalAllowances

type ReviewDismissalAllowances struct {
	Nodes []struct {
		Actor ReviewDismissalAllowanceActor
	}
	PageInfo PageInfo
}

type Team

type Team struct {
	Id   string
	Slug string
}

type TeamNotFoundError

type TeamNotFoundError struct {
	OrgSlug  *string
	OrgId    *int64
	TeamSlug *string
	TeamId   *int64
}

func (*TeamNotFoundError) Error

func (e *TeamNotFoundError) Error() string

type TeamRepositoryPermission

type TeamRepositoryPermission struct {
	OrganizationLogin string
	TeamSlug          string
	RepositoryName    string
	RepositoryId      string
	Permission        string
}

type User

type User struct {
	Id    string
	Login string
}

Jump to

Keyboard shortcuts

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