github

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package github provides a client for interacting with GitHub repositories as vaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRepoURL

func ParseRepoURL(repoURL string) (string, string, error)

ParseRepoURL parses a GitHub repository URL and returns owner and repo name. Supports HTTPS URLs: https://github.com/owner/repo. Supports SSH URLs: git@github.com:owner/repo.git. Supports short URLs: owner/repo.

func ReadFileFromStdin

func ReadFileFromStdin() ([]byte, error)

ReadFileFromStdin reads content from standard input.

Types

type Client

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

Client wraps the GitHub client and provides vault operations.

func NewClient

func NewClient(token, repoOwner, repoName string) (*Client, error)

NewClient creates a new GitHub client using the provided token and repo.

func NewClientFromURL

func NewClientFromURL(repoURL, token string) (*Client, error)

NewClientFromURL creates a new GitHub client from a repository URL and token. Supports HTTPS URLs like: https://github.com/owner/repo. Supports SSH URLs like: git@github.com:owner/repo.git.

func (*Client) CheckConnectivity

func (c *Client) CheckConnectivity(ctx context.Context) error

CheckConnectivity verifies that the token has access to the repository.

func (*Client) DeleteFile

func (c *Client) DeleteFile(ctx context.Context, path, sha, message string) error

DeleteFile deletes a file from the vault.

func (*Client) DownloadFile

func (c *Client) DownloadFile(ctx context.Context, path string) ([]byte, error)

DownloadFile downloads a file from the vault.

func (*Client) GetFileSHA

func (c *Client) GetFileSHA(ctx context.Context, path string) (string, error)

GetFileSHA returns the SHA of a file for update operations.

func (*Client) GetRepository

func (c *Client) GetRepository(ctx context.Context) (*github.Repository, error)

GetRepository returns the repository info.

func (*Client) ListFiles

func (c *Client) ListFiles(ctx context.Context) ([]vault.FileInfo, error)

ListFiles lists all files in the vault using the Tree API.

func (*Client) Owner

func (c *Client) Owner() string

Owner returns the authenticated user's login (repo owner).

func (*Client) Repo

func (c *Client) Repo() string

Repo returns the repository name.

func (*Client) RepoURL

func (c *Client) RepoURL() string

RepoURL returns the full repository URL.

func (*Client) UploadFile

func (c *Client) UploadFile(ctx context.Context, path string, content []byte, message string) error

UploadFile uploads or updates a file in the vault.

Jump to

Keyboard shortcuts

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