docs(forgegen): expand generated usage examples
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
09d01bee96
commit
4b33c1b71c
37 changed files with 1807 additions and 1206 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"cmp"
|
||||
"maps"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
|
|
@ -254,35 +255,24 @@ func Generate(types map[string]*GoType, pairs []CRUDPair, outDir string) error {
|
|||
|
||||
func populateUsageExamples(types map[string]*GoType) {
|
||||
for _, gt := range types {
|
||||
if !shouldHaveUsage(gt.Name) {
|
||||
continue
|
||||
}
|
||||
gt.Usage = usageExample(gt)
|
||||
}
|
||||
}
|
||||
|
||||
func shouldHaveUsage(name string) bool {
|
||||
if core.HasSuffix(name, "Option") || core.HasSuffix(name, "Options") {
|
||||
return true
|
||||
}
|
||||
for _, prefix := range []string{
|
||||
"Create", "Edit", "Update", "Delete", "Add", "Set",
|
||||
"Dispatch", "Migrate", "Generate", "Replace", "Submit", "Transfer",
|
||||
} {
|
||||
if core.HasPrefix(name, prefix) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func usageExample(gt *GoType) string {
|
||||
switch {
|
||||
case gt.IsEnum && len(gt.EnumValues) > 0:
|
||||
return enumConstName(gt.Name, gt.EnumValues[0])
|
||||
case gt.IsAlias:
|
||||
return gt.Name + "(" + exampleTypeExpression(gt.AliasType) + ")"
|
||||
default:
|
||||
example := exampleTypeLiteral(gt)
|
||||
if example == "" {
|
||||
example = gt.Name + "{}"
|
||||
}
|
||||
return example
|
||||
}
|
||||
}
|
||||
|
||||
func exampleTypeLiteral(gt *GoType) string {
|
||||
if len(gt.Fields) == 0 {
|
||||
|
|
@ -297,6 +287,31 @@ func exampleTypeLiteral(gt *GoType) string {
|
|||
return gt.Name + "{" + field.GoName + ": " + exampleValue(field) + "}"
|
||||
}
|
||||
|
||||
func exampleTypeExpression(typeName string) string {
|
||||
switch {
|
||||
case typeName == "string":
|
||||
return strconv.Quote("example")
|
||||
case typeName == "bool":
|
||||
return "true"
|
||||
case typeName == "int", typeName == "int32", typeName == "int64", typeName == "uint", typeName == "uint32", typeName == "uint64":
|
||||
return "1"
|
||||
case typeName == "float32", typeName == "float64":
|
||||
return "1.0"
|
||||
case typeName == "time.Time":
|
||||
return "time.Now()"
|
||||
case core.HasPrefix(typeName, "[]string"):
|
||||
return "[]string{\"example\"}"
|
||||
case core.HasPrefix(typeName, "[]int64"):
|
||||
return "[]int64{1}"
|
||||
case core.HasPrefix(typeName, "[]int"):
|
||||
return "[]int{1}"
|
||||
case core.HasPrefix(typeName, "map["):
|
||||
return typeName + "{\"key\": \"value\"}"
|
||||
default:
|
||||
return typeName + "{}"
|
||||
}
|
||||
}
|
||||
|
||||
func chooseUsageField(fields []GoField) GoField {
|
||||
best := fields[0]
|
||||
bestScore := usageFieldScore(best)
|
||||
|
|
@ -352,7 +367,7 @@ func exampleValue(field GoField) string {
|
|||
case core.HasPrefix(field.GoType, "[]int"):
|
||||
return "[]int{1}"
|
||||
case core.HasPrefix(field.GoType, "map["):
|
||||
return "map[string]string{\"key\": \"value\"}"
|
||||
return field.GoType + "{\"key\": \"value\"}"
|
||||
default:
|
||||
return "{}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,3 +204,52 @@ func TestGenerate_UsageExamples_Good(t *testing.T) {
|
|||
t.Fatalf("generated usage example is missing assignment syntax:\n%s", content)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerate_UsageExamples_AllKinds_Good(t *testing.T) {
|
||||
spec, err := LoadSpec("../../testdata/swagger.v1.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
types := ExtractTypes(spec)
|
||||
pairs := DetectCRUDPairs(spec)
|
||||
|
||||
outDir := t.TempDir()
|
||||
if err := Generate(types, pairs, outDir); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
entries, _ := coreio.Local.List(outDir)
|
||||
var content string
|
||||
for _, e := range entries {
|
||||
data, _ := coreio.Local.Read(core.JoinPath(outDir, e.Name()))
|
||||
if core.Contains(data, "type CommitStatusState string") {
|
||||
content = data
|
||||
break
|
||||
}
|
||||
}
|
||||
if content == "" {
|
||||
t.Fatal("CommitStatusState type not found in any generated file")
|
||||
}
|
||||
if !core.Contains(content, "type CommitStatusState string") {
|
||||
t.Fatalf("CommitStatusState type not generated:\n%s", content)
|
||||
}
|
||||
if !core.Contains(content, "// Usage:") {
|
||||
t.Fatalf("generated enum type is missing usage documentation:\n%s", content)
|
||||
}
|
||||
|
||||
content = ""
|
||||
for _, e := range entries {
|
||||
data, _ := coreio.Local.Read(core.JoinPath(outDir, e.Name()))
|
||||
if core.Contains(data, "type CreateHookOptionConfig map[string]any") {
|
||||
content = data
|
||||
break
|
||||
}
|
||||
}
|
||||
if content == "" {
|
||||
t.Fatal("CreateHookOptionConfig type not found in any generated file")
|
||||
}
|
||||
if !core.Contains(content, "CreateHookOptionConfig(map[string]any{\"key\": \"value\"})") {
|
||||
t.Fatalf("generated alias type is missing a valid usage example:\n%s", content)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// ActionTask — ActionTask represents a ActionTask
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ActionTask{DisplayTitle: "example"}
|
||||
type ActionTask struct {
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
DisplayTitle string `json:"display_title,omitempty"`
|
||||
|
|
@ -23,12 +26,20 @@ type ActionTask struct {
|
|||
}
|
||||
|
||||
// ActionTaskResponse — ActionTaskResponse returns a ActionTask
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ActionTaskResponse{TotalCount: 1}
|
||||
type ActionTaskResponse struct {
|
||||
Entries []*ActionTask `json:"workflow_runs,omitempty"`
|
||||
TotalCount int64 `json:"total_count,omitempty"`
|
||||
}
|
||||
|
||||
// ActionVariable — ActionVariable return value of the query API
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ActionVariable{Name: "example"}
|
||||
type ActionVariable struct {
|
||||
Data string `json:"data,omitempty"` // the value of the variable
|
||||
Name string `json:"name,omitempty"` // the name of the variable
|
||||
|
|
@ -56,6 +67,10 @@ type DispatchWorkflowOption struct {
|
|||
}
|
||||
|
||||
// Secret — Secret represents a secret
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Secret{Name: "example"}
|
||||
type Secret struct {
|
||||
Created time.Time `json:"created_at,omitempty"`
|
||||
Name string `json:"name,omitempty"` // the secret's name
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := Activity{RefName: "main"}
|
||||
type Activity struct {
|
||||
ActUser *User `json:"act_user,omitempty"`
|
||||
ActUserID int64 `json:"act_user_id,omitempty"`
|
||||
|
|
@ -22,6 +24,10 @@ type Activity struct {
|
|||
}
|
||||
|
||||
// ActivityPub — ActivityPub type
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ActivityPub{Context: "example"}
|
||||
type ActivityPub struct {
|
||||
Context string `json:"@context,omitempty"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// Cron — Cron represents a Cron task
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Cron{Name: "example"}
|
||||
type Cron struct {
|
||||
ExecTimes int64 `json:"exec_times,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// Branch — Branch represents a repository branch
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Branch{EffectiveBranchProtectionName: "main"}
|
||||
type Branch struct {
|
||||
Commit *PayloadCommit `json:"commit,omitempty"`
|
||||
EffectiveBranchProtectionName string `json:"effective_branch_protection_name,omitempty"`
|
||||
|
|
@ -19,6 +22,10 @@ type Branch struct {
|
|||
}
|
||||
|
||||
// BranchProtection — BranchProtection represents a branch protection for a repository
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := BranchProtection{BranchName: "main"}
|
||||
type BranchProtection struct {
|
||||
ApplyToAdmins bool `json:"apply_to_admins,omitempty"`
|
||||
ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// Comment — Comment represents a comment on a commit or issue
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Comment{Body: "example"}
|
||||
type Comment struct {
|
||||
Attachments []*Attachment `json:"assets,omitempty"`
|
||||
Body string `json:"body,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := Commit{HTMLURL: "https://example.com"}
|
||||
type Commit struct {
|
||||
Author *User `json:"author,omitempty"`
|
||||
Commit *RepoCommit `json:"commit,omitempty"`
|
||||
|
|
@ -19,6 +21,10 @@ type Commit struct {
|
|||
}
|
||||
|
||||
// CommitAffectedFiles — CommitAffectedFiles store information about files affected by the commit
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := CommitAffectedFiles{Filename: "example"}
|
||||
type CommitAffectedFiles struct {
|
||||
Filename string `json:"filename,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
|
|
@ -34,6 +40,9 @@ type CommitDateOptions struct {
|
|||
Committer time.Time `json:"committer,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := CommitMeta{SHA: "example"}
|
||||
type CommitMeta struct {
|
||||
Created time.Time `json:"created,omitempty"`
|
||||
SHA string `json:"sha,omitempty"`
|
||||
|
|
@ -41,6 +50,10 @@ type CommitMeta struct {
|
|||
}
|
||||
|
||||
// CommitStats — CommitStats is statistics for a RepoCommit
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := CommitStats{Additions: 1}
|
||||
type CommitStats struct {
|
||||
Additions int64 `json:"additions,omitempty"`
|
||||
Deletions int64 `json:"deletions,omitempty"`
|
||||
|
|
@ -48,6 +61,10 @@ type CommitStats struct {
|
|||
}
|
||||
|
||||
// CommitStatus — CommitStatus holds a single status of a single Commit
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := CommitStatus{Description: "example"}
|
||||
type CommitStatus struct {
|
||||
Context string `json:"context,omitempty"`
|
||||
Created time.Time `json:"created_at,omitempty"`
|
||||
|
|
@ -61,8 +78,15 @@ type CommitStatus struct {
|
|||
}
|
||||
|
||||
// CommitStatusState — CommitStatusState holds the state of a CommitStatus It can be "pending", "success", "error" and "failure"
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := CommitStatusState("example")
|
||||
type CommitStatusState string
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := CommitUser{Name: "example"}
|
||||
type CommitUser struct {
|
||||
Date string `json:"date,omitempty"`
|
||||
Email string `json:"email,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// Attachment — Attachment a generic attachment
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Attachment{Name: "example"}
|
||||
type Attachment struct {
|
||||
Created time.Time `json:"created_at,omitempty"`
|
||||
DownloadCount int64 `json:"download_count,omitempty"`
|
||||
|
|
@ -28,6 +31,10 @@ type EditAttachmentOptions struct {
|
|||
}
|
||||
|
||||
// Permission — Permission represents a set of permissions
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Permission{Admin: true}
|
||||
type Permission struct {
|
||||
Admin bool `json:"admin,omitempty"`
|
||||
Pull bool `json:"pull,omitempty"`
|
||||
|
|
@ -35,7 +42,15 @@ type Permission struct {
|
|||
}
|
||||
|
||||
// StateType — StateType issue state type
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := StateType("example")
|
||||
type StateType string
|
||||
|
||||
// TimeStamp — TimeStamp defines a timestamp
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := TimeStamp(1)
|
||||
type TimeStamp int64
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// ContentsResponse — ContentsResponse contains information about a repo's entry's (dir, file, symlink, submodule) metadata and content
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ContentsResponse{Name: "example"}
|
||||
type ContentsResponse struct {
|
||||
Content string `json:"content,omitempty"` // `content` is populated when `type` is `file`, otherwise null
|
||||
DownloadURL string `json:"download_url,omitempty"`
|
||||
|
|
@ -56,6 +59,9 @@ type DeleteFileOptions struct {
|
|||
Signoff bool `json:"signoff,omitempty"` // Add a Signed-off-by trailer by the committer at the end of the commit log message.
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := FileCommitResponse{HTMLURL: "https://example.com"}
|
||||
type FileCommitResponse struct {
|
||||
Author *CommitUser `json:"author,omitempty"`
|
||||
Committer *CommitUser `json:"committer,omitempty"`
|
||||
|
|
@ -69,6 +75,10 @@ type FileCommitResponse struct {
|
|||
}
|
||||
|
||||
// FileDeleteResponse — FileDeleteResponse contains information about a repo's file that was deleted
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := FileDeleteResponse{Commit: &FileCommitResponse{}}
|
||||
type FileDeleteResponse struct {
|
||||
Commit *FileCommitResponse `json:"commit,omitempty"`
|
||||
Content any `json:"content,omitempty"`
|
||||
|
|
@ -76,6 +86,10 @@ type FileDeleteResponse struct {
|
|||
}
|
||||
|
||||
// FileLinksResponse — FileLinksResponse contains the links for a repo's file
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := FileLinksResponse{GitURL: "https://example.com"}
|
||||
type FileLinksResponse struct {
|
||||
GitURL string `json:"git,omitempty"`
|
||||
HTMLURL string `json:"html,omitempty"`
|
||||
|
|
@ -83,6 +97,10 @@ type FileLinksResponse struct {
|
|||
}
|
||||
|
||||
// FileResponse — FileResponse contains information about a repo's file
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := FileResponse{Commit: &FileCommitResponse{}}
|
||||
type FileResponse struct {
|
||||
Commit *FileCommitResponse `json:"commit,omitempty"`
|
||||
Content *ContentsResponse `json:"content,omitempty"`
|
||||
|
|
@ -90,6 +108,10 @@ type FileResponse struct {
|
|||
}
|
||||
|
||||
// FilesResponse — FilesResponse contains information about multiple files from a repo
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := FilesResponse{Files: {}}
|
||||
type FilesResponse struct {
|
||||
Commit *FileCommitResponse `json:"commit,omitempty"`
|
||||
Files []*ContentsResponse `json:"files,omitempty"`
|
||||
|
|
|
|||
|
|
@ -2,39 +2,60 @@
|
|||
|
||||
package types
|
||||
|
||||
|
||||
// APIError — APIError is an api error with a message
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := APIError{Message: "example"}
|
||||
type APIError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := APIForbiddenError{Message: "example"}
|
||||
type APIForbiddenError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := APIInvalidTopicsError{InvalidTopics: []string{"example"}}
|
||||
type APIInvalidTopicsError struct {
|
||||
InvalidTopics []string `json:"invalidTopics,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := APINotFound{Errors: []string{"example"}}
|
||||
type APINotFound struct {
|
||||
Errors []string `json:"errors,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := APIRepoArchivedError{Message: "example"}
|
||||
type APIRepoArchivedError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := APIUnauthorizedError{Message: "example"}
|
||||
type APIUnauthorizedError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := APIValidationError{Message: "example"}
|
||||
type APIValidationError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
package types
|
||||
|
||||
|
||||
// NodeInfo — NodeInfo contains standardized way of exposing metadata about a server running one of the distributed social networks
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := NodeInfo{Protocols: []string{"example"}}
|
||||
type NodeInfo struct {
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
OpenRegistrations bool `json:"openRegistrations,omitempty"`
|
||||
|
|
@ -15,12 +18,20 @@ type NodeInfo struct {
|
|||
}
|
||||
|
||||
// NodeInfoServices — NodeInfoServices contains the third party sites this server can connect to via their application API
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := NodeInfoServices{Inbound: []string{"example"}}
|
||||
type NodeInfoServices struct {
|
||||
Inbound []string `json:"inbound,omitempty"`
|
||||
Outbound []string `json:"outbound,omitempty"`
|
||||
}
|
||||
|
||||
// NodeInfoSoftware — NodeInfoSoftware contains Metadata about server software in use
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := NodeInfoSoftware{Name: "example"}
|
||||
type NodeInfoSoftware struct {
|
||||
Homepage string `json:"homepage,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
|
|
@ -29,6 +40,10 @@ type NodeInfoSoftware struct {
|
|||
}
|
||||
|
||||
// NodeInfoUsage — NodeInfoUsage contains usage statistics for this server
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := NodeInfoUsage{LocalComments: 1}
|
||||
type NodeInfoUsage struct {
|
||||
LocalComments int64 `json:"localComments,omitempty"`
|
||||
LocalPosts int64 `json:"localPosts,omitempty"`
|
||||
|
|
@ -36,6 +51,10 @@ type NodeInfoUsage struct {
|
|||
}
|
||||
|
||||
// NodeInfoUsageUsers — NodeInfoUsageUsers contains statistics about the users of this server
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := NodeInfoUsageUsers{ActiveHalfyear: 1}
|
||||
type NodeInfoUsageUsers struct {
|
||||
ActiveHalfyear int64 `json:"activeHalfyear,omitempty"`
|
||||
ActiveMonth int64 `json:"activeMonth,omitempty"`
|
||||
|
|
|
|||
37
types/git.go
37
types/git.go
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
package types
|
||||
|
||||
|
||||
// AnnotatedTag — AnnotatedTag represents an annotated tag
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := AnnotatedTag{Message: "example"}
|
||||
type AnnotatedTag struct {
|
||||
ArchiveDownloadCount *TagArchiveDownloadCount `json:"archive_download_count,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
|
|
@ -16,6 +19,10 @@ type AnnotatedTag struct {
|
|||
}
|
||||
|
||||
// AnnotatedTagObject — AnnotatedTagObject contains meta information of the tag object
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := AnnotatedTagObject{SHA: "example"}
|
||||
type AnnotatedTagObject struct {
|
||||
SHA string `json:"sha,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
|
|
@ -23,6 +30,10 @@ type AnnotatedTagObject struct {
|
|||
}
|
||||
|
||||
// ChangedFile — ChangedFile store information about files affected by the pull request
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ChangedFile{ContentsURL: "https://example.com"}
|
||||
type ChangedFile struct {
|
||||
Additions int64 `json:"additions,omitempty"`
|
||||
Changes int64 `json:"changes,omitempty"`
|
||||
|
|
@ -45,6 +56,10 @@ type EditGitHookOption struct {
|
|||
}
|
||||
|
||||
// GitBlobResponse — GitBlobResponse represents a git blob
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := GitBlobResponse{Content: "example"}
|
||||
type GitBlobResponse struct {
|
||||
Content string `json:"content,omitempty"`
|
||||
Encoding string `json:"encoding,omitempty"`
|
||||
|
|
@ -54,6 +69,10 @@ type GitBlobResponse struct {
|
|||
}
|
||||
|
||||
// GitEntry — GitEntry represents a git tree
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := GitEntry{Mode: "example"}
|
||||
type GitEntry struct {
|
||||
Mode string `json:"mode,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
|
|
@ -64,12 +83,19 @@ type GitEntry struct {
|
|||
}
|
||||
|
||||
// GitHook — GitHook represents a Git repository hook
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := GitHook{Name: "example"}
|
||||
type GitHook struct {
|
||||
Content string `json:"content,omitempty"`
|
||||
IsActive bool `json:"is_active,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := GitObject{SHA: "example"}
|
||||
type GitObject struct {
|
||||
SHA string `json:"sha,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
|
|
@ -77,6 +103,10 @@ type GitObject struct {
|
|||
}
|
||||
|
||||
// GitTreeResponse — GitTreeResponse returns a git tree
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := GitTreeResponse{SHA: "example"}
|
||||
type GitTreeResponse struct {
|
||||
Entries []*GitEntry `json:"tree,omitempty"`
|
||||
Page int64 `json:"page,omitempty"`
|
||||
|
|
@ -87,12 +117,15 @@ type GitTreeResponse struct {
|
|||
}
|
||||
|
||||
// Note — Note contains information related to a git note
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Note{Message: "example"}
|
||||
type Note struct {
|
||||
Commit *Commit `json:"commit,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := NoteOptions{Message: "example"}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// CreateHookOption — CreateHookOption options when create a hook
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -23,7 +22,7 @@ type CreateHookOption struct {
|
|||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := CreateHookOptionConfig{}
|
||||
// opts := CreateHookOptionConfig(map[string]any{"key": "value"})
|
||||
type CreateHookOptionConfig map[string]any
|
||||
|
||||
// EditHookOption — EditHookOption options when modify one hook
|
||||
|
|
@ -40,6 +39,10 @@ type EditHookOption struct {
|
|||
}
|
||||
|
||||
// Hook — Hook a hook is a web hook when one repository changed
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Hook{AuthorizationHeader: "example"}
|
||||
type Hook struct {
|
||||
Active bool `json:"active,omitempty"`
|
||||
AuthorizationHeader string `json:"authorization_header,omitempty"`
|
||||
|
|
@ -56,6 +59,10 @@ type Hook struct {
|
|||
}
|
||||
|
||||
// PayloadCommit — PayloadCommit represents a commit
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := PayloadCommit{Added: []string{"example"}}
|
||||
type PayloadCommit struct {
|
||||
Added []string `json:"added,omitempty"`
|
||||
Author *PayloadUser `json:"author,omitempty"`
|
||||
|
|
@ -70,6 +77,10 @@ type PayloadCommit struct {
|
|||
}
|
||||
|
||||
// PayloadCommitVerification — PayloadCommitVerification represents the GPG verification of a commit
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := PayloadCommitVerification{Payload: "example"}
|
||||
type PayloadCommitVerification struct {
|
||||
Payload string `json:"payload,omitempty"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// CreateIssueCommentOption — CreateIssueCommentOption options for creating a comment on an issue
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -70,6 +69,10 @@ type EditIssueOption struct {
|
|||
}
|
||||
|
||||
// Issue — Issue represents an issue in a repository
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Issue{Body: "example"}
|
||||
type Issue struct {
|
||||
Assignee *User `json:"assignee,omitempty"`
|
||||
Assignees []*User `json:"assignees,omitempty"`
|
||||
|
|
@ -98,28 +101,45 @@ type Issue struct {
|
|||
User *User `json:"user,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := IssueConfig{BlankIssuesEnabled: true}
|
||||
type IssueConfig struct {
|
||||
BlankIssuesEnabled bool `json:"blank_issues_enabled,omitempty"`
|
||||
ContactLinks []*IssueConfigContactLink `json:"contact_links,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := IssueConfigContactLink{Name: "example"}
|
||||
type IssueConfigContactLink struct {
|
||||
About string `json:"about,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := IssueConfigValidation{Message: "example"}
|
||||
type IssueConfigValidation struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Valid bool `json:"valid,omitempty"`
|
||||
}
|
||||
|
||||
// IssueDeadline — IssueDeadline represents an issue deadline
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := IssueDeadline{Deadline: time.Now()}
|
||||
type IssueDeadline struct {
|
||||
Deadline time.Time `json:"due_date,omitempty"`
|
||||
}
|
||||
|
||||
// IssueFormField — IssueFormField represents a form field
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := IssueFormField{ID: "example"}
|
||||
type IssueFormField struct {
|
||||
Attributes map[string]any `json:"attributes,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
|
|
@ -128,9 +148,16 @@ type IssueFormField struct {
|
|||
Visible []IssueFormFieldVisible `json:"visible,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := IssueFormFieldType("example")
|
||||
type IssueFormFieldType string
|
||||
|
||||
// IssueFormFieldVisible — IssueFormFieldVisible defines issue form field visible
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := IssueFormFieldVisible("example")
|
||||
type IssueFormFieldVisible string
|
||||
|
||||
// IssueLabelsOption — IssueLabelsOption a collection of labels
|
||||
|
|
@ -144,6 +171,10 @@ type IssueLabelsOption struct {
|
|||
}
|
||||
|
||||
// IssueMeta — IssueMeta basic issue information
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := IssueMeta{Name: "example"}
|
||||
type IssueMeta struct {
|
||||
Index int64 `json:"index,omitempty"`
|
||||
Name string `json:"repo,omitempty"`
|
||||
|
|
@ -151,6 +182,10 @@ type IssueMeta struct {
|
|||
}
|
||||
|
||||
// IssueTemplate — IssueTemplate represents an issue template for a repository
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := IssueTemplate{FileName: "example"}
|
||||
type IssueTemplate struct {
|
||||
About string `json:"about,omitempty"`
|
||||
Content string `json:"content,omitempty"`
|
||||
|
|
@ -162,4 +197,7 @@ type IssueTemplate struct {
|
|||
Title string `json:"title,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := IssueTemplateLabels([]string{"example"})
|
||||
type IssueTemplateLabels []string
|
||||
|
|
|
|||
17
types/key.go
17
types/key.go
|
|
@ -4,7 +4,6 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// CreateGPGKeyOption — CreateGPGKeyOption options create user GPG key
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -27,6 +26,10 @@ type CreateKeyOption struct {
|
|||
}
|
||||
|
||||
// DeployKey — DeployKey a deploy key
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := DeployKey{Title: "example"}
|
||||
type DeployKey struct {
|
||||
Created time.Time `json:"created_at,omitempty"`
|
||||
Fingerprint string `json:"fingerprint,omitempty"`
|
||||
|
|
@ -40,6 +43,10 @@ type DeployKey struct {
|
|||
}
|
||||
|
||||
// GPGKey — GPGKey a user GPG key to sign commit and tag in repository
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := GPGKey{KeyID: "example"}
|
||||
type GPGKey struct {
|
||||
CanCertify bool `json:"can_certify,omitempty"`
|
||||
CanEncryptComms bool `json:"can_encrypt_comms,omitempty"`
|
||||
|
|
@ -57,12 +64,20 @@ type GPGKey struct {
|
|||
}
|
||||
|
||||
// GPGKeyEmail — GPGKeyEmail an email attached to a GPGKey
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := GPGKeyEmail{Email: "alice@example.com"}
|
||||
type GPGKeyEmail struct {
|
||||
Email string `json:"email,omitempty"`
|
||||
Verified bool `json:"verified,omitempty"`
|
||||
}
|
||||
|
||||
// PublicKey — PublicKey publickey is a user key to push code to repository
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := PublicKey{Title: "example"}
|
||||
type PublicKey struct {
|
||||
Created time.Time `json:"created_at,omitempty"`
|
||||
Fingerprint string `json:"fingerprint,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// CreateLabelOption — CreateLabelOption options for creating a label
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -41,6 +40,10 @@ type EditLabelOption struct {
|
|||
}
|
||||
|
||||
// Label — Label a label to an issue or a pr
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Label{Description: "example"}
|
||||
type Label struct {
|
||||
Color string `json:"color,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
|
|
@ -52,6 +55,10 @@ type Label struct {
|
|||
}
|
||||
|
||||
// LabelTemplate — LabelTemplate info of a Label template
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := LabelTemplate{Description: "example"}
|
||||
type LabelTemplate struct {
|
||||
Color string `json:"color,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// CreateMilestoneOption — CreateMilestoneOption options for creating a milestone
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -30,6 +29,10 @@ type EditMilestoneOption struct {
|
|||
}
|
||||
|
||||
// Milestone — Milestone milestone is a collection of issues on one repository
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Milestone{Description: "example"}
|
||||
type Milestone struct {
|
||||
Closed time.Time `json:"closed_at,omitempty"`
|
||||
ClosedIssues int64 `json:"closed_issues,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// AddCollaboratorOption — AddCollaboratorOption options when adding a user as a collaborator of a repository
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -26,6 +25,10 @@ type AddTimeOption struct {
|
|||
}
|
||||
|
||||
// ChangeFileOperation — ChangeFileOperation for creating, updating or deleting a file
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ChangeFileOperation{Operation: "example"}
|
||||
type ChangeFileOperation struct {
|
||||
ContentBase64 string `json:"content,omitempty"` // new or updated file content, must be base64 encoded
|
||||
FromPath string `json:"from_path,omitempty"` // old path of the file to move
|
||||
|
|
@ -50,6 +53,9 @@ type ChangeFilesOptions struct {
|
|||
Signoff bool `json:"signoff,omitempty"` // Add a Signed-off-by trailer by the committer at the end of the commit log message.
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := Compare{TotalCommits: 1}
|
||||
type Compare struct {
|
||||
Commits []*Commit `json:"commits,omitempty"`
|
||||
TotalCommits int64 `json:"total_commits,omitempty"`
|
||||
|
|
@ -85,6 +91,11 @@ type DismissPullReviewOptions struct {
|
|||
}
|
||||
|
||||
// ForgeLike — ForgeLike activity data type
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ForgeLike{}
|
||||
//
|
||||
// ForgeLike has no fields in the swagger spec.
|
||||
type ForgeLike struct{}
|
||||
|
||||
|
|
@ -109,18 +120,30 @@ type GenerateRepoOption struct {
|
|||
}
|
||||
|
||||
// GitignoreTemplateInfo — GitignoreTemplateInfo name and text of a gitignore template
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := GitignoreTemplateInfo{Name: "example"}
|
||||
type GitignoreTemplateInfo struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
}
|
||||
|
||||
// Identity — Identity for a person's identity like an author or committer
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Identity{Name: "example"}
|
||||
type Identity struct {
|
||||
Email string `json:"email,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// LicenseTemplateInfo — LicensesInfo contains information about a License
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := LicenseTemplateInfo{Body: "example"}
|
||||
type LicenseTemplateInfo struct {
|
||||
Body string `json:"body,omitempty"`
|
||||
Implementation string `json:"implementation,omitempty"`
|
||||
|
|
@ -130,6 +153,10 @@ type LicenseTemplateInfo struct {
|
|||
}
|
||||
|
||||
// LicensesTemplateListEntry — LicensesListEntry is used for the API
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := LicensesTemplateListEntry{Name: "example"}
|
||||
type LicensesTemplateListEntry struct {
|
||||
Key string `json:"key,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
|
|
@ -207,15 +234,27 @@ type MigrateRepoOptions struct {
|
|||
}
|
||||
|
||||
// NewIssuePinsAllowed — NewIssuePinsAllowed represents an API response that says if new Issue Pins are allowed
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := NewIssuePinsAllowed{Issues: true}
|
||||
type NewIssuePinsAllowed struct {
|
||||
Issues bool `json:"issues,omitempty"`
|
||||
PullRequests bool `json:"pull_requests,omitempty"`
|
||||
}
|
||||
|
||||
// NotifySubjectType — NotifySubjectType represent type of notification subject
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := NotifySubjectType("example")
|
||||
type NotifySubjectType string
|
||||
|
||||
// PRBranchInfo — PRBranchInfo information about a branch
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := PRBranchInfo{Name: "example"}
|
||||
type PRBranchInfo struct {
|
||||
Name string `json:"label,omitempty"`
|
||||
Ref string `json:"ref,omitempty"`
|
||||
|
|
@ -225,12 +264,19 @@ type PRBranchInfo struct {
|
|||
}
|
||||
|
||||
// PayloadUser — PayloadUser represents the author or committer of a commit
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := PayloadUser{Name: "example"}
|
||||
type PayloadUser struct {
|
||||
Email string `json:"email,omitempty"`
|
||||
Name string `json:"name,omitempty"` // Full name of the commit author
|
||||
UserName string `json:"username,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := Reference{Ref: "main"}
|
||||
type Reference struct {
|
||||
Object *GitObject `json:"object,omitempty"`
|
||||
Ref string `json:"ref,omitempty"`
|
||||
|
|
@ -247,17 +293,29 @@ type ReplaceFlagsOption struct {
|
|||
}
|
||||
|
||||
// SearchResults — SearchResults results of a successful search
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := SearchResults{OK: true}
|
||||
type SearchResults struct {
|
||||
Data []*Repository `json:"data,omitempty"`
|
||||
OK bool `json:"ok,omitempty"`
|
||||
}
|
||||
|
||||
// ServerVersion — ServerVersion wraps the version of the server
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ServerVersion{Version: "example"}
|
||||
type ServerVersion struct {
|
||||
Version string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// TimelineComment — TimelineComment represents a timeline comment (comment of any type) on a commit or issue
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := TimelineComment{Body: "example"}
|
||||
type TimelineComment struct {
|
||||
Assignee *User `json:"assignee,omitempty"`
|
||||
AssigneeTeam *Team `json:"assignee_team,omitempty"`
|
||||
|
|
@ -291,6 +349,10 @@ type TimelineComment struct {
|
|||
}
|
||||
|
||||
// WatchInfo — WatchInfo represents an API watch status of one repository
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := WatchInfo{RepositoryURL: "https://example.com"}
|
||||
type WatchInfo struct {
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
Ignored bool `json:"ignored,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,13 +4,20 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// NotificationCount — NotificationCount number of unread notifications
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := NotificationCount{New: 1}
|
||||
type NotificationCount struct {
|
||||
New int64 `json:"new,omitempty"`
|
||||
}
|
||||
|
||||
// NotificationSubject — NotificationSubject contains the notification subject (Issue/Pull/Commit)
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := NotificationSubject{Title: "example"}
|
||||
type NotificationSubject struct {
|
||||
HTMLURL string `json:"html_url,omitempty"`
|
||||
LatestCommentHTMLURL string `json:"latest_comment_html_url,omitempty"`
|
||||
|
|
@ -22,6 +29,10 @@ type NotificationSubject struct {
|
|||
}
|
||||
|
||||
// NotificationThread — NotificationThread expose Notification on API
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := NotificationThread{URL: "https://example.com"}
|
||||
type NotificationThread struct {
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Pinned bool `json:"pinned,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := AccessToken{Name: "example"}
|
||||
type AccessToken struct {
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
|
|
@ -34,6 +36,9 @@ type CreateOAuth2ApplicationOptions struct {
|
|||
RedirectURIs []string `json:"redirect_uris,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := OAuth2Application{Name: "example"}
|
||||
type OAuth2Application struct {
|
||||
ClientID string `json:"client_id,omitempty"`
|
||||
ClientSecret string `json:"client_secret,omitempty"`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
package types
|
||||
|
||||
|
||||
// CreateOrgOption — CreateOrgOption options for creating an organization
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -35,6 +34,10 @@ type EditOrgOption struct {
|
|||
}
|
||||
|
||||
// Organization — Organization represents an organization
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Organization{Description: "example"}
|
||||
type Organization struct {
|
||||
AvatarURL string `json:"avatar_url,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
|
|
@ -50,6 +53,10 @@ type Organization struct {
|
|||
}
|
||||
|
||||
// OrganizationPermissions — OrganizationPermissions list different users permissions on an organization
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := OrganizationPermissions{CanCreateRepository: true}
|
||||
type OrganizationPermissions struct {
|
||||
CanCreateRepository bool `json:"can_create_repository,omitempty"`
|
||||
CanRead bool `json:"can_read,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// Package — Package represents a package
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Package{Name: "example"}
|
||||
type Package struct {
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
Creator *User `json:"creator,omitempty"`
|
||||
|
|
@ -19,6 +22,10 @@ type Package struct {
|
|||
}
|
||||
|
||||
// PackageFile — PackageFile represents a package file
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := PackageFile{Name: "example"}
|
||||
type PackageFile struct {
|
||||
HashMD5 string `json:"md5,omitempty"`
|
||||
HashSHA1 string `json:"sha1,omitempty"`
|
||||
|
|
|
|||
19
types/pr.go
19
types/pr.go
|
|
@ -4,7 +4,6 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// CreatePullRequestOption — CreatePullRequestOption options when creating a pull request
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -38,7 +37,7 @@ type CreatePullReviewComment struct {
|
|||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := CreatePullReviewCommentOptions{}
|
||||
// opts := CreatePullReviewCommentOptions(CreatePullReviewComment{})
|
||||
type CreatePullReviewCommentOptions CreatePullReviewComment
|
||||
|
||||
// CreatePullReviewOptions — CreatePullReviewOptions are options to create a pull review
|
||||
|
|
@ -73,6 +72,10 @@ type EditPullRequestOption struct {
|
|||
}
|
||||
|
||||
// PullRequest — PullRequest represents a pull request
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := PullRequest{Body: "example"}
|
||||
type PullRequest struct {
|
||||
Additions int64 `json:"additions,omitempty"`
|
||||
AllowMaintainerEdit bool `json:"allow_maintainer_edit,omitempty"`
|
||||
|
|
@ -114,6 +117,10 @@ type PullRequest struct {
|
|||
}
|
||||
|
||||
// PullRequestMeta — PullRequestMeta PR info if an issue is a PR
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := PullRequestMeta{HTMLURL: "https://example.com"}
|
||||
type PullRequestMeta struct {
|
||||
HTMLURL string `json:"html_url,omitempty"`
|
||||
HasMerged bool `json:"merged,omitempty"`
|
||||
|
|
@ -122,6 +129,10 @@ type PullRequestMeta struct {
|
|||
}
|
||||
|
||||
// PullReview — PullReview represents a pull request review
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := PullReview{Body: "example"}
|
||||
type PullReview struct {
|
||||
Body string `json:"body,omitempty"`
|
||||
CodeCommentsCount int64 `json:"comments_count,omitempty"`
|
||||
|
|
@ -140,6 +151,10 @@ type PullReview struct {
|
|||
}
|
||||
|
||||
// PullReviewComment — PullReviewComment represents a comment on a pull request review
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := PullReviewComment{Body: "example"}
|
||||
type PullReviewComment struct {
|
||||
Body string `json:"body,omitempty"`
|
||||
CommitID string `json:"commit_id,omitempty"`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
package types
|
||||
|
||||
|
||||
// CreateQuotaGroupOptions — CreateQutaGroupOptions represents the options for creating a quota group
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -35,21 +34,37 @@ type EditQuotaRuleOptions struct {
|
|||
}
|
||||
|
||||
// QuotaGroup — QuotaGroup represents a quota group
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaGroup{Name: "example"}
|
||||
type QuotaGroup struct {
|
||||
Name string `json:"name,omitempty"` // Name of the group
|
||||
Rules []*QuotaRuleInfo `json:"rules,omitempty"` // Rules associated with the group
|
||||
}
|
||||
|
||||
// QuotaGroupList — QuotaGroupList represents a list of quota groups
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaGroupList([]*QuotaGroup{})
|
||||
type QuotaGroupList []*QuotaGroup
|
||||
|
||||
// QuotaInfo — QuotaInfo represents information about a user's quota
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaInfo{Groups: {}}
|
||||
type QuotaInfo struct {
|
||||
Groups QuotaGroupList `json:"groups,omitempty"`
|
||||
Used *QuotaUsed `json:"used,omitempty"`
|
||||
}
|
||||
|
||||
// QuotaRuleInfo — QuotaRuleInfo contains information about a quota rule
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaRuleInfo{Name: "example"}
|
||||
type QuotaRuleInfo struct {
|
||||
Limit int64 `json:"limit,omitempty"` // The limit set by the rule
|
||||
Name string `json:"name,omitempty"` // Name of the rule (only shown to admins)
|
||||
|
|
@ -57,11 +72,19 @@ type QuotaRuleInfo struct {
|
|||
}
|
||||
|
||||
// QuotaUsed — QuotaUsed represents the quota usage of a user
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsed{Size: &QuotaUsedSize{}}
|
||||
type QuotaUsed struct {
|
||||
Size *QuotaUsedSize `json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// QuotaUsedArtifact — QuotaUsedArtifact represents an artifact counting towards a user's quota
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedArtifact{Name: "example"}
|
||||
type QuotaUsedArtifact struct {
|
||||
HTMLURL string `json:"html_url,omitempty"` // HTML URL to the action run containing the artifact
|
||||
Name string `json:"name,omitempty"` // Name of the artifact
|
||||
|
|
@ -69,9 +92,17 @@ type QuotaUsedArtifact struct {
|
|||
}
|
||||
|
||||
// QuotaUsedArtifactList — QuotaUsedArtifactList represents a list of artifacts counting towards a user's quota
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedArtifactList([]*QuotaUsedArtifact{})
|
||||
type QuotaUsedArtifactList []*QuotaUsedArtifact
|
||||
|
||||
// QuotaUsedAttachment — QuotaUsedAttachment represents an attachment counting towards a user's quota
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedAttachment{Name: "example"}
|
||||
type QuotaUsedAttachment struct {
|
||||
APIURL string `json:"api_url,omitempty"` // API URL for the attachment
|
||||
ContainedIn map[string]any `json:"contained_in,omitempty"` // Context for the attachment: URLs to the containing object
|
||||
|
|
@ -80,9 +111,17 @@ type QuotaUsedAttachment struct {
|
|||
}
|
||||
|
||||
// QuotaUsedAttachmentList — QuotaUsedAttachmentList represents a list of attachment counting towards a user's quota
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedAttachmentList([]*QuotaUsedAttachment{})
|
||||
type QuotaUsedAttachmentList []*QuotaUsedAttachment
|
||||
|
||||
// QuotaUsedPackage — QuotaUsedPackage represents a package counting towards a user's quota
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedPackage{Name: "example"}
|
||||
type QuotaUsedPackage struct {
|
||||
HTMLURL string `json:"html_url,omitempty"` // HTML URL to the package version
|
||||
Name string `json:"name,omitempty"` // Name of the package
|
||||
|
|
@ -92,9 +131,17 @@ type QuotaUsedPackage struct {
|
|||
}
|
||||
|
||||
// QuotaUsedPackageList — QuotaUsedPackageList represents a list of packages counting towards a user's quota
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedPackageList([]*QuotaUsedPackage{})
|
||||
type QuotaUsedPackageList []*QuotaUsedPackage
|
||||
|
||||
// QuotaUsedSize — QuotaUsedSize represents the size-based quota usage of a user
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedSize{Assets: &QuotaUsedSizeAssets{}}
|
||||
type QuotaUsedSize struct {
|
||||
Assets *QuotaUsedSizeAssets `json:"assets,omitempty"`
|
||||
Git *QuotaUsedSizeGit `json:"git,omitempty"`
|
||||
|
|
@ -102,6 +149,10 @@ type QuotaUsedSize struct {
|
|||
}
|
||||
|
||||
// QuotaUsedSizeAssets — QuotaUsedSizeAssets represents the size-based asset usage of a user
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedSizeAssets{Artifacts: 1}
|
||||
type QuotaUsedSizeAssets struct {
|
||||
Artifacts int64 `json:"artifacts,omitempty"` // Storage size used for the user's artifacts
|
||||
Attachments *QuotaUsedSizeAssetsAttachments `json:"attachments,omitempty"`
|
||||
|
|
@ -109,22 +160,38 @@ type QuotaUsedSizeAssets struct {
|
|||
}
|
||||
|
||||
// QuotaUsedSizeAssetsAttachments — QuotaUsedSizeAssetsAttachments represents the size-based attachment quota usage of a user
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedSizeAssetsAttachments{Issues: 1}
|
||||
type QuotaUsedSizeAssetsAttachments struct {
|
||||
Issues int64 `json:"issues,omitempty"` // Storage size used for the user's issue & comment attachments
|
||||
Releases int64 `json:"releases,omitempty"` // Storage size used for the user's release attachments
|
||||
}
|
||||
|
||||
// QuotaUsedSizeAssetsPackages — QuotaUsedSizeAssetsPackages represents the size-based package quota usage of a user
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedSizeAssetsPackages{All: 1}
|
||||
type QuotaUsedSizeAssetsPackages struct {
|
||||
All int64 `json:"all,omitempty"` // Storage suze used for the user's packages
|
||||
}
|
||||
|
||||
// QuotaUsedSizeGit — QuotaUsedSizeGit represents the size-based git (lfs) quota usage of a user
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedSizeGit{LFS: 1}
|
||||
type QuotaUsedSizeGit struct {
|
||||
LFS int64 `json:"LFS,omitempty"` // Storage size of the user's Git LFS objects
|
||||
}
|
||||
|
||||
// QuotaUsedSizeRepos — QuotaUsedSizeRepos represents the size-based repository quota usage of a user
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := QuotaUsedSizeRepos{Private: 1}
|
||||
type QuotaUsedSizeRepos struct {
|
||||
Private int64 `json:"private,omitempty"` // Storage size of the user's private repositories
|
||||
Public int64 `json:"public,omitempty"` // Storage size of the user's public repositories
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// EditReactionOption — EditReactionOption contain the reaction type
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -15,6 +14,10 @@ type EditReactionOption struct {
|
|||
}
|
||||
|
||||
// Reaction — Reaction contain one reaction
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Reaction{Reaction: "example"}
|
||||
type Reaction struct {
|
||||
Created time.Time `json:"created_at,omitempty"`
|
||||
Reaction string `json:"content,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// CreateReleaseOption — CreateReleaseOption options when creating a release
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -36,6 +35,10 @@ type EditReleaseOption struct {
|
|||
}
|
||||
|
||||
// Release — Release represents a repository release
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Release{TagName: "v1.0.0"}
|
||||
type Release struct {
|
||||
ArchiveDownloadCount *TagArchiveDownloadCount `json:"archive_download_count,omitempty"`
|
||||
Attachments []*Attachment `json:"assets,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := CreatePushMirrorOption{Interval: "example"}
|
||||
|
|
@ -81,6 +79,10 @@ type EditRepoOption struct {
|
|||
}
|
||||
|
||||
// ExternalTracker — ExternalTracker represents settings for external tracker
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ExternalTracker{ExternalTrackerFormat: "example"}
|
||||
type ExternalTracker struct {
|
||||
ExternalTrackerFormat string `json:"external_tracker_format,omitempty"` // External Issue Tracker URL Format. Use the placeholders {user}, {repo} and {index} for the username, repository name and issue index.
|
||||
ExternalTrackerRegexpPattern string `json:"external_tracker_regexp_pattern,omitempty"` // External Issue Tracker issue regular expression
|
||||
|
|
@ -89,11 +91,19 @@ type ExternalTracker struct {
|
|||
}
|
||||
|
||||
// ExternalWiki — ExternalWiki represents setting for external wiki
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ExternalWiki{ExternalWikiURL: "https://example.com"}
|
||||
type ExternalWiki struct {
|
||||
ExternalWikiURL string `json:"external_wiki_url,omitempty"` // URL of external wiki.
|
||||
}
|
||||
|
||||
// InternalTracker — InternalTracker represents settings for internal tracker
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := InternalTracker{AllowOnlyContributorsToTrackTime: true}
|
||||
type InternalTracker struct {
|
||||
AllowOnlyContributorsToTrackTime bool `json:"allow_only_contributors_to_track_time,omitempty"` // Let only contributors track time (Built-in issue tracker)
|
||||
EnableIssueDependencies bool `json:"enable_issue_dependencies,omitempty"` // Enable dependencies for issues and pull requests (Built-in issue tracker)
|
||||
|
|
@ -101,6 +111,10 @@ type InternalTracker struct {
|
|||
}
|
||||
|
||||
// PushMirror — PushMirror represents information of a push mirror
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := PushMirror{RemoteName: "example"}
|
||||
type PushMirror struct {
|
||||
CreatedUnix time.Time `json:"created,omitempty"`
|
||||
Interval string `json:"interval,omitempty"`
|
||||
|
|
@ -114,12 +128,19 @@ type PushMirror struct {
|
|||
}
|
||||
|
||||
// RepoCollaboratorPermission — RepoCollaboratorPermission to get repository permission for a collaborator
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := RepoCollaboratorPermission{RoleName: "example"}
|
||||
type RepoCollaboratorPermission struct {
|
||||
Permission string `json:"permission,omitempty"`
|
||||
RoleName string `json:"role_name,omitempty"`
|
||||
User *User `json:"user,omitempty"`
|
||||
}
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := RepoCommit{Message: "example"}
|
||||
type RepoCommit struct {
|
||||
Author *CommitUser `json:"author,omitempty"`
|
||||
Committer *CommitUser `json:"committer,omitempty"`
|
||||
|
|
@ -139,6 +160,10 @@ type RepoTopicOptions struct {
|
|||
}
|
||||
|
||||
// RepoTransfer — RepoTransfer represents a pending repo transfer
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := RepoTransfer{Teams: {}}
|
||||
type RepoTransfer struct {
|
||||
Doer *User `json:"doer,omitempty"`
|
||||
Recipient *User `json:"recipient,omitempty"`
|
||||
|
|
@ -146,6 +171,10 @@ type RepoTransfer struct {
|
|||
}
|
||||
|
||||
// Repository — Repository represents a repository
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Repository{Description: "example"}
|
||||
type Repository struct {
|
||||
AllowFastForwardOnly bool `json:"allow_fast_forward_only_merge,omitempty"`
|
||||
AllowMerge bool `json:"allow_merge_commits,omitempty"`
|
||||
|
|
@ -213,6 +242,10 @@ type Repository struct {
|
|||
}
|
||||
|
||||
// RepositoryMeta — RepositoryMeta basic repository information
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := RepositoryMeta{FullName: "example"}
|
||||
type RepositoryMeta struct {
|
||||
FullName string `json:"full_name,omitempty"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
package types
|
||||
|
||||
|
||||
// ReviewStateType — ReviewStateType review state type
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := ReviewStateType("example")
|
||||
type ReviewStateType string
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
package types
|
||||
|
||||
|
||||
// GeneralAPISettings — GeneralAPISettings contains global api settings exposed by it
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := GeneralAPISettings{DefaultGitTreesPerPage: 1}
|
||||
type GeneralAPISettings struct {
|
||||
DefaultGitTreesPerPage int64 `json:"default_git_trees_per_page,omitempty"`
|
||||
DefaultMaxBlobSize int64 `json:"default_max_blob_size,omitempty"`
|
||||
|
|
@ -12,6 +15,10 @@ type GeneralAPISettings struct {
|
|||
}
|
||||
|
||||
// GeneralAttachmentSettings — GeneralAttachmentSettings contains global Attachment settings exposed by API
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := GeneralAttachmentSettings{AllowedTypes: "example"}
|
||||
type GeneralAttachmentSettings struct {
|
||||
AllowedTypes string `json:"allowed_types,omitempty"`
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
|
|
@ -20,6 +27,10 @@ type GeneralAttachmentSettings struct {
|
|||
}
|
||||
|
||||
// GeneralRepoSettings — GeneralRepoSettings contains global repository settings exposed by API
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := GeneralRepoSettings{ForksDisabled: true}
|
||||
type GeneralRepoSettings struct {
|
||||
ForksDisabled bool `json:"forks_disabled,omitempty"`
|
||||
HTTPGitDisabled bool `json:"http_git_disabled,omitempty"`
|
||||
|
|
@ -31,6 +42,10 @@ type GeneralRepoSettings struct {
|
|||
}
|
||||
|
||||
// GeneralUISettings — GeneralUISettings contains global ui settings exposed by API
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := GeneralUISettings{AllowedReactions: []string{"example"}}
|
||||
type GeneralUISettings struct {
|
||||
AllowedReactions []string `json:"allowed_reactions,omitempty"`
|
||||
CustomEmojis []string `json:"custom_emojis,omitempty"`
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
package types
|
||||
|
||||
|
||||
// CombinedStatus — CombinedStatus holds the combined state of several statuses for a single commit
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := CombinedStatus{CommitURL: "https://example.com"}
|
||||
type CombinedStatus struct {
|
||||
CommitURL string `json:"commit_url,omitempty"`
|
||||
Repository *Repository `json:"repository,omitempty"`
|
||||
|
|
|
|||
13
types/tag.go
13
types/tag.go
|
|
@ -4,7 +4,6 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// CreateTagOption — CreateTagOption options when creating a tag
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -39,6 +38,10 @@ type EditTagProtectionOption struct {
|
|||
}
|
||||
|
||||
// Tag — Tag represents a repository tag
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Tag{Name: "example"}
|
||||
type Tag struct {
|
||||
ArchiveDownloadCount *TagArchiveDownloadCount `json:"archive_download_count,omitempty"`
|
||||
Commit *CommitMeta `json:"commit,omitempty"`
|
||||
|
|
@ -50,12 +53,20 @@ type Tag struct {
|
|||
}
|
||||
|
||||
// TagArchiveDownloadCount — TagArchiveDownloadCount counts how many times a archive was downloaded
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := TagArchiveDownloadCount{TarGz: 1}
|
||||
type TagArchiveDownloadCount struct {
|
||||
TarGz int64 `json:"tar_gz,omitempty"`
|
||||
Zip int64 `json:"zip,omitempty"`
|
||||
}
|
||||
|
||||
// TagProtection — TagProtection represents a tag protection
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := TagProtection{NamePattern: "example"}
|
||||
type TagProtection struct {
|
||||
Created time.Time `json:"created_at,omitempty"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
package types
|
||||
|
||||
|
||||
// CreateTeamOption — CreateTeamOption options for creating a team
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -34,6 +33,10 @@ type EditTeamOption struct {
|
|||
}
|
||||
|
||||
// Team — Team represents a team in an organization
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Team{Description: "example"}
|
||||
type Team struct {
|
||||
CanCreateOrgRepo bool `json:"can_create_org_repo,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// StopWatch — StopWatch represent a running stopwatch
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := StopWatch{IssueTitle: "example"}
|
||||
type StopWatch struct {
|
||||
Created time.Time `json:"created,omitempty"`
|
||||
Duration string `json:"duration,omitempty"`
|
||||
|
|
@ -17,6 +20,10 @@ type StopWatch struct {
|
|||
}
|
||||
|
||||
// TrackedTime — TrackedTime worked time for an issue / pr
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := TrackedTime{UserName: "example"}
|
||||
type TrackedTime struct {
|
||||
Created time.Time `json:"created,omitempty"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,13 +4,20 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// TopicName — TopicName a list of repo topic names
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := TopicName{TopicNames: []string{"example"}}
|
||||
type TopicName struct {
|
||||
TopicNames []string `json:"topics,omitempty"`
|
||||
}
|
||||
|
||||
// TopicResponse — TopicResponse for returning topics
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := TopicResponse{Name: "example"}
|
||||
type TopicResponse struct {
|
||||
Created time.Time `json:"created,omitempty"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ package types
|
|||
|
||||
import "time"
|
||||
|
||||
|
||||
// Usage:
|
||||
//
|
||||
// opts := BlockedUser{Created: time.Now()}
|
||||
type BlockedUser struct {
|
||||
BlockID int64 `json:"block_id,omitempty"`
|
||||
Created time.Time `json:"created_at,omitempty"`
|
||||
|
|
@ -75,6 +77,10 @@ type EditUserOption struct {
|
|||
}
|
||||
|
||||
// Email — Email an email address belonging to a user
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := Email{UserName: "example"}
|
||||
type Email struct {
|
||||
Email string `json:"email,omitempty"`
|
||||
Primary bool `json:"primary,omitempty"`
|
||||
|
|
@ -102,6 +108,10 @@ type UpdateUserAvatarOption struct {
|
|||
}
|
||||
|
||||
// User — User represents a user
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := User{Description: "example"}
|
||||
type User struct {
|
||||
AvatarURL string `json:"avatar_url,omitempty"` // URL to the user's avatar
|
||||
Created time.Time `json:"created,omitempty"`
|
||||
|
|
@ -129,12 +139,20 @@ type User struct {
|
|||
}
|
||||
|
||||
// UserHeatmapData — UserHeatmapData represents the data needed to create a heatmap
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := UserHeatmapData{Contributions: 1}
|
||||
type UserHeatmapData struct {
|
||||
Contributions int64 `json:"contributions,omitempty"`
|
||||
Timestamp TimeStamp `json:"timestamp,omitempty"`
|
||||
}
|
||||
|
||||
// UserSettings — UserSettings represents user settings
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := UserSettings{Description: "example"}
|
||||
type UserSettings struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
DiffViewStyle string `json:"diff_view_style,omitempty"`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
package types
|
||||
|
||||
|
||||
// CreateWikiPageOptions — CreateWikiPageOptions form for creating wiki
|
||||
//
|
||||
// Usage:
|
||||
|
|
@ -15,6 +14,10 @@ type CreateWikiPageOptions struct {
|
|||
}
|
||||
|
||||
// WikiCommit — WikiCommit page commit/revision
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := WikiCommit{ID: "example"}
|
||||
type WikiCommit struct {
|
||||
Author *CommitUser `json:"author,omitempty"`
|
||||
Commiter *CommitUser `json:"commiter,omitempty"`
|
||||
|
|
@ -23,12 +26,20 @@ type WikiCommit struct {
|
|||
}
|
||||
|
||||
// WikiCommitList — WikiCommitList commit/revision list
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := WikiCommitList{Count: 1}
|
||||
type WikiCommitList struct {
|
||||
Count int64 `json:"count,omitempty"`
|
||||
WikiCommits []*WikiCommit `json:"commits,omitempty"`
|
||||
}
|
||||
|
||||
// WikiPage — WikiPage a wiki page
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := WikiPage{Title: "example"}
|
||||
type WikiPage struct {
|
||||
CommitCount int64 `json:"commit_count,omitempty"`
|
||||
ContentBase64 string `json:"content_base64,omitempty"` // Page content, base64 encoded
|
||||
|
|
@ -41,6 +52,10 @@ type WikiPage struct {
|
|||
}
|
||||
|
||||
// WikiPageMetaData — WikiPageMetaData wiki page meta information
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// opts := WikiPageMetaData{Title: "example"}
|
||||
type WikiPageMetaData struct {
|
||||
HTMLURL string `json:"html_url,omitempty"`
|
||||
LastCommit *WikiCommit `json:"last_commit,omitempty"`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue