internal

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTrailingGarbage = errors.New("trailing garbage in JSON file")

Functions

func AppName

func AppName() string

AppName is what the app will call itself. When customizing, overwrite it before calling Main().

func CheckCanCustomize

func CheckCanCustomize()

func CheckLockedDown

func CheckLockedDown()

func FilterSlice

func FilterSlice[E any, S ~[]E](s S, f func(E) bool) S

func IsHTTPOk

func IsHTTPOk(r *http.Response) bool

func IsNotFound

func IsNotFound(err error) bool

func LockCustomizations

func LockCustomizations()

func Must

func Must[T any](v T, err error) T

func Ptr

func Ptr[T any](t T) *T

func ReadJSONFile

func ReadJSONFile[T any](name string) (T, error)

func SetAppName

func SetAppName(name string)

func ValueOrDefault

func ValueOrDefault[T any](p *T, d T) T

func ValueOrZero

func ValueOrZero[T any](p *T) T

func WithToken

func WithToken(token string) ghClientOpt

Types

type GitHubClient

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

GitHubClient provides a rudimentary client for acccessing GitHub resources over its REST api, without pulling in large dependencies.

func NewGitHubClient

func NewGitHubClient(opts ...ghClientOpt) *GitHubClient

func (*GitHubClient) Do

func (c *GitHubClient) Do(req *http.Request) (*http.Response, error)

func (*GitHubClient) DoAndParse

func (c *GitHubClient) DoAndParse(req *http.Request, respData any) error

func (*GitHubClient) Download

func (c *GitHubClient) Download(ctx context.Context, url string) (*http.Response, error)

func (*GitHubClient) Get

func (c *GitHubClient) Get(ctx context.Context, path string, respData any) error

func (*GitHubClient) Release

func (c *GitHubClient) Release(ctx context.Context, owner, repo, tag string) (*GitHubRelease, error)

type GitHubRelease

type GitHubRelease struct {
	Assets []GitHubReleaseAsset `json:"assets"`
}

type GitHubReleaseAsset

type GitHubReleaseAsset struct {
	URL string `json:"url"`

	Name        string `json:"name"`
	Label       string `json:"label"`
	ContentType string `json:"content_type"`
	Size        int    `json:"size"`
}

type HTTPError

type HTTPError struct {
	Resp *http.Response
	Body []byte
	Err  error
}

func HTTPResponseErr

func HTTPResponseErr(
	r *http.Response,
	msg string,
) *HTTPError

func (*HTTPError) Error

func (e *HTTPError) Error() string

func (*HTTPError) StatusCode

func (e *HTTPError) StatusCode() int

StatusCode implements internal.StatusCodeErr

type NoCopy added in v0.2.0

type NoCopy struct{}

func (NoCopy) Lock added in v0.2.0

func (NoCopy) Lock()

func (NoCopy) Unlock added in v0.2.0

func (NoCopy) Unlock()

type StatusCodeErr

type StatusCodeErr interface {
	StatusCode() int
}

Jump to

Keyboard shortcuts

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