github

package
v0.0.0-...-c8f585d Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package github contains utilities for interacting with the Github API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(fl *flag.FlagSet) func() ContentStore

Types

type Client

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

func NewClient

func NewClient(token, owner, repo, branch string) *Client

func (*Client) CreateFile

func (cl *Client) CreateFile(ctx context.Context, msg, path string, content []byte) error

func (*Client) GetFile

func (cl *Client) GetFile(ctx context.Context, path string) (contents string, err error)

func (*Client) Ping

func (cl *Client) Ping(ctx context.Context) error

func (*Client) UpdateFile

func (cl *Client) UpdateFile(ctx context.Context, msg, path string, content []byte) error

type ContentStore

type ContentStore interface {
	GetFile(ctx context.Context, path string) (content string, err error)
	UpdateFile(ctx context.Context, msg, path string, content []byte) error
}

type ErrorClient

type ErrorClient struct {
	Error error
}

ErrorClient is a test client that just always returns an error.

func (ErrorClient) CreateFile

func (ec ErrorClient) CreateFile(ctx context.Context, msg, path string, content []byte) error

func (ErrorClient) GetFile

func (ec ErrorClient) GetFile(ctx context.Context, path string) (contents string, err error)

func (ErrorClient) UpdateFile

func (ec ErrorClient) UpdateFile(ctx context.Context, msg, path string, content []byte) error

type MockClient

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

func NewMockClient

func NewMockClient(dir string) *MockClient

func (*MockClient) CreateFile

func (mc *MockClient) CreateFile(ctx context.Context, msg, path string, content []byte) error

func (*MockClient) GetFile

func (mc *MockClient) GetFile(ctx context.Context, path string) (contents string, err error)

func (*MockClient) UpdateFile

func (mc *MockClient) UpdateFile(ctx context.Context, msg, path string, content []byte) error

Jump to

Keyboard shortcuts

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