Documentation
¶
Index ¶
- Constants
- type GitApi
- func (ga *GitApi) Body() *string
- func (ga *GitApi) Del() *GitApi
- func (ga *GitApi) Do() *GitApi
- func (ga *GitApi) EndpointRepos() *GitApi
- func (ga *GitApi) EndpointReposSecrets() *GitApi
- func (ga *GitApi) EndpointReposSecretsPubkey() *GitApi
- func (ga *GitApi) EndpointReposTopics() *GitApi
- func (ga *GitApi) EndpointUserRepos() *GitApi
- func (ga *GitApi) Err() *string
- func (ga *GitApi) Get() *GitApi
- func (ga *GitApi) HeaderGithub() *GitApi
- func (ga *GitApi) HeaderInit() *GitApi
- func (ga *GitApi) New(name string, token string, entrypoint string, user string, vendor string, ...) *GitApi
- func (ga *GitApi) Ok() bool
- func (ga *GitApi) Output() *string
- func (ga *GitApi) Patch() *GitApi
- func (ga *GitApi) Post() *GitApi
- func (ga *GitApi) ProcessError() *GitApi
- func (ga *GitApi) ProcessOutput() *GitApi
- func (ga *GitApi) ProcessOutputError() *GitApi
- func (ga *GitApi) Put() *GitApi
- func (ga *GitApi) SetDel() *GitApi
- func (ga *GitApi) SetGet() *GitApi
- func (ga *GitApi) SetPatch() *GitApi
- func (ga *GitApi) SetPost() *GitApi
- func (ga *GitApi) SetPut() *GitApi
- type GitApiInfo
- type GitApiReq
- type GitApiRes
- type NilType
- type RepoDescription
- type RepoEncryptedPair
- type RepoError
- type RepoInfo
- type RepoInfoList
- type RepoPrivate
- type RepoPublicKey
- type RepoTopics
- type RepoVisibility
Constants ¶
const ( Vendor_Github = "github" Vendor_Gitea = "gitea" Vendor_Gogs = "gogs" )
GitApi supperted vendors
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitApi ¶
type GitApi struct {
Method string `json:"Method"` // Http request method
SkipVerify bool `json:"skipverify"` // Api request skip cert verify (allow self-signed cert)
Vendor string `json:"Vendor"` // github/gitea
Name string `json:"Name"` // Name of connection
Repo string `json:"Repo"` // Repository name
User string `json:"User"` // Api username
Req GitApiReq `json:"In"` // Api http input
Res GitApiRes `json:"Out"` // Api http output
Info GitApiInfo `json:"Info"` // Pointer to structure. Use NilType.Nil() for nil pointer
}
GitApi
func New ¶ added in v1.6.4
func New(name string, token string, entrypoint string, user string, vendor string, skipVerify bool, repo string, info GitApiInfo) *GitApi
Setup a *GitApi
func (*GitApi) Do ¶
Execute http request using info in GitApi.Req. Then put response info in GitApi.Res.
GitApi.Info, if not nil, will be - auto marshal for send other than "GET" - auto unmarshal from http response body
func (*GitApi) EndpointRepos ¶
Initialize endpoint /repos/OWNER/REPO
Use current directory if GitApi.Repo is empty
func (*GitApi) EndpointReposSecrets ¶
Initialize endpoint /repos/OWNER/REPO/actions/secrets
func (*GitApi) EndpointReposSecretsPubkey ¶
Initialize endpoint /repos/OWNER/REPO/actions/secrets/public-key
func (*GitApi) EndpointReposTopics ¶
Initialize endpoint /repos/OWNER/REPO/topics
func (*GitApi) EndpointUserRepos ¶
Initialize endpoint /user/repos
func (*GitApi) HeaderGithub ¶ added in v1.2.0
Set github/gitea header
GitApi.Req.Token, if empty, authorization header will not be set.
func (*GitApi) HeaderInit ¶ added in v1.2.5
Setup empty API header
func (*GitApi) New ¶ added in v1.6.4
func (ga *GitApi) New(name string, token string, entrypoint string, user string, vendor string, skipVerify bool, repo string, info GitApiInfo) *GitApi
Setup a *GitApi
func (*GitApi) ProcessError ¶ added in v1.5.0
Print HTTP Body Err into string pointer
func (*GitApi) ProcessOutput ¶ added in v1.1.0
Print HTTP Body into string pointer
func (*GitApi) ProcessOutputError ¶ added in v1.5.0
Print HTTP Body into string pointer
type GitApiInfo ¶
type GitApiInfo interface {
// *RepoEncryptedPair |
// *RepoPublicKey |
// *RepoPrivate |
// *RepoVisibility |
// *RepoDescription |
// *RepoTopics |
// *RepoInfo |
// *RepoInfoList |
// *NilType
StringP() *string
String() string
}
GitApi structures interface
type GitApiReq ¶ added in v1.3.0
type GitApiReq struct {
Entrypoint string `json:"Entrypoint"` // Api base url
Endpoint string `json:"Endpoint"` // Api endpoint
Token string `json:"Token"` // Api auth token
Header *http.Header `json:"Header"` // Http request header
UrlVal *url.Values `json:"UrlVal"` // Api url values
Data string `json:"Data"` // Json marshaled Info
}
GitApi http input structure
func (*GitApiReq) UrlValInit ¶ added in v1.3.0
func (gaReq *GitApiReq) UrlValInit()
Setup empty API url values
type GitApiRes ¶ added in v1.3.0
type GitApiRes struct {
Url *url.URL `json:"Url"` // In.Uri + In.Endpoint
Header *http.Header `json:"Header"` // Http response header
Status string `json:"Status"` // Http response status
Body *[]byte `json:"Body"`
Output *string `json:"Output"` // Api response body in string
Err string `json:"Err"`
}
GitApi http output structure
type NilType ¶
type NilType struct {
Nil *byte // Dummy pointer
}
This is used as a dummy type for nil GitApiInfo parameter
type RepoDescription ¶
type RepoDescription struct {
Description string `json:"description"`
}
Github repository description structure
func (*RepoDescription) String ¶
func (rDesc *RepoDescription) String() string
func (*RepoDescription) StringP ¶
func (rDesc *RepoDescription) StringP() *string
type RepoEncryptedPair ¶
type RepoEncryptedPair struct {
Encrypted_value string `json:"encrypted_value"` // Encrypted value
Key_id string `json:"key_id"` // Public key id
}
Github repository action secret structure
func (*RepoEncryptedPair) String ¶
func (rEncryptedPair *RepoEncryptedPair) String() string
func (*RepoEncryptedPair) StringP ¶
func (rEncryptedPair *RepoEncryptedPair) StringP() *string
type RepoError ¶ added in v1.5.0
type RepoError struct {
Errors string `json:"errors"`
Message string `json:"message"`
Status string `json:"status"`
}
Github uses message and status. Gitea uses message and errors.
type RepoInfoList ¶
type RepoInfoList []RepoInfo
Github repository(creation) info array
func (*RepoInfoList) String ¶
func (rInfoList *RepoInfoList) String() string
func (*RepoInfoList) StringP ¶
func (rInfoList *RepoInfoList) StringP() *string
type RepoPrivate ¶
type RepoPrivate struct {
Private bool `json:"private"`
}
Github repository private structure
func (*RepoPrivate) String ¶
func (rPrivate *RepoPrivate) String() string
func (*RepoPrivate) StringP ¶
func (rPrivate *RepoPrivate) StringP() *string
type RepoPublicKey ¶
Github repository public key structure
func (*RepoPublicKey) String ¶
func (rPKey *RepoPublicKey) String() string
func (*RepoPublicKey) StringP ¶
func (rPKey *RepoPublicKey) StringP() *string
type RepoTopics ¶
type RepoTopics struct {
Topics *[]string `json:"topics"` // Github topics is "Topics"
Names *[]string `json:"names"` // Gitea topics is "Names"
}
Github repository topics structure
func (*RepoTopics) String ¶
func (rTopics *RepoTopics) String() string
func (*RepoTopics) StringP ¶
func (rTopics *RepoTopics) StringP() *string
type RepoVisibility ¶
type RepoVisibility struct {
Visibility string `json:"visibility"`
}
Github repository visibility structure
func (*RepoVisibility) String ¶
func (rVisibility *RepoVisibility) String() string
func (*RepoVisibility) StringP ¶
func (rVisibility *RepoVisibility) StringP() *string
