xgit

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiURL         = "https://api.github.com/repos/%s/%s/contents/%s"
	TagURL         = "https://api.github.com/repos/%s/%s/tags"
	CdnURL         = "https://cdn.jsdelivr.net/gh/%s/%s/%s"
	DefaultMessage = "operate by brick"
)

Client https://docs.github.com/cn/rest/reference/repos#contents

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Repo        string `json:"repo" `
	Owner       string `json:"owner"`
	Email       string `json:"email"`
	AccessToken string `json:"access_token"`
}

Client ...

func New

func New(repo string, owner string, email string, accessToken string) *Client

New ...

func (*Client) Api

func (t *Client) Api(path string) string

Api ...

func (*Client) Delete

func (t *Client) Delete(ctx context.Context, path string) error

Delete 删除文件

func (*Client) Get

func (t *Client) Get(ctx context.Context, path string) (string, error)

Get 获取文件

func (*Client) GetCdnUrl

func (t *Client) GetCdnUrl(path string) string

GetCdnUrl 获取文件链接

func (*Client) GetContent

func (t *Client) GetContent(ctx context.Context, path string) string

GetContent ...

func (*Client) GetLastVersion

func (t *Client) GetLastVersion(ctx context.Context) string

GetLastVersion 获取应用最后版本号

func (*Client) Request

func (t *Client) Request(
	ctx context.Context,
	method string,
	url string,
	data string,
) (string, error)

Request ...

func (*Client) Response

func (t *Client) Response(resp string) (string, error)

Response ...

func (*Client) Sha

func (t *Client) Sha(ctx context.Context, path string) string

Sha ...

func (*Client) Update

func (t *Client) Update(
	ctx context.Context,
	path string,
	content string,
	messages ...string,
) error

Update 新增或更新文件

Jump to

Keyboard shortcuts

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