Skip to content

J-Siu/go-gitapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-gitapi Paypal donate

Golang Github/Gitea api library using go-restapi.

Table Of Content

api.go

func (t *GitApi) EndpointRepos() *GitApi
func (t *GitApi) EndpointReposActionsGithub() *GitApi
func (t *GitApi) EndpointReposSecrets() *GitApi
func (t *GitApi) EndpointReposSecretsPubkey() *GitApi
func (t *GitApi) EndpointReposTopics() *GitApi
func (t *GitApi) EndpointUserRepos() *GitApi
func (t *GitApi) HeaderGithub() *GitApi
func (t *GitApi) HeaderInit() *GitApi
func (t *GitApi) New(property *Property) *GitApi
func New(property *Property) *GitApi
type IInfo interface

Repo Struct

type EncryptedPair struct
type PublicKey struct
type Private struct
type Visibility struct
type Description struct
type Topics struct
type Info struct
type Error struct
type InfoList []IInfo

Pro

  • Easy to extend
  • Small size

Doc

Dependency

Supported git repository services

  • gitea
  • github
  • gogs

Usage Example

Following is code to create a new repository:

  1. Prepare a GitApi data structure

    var info gitapi.RepoInfo
    info.Name = "test"
    info.Private = remote.Private
  2. Setup and execute

    property = gitapi.Property{
      // Debug:      true,
      EntryPoint: "https://api.github.com",
      Info:       &repoList,
      Name:       "Test",
      User:       "User",
      Token:      "01234567890123456789012345678912",
      Vendor:     gitapi.VendorGithub,
      SkipVerify: false,
    }
    
    // Get instance
    gitApi := gitapi.New(&property)
    // Setup endpoint
    gitApi.EndpointRepos()
    // Setup Github header
    gitApi.HeaderGithub()
    // Set http method: Post
    gitApi.SetPost()
    // Do request
    success := gitApi.Do().Ok()

Used By Project

Repository

Contributors

License

The MIT License (MIT)

Copyright © 2025 John, Sing Dao, Siu [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

API library supporting github/gitea.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages