Documentation ¶
Index ¶
- func CountFeatures(repo *git.Repository, tree *git.Tree, exclude *ignore.GitIgnore, ...) (int, int, error)
- func MakeRequest(changeset *MetaChangeset, organizationId string, baseUrl string, ...) (*http.Request, error)
- func Publish(changeset *MetaChangeset, organizationId string, baseUrl string, ...) (string, error)
- type Change
- type MetaChangeset
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountFeatures ¶ added in v0.0.7
func CountFeatures(repo *git.Repository, tree *git.Tree, exclude *ignore.GitIgnore, include *ignore.GitIgnore, countLines bool) (int, int, error)
CountFeatures counts how many lines of code, and how many files there are.
func MakeRequest ¶
func Publish ¶
func Publish(changeset *MetaChangeset, organizationId string, baseUrl string, username string, password string) (string, error)
Example ¶
changeset := &MetaChangeset{ Remote: "some-remote", UnixTime: 1644410531, OldShas: []string{"aaa"}, Sha: "bbb", Changes: make([]Change, 0), Loc: 9876, Files: 31, } req, err := MakeRequest(changeset, "1CCC7924-051C-496E-8467-D494C1C37B2A", "https://host.com", "anyone", "secret") if err != nil { fmt.Println(err.Error()) return } res := httptest.NewRecorder() ChangesetHandler := func(res http.ResponseWriter, req *http.Request) { txt, err := httputil.DumpRequest(req, true) if err != nil { fmt.Println(err.Error()) return } dumpedReq := strings.ReplaceAll(string(txt), "\r\n", "\n") fmt.Print(dumpedReq) } ChangesetHandler(res, req)
Output: POST /api/organization/1CCC7924-051C-496E-8467-D494C1C37B2A/changeset HTTP/1.1 Host: host.com Authorization: Basic YW55b25lOnNlY3JldA== Content-Type: application/vnd.smartbear.onereport.changeset.v1+json { "remote": "some-remote", "unixTime": 1644410531, "oldShas": [ "aaa" ], "sha": "bbb", "changes": [], "loc": 9876, "files": 31 }
Types ¶
type MetaChangeset ¶ added in v0.0.7
type MetaChangeset struct { Remote string `json:"remote"` UnixTime int64 `json:"unixTime"` OldShas []string `json:"oldShas"` Sha string `json:"sha"` Changes []Change `json:"changes"` // The total number of lines of code in Sha (filtered by .onereportinclude and .onereportexluce Loc int `json:"loc"` // The total number of files in Sha (filtered by .onereportinclude and .onereportexluce Files int `json:"files"` }
func MakeMetaChangeset ¶ added in v0.0.7
Click to show internal directories.
Click to hide internal directories.