Documentation ¶
Index ¶
- Constants
- func URLEncoded(path string) string
- type Client
- func (c *Client) BuildAPI(path string) string
- func (c *Client) BuildFileDownloadURL(projectID, filePath, ref string, private bool) string
- func (c *Client) CreateFile(data *CreateFileData) (*CreateFileResponse, error)
- func (c *Client) DeleteFile(data *DeleteFileData) error
- func (c *Client) GetCurrentAuthenticatedUser() (*User, error)
- func (c *Client) GetFile(projectID, filePath, ref string) (*FileInfo, error)
- func (c *Client) GetProject(id string) (*Project, error)
- func (c *Client) ListRepoTree(projectID string, params *ListRepoTreeParams) ([]*FileNode, error)
- func (c *Client) Request(method, path string, headers http.Header, data interface{}, params url.Values) (*http.Response, error)
- func (c *Client) UpdateFile(data *UpdateFileData) (*UpdateFileResponse, error)
- type ContentEncoding
- type CreateFileData
- type CreateFileResponse
- type DeleteFileData
- type FileInfo
- type FileNode
- type FileNodeType
- type ListRepoTreeParams
- type Project
- type UpdateFileData
- type UpdateFileResponse
- type User
Constants ¶
View Source
const ( APIVersion = "/api/v4" BaseURLJihuLab = "https://jihulab.com" BaseURLGitLabURL = "https://gitlab.com" )
View Source
const PerPageMax = 100
Variables ¶
This section is empty.
Functions ¶
func URLEncoded ¶
Types ¶
type Client ¶
func (*Client) BuildFileDownloadURL ¶
func (*Client) CreateFile ¶
func (c *Client) CreateFile(data *CreateFileData) (*CreateFileResponse, error)
CreateFile https://docs.gitlab.com/ee/api/repository_files.html#create-new-file-in-repository
func (*Client) DeleteFile ¶
func (c *Client) DeleteFile(data *DeleteFileData) error
func (*Client) GetCurrentAuthenticatedUser ¶
func (*Client) GetFile ¶
GetFile https://docs.gitlab.com/ee/api/repository_files.html#get-file-from-repository
func (*Client) ListRepoTree ¶
func (c *Client) ListRepoTree(projectID string, params *ListRepoTreeParams) ([]*FileNode, error)
ListRepoTree https://docs.gitlab.com/ee/api/repositories.html#list-repository-tree
func (*Client) UpdateFile ¶
func (c *Client) UpdateFile(data *UpdateFileData) (*UpdateFileResponse, error)
UpdateFile https://docs.gitlab.com/ee/api/repository_files.html#update-existing-file-in-repository
type ContentEncoding ¶
type ContentEncoding string
const ( ContentEncodingBase64 ContentEncoding = "base64" ContentEncodingText ContentEncoding = "text" )
type CreateFileData ¶
type CreateFileData struct { ProjectID string `json:"-"` FilePath string `json:"-"` Branch string `json:"branch"` Content string `json:"content"` Encoding ContentEncoding `json:"encoding,omitempty"` AuthorEmail string `json:"author_email,omitempty"` AuthorName string `json:"author_name,omitempty"` CommitMessage string `json:"commit_message"` StartBranch string `json:"start_branch,omitempty"` }
func (*CreateFileData) GetFilePath ¶
func (d *CreateFileData) GetFilePath() string
func (*CreateFileData) GetProjectID ¶
func (d *CreateFileData) GetProjectID() string
func (*CreateFileData) Validate ¶
func (d *CreateFileData) Validate() error
type CreateFileResponse ¶
type DeleteFileData ¶
type DeleteFileData struct { ProjectID string `json:"-"` FilePath string `json:"-"` Branch string `json:"branch"` AuthorEmail string `json:"author_email,omitempty"` AuthorName string `json:"author_name,omitempty"` CommitMessage string `json:"commit_message"` StartBranch string `json:"start_branch,omitempty"` LastCommitID string `json:"last_commit_id,omitempty"` }
func (*DeleteFileData) GetFilePath ¶
func (d *DeleteFileData) GetFilePath() string
func (*DeleteFileData) GetProjectID ¶
func (d *DeleteFileData) GetProjectID() string
func (*DeleteFileData) Validate ¶
func (d *DeleteFileData) Validate() error
type FileInfo ¶
type FileInfo struct { FileName string `json:"file_name"` FilePath string `json:"file_path"` Size int64 `json:"size"` Encoding string `json:"encoding"` Content string `json:"content"` ContentSHA256 string `json:"content_sha256"` Ref string `json:"ref"` BlobID string `json:"blob_id"` CommitID string `json:"commit_id"` LastCommitID string `json:"last_commit_id"` }
func (*FileInfo) GetHumanSize ¶
type FileNode ¶
type FileNode struct { ID string `json:"id"` Name string `json:"name"` Type FileNodeType `json:"type"` Path string `json:"path"` Mode string `json:"mode"` }
type FileNodeType ¶
type FileNodeType string
const ( FileNodeTypeBlob FileNodeType = "blob" FileNodeTypeTree FileNodeType = "tree" )
type ListRepoTreeParams ¶
type ListRepoTreeParams struct { Path string `url:"path,omitempty"` Ref string `url:"ref,omitempty"` Recursive bool `url:"recursive,omitempty"` Page int `url:"page,omitempty"` PerPage int `url:"per_page,omitempty"` // default: 20, max: 100, https://docs.gitlab.com/ee/api/index.html#pagination }
func (*ListRepoTreeParams) IntoValues ¶
func (p *ListRepoTreeParams) IntoValues() (url.Values, error)
type Project ¶
type Project struct { ID int `json:"id"` Description string `json:"description"` DefaultBranch string `json:"default_branch"` Visibility string `json:"visibility"` Path string `json:"path"` PathWithNamespace string `json:"path_with_namespace"` Name string `json:"name"` NameWithNamespace string `json:"name_with_namespace"` }
type UpdateFileData ¶
type UpdateFileData struct { CreateFileData LastCommitID string `json:"last_commit_id,omitempty"` }
type UpdateFileResponse ¶
type UpdateFileResponse CreateFileResponse
Click to show internal directories.
Click to hide internal directories.