git

package
v0.0.0-...-5619ebe Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VISIBILITY_PUBLIC   = "public"
	VISIBILITY_UNLISTED = "unlisted"
	VISIBILITY_PRIVATE  = "private"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GitClient

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

An API client for git.sr.ht.

func NewGitClient

func NewGitClient(srhtClient *srht.SrhtClient) *GitClient

Creates a new git.sr.ht API client with the default upstream (https://git.sr.ht).

func (*GitClient) DeleteRepository

func (client *GitClient) DeleteRepository(name string) error

func (*GitClient) GetRepositories

func (client *GitClient) GetRepositories(start *int,
	owner string) (*GitRepositoryPager, error)

Returns a pager for enumerating a list git repositories owned by a user. If owner is an empty string, the authenticated user's repositories are listed.

func (*GitClient) GetRepository

func (client *GitClient) GetRepository(owner string,
	name string) (*GitRepository, error)

Fetches a single git repository. If owner is an empty string, the owner is assumed to be the authenticated user.

func (*GitClient) Origin

func (client *GitClient) Origin() string

Returns the upstream for this git.sr.ht API client.

func (*GitClient) PostRepository

func (client *GitClient) PostRepository(name string) *PostRepository

Initialize a request to create a new repository.

func (*GitClient) WithOrigin

func (client *GitClient) WithOrigin(origin string) *GitClient

Sets the upstream for this git.sr.ht API client to a particular SourceHut instance.

type GitRepository

type GitRepository struct {
	Id          int       `json:"id"`
	Created     time.Time `json:"-"`
	CreatedStr  string    `json:"created"`
	Description string    `json:"description"`
	Name        string    `json:"name"`
	Updated     time.Time `json:"-"`
	UpdatedStr  string    `json:"updated"`
	Visibility  string    `json:"visibility"`

	// Short-form user info for the repository owner
	Owner srht.User `json:"owner"`
}

A git repository

type GitRepositoryPager

type GitRepositoryPager struct {
	Next           *int             `json:"next,string"`
	Total          int              `json:"total"`
	Results        []*GitRepository `json:"results"`
	ResultsPerPage int              `json:"results_per_page"`
	// contains filtered or unexported fields
}

A pager for enumerating git repositories

func (*GitRepositoryPager) NextPage

func (pager *GitRepositoryPager) NextPage() error

Fetches the next page of results.

func (*GitRepositoryPager) Url

func (p *GitRepositoryPager) Url(start *int) string

Gets the URL for fetching a page of results from the given starting ID, or nil to fetch the first page.

type PostRepository

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

A request to create a new repository. Create this request with GitClient.PostRepository(), then call the functions provided to populate it with the repository details. Call PostRepository.Post() to perform the HTTP request, committing the changes.

func (*PostRepository) Description

func (repo *PostRepository) Description(desc string) *PostRepository

Sets the repository description field.

func (*PostRepository) Post

func (repo *PostRepository) Post() (*GitRepository, error)

Sends the API request, executing the repository creation.

func (*PostRepository) Visibility

func (repo *PostRepository) Visibility(vis string) *PostRepository

Sets the repository description field.

Jump to

Keyboard shortcuts

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