git

package
v0.0.0-...-af6bc0f Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package git provides an interface to the git.sr.ht API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides the functions available to the service.

func NewClient

func NewClient(token string) Client

NewClient constructs a new client for the git service. This client is used to make all further calls to the API and must be provided a personal access token which will be used within all requests.

func (*Client) CreateRepository

func (c *Client) CreateRepository(r *Repository) error

CreateRepository creates a repository on the service with the provided information. The provided struct will be updated with the ID of the repository.

func (*Client) DeleteRepository

func (c *Client) DeleteRepository(id int32) error

DeleteRepository instantly and permanently deletes a repository for the given ID. This is irreversible and permanent.

func (*Client) ReadRepository

func (c *Client) ReadRepository(id int32) (Repository, error)

ReadRepository returns a Repository struct filled with data for a repository with a given ID.

func (*Client) UpdateRepository

func (c *Client) UpdateRepository(r *Repository) error

UpdateRepository updates all the provided fields for the repository. All fields should be provided, any fields that are missing will be set to default values.

type RepoInput

type RepoInput struct {
	// Name is the name of the repository.
	Name string `json:"name"`
	// Visibility controls who is able to view the repository.
	Visibility Visibility `json:"visibility"`
	// Description can be a short summary of what the repository is for.
	Description string `json:"description"`
}

RepoInput are the fields of a repository that may be updated.

type Repository

type Repository struct {
	// ID is an automatically generated ID that can be used to reference the
	// repository in further calls.
	ID int32
	// Name is the name of the repository.
	Name string
	// Visibility controls who is able to view the repository.
	Visibility Visibility
	// Description can be a short summary of what the repository is for.
	Description string
}

Repository represents a single git repository on git.sr.ht.

type Visibility

type Visibility string

Visibility represents the different available visibility states.

const (
	VisibilityPublic   Visibility = "PUBLIC"
	VisibilityUnlisted Visibility = "UNLISTED"
	VisibilityPrivate  Visibility = "PRIVATE"
)

Visibility states of a git repository.

Jump to

Keyboard shortcuts

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