docs(forgegen): expand generated usage examples
Some checks are pending
Test / test (push) Waiting to run
Security Scan / security (push) Successful in 13s

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-02 08:37:32 +00:00
parent 09d01bee96
commit 4b33c1b71c
37 changed files with 1807 additions and 1206 deletions

View file

@ -5,6 +5,7 @@ import (
"cmp"
"maps"
"slices"
"strconv"
"strings"
"text/template"
@ -254,34 +255,23 @@ 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 {
example := exampleTypeLiteral(gt)
if example == "" {
example = gt.Name + "{}"
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
}
return example
}
func exampleTypeLiteral(gt *GoType) string {
@ -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 "{}"
}

View file

@ -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)
}
}

View file

@ -4,36 +4,47 @@ 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"`
Event string `json:"event,omitempty"`
HeadBranch string `json:"head_branch,omitempty"`
HeadSHA string `json:"head_sha,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
RunNumber int64 `json:"run_number,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
DisplayTitle string `json:"display_title,omitempty"`
Event string `json:"event,omitempty"`
HeadBranch string `json:"head_branch,omitempty"`
HeadSHA string `json:"head_sha,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
RunNumber int64 `json:"run_number,omitempty"`
RunStartedAt time.Time `json:"run_started_at,omitempty"`
Status string `json:"status,omitempty"`
URL string `json:"url,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
WorkflowID string `json:"workflow_id,omitempty"`
Status string `json:"status,omitempty"`
URL string `json:"url,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
WorkflowID string `json:"workflow_id,omitempty"`
}
// 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"`
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
OwnerID int64 `json:"owner_id,omitempty"` // the owner to which the variable belongs
RepoID int64 `json:"repo_id,omitempty"` // the repository to which the variable belongs
Data string `json:"data,omitempty"` // the value of the variable
Name string `json:"name,omitempty"` // the name of the variable
OwnerID int64 `json:"owner_id,omitempty"` // the owner to which the variable belongs
RepoID int64 `json:"repo_id,omitempty"` // the repository to which the variable belongs
}
// CreateVariableOption — CreateVariableOption the option when creating variable
@ -52,13 +63,17 @@ type CreateVariableOption struct {
// opts := DispatchWorkflowOption{Ref: "main"}
type DispatchWorkflowOption struct {
Inputs map[string]string `json:"inputs,omitempty"` // Input keys and values configured in the workflow file.
Ref string `json:"ref"` // Git reference for the workflow
Ref string `json:"ref"` // Git reference for the workflow
}
// 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
Name string `json:"name,omitempty"` // the secret's name
}
// UpdateVariableOption — UpdateVariableOption the option when updating variable
@ -67,6 +82,6 @@ type Secret struct {
//
// opts := UpdateVariableOption{Value: "example"}
type UpdateVariableOption struct {
Name string `json:"name,omitempty"` // New name for the variable. If the field is empty, the variable name won't be updated.
Value string `json:"value"` // Value of the variable to update
Name string `json:"name,omitempty"` // New name for the variable. If the field is empty, the variable name won't be updated.
Value string `json:"value"` // Value of the variable to update
}

View file

@ -4,24 +4,30 @@ 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"`
Comment *Comment `json:"comment,omitempty"`
CommentID int64 `json:"comment_id,omitempty"`
Content string `json:"content,omitempty"`
Created time.Time `json:"created,omitempty"`
ID int64 `json:"id,omitempty"`
IsPrivate bool `json:"is_private,omitempty"`
OpType string `json:"op_type,omitempty"` // the type of action
RefName string `json:"ref_name,omitempty"`
Repo *Repository `json:"repo,omitempty"`
RepoID int64 `json:"repo_id,omitempty"`
UserID int64 `json:"user_id,omitempty"`
ActUser *User `json:"act_user,omitempty"`
ActUserID int64 `json:"act_user_id,omitempty"`
Comment *Comment `json:"comment,omitempty"`
CommentID int64 `json:"comment_id,omitempty"`
Content string `json:"content,omitempty"`
Created time.Time `json:"created,omitempty"`
ID int64 `json:"id,omitempty"`
IsPrivate bool `json:"is_private,omitempty"`
OpType string `json:"op_type,omitempty"` // the type of action
RefName string `json:"ref_name,omitempty"`
Repo *Repository `json:"repo,omitempty"`
RepoID int64 `json:"repo_id,omitempty"`
UserID int64 `json:"user_id,omitempty"`
}
// ActivityPub — ActivityPub type
//
// Usage:
//
// opts := ActivityPub{Context: "example"}
type ActivityPub struct {
Context string `json:"@context,omitempty"`
}

View file

@ -4,14 +4,17 @@ 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"`
Next time.Time `json:"next,omitempty"`
Prev time.Time `json:"prev,omitempty"`
Schedule string `json:"schedule,omitempty"`
ExecTimes int64 `json:"exec_times,omitempty"`
Name string `json:"name,omitempty"`
Next time.Time `json:"next,omitempty"`
Prev time.Time `json:"prev,omitempty"`
Schedule string `json:"schedule,omitempty"`
}
// RenameUserOption — RenameUserOption options when renaming a user

View file

@ -4,49 +4,56 @@ 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"`
EnableStatusCheck bool `json:"enable_status_check,omitempty"`
Name string `json:"name,omitempty"`
Protected bool `json:"protected,omitempty"`
RequiredApprovals int64 `json:"required_approvals,omitempty"`
StatusCheckContexts []string `json:"status_check_contexts,omitempty"`
UserCanMerge bool `json:"user_can_merge,omitempty"`
UserCanPush bool `json:"user_can_push,omitempty"`
Commit *PayloadCommit `json:"commit,omitempty"`
EffectiveBranchProtectionName string `json:"effective_branch_protection_name,omitempty"`
EnableStatusCheck bool `json:"enable_status_check,omitempty"`
Name string `json:"name,omitempty"`
Protected bool `json:"protected,omitempty"`
RequiredApprovals int64 `json:"required_approvals,omitempty"`
StatusCheckContexts []string `json:"status_check_contexts,omitempty"`
UserCanMerge bool `json:"user_can_merge,omitempty"`
UserCanPush bool `json:"user_can_push,omitempty"`
}
// 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"`
ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username,omitempty"`
BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests,omitempty"`
BlockOnOutdatedBranch bool `json:"block_on_outdated_branch,omitempty"`
BlockOnRejectedReviews bool `json:"block_on_rejected_reviews,omitempty"`
BranchName string `json:"branch_name,omitempty"` // Deprecated: true
Created time.Time `json:"created_at,omitempty"`
DismissStaleApprovals bool `json:"dismiss_stale_approvals,omitempty"`
EnableApprovalsWhitelist bool `json:"enable_approvals_whitelist,omitempty"`
EnableMergeWhitelist bool `json:"enable_merge_whitelist,omitempty"`
EnablePush bool `json:"enable_push,omitempty"`
EnablePushWhitelist bool `json:"enable_push_whitelist,omitempty"`
EnableStatusCheck bool `json:"enable_status_check,omitempty"`
IgnoreStaleApprovals bool `json:"ignore_stale_approvals,omitempty"`
MergeWhitelistTeams []string `json:"merge_whitelist_teams,omitempty"`
MergeWhitelistUsernames []string `json:"merge_whitelist_usernames,omitempty"`
ProtectedFilePatterns string `json:"protected_file_patterns,omitempty"`
PushWhitelistDeployKeys bool `json:"push_whitelist_deploy_keys,omitempty"`
PushWhitelistTeams []string `json:"push_whitelist_teams,omitempty"`
PushWhitelistUsernames []string `json:"push_whitelist_usernames,omitempty"`
RequireSignedCommits bool `json:"require_signed_commits,omitempty"`
RequiredApprovals int64 `json:"required_approvals,omitempty"`
RuleName string `json:"rule_name,omitempty"`
StatusCheckContexts []string `json:"status_check_contexts,omitempty"`
UnprotectedFilePatterns string `json:"unprotected_file_patterns,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
ApplyToAdmins bool `json:"apply_to_admins,omitempty"`
ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams,omitempty"`
ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username,omitempty"`
BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests,omitempty"`
BlockOnOutdatedBranch bool `json:"block_on_outdated_branch,omitempty"`
BlockOnRejectedReviews bool `json:"block_on_rejected_reviews,omitempty"`
BranchName string `json:"branch_name,omitempty"` // Deprecated: true
Created time.Time `json:"created_at,omitempty"`
DismissStaleApprovals bool `json:"dismiss_stale_approvals,omitempty"`
EnableApprovalsWhitelist bool `json:"enable_approvals_whitelist,omitempty"`
EnableMergeWhitelist bool `json:"enable_merge_whitelist,omitempty"`
EnablePush bool `json:"enable_push,omitempty"`
EnablePushWhitelist bool `json:"enable_push_whitelist,omitempty"`
EnableStatusCheck bool `json:"enable_status_check,omitempty"`
IgnoreStaleApprovals bool `json:"ignore_stale_approvals,omitempty"`
MergeWhitelistTeams []string `json:"merge_whitelist_teams,omitempty"`
MergeWhitelistUsernames []string `json:"merge_whitelist_usernames,omitempty"`
ProtectedFilePatterns string `json:"protected_file_patterns,omitempty"`
PushWhitelistDeployKeys bool `json:"push_whitelist_deploy_keys,omitempty"`
PushWhitelistTeams []string `json:"push_whitelist_teams,omitempty"`
PushWhitelistUsernames []string `json:"push_whitelist_usernames,omitempty"`
RequireSignedCommits bool `json:"require_signed_commits,omitempty"`
RequiredApprovals int64 `json:"required_approvals,omitempty"`
RuleName string `json:"rule_name,omitempty"`
StatusCheckContexts []string `json:"status_check_contexts,omitempty"`
UnprotectedFilePatterns string `json:"unprotected_file_patterns,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
}
// CreateBranchProtectionOption — CreateBranchProtectionOption options for creating a branch protection
@ -55,31 +62,31 @@ type BranchProtection struct {
//
// opts := CreateBranchProtectionOption{BranchName: "main"}
type CreateBranchProtectionOption struct {
ApplyToAdmins bool `json:"apply_to_admins,omitempty"`
ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams,omitempty"`
ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username,omitempty"`
BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests,omitempty"`
BlockOnOutdatedBranch bool `json:"block_on_outdated_branch,omitempty"`
BlockOnRejectedReviews bool `json:"block_on_rejected_reviews,omitempty"`
BranchName string `json:"branch_name,omitempty"` // Deprecated: true
DismissStaleApprovals bool `json:"dismiss_stale_approvals,omitempty"`
EnableApprovalsWhitelist bool `json:"enable_approvals_whitelist,omitempty"`
EnableMergeWhitelist bool `json:"enable_merge_whitelist,omitempty"`
EnablePush bool `json:"enable_push,omitempty"`
EnablePushWhitelist bool `json:"enable_push_whitelist,omitempty"`
EnableStatusCheck bool `json:"enable_status_check,omitempty"`
IgnoreStaleApprovals bool `json:"ignore_stale_approvals,omitempty"`
MergeWhitelistTeams []string `json:"merge_whitelist_teams,omitempty"`
MergeWhitelistUsernames []string `json:"merge_whitelist_usernames,omitempty"`
ProtectedFilePatterns string `json:"protected_file_patterns,omitempty"`
PushWhitelistDeployKeys bool `json:"push_whitelist_deploy_keys,omitempty"`
PushWhitelistTeams []string `json:"push_whitelist_teams,omitempty"`
PushWhitelistUsernames []string `json:"push_whitelist_usernames,omitempty"`
RequireSignedCommits bool `json:"require_signed_commits,omitempty"`
RequiredApprovals int64 `json:"required_approvals,omitempty"`
RuleName string `json:"rule_name,omitempty"`
StatusCheckContexts []string `json:"status_check_contexts,omitempty"`
UnprotectedFilePatterns string `json:"unprotected_file_patterns,omitempty"`
ApplyToAdmins bool `json:"apply_to_admins,omitempty"`
ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams,omitempty"`
ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username,omitempty"`
BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests,omitempty"`
BlockOnOutdatedBranch bool `json:"block_on_outdated_branch,omitempty"`
BlockOnRejectedReviews bool `json:"block_on_rejected_reviews,omitempty"`
BranchName string `json:"branch_name,omitempty"` // Deprecated: true
DismissStaleApprovals bool `json:"dismiss_stale_approvals,omitempty"`
EnableApprovalsWhitelist bool `json:"enable_approvals_whitelist,omitempty"`
EnableMergeWhitelist bool `json:"enable_merge_whitelist,omitempty"`
EnablePush bool `json:"enable_push,omitempty"`
EnablePushWhitelist bool `json:"enable_push_whitelist,omitempty"`
EnableStatusCheck bool `json:"enable_status_check,omitempty"`
IgnoreStaleApprovals bool `json:"ignore_stale_approvals,omitempty"`
MergeWhitelistTeams []string `json:"merge_whitelist_teams,omitempty"`
MergeWhitelistUsernames []string `json:"merge_whitelist_usernames,omitempty"`
ProtectedFilePatterns string `json:"protected_file_patterns,omitempty"`
PushWhitelistDeployKeys bool `json:"push_whitelist_deploy_keys,omitempty"`
PushWhitelistTeams []string `json:"push_whitelist_teams,omitempty"`
PushWhitelistUsernames []string `json:"push_whitelist_usernames,omitempty"`
RequireSignedCommits bool `json:"require_signed_commits,omitempty"`
RequiredApprovals int64 `json:"required_approvals,omitempty"`
RuleName string `json:"rule_name,omitempty"`
StatusCheckContexts []string `json:"status_check_contexts,omitempty"`
UnprotectedFilePatterns string `json:"unprotected_file_patterns,omitempty"`
}
// CreateBranchRepoOption — CreateBranchRepoOption options when creating a branch in a repository
@ -88,9 +95,9 @@ type CreateBranchProtectionOption struct {
//
// opts := CreateBranchRepoOption{BranchName: "main"}
type CreateBranchRepoOption struct {
BranchName string `json:"new_branch_name"` // Name of the branch to create
BranchName string `json:"new_branch_name"` // Name of the branch to create
OldBranchName string `json:"old_branch_name,omitempty"` // Deprecated: true Name of the old branch to create from
OldRefName string `json:"old_ref_name,omitempty"` // Name of the old branch/tag/commit to create from
OldRefName string `json:"old_ref_name,omitempty"` // Name of the old branch/tag/commit to create from
}
// EditBranchProtectionOption — EditBranchProtectionOption options for editing a branch protection
@ -99,29 +106,29 @@ type CreateBranchRepoOption struct {
//
// opts := EditBranchProtectionOption{ApprovalsWhitelistTeams: []string{"example"}}
type EditBranchProtectionOption struct {
ApplyToAdmins bool `json:"apply_to_admins,omitempty"`
ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams,omitempty"`
ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username,omitempty"`
BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests,omitempty"`
BlockOnOutdatedBranch bool `json:"block_on_outdated_branch,omitempty"`
BlockOnRejectedReviews bool `json:"block_on_rejected_reviews,omitempty"`
DismissStaleApprovals bool `json:"dismiss_stale_approvals,omitempty"`
EnableApprovalsWhitelist bool `json:"enable_approvals_whitelist,omitempty"`
EnableMergeWhitelist bool `json:"enable_merge_whitelist,omitempty"`
EnablePush bool `json:"enable_push,omitempty"`
EnablePushWhitelist bool `json:"enable_push_whitelist,omitempty"`
EnableStatusCheck bool `json:"enable_status_check,omitempty"`
IgnoreStaleApprovals bool `json:"ignore_stale_approvals,omitempty"`
MergeWhitelistTeams []string `json:"merge_whitelist_teams,omitempty"`
MergeWhitelistUsernames []string `json:"merge_whitelist_usernames,omitempty"`
ProtectedFilePatterns string `json:"protected_file_patterns,omitempty"`
PushWhitelistDeployKeys bool `json:"push_whitelist_deploy_keys,omitempty"`
PushWhitelistTeams []string `json:"push_whitelist_teams,omitempty"`
PushWhitelistUsernames []string `json:"push_whitelist_usernames,omitempty"`
RequireSignedCommits bool `json:"require_signed_commits,omitempty"`
RequiredApprovals int64 `json:"required_approvals,omitempty"`
StatusCheckContexts []string `json:"status_check_contexts,omitempty"`
UnprotectedFilePatterns string `json:"unprotected_file_patterns,omitempty"`
ApplyToAdmins bool `json:"apply_to_admins,omitempty"`
ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams,omitempty"`
ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username,omitempty"`
BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests,omitempty"`
BlockOnOutdatedBranch bool `json:"block_on_outdated_branch,omitempty"`
BlockOnRejectedReviews bool `json:"block_on_rejected_reviews,omitempty"`
DismissStaleApprovals bool `json:"dismiss_stale_approvals,omitempty"`
EnableApprovalsWhitelist bool `json:"enable_approvals_whitelist,omitempty"`
EnableMergeWhitelist bool `json:"enable_merge_whitelist,omitempty"`
EnablePush bool `json:"enable_push,omitempty"`
EnablePushWhitelist bool `json:"enable_push_whitelist,omitempty"`
EnableStatusCheck bool `json:"enable_status_check,omitempty"`
IgnoreStaleApprovals bool `json:"ignore_stale_approvals,omitempty"`
MergeWhitelistTeams []string `json:"merge_whitelist_teams,omitempty"`
MergeWhitelistUsernames []string `json:"merge_whitelist_usernames,omitempty"`
ProtectedFilePatterns string `json:"protected_file_patterns,omitempty"`
PushWhitelistDeployKeys bool `json:"push_whitelist_deploy_keys,omitempty"`
PushWhitelistTeams []string `json:"push_whitelist_teams,omitempty"`
PushWhitelistUsernames []string `json:"push_whitelist_usernames,omitempty"`
RequireSignedCommits bool `json:"require_signed_commits,omitempty"`
RequiredApprovals int64 `json:"required_approvals,omitempty"`
StatusCheckContexts []string `json:"status_check_contexts,omitempty"`
UnprotectedFilePatterns string `json:"unprotected_file_patterns,omitempty"`
}
// UpdateBranchRepoOption — UpdateBranchRepoOption options when updating a branch in a repository

View file

@ -4,18 +4,21 @@ 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"`
Created time.Time `json:"created_at,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
IssueURL string `json:"issue_url,omitempty"`
OriginalAuthor string `json:"original_author,omitempty"`
OriginalAuthorID int64 `json:"original_author_id,omitempty"`
PRURL string `json:"pull_request_url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
Attachments []*Attachment `json:"assets,omitempty"`
Body string `json:"body,omitempty"`
Created time.Time `json:"created_at,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
IssueURL string `json:"issue_url,omitempty"`
OriginalAuthor string `json:"original_author,omitempty"`
OriginalAuthorID int64 `json:"original_author_id,omitempty"`
PRURL string `json:"pull_request_url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
}

View file

@ -4,24 +4,30 @@ package types
import "time"
// Usage:
//
// opts := Commit{HTMLURL: "https://example.com"}
type Commit struct {
Author *User `json:"author,omitempty"`
Commit *RepoCommit `json:"commit,omitempty"`
Committer *User `json:"committer,omitempty"`
Created time.Time `json:"created,omitempty"`
Files []*CommitAffectedFiles `json:"files,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
Parents []*CommitMeta `json:"parents,omitempty"`
SHA string `json:"sha,omitempty"`
Stats *CommitStats `json:"stats,omitempty"`
URL string `json:"url,omitempty"`
Author *User `json:"author,omitempty"`
Commit *RepoCommit `json:"commit,omitempty"`
Committer *User `json:"committer,omitempty"`
Created time.Time `json:"created,omitempty"`
Files []*CommitAffectedFiles `json:"files,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
Parents []*CommitMeta `json:"parents,omitempty"`
SHA string `json:"sha,omitempty"`
Stats *CommitStats `json:"stats,omitempty"`
URL string `json:"url,omitempty"`
}
// 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"`
Status string `json:"status,omitempty"`
}
// CommitDateOptions — CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
@ -30,41 +36,59 @@ type CommitAffectedFiles struct {
//
// opts := CommitDateOptions{Author: time.Now()}
type CommitDateOptions struct {
Author time.Time `json:"author,omitempty"`
Author time.Time `json:"author,omitempty"`
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"`
URL string `json:"url,omitempty"`
SHA string `json:"sha,omitempty"`
URL string `json:"url,omitempty"`
}
// 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"`
Total int64 `json:"total,omitempty"`
Total int64 `json:"total,omitempty"`
}
// 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"`
Creator *User `json:"creator,omitempty"`
Description string `json:"description,omitempty"`
ID int64 `json:"id,omitempty"`
Status CommitStatusState `json:"status,omitempty"`
TargetURL string `json:"target_url,omitempty"`
URL string `json:"url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
Context string `json:"context,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Creator *User `json:"creator,omitempty"`
Description string `json:"description,omitempty"`
ID int64 `json:"id,omitempty"`
Status CommitStatusState `json:"status,omitempty"`
TargetURL string `json:"target_url,omitempty"`
URL string `json:"url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
}
// 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"`
Date string `json:"date,omitempty"`
Email string `json:"email,omitempty"`
Name string `json:"name,omitempty"`
Name string `json:"name,omitempty"`
}

View file

@ -4,17 +4,20 @@ 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"`
DownloadURL string `json:"browser_download_url,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Size int64 `json:"size,omitempty"`
Type string `json:"type,omitempty"`
UUID string `json:"uuid,omitempty"`
Created time.Time `json:"created_at,omitempty"`
DownloadCount int64 `json:"download_count,omitempty"`
DownloadURL string `json:"browser_download_url,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Size int64 `json:"size,omitempty"`
Type string `json:"type,omitempty"`
UUID string `json:"uuid,omitempty"`
}
// EditAttachmentOptions — EditAttachmentOptions options for editing attachments
@ -24,18 +27,30 @@ type Attachment struct {
// opts := EditAttachmentOptions{Name: "example"}
type EditAttachmentOptions struct {
DownloadURL string `json:"browser_download_url,omitempty"` // (Can only be set if existing attachment is of external type)
Name string `json:"name,omitempty"`
Name string `json:"name,omitempty"`
}
// 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"`
Push bool `json:"push,omitempty"`
Pull bool `json:"pull,omitempty"`
Push bool `json:"push,omitempty"`
}
// StateType — StateType issue state type
//
// Usage:
//
// opts := StateType("example")
type StateType string
// TimeStamp — TimeStamp defines a timestamp
//
// Usage:
//
// opts := TimeStamp(1)
type TimeStamp int64

View file

@ -4,24 +4,27 @@ 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"`
Encoding string `json:"encoding,omitempty"` // `encoding` is populated when `type` is `file`, otherwise null
GitURL string `json:"git_url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
LastCommitSHA string `json:"last_commit_sha,omitempty"`
Links *FileLinksResponse `json:"_links,omitempty"`
Name string `json:"name,omitempty"`
Path string `json:"path,omitempty"`
SHA string `json:"sha,omitempty"`
Size int64 `json:"size,omitempty"`
SubmoduleGitURL string `json:"submodule_git_url,omitempty"` // `submodule_git_url` is populated when `type` is `submodule`, otherwise null
Target string `json:"target,omitempty"` // `target` is populated when `type` is `symlink`, otherwise null
Type string `json:"type,omitempty"` // `type` will be `file`, `dir`, `symlink`, or `submodule`
URL string `json:"url,omitempty"`
Content string `json:"content,omitempty"` // `content` is populated when `type` is `file`, otherwise null
DownloadURL string `json:"download_url,omitempty"`
Encoding string `json:"encoding,omitempty"` // `encoding` is populated when `type` is `file`, otherwise null
GitURL string `json:"git_url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
LastCommitSHA string `json:"last_commit_sha,omitempty"`
Links *FileLinksResponse `json:"_links,omitempty"`
Name string `json:"name,omitempty"`
Path string `json:"path,omitempty"`
SHA string `json:"sha,omitempty"`
Size int64 `json:"size,omitempty"`
SubmoduleGitURL string `json:"submodule_git_url,omitempty"` // `submodule_git_url` is populated when `type` is `submodule`, otherwise null
Target string `json:"target,omitempty"` // `target` is populated when `type` is `symlink`, otherwise null
Type string `json:"type,omitempty"` // `type` will be `file`, `dir`, `symlink`, or `submodule`
URL string `json:"url,omitempty"`
}
// CreateFileOptions — CreateFileOptions options for creating files Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
@ -30,14 +33,14 @@ type ContentsResponse struct {
//
// opts := CreateFileOptions{ContentBase64: "example"}
type CreateFileOptions struct {
Author *Identity `json:"author,omitempty"`
BranchName string `json:"branch,omitempty"` // branch (optional) to base this file from. if not given, the default branch is used
Committer *Identity `json:"committer,omitempty"`
ContentBase64 string `json:"content"` // content must be base64 encoded
Dates *CommitDateOptions `json:"dates,omitempty"`
Message string `json:"message,omitempty"` // message (optional) for the commit of this file. if not supplied, a default message will be used
NewBranchName string `json:"new_branch,omitempty"` // new_branch (optional) will make a new branch from `branch` before creating the file
Signoff bool `json:"signoff,omitempty"` // Add a Signed-off-by trailer by the committer at the end of the commit log message.
Author *Identity `json:"author,omitempty"`
BranchName string `json:"branch,omitempty"` // branch (optional) to base this file from. if not given, the default branch is used
Committer *Identity `json:"committer,omitempty"`
ContentBase64 string `json:"content"` // content must be base64 encoded
Dates *CommitDateOptions `json:"dates,omitempty"`
Message string `json:"message,omitempty"` // message (optional) for the commit of this file. if not supplied, a default message will be used
NewBranchName string `json:"new_branch,omitempty"` // new_branch (optional) will make a new branch from `branch` before creating the file
Signoff bool `json:"signoff,omitempty"` // Add a Signed-off-by trailer by the committer at the end of the commit log message.
}
// DeleteFileOptions — DeleteFileOptions options for deleting files (used for other File structs below) Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
@ -46,53 +49,72 @@ type CreateFileOptions struct {
//
// opts := DeleteFileOptions{SHA: "example"}
type DeleteFileOptions struct {
Author *Identity `json:"author,omitempty"`
BranchName string `json:"branch,omitempty"` // branch (optional) to base this file from. if not given, the default branch is used
Committer *Identity `json:"committer,omitempty"`
Dates *CommitDateOptions `json:"dates,omitempty"`
Message string `json:"message,omitempty"` // message (optional) for the commit of this file. if not supplied, a default message will be used
NewBranchName string `json:"new_branch,omitempty"` // new_branch (optional) will make a new branch from `branch` before creating the file
SHA string `json:"sha"` // sha is the SHA for the file that already exists
Signoff bool `json:"signoff,omitempty"` // Add a Signed-off-by trailer by the committer at the end of the commit log message.
Author *Identity `json:"author,omitempty"`
BranchName string `json:"branch,omitempty"` // branch (optional) to base this file from. if not given, the default branch is used
Committer *Identity `json:"committer,omitempty"`
Dates *CommitDateOptions `json:"dates,omitempty"`
Message string `json:"message,omitempty"` // message (optional) for the commit of this file. if not supplied, a default message will be used
NewBranchName string `json:"new_branch,omitempty"` // new_branch (optional) will make a new branch from `branch` before creating the file
SHA string `json:"sha"` // sha is the SHA for the file that already exists
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"`
Created time.Time `json:"created,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
Message string `json:"message,omitempty"`
Parents []*CommitMeta `json:"parents,omitempty"`
SHA string `json:"sha,omitempty"`
Tree *CommitMeta `json:"tree,omitempty"`
URL string `json:"url,omitempty"`
Author *CommitUser `json:"author,omitempty"`
Committer *CommitUser `json:"committer,omitempty"`
Created time.Time `json:"created,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
Message string `json:"message,omitempty"`
Parents []*CommitMeta `json:"parents,omitempty"`
SHA string `json:"sha,omitempty"`
Tree *CommitMeta `json:"tree,omitempty"`
URL string `json:"url,omitempty"`
}
// 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"`
Commit *FileCommitResponse `json:"commit,omitempty"`
Content any `json:"content,omitempty"`
Verification *PayloadCommitVerification `json:"verification,omitempty"`
}
// 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"`
GitURL string `json:"git,omitempty"`
HTMLURL string `json:"html,omitempty"`
Self string `json:"self,omitempty"`
Self string `json:"self,omitempty"`
}
// 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"`
Commit *FileCommitResponse `json:"commit,omitempty"`
Content *ContentsResponse `json:"content,omitempty"`
Verification *PayloadCommitVerification `json:"verification,omitempty"`
}
// 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"`
Commit *FileCommitResponse `json:"commit,omitempty"`
Files []*ContentsResponse `json:"files,omitempty"`
Verification *PayloadCommitVerification `json:"verification,omitempty"`
}
@ -102,14 +124,14 @@ type FilesResponse struct {
//
// opts := UpdateFileOptions{ContentBase64: "example"}
type UpdateFileOptions struct {
Author *Identity `json:"author,omitempty"`
BranchName string `json:"branch,omitempty"` // branch (optional) to base this file from. if not given, the default branch is used
Committer *Identity `json:"committer,omitempty"`
ContentBase64 string `json:"content"` // content must be base64 encoded
Dates *CommitDateOptions `json:"dates,omitempty"`
FromPath string `json:"from_path,omitempty"` // from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL
Message string `json:"message,omitempty"` // message (optional) for the commit of this file. if not supplied, a default message will be used
NewBranchName string `json:"new_branch,omitempty"` // new_branch (optional) will make a new branch from `branch` before creating the file
SHA string `json:"sha"` // sha is the SHA for the file that already exists
Signoff bool `json:"signoff,omitempty"` // Add a Signed-off-by trailer by the committer at the end of the commit log message.
Author *Identity `json:"author,omitempty"`
BranchName string `json:"branch,omitempty"` // branch (optional) to base this file from. if not given, the default branch is used
Committer *Identity `json:"committer,omitempty"`
ContentBase64 string `json:"content"` // content must be base64 encoded
Dates *CommitDateOptions `json:"dates,omitempty"`
FromPath string `json:"from_path,omitempty"` // from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL
Message string `json:"message,omitempty"` // message (optional) for the commit of this file. if not supplied, a default message will be used
NewBranchName string `json:"new_branch,omitempty"` // new_branch (optional) will make a new branch from `branch` before creating the file
SHA string `json:"sha"` // sha is the SHA for the file that already exists
Signoff bool `json:"signoff,omitempty"` // Add a Signed-off-by trailer by the committer at the end of the commit log message.
}

View file

@ -2,40 +2,61 @@
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"`
URL string `json:"url,omitempty"`
}
// Usage:
//
// opts := APIForbiddenError{Message: "example"}
type APIForbiddenError struct {
Message string `json:"message,omitempty"`
URL string `json:"url,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"`
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"`
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"`
URL string `json:"url,omitempty"`
}
// Usage:
//
// opts := APIUnauthorizedError{Message: "example"}
type APIUnauthorizedError struct {
Message string `json:"message,omitempty"`
URL string `json:"url,omitempty"`
URL string `json:"url,omitempty"`
}
// Usage:
//
// opts := APIValidationError{Message: "example"}
type APIValidationError struct {
Message string `json:"message,omitempty"`
URL string `json:"url,omitempty"`
URL string `json:"url,omitempty"`
}

View file

@ -2,42 +2,61 @@
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"`
Protocols []string `json:"protocols,omitempty"`
Services *NodeInfoServices `json:"services,omitempty"`
Software *NodeInfoSoftware `json:"software,omitempty"`
Usage *NodeInfoUsage `json:"usage,omitempty"`
Version string `json:"version,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
OpenRegistrations bool `json:"openRegistrations,omitempty"`
Protocols []string `json:"protocols,omitempty"`
Services *NodeInfoServices `json:"services,omitempty"`
Software *NodeInfoSoftware `json:"software,omitempty"`
Usage *NodeInfoUsage `json:"usage,omitempty"`
Version string `json:"version,omitempty"`
}
// 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"`
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"`
Homepage string `json:"homepage,omitempty"`
Name string `json:"name,omitempty"`
Repository string `json:"repository,omitempty"`
Version string `json:"version,omitempty"`
Version string `json:"version,omitempty"`
}
// 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"`
Users *NodeInfoUsageUsers `json:"users,omitempty"`
LocalComments int64 `json:"localComments,omitempty"`
LocalPosts int64 `json:"localPosts,omitempty"`
Users *NodeInfoUsageUsers `json:"users,omitempty"`
}
// 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"`
Total int64 `json:"total,omitempty"`
ActiveMonth int64 `json:"activeMonth,omitempty"`
Total int64 `json:"total,omitempty"`
}

View file

@ -2,37 +2,48 @@
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"`
Object *AnnotatedTagObject `json:"object,omitempty"`
SHA string `json:"sha,omitempty"`
Tag string `json:"tag,omitempty"`
Tagger *CommitUser `json:"tagger,omitempty"`
URL string `json:"url,omitempty"`
Verification *PayloadCommitVerification `json:"verification,omitempty"`
ArchiveDownloadCount *TagArchiveDownloadCount `json:"archive_download_count,omitempty"`
Message string `json:"message,omitempty"`
Object *AnnotatedTagObject `json:"object,omitempty"`
SHA string `json:"sha,omitempty"`
Tag string `json:"tag,omitempty"`
Tagger *CommitUser `json:"tagger,omitempty"`
URL string `json:"url,omitempty"`
Verification *PayloadCommitVerification `json:"verification,omitempty"`
}
// AnnotatedTagObject — AnnotatedTagObject contains meta information of the tag object
//
// Usage:
//
// opts := AnnotatedTagObject{SHA: "example"}
type AnnotatedTagObject struct {
SHA string `json:"sha,omitempty"`
SHA string `json:"sha,omitempty"`
Type string `json:"type,omitempty"`
URL string `json:"url,omitempty"`
URL string `json:"url,omitempty"`
}
// 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"`
ContentsURL string `json:"contents_url,omitempty"`
Deletions int64 `json:"deletions,omitempty"`
Filename string `json:"filename,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
Additions int64 `json:"additions,omitempty"`
Changes int64 `json:"changes,omitempty"`
ContentsURL string `json:"contents_url,omitempty"`
Deletions int64 `json:"deletions,omitempty"`
Filename string `json:"filename,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
PreviousFilename string `json:"previous_filename,omitempty"`
RawURL string `json:"raw_url,omitempty"`
Status string `json:"status,omitempty"`
RawURL string `json:"raw_url,omitempty"`
Status string `json:"status,omitempty"`
}
// EditGitHookOption — EditGitHookOption options when modifying one Git hook
@ -45,54 +56,76 @@ type EditGitHookOption struct {
}
// GitBlobResponse — GitBlobResponse represents a git blob
//
// Usage:
//
// opts := GitBlobResponse{Content: "example"}
type GitBlobResponse struct {
Content string `json:"content,omitempty"`
Content string `json:"content,omitempty"`
Encoding string `json:"encoding,omitempty"`
SHA string `json:"sha,omitempty"`
Size int64 `json:"size,omitempty"`
URL string `json:"url,omitempty"`
SHA string `json:"sha,omitempty"`
Size int64 `json:"size,omitempty"`
URL string `json:"url,omitempty"`
}
// GitEntry — GitEntry represents a git tree
//
// Usage:
//
// opts := GitEntry{Mode: "example"}
type GitEntry struct {
Mode string `json:"mode,omitempty"`
Path string `json:"path,omitempty"`
SHA string `json:"sha,omitempty"`
Size int64 `json:"size,omitempty"`
SHA string `json:"sha,omitempty"`
Size int64 `json:"size,omitempty"`
Type string `json:"type,omitempty"`
URL string `json:"url,omitempty"`
URL string `json:"url,omitempty"`
}
// 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"`
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"`
SHA string `json:"sha,omitempty"`
Type string `json:"type,omitempty"`
URL string `json:"url,omitempty"`
URL string `json:"url,omitempty"`
}
// GitTreeResponse — GitTreeResponse returns a git tree
//
// Usage:
//
// opts := GitTreeResponse{SHA: "example"}
type GitTreeResponse struct {
Entries []*GitEntry `json:"tree,omitempty"`
Page int64 `json:"page,omitempty"`
SHA string `json:"sha,omitempty"`
TotalCount int64 `json:"total_count,omitempty"`
Truncated bool `json:"truncated,omitempty"`
URL string `json:"url,omitempty"`
Entries []*GitEntry `json:"tree,omitempty"`
Page int64 `json:"page,omitempty"`
SHA string `json:"sha,omitempty"`
TotalCount int64 `json:"total_count,omitempty"`
Truncated bool `json:"truncated,omitempty"`
URL string `json:"url,omitempty"`
}
// 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"`
Commit *Commit `json:"commit,omitempty"`
Message string `json:"message,omitempty"`
}
//
// Usage:
//
// opts := NoteOptions{Message: "example"}

View file

@ -4,26 +4,25 @@ package types
import "time"
// CreateHookOption — CreateHookOption options when create a hook
//
// Usage:
//
// opts := CreateHookOption{Type: "example"}
type CreateHookOption struct {
Active bool `json:"active,omitempty"`
AuthorizationHeader string `json:"authorization_header,omitempty"`
BranchFilter string `json:"branch_filter,omitempty"`
Config *CreateHookOptionConfig `json:"config"`
Events []string `json:"events,omitempty"`
Type string `json:"type"`
Active bool `json:"active,omitempty"`
AuthorizationHeader string `json:"authorization_header,omitempty"`
BranchFilter string `json:"branch_filter,omitempty"`
Config *CreateHookOptionConfig `json:"config"`
Events []string `json:"events,omitempty"`
Type string `json:"type"`
}
// CreateHookOptionConfig — CreateHookOptionConfig has all config options in it required are "content_type" and "url" Required
//
// Usage:
//
// opts := CreateHookOptionConfig{}
// opts := CreateHookOptionConfig(map[string]any{"key": "value"})
type CreateHookOptionConfig map[string]any
// EditHookOption — EditHookOption options when modify one hook
@ -32,48 +31,60 @@ type CreateHookOptionConfig map[string]any
//
// opts := EditHookOption{AuthorizationHeader: "example"}
type EditHookOption struct {
Active bool `json:"active,omitempty"`
AuthorizationHeader string `json:"authorization_header,omitempty"`
BranchFilter string `json:"branch_filter,omitempty"`
Config map[string]string `json:"config,omitempty"`
Events []string `json:"events,omitempty"`
Active bool `json:"active,omitempty"`
AuthorizationHeader string `json:"authorization_header,omitempty"`
BranchFilter string `json:"branch_filter,omitempty"`
Config map[string]string `json:"config,omitempty"`
Events []string `json:"events,omitempty"`
}
// 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"`
BranchFilter string `json:"branch_filter,omitempty"`
Config map[string]string `json:"config,omitempty"` // Deprecated: use Metadata instead
ContentType string `json:"content_type,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Events []string `json:"events,omitempty"`
ID int64 `json:"id,omitempty"`
Metadata any `json:"metadata,omitempty"`
Type string `json:"type,omitempty"`
URL string `json:"url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
Active bool `json:"active,omitempty"`
AuthorizationHeader string `json:"authorization_header,omitempty"`
BranchFilter string `json:"branch_filter,omitempty"`
Config map[string]string `json:"config,omitempty"` // Deprecated: use Metadata instead
ContentType string `json:"content_type,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Events []string `json:"events,omitempty"`
ID int64 `json:"id,omitempty"`
Metadata any `json:"metadata,omitempty"`
Type string `json:"type,omitempty"`
URL string `json:"url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
}
// PayloadCommit — PayloadCommit represents a commit
//
// Usage:
//
// opts := PayloadCommit{Added: []string{"example"}}
type PayloadCommit struct {
Added []string `json:"added,omitempty"`
Author *PayloadUser `json:"author,omitempty"`
Committer *PayloadUser `json:"committer,omitempty"`
ID string `json:"id,omitempty"` // sha1 hash of the commit
Message string `json:"message,omitempty"`
Modified []string `json:"modified,omitempty"`
Removed []string `json:"removed,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
URL string `json:"url,omitempty"`
Added []string `json:"added,omitempty"`
Author *PayloadUser `json:"author,omitempty"`
Committer *PayloadUser `json:"committer,omitempty"`
ID string `json:"id,omitempty"` // sha1 hash of the commit
Message string `json:"message,omitempty"`
Modified []string `json:"modified,omitempty"`
Removed []string `json:"removed,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
URL string `json:"url,omitempty"`
Verification *PayloadCommitVerification `json:"verification,omitempty"`
}
// 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"`
Signature string `json:"signature,omitempty"`
Signer *PayloadUser `json:"signer,omitempty"`
Verified bool `json:"verified,omitempty"`
Payload string `json:"payload,omitempty"`
Reason string `json:"reason,omitempty"`
Signature string `json:"signature,omitempty"`
Signer *PayloadUser `json:"signer,omitempty"`
Verified bool `json:"verified,omitempty"`
}

View file

@ -4,14 +4,13 @@ package types
import "time"
// CreateIssueCommentOption — CreateIssueCommentOption options for creating a comment on an issue
//
// Usage:
//
// opts := CreateIssueCommentOption{Body: "example"}
type CreateIssueCommentOption struct {
Body string `json:"body"`
Body string `json:"body"`
Updated time.Time `json:"updated_at,omitempty"`
}
@ -21,15 +20,15 @@ type CreateIssueCommentOption struct {
//
// opts := CreateIssueOption{Title: "example"}
type CreateIssueOption struct {
Assignee string `json:"assignee,omitempty"` // deprecated
Assignees []string `json:"assignees,omitempty"`
Body string `json:"body,omitempty"`
Closed bool `json:"closed,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
Labels []int64 `json:"labels,omitempty"` // list of label ids
Milestone int64 `json:"milestone,omitempty"` // milestone id
Ref string `json:"ref,omitempty"`
Title string `json:"title"`
Assignee string `json:"assignee,omitempty"` // deprecated
Assignees []string `json:"assignees,omitempty"`
Body string `json:"body,omitempty"`
Closed bool `json:"closed,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
Labels []int64 `json:"labels,omitempty"` // list of label ids
Milestone int64 `json:"milestone,omitempty"` // milestone id
Ref string `json:"ref,omitempty"`
Title string `json:"title"`
}
// EditDeadlineOption — EditDeadlineOption options for creating a deadline
@ -47,7 +46,7 @@ type EditDeadlineOption struct {
//
// opts := EditIssueCommentOption{Body: "example"}
type EditIssueCommentOption struct {
Body string `json:"body"`
Body string `json:"body"`
Updated time.Time `json:"updated_at,omitempty"`
}
@ -57,80 +56,108 @@ type EditIssueCommentOption struct {
//
// opts := EditIssueOption{Body: "example"}
type EditIssueOption struct {
Assignee string `json:"assignee,omitempty"` // deprecated
Assignees []string `json:"assignees,omitempty"`
Body string `json:"body,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
Milestone int64 `json:"milestone,omitempty"`
Ref string `json:"ref,omitempty"`
RemoveDeadline bool `json:"unset_due_date,omitempty"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
Assignee string `json:"assignee,omitempty"` // deprecated
Assignees []string `json:"assignees,omitempty"`
Body string `json:"body,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
Milestone int64 `json:"milestone,omitempty"`
Ref string `json:"ref,omitempty"`
RemoveDeadline bool `json:"unset_due_date,omitempty"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
}
// 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"`
Attachments []*Attachment `json:"assets,omitempty"`
Body string `json:"body,omitempty"`
Closed time.Time `json:"closed_at,omitempty"`
Comments int64 `json:"comments,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
Index int64 `json:"number,omitempty"`
IsLocked bool `json:"is_locked,omitempty"`
Labels []*Label `json:"labels,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
OriginalAuthor string `json:"original_author,omitempty"`
OriginalAuthorID int64 `json:"original_author_id,omitempty"`
PinOrder int64 `json:"pin_order,omitempty"`
PullRequest *PullRequestMeta `json:"pull_request,omitempty"`
Ref string `json:"ref,omitempty"`
Repository *RepositoryMeta `json:"repository,omitempty"`
State StateType `json:"state,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
Assignee *User `json:"assignee,omitempty"`
Assignees []*User `json:"assignees,omitempty"`
Attachments []*Attachment `json:"assets,omitempty"`
Body string `json:"body,omitempty"`
Closed time.Time `json:"closed_at,omitempty"`
Comments int64 `json:"comments,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
Index int64 `json:"number,omitempty"`
IsLocked bool `json:"is_locked,omitempty"`
Labels []*Label `json:"labels,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
OriginalAuthor string `json:"original_author,omitempty"`
OriginalAuthorID int64 `json:"original_author_id,omitempty"`
PinOrder int64 `json:"pin_order,omitempty"`
PullRequest *PullRequestMeta `json:"pull_request,omitempty"`
Ref string `json:"ref,omitempty"`
Repository *RepositoryMeta `json:"repository,omitempty"`
State StateType `json:"state,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
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"`
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"`
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"`
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"`
Type IssueFormFieldType `json:"type,omitempty"`
Validations map[string]any `json:"validations,omitempty"`
Visible []IssueFormFieldVisible `json:"visible,omitempty"`
Attributes map[string]any `json:"attributes,omitempty"`
ID string `json:"id,omitempty"`
Type IssueFormFieldType `json:"type,omitempty"`
Validations map[string]any `json:"validations,omitempty"`
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
@ -139,27 +166,38 @@ type IssueFormFieldVisible string
//
// opts := IssueLabelsOption{Updated: time.Now()}
type IssueLabelsOption struct {
Labels []any `json:"labels,omitempty"` // Labels can be a list of integers representing label IDs or a list of strings representing label names
Labels []any `json:"labels,omitempty"` // Labels can be a list of integers representing label IDs or a list of strings representing label names
Updated time.Time `json:"updated_at,omitempty"`
}
// IssueMeta — IssueMeta basic issue information
//
// Usage:
//
// opts := IssueMeta{Name: "example"}
type IssueMeta struct {
Index int64 `json:"index,omitempty"`
Name string `json:"repo,omitempty"`
Index int64 `json:"index,omitempty"`
Name string `json:"repo,omitempty"`
Owner string `json:"owner,omitempty"`
}
// 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"`
Fields []*IssueFormField `json:"body,omitempty"`
FileName string `json:"file_name,omitempty"`
Labels IssueTemplateLabels `json:"labels,omitempty"`
Name string `json:"name,omitempty"`
Ref string `json:"ref,omitempty"`
Title string `json:"title,omitempty"`
About string `json:"about,omitempty"`
Content string `json:"content,omitempty"`
Fields []*IssueFormField `json:"body,omitempty"`
FileName string `json:"file_name,omitempty"`
Labels IssueTemplateLabels `json:"labels,omitempty"`
Name string `json:"name,omitempty"`
Ref string `json:"ref,omitempty"`
Title string `json:"title,omitempty"`
}
// Usage:
//
// opts := IssueTemplateLabels([]string{"example"})
type IssueTemplateLabels []string

View file

@ -4,7 +4,6 @@ package types
import "time"
// CreateGPGKeyOption — CreateGPGKeyOption options create user GPG key
//
// Usage:
@ -12,7 +11,7 @@ import "time"
// opts := CreateGPGKeyOption{ArmoredKey: "example"}
type CreateGPGKeyOption struct {
ArmoredKey string `json:"armored_public_key"` // An armored GPG key to add
Signature string `json:"armored_signature,omitempty"`
Signature string `json:"armored_signature,omitempty"`
}
// CreateKeyOption — CreateKeyOption options when creating a key
@ -21,56 +20,72 @@ type CreateGPGKeyOption struct {
//
// opts := CreateKeyOption{Title: "example"}
type CreateKeyOption struct {
Key string `json:"key"` // An armored SSH key to add
ReadOnly bool `json:"read_only,omitempty"` // Describe if the key has only read access or read/write
Title string `json:"title"` // Title of the key to add
Key string `json:"key"` // An armored SSH key to add
ReadOnly bool `json:"read_only,omitempty"` // Describe if the key has only read access or read/write
Title string `json:"title"` // Title of the key to add
}
// 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"`
ID int64 `json:"id,omitempty"`
Key string `json:"key,omitempty"`
KeyID int64 `json:"key_id,omitempty"`
ReadOnly bool `json:"read_only,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
ID int64 `json:"id,omitempty"`
Key string `json:"key,omitempty"`
KeyID int64 `json:"key_id,omitempty"`
ReadOnly bool `json:"read_only,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
}
// 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"`
CanEncryptStorage bool `json:"can_encrypt_storage,omitempty"`
CanSign bool `json:"can_sign,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Emails []*GPGKeyEmail `json:"emails,omitempty"`
Expires time.Time `json:"expires_at,omitempty"`
ID int64 `json:"id,omitempty"`
KeyID string `json:"key_id,omitempty"`
PrimaryKeyID string `json:"primary_key_id,omitempty"`
PublicKey string `json:"public_key,omitempty"`
SubsKey []*GPGKey `json:"subkeys,omitempty"`
Verified bool `json:"verified,omitempty"`
CanCertify bool `json:"can_certify,omitempty"`
CanEncryptComms bool `json:"can_encrypt_comms,omitempty"`
CanEncryptStorage bool `json:"can_encrypt_storage,omitempty"`
CanSign bool `json:"can_sign,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Emails []*GPGKeyEmail `json:"emails,omitempty"`
Expires time.Time `json:"expires_at,omitempty"`
ID int64 `json:"id,omitempty"`
KeyID string `json:"key_id,omitempty"`
PrimaryKeyID string `json:"primary_key_id,omitempty"`
PublicKey string `json:"public_key,omitempty"`
SubsKey []*GPGKey `json:"subkeys,omitempty"`
Verified bool `json:"verified,omitempty"`
}
// 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"`
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"`
ID int64 `json:"id,omitempty"`
Key string `json:"key,omitempty"`
KeyType string `json:"key_type,omitempty"`
ReadOnly bool `json:"read_only,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
User *User `json:"user,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
ID int64 `json:"id,omitempty"`
Key string `json:"key,omitempty"`
KeyType string `json:"key_type,omitempty"`
ReadOnly bool `json:"read_only,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
User *User `json:"user,omitempty"`
}

View file

@ -4,18 +4,17 @@ package types
import "time"
// CreateLabelOption — CreateLabelOption options for creating a label
//
// Usage:
//
// opts := CreateLabelOption{Name: "example"}
type CreateLabelOption struct {
Color string `json:"color"`
Color string `json:"color"`
Description string `json:"description,omitempty"`
Exclusive bool `json:"exclusive,omitempty"`
IsArchived bool `json:"is_archived,omitempty"`
Name string `json:"name"`
Exclusive bool `json:"exclusive,omitempty"`
IsArchived bool `json:"is_archived,omitempty"`
Name string `json:"name"`
}
// DeleteLabelsOption — DeleteLabelOption options for deleting a label
@ -33,28 +32,36 @@ type DeleteLabelsOption struct {
//
// opts := EditLabelOption{Description: "example"}
type EditLabelOption struct {
Color string `json:"color,omitempty"`
Color string `json:"color,omitempty"`
Description string `json:"description,omitempty"`
Exclusive bool `json:"exclusive,omitempty"`
IsArchived bool `json:"is_archived,omitempty"`
Name string `json:"name,omitempty"`
Exclusive bool `json:"exclusive,omitempty"`
IsArchived bool `json:"is_archived,omitempty"`
Name string `json:"name,omitempty"`
}
// Label — Label a label to an issue or a pr
//
// Usage:
//
// opts := Label{Description: "example"}
type Label struct {
Color string `json:"color,omitempty"`
Color string `json:"color,omitempty"`
Description string `json:"description,omitempty"`
Exclusive bool `json:"exclusive,omitempty"`
ID int64 `json:"id,omitempty"`
IsArchived bool `json:"is_archived,omitempty"`
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
Exclusive bool `json:"exclusive,omitempty"`
ID int64 `json:"id,omitempty"`
IsArchived bool `json:"is_archived,omitempty"`
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
}
// LabelTemplate — LabelTemplate info of a Label template
//
// Usage:
//
// opts := LabelTemplate{Description: "example"}
type LabelTemplate struct {
Color string `json:"color,omitempty"`
Color string `json:"color,omitempty"`
Description string `json:"description,omitempty"`
Exclusive bool `json:"exclusive,omitempty"`
Name string `json:"name,omitempty"`
Exclusive bool `json:"exclusive,omitempty"`
Name string `json:"name,omitempty"`
}

View file

@ -4,17 +4,16 @@ package types
import "time"
// CreateMilestoneOption — CreateMilestoneOption options for creating a milestone
//
// Usage:
//
// opts := CreateMilestoneOption{Description: "example"}
type CreateMilestoneOption struct {
Deadline time.Time `json:"due_on,omitempty"`
Description string `json:"description,omitempty"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
Deadline time.Time `json:"due_on,omitempty"`
Description string `json:"description,omitempty"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
}
// EditMilestoneOption — EditMilestoneOption options for editing a milestone
@ -23,22 +22,26 @@ type CreateMilestoneOption struct {
//
// opts := EditMilestoneOption{Description: "example"}
type EditMilestoneOption struct {
Deadline time.Time `json:"due_on,omitempty"`
Description string `json:"description,omitempty"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
Deadline time.Time `json:"due_on,omitempty"`
Description string `json:"description,omitempty"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
}
// 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"`
Created time.Time `json:"created_at,omitempty"`
Deadline time.Time `json:"due_on,omitempty"`
Description string `json:"description,omitempty"`
ID int64 `json:"id,omitempty"`
OpenIssues int64 `json:"open_issues,omitempty"`
State StateType `json:"state,omitempty"`
Title string `json:"title,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
Closed time.Time `json:"closed_at,omitempty"`
ClosedIssues int64 `json:"closed_issues,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Deadline time.Time `json:"due_on,omitempty"`
Description string `json:"description,omitempty"`
ID int64 `json:"id,omitempty"`
OpenIssues int64 `json:"open_issues,omitempty"`
State StateType `json:"state,omitempty"`
Title string `json:"title,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
}

View file

@ -4,7 +4,6 @@ package types
import "time"
// AddCollaboratorOption — AddCollaboratorOption options when adding a user as a collaborator of a repository
//
// Usage:
@ -21,17 +20,21 @@ type AddCollaboratorOption struct {
// opts := AddTimeOption{Time: 1}
type AddTimeOption struct {
Created time.Time `json:"created,omitempty"`
Time int64 `json:"time"` // time in seconds
User string `json:"user_name,omitempty"` // User who spent the time (optional)
Time int64 `json:"time"` // time in seconds
User string `json:"user_name,omitempty"` // User who spent the time (optional)
}
// 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
Operation string `json:"operation"` // indicates what to do with the file
Path string `json:"path"` // path to the existing or new file
SHA string `json:"sha,omitempty"` // sha is the SHA for the file that already exists, required for update or delete
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
Operation string `json:"operation"` // indicates what to do with the file
Path string `json:"path"` // path to the existing or new file
SHA string `json:"sha,omitempty"` // sha is the SHA for the file that already exists, required for update or delete
}
// ChangeFilesOptions — ChangeFilesOptions options for creating, updating or deleting multiple files Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
@ -40,19 +43,22 @@ type ChangeFileOperation struct {
//
// opts := ChangeFilesOptions{Files: {}}
type ChangeFilesOptions struct {
Author *Identity `json:"author,omitempty"`
BranchName string `json:"branch,omitempty"` // branch (optional) to base this file from. if not given, the default branch is used
Committer *Identity `json:"committer,omitempty"`
Dates *CommitDateOptions `json:"dates,omitempty"`
Files []*ChangeFileOperation `json:"files"` // list of file operations
Message string `json:"message,omitempty"` // message (optional) for the commit of this file. if not supplied, a default message will be used
NewBranchName string `json:"new_branch,omitempty"` // new_branch (optional) will make a new branch from `branch` before creating the file
Signoff bool `json:"signoff,omitempty"` // Add a Signed-off-by trailer by the committer at the end of the commit log message.
Author *Identity `json:"author,omitempty"`
BranchName string `json:"branch,omitempty"` // branch (optional) to base this file from. if not given, the default branch is used
Committer *Identity `json:"committer,omitempty"`
Dates *CommitDateOptions `json:"dates,omitempty"`
Files []*ChangeFileOperation `json:"files"` // list of file operations
Message string `json:"message,omitempty"` // message (optional) for the commit of this file. if not supplied, a default message will be used
NewBranchName string `json:"new_branch,omitempty"` // new_branch (optional) will make a new branch from `branch` before creating the file
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"`
Commits []*Commit `json:"commits,omitempty"`
TotalCommits int64 `json:"total_commits,omitempty"`
}
// CreateForkOption — CreateForkOption options for creating a fork
@ -61,7 +67,7 @@ type Compare struct {
//
// opts := CreateForkOption{Name: "example"}
type CreateForkOption struct {
Name string `json:"name,omitempty"` // name of the forked repository
Name string `json:"name,omitempty"` // name of the forked repository
Organization string `json:"organization,omitempty"` // organization name, if forking into an organization
}
@ -81,10 +87,15 @@ type CreateOrUpdateSecretOption struct {
// opts := DismissPullReviewOptions{Message: "example"}
type DismissPullReviewOptions struct {
Message string `json:"message,omitempty"`
Priors bool `json:"priors,omitempty"`
Priors bool `json:"priors,omitempty"`
}
// ForgeLike — ForgeLike activity data type
//
// Usage:
//
// opts := ForgeLike{}
//
// ForgeLike has no fields in the swagger spec.
type ForgeLike struct{}
@ -94,46 +105,62 @@ type ForgeLike struct{}
//
// opts := GenerateRepoOption{Name: "example"}
type GenerateRepoOption struct {
Avatar bool `json:"avatar,omitempty"` // include avatar of the template repo
DefaultBranch string `json:"default_branch,omitempty"` // Default branch of the new repository
Description string `json:"description,omitempty"` // Description of the repository to create
GitContent bool `json:"git_content,omitempty"` // include git content of default branch in template repo
GitHooks bool `json:"git_hooks,omitempty"` // include git hooks in template repo
Labels bool `json:"labels,omitempty"` // include labels in template repo
Name string `json:"name"` // Name of the repository to create
Owner string `json:"owner"` // The organization or person who will own the new repository
Private bool `json:"private,omitempty"` // Whether the repository is private
ProtectedBranch bool `json:"protected_branch,omitempty"` // include protected branches in template repo
Topics bool `json:"topics,omitempty"` // include topics in template repo
Webhooks bool `json:"webhooks,omitempty"` // include webhooks in template repo
Avatar bool `json:"avatar,omitempty"` // include avatar of the template repo
DefaultBranch string `json:"default_branch,omitempty"` // Default branch of the new repository
Description string `json:"description,omitempty"` // Description of the repository to create
GitContent bool `json:"git_content,omitempty"` // include git content of default branch in template repo
GitHooks bool `json:"git_hooks,omitempty"` // include git hooks in template repo
Labels bool `json:"labels,omitempty"` // include labels in template repo
Name string `json:"name"` // Name of the repository to create
Owner string `json:"owner"` // The organization or person who will own the new repository
Private bool `json:"private,omitempty"` // Whether the repository is private
ProtectedBranch bool `json:"protected_branch,omitempty"` // include protected branches in template repo
Topics bool `json:"topics,omitempty"` // include topics in template repo
Webhooks bool `json:"webhooks,omitempty"` // include webhooks in template repo
}
// GitignoreTemplateInfo — GitignoreTemplateInfo name and text of a gitignore template
//
// Usage:
//
// opts := GitignoreTemplateInfo{Name: "example"}
type GitignoreTemplateInfo struct {
Name string `json:"name,omitempty"`
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"`
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"`
Body string `json:"body,omitempty"`
Implementation string `json:"implementation,omitempty"`
Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
}
// LicensesTemplateListEntry — LicensesListEntry is used for the API
//
// Usage:
//
// opts := LicensesTemplateListEntry{Name: "example"}
type LicensesTemplateListEntry struct {
Key string `json:"key,omitempty"`
Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
URL string `json:"url,omitempty"`
}
// MarkdownOption — MarkdownOption markdown options
@ -143,9 +170,9 @@ type LicensesTemplateListEntry struct {
// opts := MarkdownOption{Context: "example"}
type MarkdownOption struct {
Context string `json:"Context,omitempty"` // Context to render in: body
Mode string `json:"Mode,omitempty"` // Mode to render (comment, gfm, markdown) in: body
Text string `json:"Text,omitempty"` // Text markdown to render in: body
Wiki bool `json:"Wiki,omitempty"` // Is it a wiki page ? in: body
Mode string `json:"Mode,omitempty"` // Mode to render (comment, gfm, markdown) in: body
Text string `json:"Text,omitempty"` // Text markdown to render in: body
Wiki bool `json:"Wiki,omitempty"` // Is it a wiki page ? in: body
}
// MarkupOption — MarkupOption markup options
@ -155,11 +182,11 @@ type MarkdownOption struct {
// opts := MarkupOption{BranchPath: "main"}
type MarkupOption struct {
BranchPath string `json:"BranchPath,omitempty"` // The current branch path where the form gets posted in: body
Context string `json:"Context,omitempty"` // Context to render in: body
FilePath string `json:"FilePath,omitempty"` // File path for detecting extension in file mode in: body
Mode string `json:"Mode,omitempty"` // Mode to render (comment, gfm, markdown, file) in: body
Text string `json:"Text,omitempty"` // Text markup to render in: body
Wiki bool `json:"Wiki,omitempty"` // Is it a wiki page ? in: body
Context string `json:"Context,omitempty"` // Context to render in: body
FilePath string `json:"FilePath,omitempty"` // File path for detecting extension in file mode in: body
Mode string `json:"Mode,omitempty"` // Mode to render (comment, gfm, markdown, file) in: body
Text string `json:"Text,omitempty"` // Text markup to render in: body
Wiki bool `json:"Wiki,omitempty"` // Is it a wiki page ? in: body
}
// MergePullRequestOption — MergePullRequestForm form for merging Pull Request
@ -168,14 +195,14 @@ type MarkupOption struct {
//
// opts := MergePullRequestOption{Do: "example"}
type MergePullRequestOption struct {
DeleteBranchAfterMerge bool `json:"delete_branch_after_merge,omitempty"`
Do string `json:"Do"`
ForceMerge bool `json:"force_merge,omitempty"`
HeadCommitID string `json:"head_commit_id,omitempty"`
MergeCommitID string `json:"MergeCommitID,omitempty"`
MergeMessageField string `json:"MergeMessageField,omitempty"`
MergeTitleField string `json:"MergeTitleField,omitempty"`
MergeWhenChecksSucceed bool `json:"merge_when_checks_succeed,omitempty"`
DeleteBranchAfterMerge bool `json:"delete_branch_after_merge,omitempty"`
Do string `json:"Do"`
ForceMerge bool `json:"force_merge,omitempty"`
HeadCommitID string `json:"head_commit_id,omitempty"`
MergeCommitID string `json:"MergeCommitID,omitempty"`
MergeMessageField string `json:"MergeMessageField,omitempty"`
MergeTitleField string `json:"MergeTitleField,omitempty"`
MergeWhenChecksSucceed bool `json:"merge_when_checks_succeed,omitempty"`
}
// MigrateRepoOptions — MigrateRepoOptions options for migrating repository's this is used to interact with api v1
@ -184,57 +211,76 @@ type MergePullRequestOption struct {
//
// opts := MigrateRepoOptions{RepoName: "example"}
type MigrateRepoOptions struct {
AuthPassword string `json:"auth_password,omitempty"`
AuthToken string `json:"auth_token,omitempty"`
AuthUsername string `json:"auth_username,omitempty"`
CloneAddr string `json:"clone_addr"`
Description string `json:"description,omitempty"`
Issues bool `json:"issues,omitempty"`
LFS bool `json:"lfs,omitempty"`
LFSEndpoint string `json:"lfs_endpoint,omitempty"`
Labels bool `json:"labels,omitempty"`
Milestones bool `json:"milestones,omitempty"`
Mirror bool `json:"mirror,omitempty"`
AuthPassword string `json:"auth_password,omitempty"`
AuthToken string `json:"auth_token,omitempty"`
AuthUsername string `json:"auth_username,omitempty"`
CloneAddr string `json:"clone_addr"`
Description string `json:"description,omitempty"`
Issues bool `json:"issues,omitempty"`
LFS bool `json:"lfs,omitempty"`
LFSEndpoint string `json:"lfs_endpoint,omitempty"`
Labels bool `json:"labels,omitempty"`
Milestones bool `json:"milestones,omitempty"`
Mirror bool `json:"mirror,omitempty"`
MirrorInterval string `json:"mirror_interval,omitempty"`
Private bool `json:"private,omitempty"`
PullRequests bool `json:"pull_requests,omitempty"`
Releases bool `json:"releases,omitempty"`
RepoName string `json:"repo_name"`
RepoOwner string `json:"repo_owner,omitempty"` // Name of User or Organisation who will own Repo after migration
RepoOwnerID int64 `json:"uid,omitempty"` // deprecated (only for backwards compatibility)
Service string `json:"service,omitempty"`
Wiki bool `json:"wiki,omitempty"`
Private bool `json:"private,omitempty"`
PullRequests bool `json:"pull_requests,omitempty"`
Releases bool `json:"releases,omitempty"`
RepoName string `json:"repo_name"`
RepoOwner string `json:"repo_owner,omitempty"` // Name of User or Organisation who will own Repo after migration
RepoOwnerID int64 `json:"uid,omitempty"` // deprecated (only for backwards compatibility)
Service string `json:"service,omitempty"`
Wiki bool `json:"wiki,omitempty"`
}
// 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"`
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"`
Repo *Repository `json:"repo,omitempty"`
RepoID int64 `json:"repo_id,omitempty"`
Sha string `json:"sha,omitempty"`
Name string `json:"label,omitempty"`
Ref string `json:"ref,omitempty"`
Repo *Repository `json:"repo,omitempty"`
RepoID int64 `json:"repo_id,omitempty"`
Sha string `json:"sha,omitempty"`
}
// 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
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"`
URL string `json:"url,omitempty"`
Ref string `json:"ref,omitempty"`
URL string `json:"url,omitempty"`
}
// ReplaceFlagsOption — ReplaceFlagsOption options when replacing the flags of a repository
@ -247,55 +293,71 @@ 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"`
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"`
Body string `json:"body,omitempty"`
Created time.Time `json:"created_at,omitempty"`
DependentIssue *Issue `json:"dependent_issue,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
IssueURL string `json:"issue_url,omitempty"`
Label *Label `json:"label,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
NewRef string `json:"new_ref,omitempty"`
NewTitle string `json:"new_title,omitempty"`
OldMilestone *Milestone `json:"old_milestone,omitempty"`
OldProjectID int64 `json:"old_project_id,omitempty"`
OldRef string `json:"old_ref,omitempty"`
OldTitle string `json:"old_title,omitempty"`
PRURL string `json:"pull_request_url,omitempty"`
ProjectID int64 `json:"project_id,omitempty"`
RefAction string `json:"ref_action,omitempty"`
RefComment *Comment `json:"ref_comment,omitempty"`
RefCommitSHA string `json:"ref_commit_sha,omitempty"` // commit SHA where issue/PR was referenced
RefIssue *Issue `json:"ref_issue,omitempty"`
RemovedAssignee bool `json:"removed_assignee,omitempty"` // whether the assignees were removed or added
ResolveDoer *User `json:"resolve_doer,omitempty"`
ReviewID int64 `json:"review_id,omitempty"`
TrackedTime *TrackedTime `json:"tracked_time,omitempty"`
Type string `json:"type,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
Assignee *User `json:"assignee,omitempty"`
AssigneeTeam *Team `json:"assignee_team,omitempty"`
Body string `json:"body,omitempty"`
Created time.Time `json:"created_at,omitempty"`
DependentIssue *Issue `json:"dependent_issue,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
IssueURL string `json:"issue_url,omitempty"`
Label *Label `json:"label,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
NewRef string `json:"new_ref,omitempty"`
NewTitle string `json:"new_title,omitempty"`
OldMilestone *Milestone `json:"old_milestone,omitempty"`
OldProjectID int64 `json:"old_project_id,omitempty"`
OldRef string `json:"old_ref,omitempty"`
OldTitle string `json:"old_title,omitempty"`
PRURL string `json:"pull_request_url,omitempty"`
ProjectID int64 `json:"project_id,omitempty"`
RefAction string `json:"ref_action,omitempty"`
RefComment *Comment `json:"ref_comment,omitempty"`
RefCommitSHA string `json:"ref_commit_sha,omitempty"` // commit SHA where issue/PR was referenced
RefIssue *Issue `json:"ref_issue,omitempty"`
RemovedAssignee bool `json:"removed_assignee,omitempty"` // whether the assignees were removed or added
ResolveDoer *User `json:"resolve_doer,omitempty"`
ReviewID int64 `json:"review_id,omitempty"`
TrackedTime *TrackedTime `json:"tracked_time,omitempty"`
Type string `json:"type,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
}
// 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"`
Reason any `json:"reason,omitempty"`
RepositoryURL string `json:"repository_url,omitempty"`
Subscribed bool `json:"subscribed,omitempty"`
URL string `json:"url,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
Ignored bool `json:"ignored,omitempty"`
Reason any `json:"reason,omitempty"`
RepositoryURL string `json:"repository_url,omitempty"`
Subscribed bool `json:"subscribed,omitempty"`
URL string `json:"url,omitempty"`
}

View file

@ -4,30 +4,41 @@ 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"`
LatestCommentURL string `json:"latest_comment_url,omitempty"`
State StateType `json:"state,omitempty"`
Title string `json:"title,omitempty"`
Type NotifySubjectType `json:"type,omitempty"`
URL string `json:"url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
LatestCommentHTMLURL string `json:"latest_comment_html_url,omitempty"`
LatestCommentURL string `json:"latest_comment_url,omitempty"`
State StateType `json:"state,omitempty"`
Title string `json:"title,omitempty"`
Type NotifySubjectType `json:"type,omitempty"`
URL string `json:"url,omitempty"`
}
// 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"`
Repository *Repository `json:"repository,omitempty"`
Subject *NotificationSubject `json:"subject,omitempty"`
URL string `json:"url,omitempty"`
Unread bool `json:"unread,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
ID int64 `json:"id,omitempty"`
Pinned bool `json:"pinned,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Subject *NotificationSubject `json:"subject,omitempty"`
URL string `json:"url,omitempty"`
Unread bool `json:"unread,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}

View file

@ -4,13 +4,15 @@ package types
import "time"
// Usage:
//
// opts := AccessToken{Name: "example"}
type AccessToken struct {
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Scopes []string `json:"scopes,omitempty"`
Token string `json:"sha1,omitempty"`
TokenLastEight string `json:"token_last_eight,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Scopes []string `json:"scopes,omitempty"`
Token string `json:"sha1,omitempty"`
TokenLastEight string `json:"token_last_eight,omitempty"`
}
// CreateAccessTokenOption — CreateAccessTokenOption options when create access token
@ -19,7 +21,7 @@ type AccessToken struct {
//
// opts := CreateAccessTokenOption{Name: "example"}
type CreateAccessTokenOption struct {
Name string `json:"name"`
Name string `json:"name"`
Scopes []string `json:"scopes,omitempty"`
}
@ -29,17 +31,20 @@ type CreateAccessTokenOption struct {
//
// opts := CreateOAuth2ApplicationOptions{Name: "example"}
type CreateOAuth2ApplicationOptions struct {
ConfidentialClient bool `json:"confidential_client,omitempty"`
Name string `json:"name,omitempty"`
RedirectURIs []string `json:"redirect_uris,omitempty"`
ConfidentialClient bool `json:"confidential_client,omitempty"`
Name string `json:"name,omitempty"`
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"`
ConfidentialClient bool `json:"confidential_client,omitempty"`
Created time.Time `json:"created,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
RedirectURIs []string `json:"redirect_uris,omitempty"`
ClientID string `json:"client_id,omitempty"`
ClientSecret string `json:"client_secret,omitempty"`
ConfidentialClient bool `json:"confidential_client,omitempty"`
Created time.Time `json:"created,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
RedirectURIs []string `json:"redirect_uris,omitempty"`
}

View file

@ -2,21 +2,20 @@
package types
// CreateOrgOption — CreateOrgOption options for creating an organization
//
// Usage:
//
// opts := CreateOrgOption{UserName: "example"}
type CreateOrgOption struct {
Description string `json:"description,omitempty"`
Email string `json:"email,omitempty"`
FullName string `json:"full_name,omitempty"`
Location string `json:"location,omitempty"`
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access,omitempty"`
UserName string `json:"username"`
Visibility string `json:"visibility,omitempty"` // possible values are `public` (default), `limited` or `private`
Website string `json:"website,omitempty"`
Description string `json:"description,omitempty"`
Email string `json:"email,omitempty"`
FullName string `json:"full_name,omitempty"`
Location string `json:"location,omitempty"`
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access,omitempty"`
UserName string `json:"username"`
Visibility string `json:"visibility,omitempty"` // possible values are `public` (default), `limited` or `private`
Website string `json:"website,omitempty"`
}
// EditOrgOption — EditOrgOption options for editing an organization
@ -25,35 +24,43 @@ type CreateOrgOption struct {
//
// opts := EditOrgOption{Description: "example"}
type EditOrgOption struct {
Description string `json:"description,omitempty"`
Email string `json:"email,omitempty"`
FullName string `json:"full_name,omitempty"`
Location string `json:"location,omitempty"`
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access,omitempty"`
Visibility string `json:"visibility,omitempty"` // possible values are `public`, `limited` or `private`
Website string `json:"website,omitempty"`
Description string `json:"description,omitempty"`
Email string `json:"email,omitempty"`
FullName string `json:"full_name,omitempty"`
Location string `json:"location,omitempty"`
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access,omitempty"`
Visibility string `json:"visibility,omitempty"` // possible values are `public`, `limited` or `private`
Website string `json:"website,omitempty"`
}
// Organization — Organization represents an organization
//
// Usage:
//
// opts := Organization{Description: "example"}
type Organization struct {
AvatarURL string `json:"avatar_url,omitempty"`
Description string `json:"description,omitempty"`
Email string `json:"email,omitempty"`
FullName string `json:"full_name,omitempty"`
ID int64 `json:"id,omitempty"`
Location string `json:"location,omitempty"`
Name string `json:"name,omitempty"`
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access,omitempty"`
UserName string `json:"username,omitempty"` // deprecated
Visibility string `json:"visibility,omitempty"`
Website string `json:"website,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
Description string `json:"description,omitempty"`
Email string `json:"email,omitempty"`
FullName string `json:"full_name,omitempty"`
ID int64 `json:"id,omitempty"`
Location string `json:"location,omitempty"`
Name string `json:"name,omitempty"`
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access,omitempty"`
UserName string `json:"username,omitempty"` // deprecated
Visibility string `json:"visibility,omitempty"`
Website string `json:"website,omitempty"`
}
// 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"`
CanWrite bool `json:"can_write,omitempty"`
IsAdmin bool `json:"is_admin,omitempty"`
IsOwner bool `json:"is_owner,omitempty"`
CanRead bool `json:"can_read,omitempty"`
CanWrite bool `json:"can_write,omitempty"`
IsAdmin bool `json:"is_admin,omitempty"`
IsOwner bool `json:"is_owner,omitempty"`
}

View file

@ -4,27 +4,34 @@ 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"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Owner *User `json:"owner,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
Creator *User `json:"creator,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Owner *User `json:"owner,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Type string `json:"type,omitempty"`
Version string `json:"version,omitempty"`
Type string `json:"type,omitempty"`
Version string `json:"version,omitempty"`
}
// PackageFile — PackageFile represents a package file
//
// Usage:
//
// opts := PackageFile{Name: "example"}
type PackageFile struct {
HashMD5 string `json:"md5,omitempty"`
HashSHA1 string `json:"sha1,omitempty"`
HashMD5 string `json:"md5,omitempty"`
HashSHA1 string `json:"sha1,omitempty"`
HashSHA256 string `json:"sha256,omitempty"`
HashSHA512 string `json:"sha512,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Size int64 `json:"Size,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Size int64 `json:"Size,omitempty"`
}

View file

@ -4,22 +4,21 @@ package types
import "time"
// CreatePullRequestOption — CreatePullRequestOption options when creating a pull request
//
// Usage:
//
// opts := CreatePullRequestOption{Body: "example"}
type CreatePullRequestOption struct {
Assignee string `json:"assignee,omitempty"`
Assignees []string `json:"assignees,omitempty"`
Base string `json:"base,omitempty"`
Body string `json:"body,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
Head string `json:"head,omitempty"`
Labels []int64 `json:"labels,omitempty"`
Milestone int64 `json:"milestone,omitempty"`
Title string `json:"title,omitempty"`
Assignee string `json:"assignee,omitempty"`
Assignees []string `json:"assignees,omitempty"`
Base string `json:"base,omitempty"`
Body string `json:"body,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
Head string `json:"head,omitempty"`
Labels []int64 `json:"labels,omitempty"`
Milestone int64 `json:"milestone,omitempty"`
Title string `json:"title,omitempty"`
}
// CreatePullReviewComment — CreatePullReviewComment represent a review comment for creation api
@ -28,17 +27,17 @@ type CreatePullRequestOption struct {
//
// opts := CreatePullReviewComment{Body: "example"}
type CreatePullReviewComment struct {
Body string `json:"body,omitempty"`
NewLineNum int64 `json:"new_position,omitempty"` // if comment to new file line or 0
OldLineNum int64 `json:"old_position,omitempty"` // if comment to old file line or 0
Path string `json:"path,omitempty"` // the tree path
Body string `json:"body,omitempty"`
NewLineNum int64 `json:"new_position,omitempty"` // if comment to new file line or 0
OldLineNum int64 `json:"old_position,omitempty"` // if comment to old file line or 0
Path string `json:"path,omitempty"` // the tree path
}
// CreatePullReviewCommentOptions — CreatePullReviewCommentOptions are options to create a pull review comment
//
// Usage:
//
// opts := CreatePullReviewCommentOptions{}
// opts := CreatePullReviewCommentOptions(CreatePullReviewComment{})
type CreatePullReviewCommentOptions CreatePullReviewComment
// CreatePullReviewOptions — CreatePullReviewOptions are options to create a pull review
@ -47,10 +46,10 @@ type CreatePullReviewCommentOptions CreatePullReviewComment
//
// opts := CreatePullReviewOptions{Body: "example"}
type CreatePullReviewOptions struct {
Body string `json:"body,omitempty"`
Body string `json:"body,omitempty"`
Comments []*CreatePullReviewComment `json:"comments,omitempty"`
CommitID string `json:"commit_id,omitempty"`
Event ReviewStateType `json:"event,omitempty"`
CommitID string `json:"commit_id,omitempty"`
Event ReviewStateType `json:"event,omitempty"`
}
// EditPullRequestOption — EditPullRequestOption options when modify pull request
@ -59,103 +58,119 @@ type CreatePullReviewOptions struct {
//
// opts := EditPullRequestOption{Body: "example"}
type EditPullRequestOption struct {
AllowMaintainerEdit bool `json:"allow_maintainer_edit,omitempty"`
Assignee string `json:"assignee,omitempty"`
Assignees []string `json:"assignees,omitempty"`
Base string `json:"base,omitempty"`
Body string `json:"body,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
Labels []int64 `json:"labels,omitempty"`
Milestone int64 `json:"milestone,omitempty"`
RemoveDeadline bool `json:"unset_due_date,omitempty"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
AllowMaintainerEdit bool `json:"allow_maintainer_edit,omitempty"`
Assignee string `json:"assignee,omitempty"`
Assignees []string `json:"assignees,omitempty"`
Base string `json:"base,omitempty"`
Body string `json:"body,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
Labels []int64 `json:"labels,omitempty"`
Milestone int64 `json:"milestone,omitempty"`
RemoveDeadline bool `json:"unset_due_date,omitempty"`
State string `json:"state,omitempty"`
Title string `json:"title,omitempty"`
}
// 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"`
Assignee *User `json:"assignee,omitempty"`
Assignees []*User `json:"assignees,omitempty"`
Base *PRBranchInfo `json:"base,omitempty"`
Body string `json:"body,omitempty"`
ChangedFiles int64 `json:"changed_files,omitempty"`
Closed time.Time `json:"closed_at,omitempty"`
Comments int64 `json:"comments,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
Deletions int64 `json:"deletions,omitempty"`
DiffURL string `json:"diff_url,omitempty"`
Draft bool `json:"draft,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
HasMerged bool `json:"merged,omitempty"`
Head *PRBranchInfo `json:"head,omitempty"`
ID int64 `json:"id,omitempty"`
Index int64 `json:"number,omitempty"`
IsLocked bool `json:"is_locked,omitempty"`
Labels []*Label `json:"labels,omitempty"`
MergeBase string `json:"merge_base,omitempty"`
Mergeable bool `json:"mergeable,omitempty"`
Merged time.Time `json:"merged_at,omitempty"`
MergedBy *User `json:"merged_by,omitempty"`
MergedCommitID string `json:"merge_commit_sha,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
PatchURL string `json:"patch_url,omitempty"`
PinOrder int64 `json:"pin_order,omitempty"`
RequestedReviewers []*User `json:"requested_reviewers,omitempty"`
RequestedReviewersTeams []*Team `json:"requested_reviewers_teams,omitempty"`
ReviewComments int64 `json:"review_comments,omitempty"` // number of review comments made on the diff of a PR review (not including comments on commits or issues in a PR)
State StateType `json:"state,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
Additions int64 `json:"additions,omitempty"`
AllowMaintainerEdit bool `json:"allow_maintainer_edit,omitempty"`
Assignee *User `json:"assignee,omitempty"`
Assignees []*User `json:"assignees,omitempty"`
Base *PRBranchInfo `json:"base,omitempty"`
Body string `json:"body,omitempty"`
ChangedFiles int64 `json:"changed_files,omitempty"`
Closed time.Time `json:"closed_at,omitempty"`
Comments int64 `json:"comments,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Deadline time.Time `json:"due_date,omitempty"`
Deletions int64 `json:"deletions,omitempty"`
DiffURL string `json:"diff_url,omitempty"`
Draft bool `json:"draft,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
HasMerged bool `json:"merged,omitempty"`
Head *PRBranchInfo `json:"head,omitempty"`
ID int64 `json:"id,omitempty"`
Index int64 `json:"number,omitempty"`
IsLocked bool `json:"is_locked,omitempty"`
Labels []*Label `json:"labels,omitempty"`
MergeBase string `json:"merge_base,omitempty"`
Mergeable bool `json:"mergeable,omitempty"`
Merged time.Time `json:"merged_at,omitempty"`
MergedBy *User `json:"merged_by,omitempty"`
MergedCommitID string `json:"merge_commit_sha,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
PatchURL string `json:"patch_url,omitempty"`
PinOrder int64 `json:"pin_order,omitempty"`
RequestedReviewers []*User `json:"requested_reviewers,omitempty"`
RequestedReviewersTeams []*Team `json:"requested_reviewers_teams,omitempty"`
ReviewComments int64 `json:"review_comments,omitempty"` // number of review comments made on the diff of a PR review (not including comments on commits or issues in a PR)
State StateType `json:"state,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
}
// 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"`
IsWorkInProgress bool `json:"draft,omitempty"`
Merged time.Time `json:"merged_at,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
HasMerged bool `json:"merged,omitempty"`
IsWorkInProgress bool `json:"draft,omitempty"`
Merged time.Time `json:"merged_at,omitempty"`
}
// 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"`
CommitID string `json:"commit_id,omitempty"`
Dismissed bool `json:"dismissed,omitempty"`
HTMLPullURL string `json:"pull_request_url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
Official bool `json:"official,omitempty"`
Stale bool `json:"stale,omitempty"`
State ReviewStateType `json:"state,omitempty"`
Submitted time.Time `json:"submitted_at,omitempty"`
Team *Team `json:"team,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
Body string `json:"body,omitempty"`
CodeCommentsCount int64 `json:"comments_count,omitempty"`
CommitID string `json:"commit_id,omitempty"`
Dismissed bool `json:"dismissed,omitempty"`
HTMLPullURL string `json:"pull_request_url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
Official bool `json:"official,omitempty"`
Stale bool `json:"stale,omitempty"`
State ReviewStateType `json:"state,omitempty"`
Submitted time.Time `json:"submitted_at,omitempty"`
Team *Team `json:"team,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
}
// 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"`
Created time.Time `json:"created_at,omitempty"`
DiffHunk string `json:"diff_hunk,omitempty"`
HTMLPullURL string `json:"pull_request_url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
LineNum int `json:"position,omitempty"`
OldLineNum int `json:"original_position,omitempty"`
OrigCommitID string `json:"original_commit_id,omitempty"`
Path string `json:"path,omitempty"`
Resolver *User `json:"resolver,omitempty"`
ReviewID int64 `json:"pull_request_review_id,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
Body string `json:"body,omitempty"`
CommitID string `json:"commit_id,omitempty"`
Created time.Time `json:"created_at,omitempty"`
DiffHunk string `json:"diff_hunk,omitempty"`
HTMLPullURL string `json:"pull_request_url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
ID int64 `json:"id,omitempty"`
LineNum int `json:"position,omitempty"`
OldLineNum int `json:"original_position,omitempty"`
OrigCommitID string `json:"original_commit_id,omitempty"`
Path string `json:"path,omitempty"`
Resolver *User `json:"resolver,omitempty"`
ReviewID int64 `json:"pull_request_review_id,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
}
// PullReviewRequestOptions — PullReviewRequestOptions are options to add or remove pull review requests
@ -164,7 +179,7 @@ type PullReviewComment struct {
//
// opts := PullReviewRequestOptions{Reviewers: []string{"example"}}
type PullReviewRequestOptions struct {
Reviewers []string `json:"reviewers,omitempty"`
Reviewers []string `json:"reviewers,omitempty"`
TeamReviewers []string `json:"team_reviewers,omitempty"`
}
@ -174,6 +189,6 @@ type PullReviewRequestOptions struct {
//
// opts := SubmitPullReviewOptions{Body: "example"}
type SubmitPullReviewOptions struct {
Body string `json:"body,omitempty"`
Body string `json:"body,omitempty"`
Event ReviewStateType `json:"event,omitempty"`
}

View file

@ -2,14 +2,13 @@
package types
// CreateQuotaGroupOptions — CreateQutaGroupOptions represents the options for creating a quota group
//
// Usage:
//
// opts := CreateQuotaGroupOptions{Name: "example"}
type CreateQuotaGroupOptions struct {
Name string `json:"name,omitempty"` // Name of the quota group to create
Name string `json:"name,omitempty"` // Name of the quota group to create
Rules []*CreateQuotaRuleOptions `json:"rules,omitempty"` // Rules to add to the newly created group. If a rule does not exist, it will be created.
}
@ -19,8 +18,8 @@ type CreateQuotaGroupOptions struct {
//
// opts := CreateQuotaRuleOptions{Name: "example"}
type CreateQuotaRuleOptions struct {
Limit int64 `json:"limit,omitempty"` // The limit set by the rule
Name string `json:"name,omitempty"` // Name of the rule to create
Limit int64 `json:"limit,omitempty"` // The limit set by the rule
Name string `json:"name,omitempty"` // Name of the rule to create
Subjects []string `json:"subjects,omitempty"` // The subjects affected by the rule
}
@ -30,102 +29,170 @@ type CreateQuotaRuleOptions struct {
//
// opts := EditQuotaRuleOptions{Subjects: []string{"example"}}
type EditQuotaRuleOptions struct {
Limit int64 `json:"limit,omitempty"` // The limit set by the rule
Limit int64 `json:"limit,omitempty"` // The limit set by the rule
Subjects []string `json:"subjects,omitempty"` // The subjects affected by the rule
}
// QuotaGroup — QuotaGroup represents a quota group
//
// Usage:
//
// opts := QuotaGroup{Name: "example"}
type QuotaGroup struct {
Name string `json:"name,omitempty"` // Name of the group
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"`
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)
Limit int64 `json:"limit,omitempty"` // The limit set by the rule
Name string `json:"name,omitempty"` // Name of the rule (only shown to admins)
Subjects []string `json:"subjects,omitempty"` // Subjects the rule affects
}
// 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
Size int64 `json:"size,omitempty"` // Size of the artifact (compressed)
Name string `json:"name,omitempty"` // Name of the artifact
Size int64 `json:"size,omitempty"` // Size of the artifact (compressed)
}
// 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
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
Name string `json:"name,omitempty"` // Filename of the attachment
Size int64 `json:"size,omitempty"` // Size of the attachment (in bytes)
Name string `json:"name,omitempty"` // Filename of the attachment
Size int64 `json:"size,omitempty"` // Size of the attachment (in bytes)
}
// 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
Size int64 `json:"size,omitempty"` // Size of the package version
Type string `json:"type,omitempty"` // Type of the package
Version string `json:"version,omitempty"` // Version of the package
Name string `json:"name,omitempty"` // Name of the package
Size int64 `json:"size,omitempty"` // Size of the package version
Type string `json:"type,omitempty"` // Type of the package
Version string `json:"version,omitempty"` // Version of the package
}
// 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"`
Repos *QuotaUsedSizeRepos `json:"repos,omitempty"`
Git *QuotaUsedSizeGit `json:"git,omitempty"`
Repos *QuotaUsedSizeRepos `json:"repos,omitempty"`
}
// 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
Artifacts int64 `json:"artifacts,omitempty"` // Storage size used for the user's artifacts
Attachments *QuotaUsedSizeAssetsAttachments `json:"attachments,omitempty"`
Packages *QuotaUsedSizeAssetsPackages `json:"packages,omitempty"`
Packages *QuotaUsedSizeAssetsPackages `json:"packages,omitempty"`
}
// 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
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
Public int64 `json:"public,omitempty"` // Storage size of the user's public repositories
}

View file

@ -4,7 +4,6 @@ package types
import "time"
// EditReactionOption — EditReactionOption contain the reaction type
//
// Usage:
@ -15,8 +14,12 @@ 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"`
User *User `json:"user,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Reaction string `json:"content,omitempty"`
User *User `json:"user,omitempty"`
}

View file

@ -4,20 +4,19 @@ package types
import "time"
// CreateReleaseOption — CreateReleaseOption options when creating a release
//
// Usage:
//
// opts := CreateReleaseOption{TagName: "v1.0.0"}
type CreateReleaseOption struct {
HideArchiveLinks bool `json:"hide_archive_links,omitempty"`
IsDraft bool `json:"draft,omitempty"`
IsPrerelease bool `json:"prerelease,omitempty"`
Note string `json:"body,omitempty"`
TagName string `json:"tag_name"`
Target string `json:"target_commitish,omitempty"`
Title string `json:"name,omitempty"`
HideArchiveLinks bool `json:"hide_archive_links,omitempty"`
IsDraft bool `json:"draft,omitempty"`
IsPrerelease bool `json:"prerelease,omitempty"`
Note string `json:"body,omitempty"`
TagName string `json:"tag_name"`
Target string `json:"target_commitish,omitempty"`
Title string `json:"name,omitempty"`
}
// EditReleaseOption — EditReleaseOption options when editing a release
@ -26,33 +25,37 @@ type CreateReleaseOption struct {
//
// opts := EditReleaseOption{TagName: "v1.0.0"}
type EditReleaseOption struct {
HideArchiveLinks bool `json:"hide_archive_links,omitempty"`
IsDraft bool `json:"draft,omitempty"`
IsPrerelease bool `json:"prerelease,omitempty"`
Note string `json:"body,omitempty"`
TagName string `json:"tag_name,omitempty"`
Target string `json:"target_commitish,omitempty"`
Title string `json:"name,omitempty"`
HideArchiveLinks bool `json:"hide_archive_links,omitempty"`
IsDraft bool `json:"draft,omitempty"`
IsPrerelease bool `json:"prerelease,omitempty"`
Note string `json:"body,omitempty"`
TagName string `json:"tag_name,omitempty"`
Target string `json:"target_commitish,omitempty"`
Title string `json:"name,omitempty"`
}
// 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"`
Author *User `json:"author,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
HideArchiveLinks bool `json:"hide_archive_links,omitempty"`
ID int64 `json:"id,omitempty"`
IsDraft bool `json:"draft,omitempty"`
IsPrerelease bool `json:"prerelease,omitempty"`
Note string `json:"body,omitempty"`
PublishedAt time.Time `json:"published_at,omitempty"`
TagName string `json:"tag_name,omitempty"`
TarURL string `json:"tarball_url,omitempty"`
Target string `json:"target_commitish,omitempty"`
Title string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
UploadURL string `json:"upload_url,omitempty"`
ZipURL string `json:"zipball_url,omitempty"`
Attachments []*Attachment `json:"assets,omitempty"`
Author *User `json:"author,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
HideArchiveLinks bool `json:"hide_archive_links,omitempty"`
ID int64 `json:"id,omitempty"`
IsDraft bool `json:"draft,omitempty"`
IsPrerelease bool `json:"prerelease,omitempty"`
Note string `json:"body,omitempty"`
PublishedAt time.Time `json:"published_at,omitempty"`
TagName string `json:"tag_name,omitempty"`
TarURL string `json:"tarball_url,omitempty"`
Target string `json:"target_commitish,omitempty"`
Title string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
UploadURL string `json:"upload_url,omitempty"`
ZipURL string `json:"zipball_url,omitempty"`
}

View file

@ -4,18 +4,16 @@ package types
import "time"
//
// Usage:
//
// opts := CreatePushMirrorOption{Interval: "example"}
type CreatePushMirrorOption struct {
Interval string `json:"interval,omitempty"`
RemoteAddress string `json:"remote_address,omitempty"`
Interval string `json:"interval,omitempty"`
RemoteAddress string `json:"remote_address,omitempty"`
RemotePassword string `json:"remote_password,omitempty"`
RemoteUsername string `json:"remote_username,omitempty"`
SyncOnCommit bool `json:"sync_on_commit,omitempty"`
UseSSH bool `json:"use_ssh,omitempty"`
SyncOnCommit bool `json:"sync_on_commit,omitempty"`
UseSSH bool `json:"use_ssh,omitempty"`
}
// CreateRepoOption — CreateRepoOption options when creating repository
@ -24,18 +22,18 @@ type CreatePushMirrorOption struct {
//
// opts := CreateRepoOption{Name: "example"}
type CreateRepoOption struct {
AutoInit bool `json:"auto_init,omitempty"` // Whether the repository should be auto-initialized?
DefaultBranch string `json:"default_branch,omitempty"` // DefaultBranch of the repository (used when initializes and in template)
Description string `json:"description,omitempty"` // Description of the repository to create
Gitignores string `json:"gitignores,omitempty"` // Gitignores to use
IssueLabels string `json:"issue_labels,omitempty"` // Label-Set to use
License string `json:"license,omitempty"` // License to use
Name string `json:"name"` // Name of the repository to create
AutoInit bool `json:"auto_init,omitempty"` // Whether the repository should be auto-initialized?
DefaultBranch string `json:"default_branch,omitempty"` // DefaultBranch of the repository (used when initializes and in template)
Description string `json:"description,omitempty"` // Description of the repository to create
Gitignores string `json:"gitignores,omitempty"` // Gitignores to use
IssueLabels string `json:"issue_labels,omitempty"` // Label-Set to use
License string `json:"license,omitempty"` // License to use
Name string `json:"name"` // Name of the repository to create
ObjectFormatName string `json:"object_format_name,omitempty"` // ObjectFormatName of the underlying git repository
Private bool `json:"private,omitempty"` // Whether the repository is private
Readme string `json:"readme,omitempty"` // Readme of the repository to create
Template bool `json:"template,omitempty"` // Whether the repository is template
TrustModel string `json:"trust_model,omitempty"` // TrustModel of the repository
Private bool `json:"private,omitempty"` // Whether the repository is private
Readme string `json:"readme,omitempty"` // Readme of the repository to create
Template bool `json:"template,omitempty"` // Whether the repository is template
TrustModel string `json:"trust_model,omitempty"` // TrustModel of the repository
}
// EditRepoOption — EditRepoOption options when editing a repository's properties
@ -44,88 +42,111 @@ type CreateRepoOption struct {
//
// opts := EditRepoOption{Description: "example"}
type EditRepoOption struct {
AllowFastForwardOnly bool `json:"allow_fast_forward_only_merge,omitempty"` // either `true` to allow fast-forward-only merging pull requests, or `false` to prevent fast-forward-only merging.
AllowManualMerge bool `json:"allow_manual_merge,omitempty"` // either `true` to allow mark pr as merged manually, or `false` to prevent it.
AllowMerge bool `json:"allow_merge_commits,omitempty"` // either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.
AllowRebase bool `json:"allow_rebase,omitempty"` // either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.
AllowRebaseMerge bool `json:"allow_rebase_explicit,omitempty"` // either `true` to allow rebase with explicit merge commits (--no-ff), or `false` to prevent rebase with explicit merge commits.
AllowRebaseUpdate bool `json:"allow_rebase_update,omitempty"` // either `true` to allow updating pull request branch by rebase, or `false` to prevent it.
AllowSquash bool `json:"allow_squash_merge,omitempty"` // either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.
Archived bool `json:"archived,omitempty"` // set to `true` to archive this repository.
AutodetectManualMerge bool `json:"autodetect_manual_merge,omitempty"` // either `true` to enable AutodetectManualMerge, or `false` to prevent it. Note: In some special cases, misjudgments can occur.
DefaultAllowMaintainerEdit bool `json:"default_allow_maintainer_edit,omitempty"` // set to `true` to allow edits from maintainers by default
DefaultBranch string `json:"default_branch,omitempty"` // sets the default branch for this repository.
DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge,omitempty"` // set to `true` to delete pr branch after merge by default
DefaultMergeStyle string `json:"default_merge_style,omitempty"` // set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", "squash", or "fast-forward-only".
DefaultUpdateStyle string `json:"default_update_style,omitempty"` // set to a update style to be used by this repository: "rebase" or "merge"
Description string `json:"description,omitempty"` // a short description of the repository.
EnablePrune bool `json:"enable_prune,omitempty"` // enable prune - remove obsolete remote-tracking references when mirroring
ExternalTracker *ExternalTracker `json:"external_tracker,omitempty"`
ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"`
GloballyEditableWiki bool `json:"globally_editable_wiki,omitempty"` // set the globally editable state of the wiki
HasActions bool `json:"has_actions,omitempty"` // either `true` to enable actions unit, or `false` to disable them.
HasIssues bool `json:"has_issues,omitempty"` // either `true` to enable issues for this repository or `false` to disable them.
HasPackages bool `json:"has_packages,omitempty"` // either `true` to enable packages unit, or `false` to disable them.
HasProjects bool `json:"has_projects,omitempty"` // either `true` to enable project unit, or `false` to disable them.
HasPullRequests bool `json:"has_pull_requests,omitempty"` // either `true` to allow pull requests, or `false` to prevent pull request.
HasReleases bool `json:"has_releases,omitempty"` // either `true` to enable releases unit, or `false` to disable them.
HasWiki bool `json:"has_wiki,omitempty"` // either `true` to enable the wiki for this repository or `false` to disable it.
IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts,omitempty"` // either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace.
InternalTracker *InternalTracker `json:"internal_tracker,omitempty"`
MirrorInterval string `json:"mirror_interval,omitempty"` // set to a string like `8h30m0s` to set the mirror interval time
Name string `json:"name,omitempty"` // name of the repository
Private bool `json:"private,omitempty"` // either `true` to make the repository private or `false` to make it public. Note: you will get a 422 error if the organization restricts changing repository visibility to organization owners and a non-owner tries to change the value of private.
Template bool `json:"template,omitempty"` // either `true` to make this repository a template or `false` to make it a normal repository
Website string `json:"website,omitempty"` // a URL with more information about the repository.
WikiBranch string `json:"wiki_branch,omitempty"` // sets the branch used for this repository's wiki.
AllowFastForwardOnly bool `json:"allow_fast_forward_only_merge,omitempty"` // either `true` to allow fast-forward-only merging pull requests, or `false` to prevent fast-forward-only merging.
AllowManualMerge bool `json:"allow_manual_merge,omitempty"` // either `true` to allow mark pr as merged manually, or `false` to prevent it.
AllowMerge bool `json:"allow_merge_commits,omitempty"` // either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.
AllowRebase bool `json:"allow_rebase,omitempty"` // either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.
AllowRebaseMerge bool `json:"allow_rebase_explicit,omitempty"` // either `true` to allow rebase with explicit merge commits (--no-ff), or `false` to prevent rebase with explicit merge commits.
AllowRebaseUpdate bool `json:"allow_rebase_update,omitempty"` // either `true` to allow updating pull request branch by rebase, or `false` to prevent it.
AllowSquash bool `json:"allow_squash_merge,omitempty"` // either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.
Archived bool `json:"archived,omitempty"` // set to `true` to archive this repository.
AutodetectManualMerge bool `json:"autodetect_manual_merge,omitempty"` // either `true` to enable AutodetectManualMerge, or `false` to prevent it. Note: In some special cases, misjudgments can occur.
DefaultAllowMaintainerEdit bool `json:"default_allow_maintainer_edit,omitempty"` // set to `true` to allow edits from maintainers by default
DefaultBranch string `json:"default_branch,omitempty"` // sets the default branch for this repository.
DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge,omitempty"` // set to `true` to delete pr branch after merge by default
DefaultMergeStyle string `json:"default_merge_style,omitempty"` // set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", "squash", or "fast-forward-only".
DefaultUpdateStyle string `json:"default_update_style,omitempty"` // set to a update style to be used by this repository: "rebase" or "merge"
Description string `json:"description,omitempty"` // a short description of the repository.
EnablePrune bool `json:"enable_prune,omitempty"` // enable prune - remove obsolete remote-tracking references when mirroring
ExternalTracker *ExternalTracker `json:"external_tracker,omitempty"`
ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"`
GloballyEditableWiki bool `json:"globally_editable_wiki,omitempty"` // set the globally editable state of the wiki
HasActions bool `json:"has_actions,omitempty"` // either `true` to enable actions unit, or `false` to disable them.
HasIssues bool `json:"has_issues,omitempty"` // either `true` to enable issues for this repository or `false` to disable them.
HasPackages bool `json:"has_packages,omitempty"` // either `true` to enable packages unit, or `false` to disable them.
HasProjects bool `json:"has_projects,omitempty"` // either `true` to enable project unit, or `false` to disable them.
HasPullRequests bool `json:"has_pull_requests,omitempty"` // either `true` to allow pull requests, or `false` to prevent pull request.
HasReleases bool `json:"has_releases,omitempty"` // either `true` to enable releases unit, or `false` to disable them.
HasWiki bool `json:"has_wiki,omitempty"` // either `true` to enable the wiki for this repository or `false` to disable it.
IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts,omitempty"` // either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace.
InternalTracker *InternalTracker `json:"internal_tracker,omitempty"`
MirrorInterval string `json:"mirror_interval,omitempty"` // set to a string like `8h30m0s` to set the mirror interval time
Name string `json:"name,omitempty"` // name of the repository
Private bool `json:"private,omitempty"` // either `true` to make the repository private or `false` to make it public. Note: you will get a 422 error if the organization restricts changing repository visibility to organization owners and a non-owner tries to change the value of private.
Template bool `json:"template,omitempty"` // either `true` to make this repository a template or `false` to make it a normal repository
Website string `json:"website,omitempty"` // a URL with more information about the repository.
WikiBranch string `json:"wiki_branch,omitempty"` // sets the branch used for this repository's wiki.
}
// 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.
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
ExternalTrackerStyle string `json:"external_tracker_style,omitempty"` // External Issue Tracker Number Format, either `numeric`, `alphanumeric`, or `regexp`
ExternalTrackerURL string `json:"external_tracker_url,omitempty"` // URL of external issue tracker.
ExternalTrackerStyle string `json:"external_tracker_style,omitempty"` // External Issue Tracker Number Format, either `numeric`, `alphanumeric`, or `regexp`
ExternalTrackerURL string `json:"external_tracker_url,omitempty"` // URL of external issue tracker.
}
// 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)
EnableTimeTracker bool `json:"enable_time_tracker,omitempty"` // Enable time tracking (Built-in issue tracker)
EnableIssueDependencies bool `json:"enable_issue_dependencies,omitempty"` // Enable dependencies for issues and pull requests (Built-in issue tracker)
EnableTimeTracker bool `json:"enable_time_tracker,omitempty"` // Enable time tracking (Built-in issue tracker)
}
// 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"`
LastError string `json:"last_error,omitempty"`
CreatedUnix time.Time `json:"created,omitempty"`
Interval string `json:"interval,omitempty"`
LastError string `json:"last_error,omitempty"`
LastUpdateUnix time.Time `json:"last_update,omitempty"`
PublicKey string `json:"public_key,omitempty"`
RemoteAddress string `json:"remote_address,omitempty"`
RemoteName string `json:"remote_name,omitempty"`
RepoName string `json:"repo_name,omitempty"`
SyncOnCommit bool `json:"sync_on_commit,omitempty"`
PublicKey string `json:"public_key,omitempty"`
RemoteAddress string `json:"remote_address,omitempty"`
RemoteName string `json:"remote_name,omitempty"`
RepoName string `json:"repo_name,omitempty"`
SyncOnCommit bool `json:"sync_on_commit,omitempty"`
}
// 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"`
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"`
Message string `json:"message,omitempty"`
Tree *CommitMeta `json:"tree,omitempty"`
URL string `json:"url,omitempty"`
Author *CommitUser `json:"author,omitempty"`
Committer *CommitUser `json:"committer,omitempty"`
Message string `json:"message,omitempty"`
Tree *CommitMeta `json:"tree,omitempty"`
URL string `json:"url,omitempty"`
Verification *PayloadCommitVerification `json:"verification,omitempty"`
}
@ -139,85 +160,97 @@ 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"`
Teams []*Team `json:"teams,omitempty"`
Doer *User `json:"doer,omitempty"`
Recipient *User `json:"recipient,omitempty"`
Teams []*Team `json:"teams,omitempty"`
}
// 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"`
AllowRebase bool `json:"allow_rebase,omitempty"`
AllowRebaseMerge bool `json:"allow_rebase_explicit,omitempty"`
AllowRebaseUpdate bool `json:"allow_rebase_update,omitempty"`
AllowSquash bool `json:"allow_squash_merge,omitempty"`
Archived bool `json:"archived,omitempty"`
ArchivedAt time.Time `json:"archived_at,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
CloneURL string `json:"clone_url,omitempty"`
Created time.Time `json:"created_at,omitempty"`
DefaultAllowMaintainerEdit bool `json:"default_allow_maintainer_edit,omitempty"`
DefaultBranch string `json:"default_branch,omitempty"`
DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge,omitempty"`
DefaultMergeStyle string `json:"default_merge_style,omitempty"`
DefaultUpdateStyle string `json:"default_update_style,omitempty"`
Description string `json:"description,omitempty"`
Empty bool `json:"empty,omitempty"`
ExternalTracker *ExternalTracker `json:"external_tracker,omitempty"`
ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"`
Fork bool `json:"fork,omitempty"`
Forks int64 `json:"forks_count,omitempty"`
FullName string `json:"full_name,omitempty"`
GloballyEditableWiki bool `json:"globally_editable_wiki,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
HasActions bool `json:"has_actions,omitempty"`
HasIssues bool `json:"has_issues,omitempty"`
HasPackages bool `json:"has_packages,omitempty"`
HasProjects bool `json:"has_projects,omitempty"`
HasPullRequests bool `json:"has_pull_requests,omitempty"`
HasReleases bool `json:"has_releases,omitempty"`
HasWiki bool `json:"has_wiki,omitempty"`
ID int64 `json:"id,omitempty"`
IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts,omitempty"`
Internal bool `json:"internal,omitempty"`
InternalTracker *InternalTracker `json:"internal_tracker,omitempty"`
Language string `json:"language,omitempty"`
LanguagesURL string `json:"languages_url,omitempty"`
Link string `json:"link,omitempty"`
Mirror bool `json:"mirror,omitempty"`
MirrorInterval string `json:"mirror_interval,omitempty"`
MirrorUpdated time.Time `json:"mirror_updated,omitempty"`
Name string `json:"name,omitempty"`
ObjectFormatName string `json:"object_format_name,omitempty"` // ObjectFormatName of the underlying git repository
OpenIssues int64 `json:"open_issues_count,omitempty"`
OpenPulls int64 `json:"open_pr_counter,omitempty"`
OriginalURL string `json:"original_url,omitempty"`
Owner *User `json:"owner,omitempty"`
Parent *Repository `json:"parent,omitempty"`
Permissions *Permission `json:"permissions,omitempty"`
Private bool `json:"private,omitempty"`
Releases int64 `json:"release_counter,omitempty"`
RepoTransfer *RepoTransfer `json:"repo_transfer,omitempty"`
SSHURL string `json:"ssh_url,omitempty"`
Size int64 `json:"size,omitempty"`
Stars int64 `json:"stars_count,omitempty"`
Template bool `json:"template,omitempty"`
Topics []string `json:"topics,omitempty"`
URL string `json:"url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
Watchers int64 `json:"watchers_count,omitempty"`
Website string `json:"website,omitempty"`
WikiBranch string `json:"wiki_branch,omitempty"`
AllowFastForwardOnly bool `json:"allow_fast_forward_only_merge,omitempty"`
AllowMerge bool `json:"allow_merge_commits,omitempty"`
AllowRebase bool `json:"allow_rebase,omitempty"`
AllowRebaseMerge bool `json:"allow_rebase_explicit,omitempty"`
AllowRebaseUpdate bool `json:"allow_rebase_update,omitempty"`
AllowSquash bool `json:"allow_squash_merge,omitempty"`
Archived bool `json:"archived,omitempty"`
ArchivedAt time.Time `json:"archived_at,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
CloneURL string `json:"clone_url,omitempty"`
Created time.Time `json:"created_at,omitempty"`
DefaultAllowMaintainerEdit bool `json:"default_allow_maintainer_edit,omitempty"`
DefaultBranch string `json:"default_branch,omitempty"`
DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge,omitempty"`
DefaultMergeStyle string `json:"default_merge_style,omitempty"`
DefaultUpdateStyle string `json:"default_update_style,omitempty"`
Description string `json:"description,omitempty"`
Empty bool `json:"empty,omitempty"`
ExternalTracker *ExternalTracker `json:"external_tracker,omitempty"`
ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"`
Fork bool `json:"fork,omitempty"`
Forks int64 `json:"forks_count,omitempty"`
FullName string `json:"full_name,omitempty"`
GloballyEditableWiki bool `json:"globally_editable_wiki,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
HasActions bool `json:"has_actions,omitempty"`
HasIssues bool `json:"has_issues,omitempty"`
HasPackages bool `json:"has_packages,omitempty"`
HasProjects bool `json:"has_projects,omitempty"`
HasPullRequests bool `json:"has_pull_requests,omitempty"`
HasReleases bool `json:"has_releases,omitempty"`
HasWiki bool `json:"has_wiki,omitempty"`
ID int64 `json:"id,omitempty"`
IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts,omitempty"`
Internal bool `json:"internal,omitempty"`
InternalTracker *InternalTracker `json:"internal_tracker,omitempty"`
Language string `json:"language,omitempty"`
LanguagesURL string `json:"languages_url,omitempty"`
Link string `json:"link,omitempty"`
Mirror bool `json:"mirror,omitempty"`
MirrorInterval string `json:"mirror_interval,omitempty"`
MirrorUpdated time.Time `json:"mirror_updated,omitempty"`
Name string `json:"name,omitempty"`
ObjectFormatName string `json:"object_format_name,omitempty"` // ObjectFormatName of the underlying git repository
OpenIssues int64 `json:"open_issues_count,omitempty"`
OpenPulls int64 `json:"open_pr_counter,omitempty"`
OriginalURL string `json:"original_url,omitempty"`
Owner *User `json:"owner,omitempty"`
Parent *Repository `json:"parent,omitempty"`
Permissions *Permission `json:"permissions,omitempty"`
Private bool `json:"private,omitempty"`
Releases int64 `json:"release_counter,omitempty"`
RepoTransfer *RepoTransfer `json:"repo_transfer,omitempty"`
SSHURL string `json:"ssh_url,omitempty"`
Size int64 `json:"size,omitempty"`
Stars int64 `json:"stars_count,omitempty"`
Template bool `json:"template,omitempty"`
Topics []string `json:"topics,omitempty"`
URL string `json:"url,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
Watchers int64 `json:"watchers_count,omitempty"`
Website string `json:"website,omitempty"`
WikiBranch string `json:"wiki_branch,omitempty"`
}
// RepositoryMeta — RepositoryMeta basic repository information
//
// Usage:
//
// opts := RepositoryMeta{FullName: "example"}
type RepositoryMeta struct {
FullName string `json:"full_name,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Owner string `json:"owner,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Owner string `json:"owner,omitempty"`
}
// TransferRepoOption — TransferRepoOption options when transfer a repository's ownership
@ -226,8 +259,8 @@ type RepositoryMeta struct {
//
// opts := TransferRepoOption{NewOwner: "example"}
type TransferRepoOption struct {
NewOwner string `json:"new_owner"`
TeamIDs []int64 `json:"team_ids,omitempty"` // ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories.
NewOwner string `json:"new_owner"`
TeamIDs []int64 `json:"team_ids,omitempty"` // ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories.
}
// UpdateRepoAvatarOption — UpdateRepoAvatarUserOption options when updating the repo avatar

View file

@ -2,6 +2,9 @@
package types
// ReviewStateType — ReviewStateType review state type
//
// Usage:
//
// opts := ReviewStateType("example")
type ReviewStateType string

View file

@ -2,37 +2,52 @@
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"`
DefaultPagingNum int64 `json:"default_paging_num,omitempty"`
MaxResponseItems int64 `json:"max_response_items,omitempty"`
DefaultMaxBlobSize int64 `json:"default_max_blob_size,omitempty"`
DefaultPagingNum int64 `json:"default_paging_num,omitempty"`
MaxResponseItems int64 `json:"max_response_items,omitempty"`
}
// 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"`
MaxFiles int64 `json:"max_files,omitempty"`
MaxSize int64 `json:"max_size,omitempty"`
Enabled bool `json:"enabled,omitempty"`
MaxFiles int64 `json:"max_files,omitempty"`
MaxSize int64 `json:"max_size,omitempty"`
}
// 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"`
LFSDisabled bool `json:"lfs_disabled,omitempty"`
MigrationsDisabled bool `json:"migrations_disabled,omitempty"`
MirrorsDisabled bool `json:"mirrors_disabled,omitempty"`
StarsDisabled bool `json:"stars_disabled,omitempty"`
ForksDisabled bool `json:"forks_disabled,omitempty"`
HTTPGitDisabled bool `json:"http_git_disabled,omitempty"`
LFSDisabled bool `json:"lfs_disabled,omitempty"`
MigrationsDisabled bool `json:"migrations_disabled,omitempty"`
MirrorsDisabled bool `json:"mirrors_disabled,omitempty"`
StarsDisabled bool `json:"stars_disabled,omitempty"`
TimeTrackingDisabled bool `json:"time_tracking_disabled,omitempty"`
}
// 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"`
DefaultTheme string `json:"default_theme,omitempty"`
CustomEmojis []string `json:"custom_emojis,omitempty"`
DefaultTheme string `json:"default_theme,omitempty"`
}

View file

@ -2,16 +2,19 @@
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"`
SHA string `json:"sha,omitempty"`
State CommitStatusState `json:"state,omitempty"`
Statuses []*CommitStatus `json:"statuses,omitempty"`
TotalCount int64 `json:"total_count,omitempty"`
URL string `json:"url,omitempty"`
CommitURL string `json:"commit_url,omitempty"`
Repository *Repository `json:"repository,omitempty"`
SHA string `json:"sha,omitempty"`
State CommitStatusState `json:"state,omitempty"`
Statuses []*CommitStatus `json:"statuses,omitempty"`
TotalCount int64 `json:"total_count,omitempty"`
URL string `json:"url,omitempty"`
}
// CreateStatusOption — CreateStatusOption holds the information needed to create a new CommitStatus for a Commit
@ -20,8 +23,8 @@ type CombinedStatus struct {
//
// opts := CreateStatusOption{Description: "example"}
type CreateStatusOption struct {
Context string `json:"context,omitempty"`
Description string `json:"description,omitempty"`
State CommitStatusState `json:"state,omitempty"`
TargetURL string `json:"target_url,omitempty"`
Context string `json:"context,omitempty"`
Description string `json:"description,omitempty"`
State CommitStatusState `json:"state,omitempty"`
TargetURL string `json:"target_url,omitempty"`
}

View file

@ -4,7 +4,6 @@ package types
import "time"
// CreateTagOption — CreateTagOption options when creating a tag
//
// Usage:
@ -13,7 +12,7 @@ import "time"
type CreateTagOption struct {
Message string `json:"message,omitempty"`
TagName string `json:"tag_name"`
Target string `json:"target,omitempty"`
Target string `json:"target,omitempty"`
}
// CreateTagProtectionOption — CreateTagProtectionOption options for creating a tag protection
@ -22,8 +21,8 @@ type CreateTagOption struct {
//
// opts := CreateTagProtectionOption{NamePattern: "example"}
type CreateTagProtectionOption struct {
NamePattern string `json:"name_pattern,omitempty"`
WhitelistTeams []string `json:"whitelist_teams,omitempty"`
NamePattern string `json:"name_pattern,omitempty"`
WhitelistTeams []string `json:"whitelist_teams,omitempty"`
WhitelistUsernames []string `json:"whitelist_usernames,omitempty"`
}
@ -33,34 +32,46 @@ type CreateTagProtectionOption struct {
//
// opts := EditTagProtectionOption{NamePattern: "example"}
type EditTagProtectionOption struct {
NamePattern string `json:"name_pattern,omitempty"`
WhitelistTeams []string `json:"whitelist_teams,omitempty"`
NamePattern string `json:"name_pattern,omitempty"`
WhitelistTeams []string `json:"whitelist_teams,omitempty"`
WhitelistUsernames []string `json:"whitelist_usernames,omitempty"`
}
// 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"`
ID string `json:"id,omitempty"`
Message string `json:"message,omitempty"`
Name string `json:"name,omitempty"`
TarballURL string `json:"tarball_url,omitempty"`
ZipballURL string `json:"zipball_url,omitempty"`
Commit *CommitMeta `json:"commit,omitempty"`
ID string `json:"id,omitempty"`
Message string `json:"message,omitempty"`
Name string `json:"name,omitempty"`
TarballURL string `json:"tarball_url,omitempty"`
ZipballURL string `json:"zipball_url,omitempty"`
}
// 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"`
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"`
NamePattern string `json:"name_pattern,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
WhitelistTeams []string `json:"whitelist_teams,omitempty"`
WhitelistUsernames []string `json:"whitelist_usernames,omitempty"`
Created time.Time `json:"created_at,omitempty"`
ID int64 `json:"id,omitempty"`
NamePattern string `json:"name_pattern,omitempty"`
Updated time.Time `json:"updated_at,omitempty"`
WhitelistTeams []string `json:"whitelist_teams,omitempty"`
WhitelistUsernames []string `json:"whitelist_usernames,omitempty"`
}

View file

@ -2,20 +2,19 @@
package types
// CreateTeamOption — CreateTeamOption options for creating a team
//
// Usage:
//
// opts := CreateTeamOption{Name: "example"}
type CreateTeamOption struct {
CanCreateOrgRepo bool `json:"can_create_org_repo,omitempty"`
Description string `json:"description,omitempty"`
IncludesAllRepositories bool `json:"includes_all_repositories,omitempty"`
Name string `json:"name"`
Permission string `json:"permission,omitempty"`
Units []string `json:"units,omitempty"`
UnitsMap map[string]string `json:"units_map,omitempty"`
CanCreateOrgRepo bool `json:"can_create_org_repo,omitempty"`
Description string `json:"description,omitempty"`
IncludesAllRepositories bool `json:"includes_all_repositories,omitempty"`
Name string `json:"name"`
Permission string `json:"permission,omitempty"`
Units []string `json:"units,omitempty"`
UnitsMap map[string]string `json:"units_map,omitempty"`
}
// EditTeamOption — EditTeamOption options for editing a team
@ -24,24 +23,28 @@ type CreateTeamOption struct {
//
// opts := EditTeamOption{Name: "example"}
type EditTeamOption struct {
CanCreateOrgRepo bool `json:"can_create_org_repo,omitempty"`
Description string `json:"description,omitempty"`
IncludesAllRepositories bool `json:"includes_all_repositories,omitempty"`
Name string `json:"name"`
Permission string `json:"permission,omitempty"`
Units []string `json:"units,omitempty"`
UnitsMap map[string]string `json:"units_map,omitempty"`
CanCreateOrgRepo bool `json:"can_create_org_repo,omitempty"`
Description string `json:"description,omitempty"`
IncludesAllRepositories bool `json:"includes_all_repositories,omitempty"`
Name string `json:"name"`
Permission string `json:"permission,omitempty"`
Units []string `json:"units,omitempty"`
UnitsMap map[string]string `json:"units_map,omitempty"`
}
// 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"`
ID int64 `json:"id,omitempty"`
IncludesAllRepositories bool `json:"includes_all_repositories,omitempty"`
Name string `json:"name,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Permission string `json:"permission,omitempty"`
Units []string `json:"units,omitempty"`
UnitsMap map[string]string `json:"units_map,omitempty"`
CanCreateOrgRepo bool `json:"can_create_org_repo,omitempty"`
Description string `json:"description,omitempty"`
ID int64 `json:"id,omitempty"`
IncludesAllRepositories bool `json:"includes_all_repositories,omitempty"`
Name string `json:"name,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Permission string `json:"permission,omitempty"`
Units []string `json:"units,omitempty"`
UnitsMap map[string]string `json:"units_map,omitempty"`
}

View file

@ -4,25 +4,32 @@ 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"`
IssueIndex int64 `json:"issue_index,omitempty"`
IssueTitle string `json:"issue_title,omitempty"`
RepoName string `json:"repo_name,omitempty"`
RepoOwnerName string `json:"repo_owner_name,omitempty"`
Seconds int64 `json:"seconds,omitempty"`
Created time.Time `json:"created,omitempty"`
Duration string `json:"duration,omitempty"`
IssueIndex int64 `json:"issue_index,omitempty"`
IssueTitle string `json:"issue_title,omitempty"`
RepoName string `json:"repo_name,omitempty"`
RepoOwnerName string `json:"repo_owner_name,omitempty"`
Seconds int64 `json:"seconds,omitempty"`
}
// 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"`
Issue *Issue `json:"issue,omitempty"`
IssueID int64 `json:"issue_id,omitempty"` // deprecated (only for backwards compatibility)
Time int64 `json:"time,omitempty"` // Time in seconds
UserID int64 `json:"user_id,omitempty"` // deprecated (only for backwards compatibility)
UserName string `json:"user_name,omitempty"`
Created time.Time `json:"created,omitempty"`
ID int64 `json:"id,omitempty"`
Issue *Issue `json:"issue,omitempty"`
IssueID int64 `json:"issue_id,omitempty"` // deprecated (only for backwards compatibility)
Time int64 `json:"time,omitempty"` // Time in seconds
UserID int64 `json:"user_id,omitempty"` // deprecated (only for backwards compatibility)
UserName string `json:"user_name,omitempty"`
}

View file

@ -4,17 +4,24 @@ 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"`
Name string `json:"topic_name,omitempty"`
RepoCount int64 `json:"repo_count,omitempty"`
Updated time.Time `json:"updated,omitempty"`
Created time.Time `json:"created,omitempty"`
ID int64 `json:"id,omitempty"`
Name string `json:"topic_name,omitempty"`
RepoCount int64 `json:"repo_count,omitempty"`
Updated time.Time `json:"updated,omitempty"`
}

View file

@ -4,9 +4,11 @@ package types
import "time"
// Usage:
//
// opts := BlockedUser{Created: time.Now()}
type BlockedUser struct {
BlockID int64 `json:"block_id,omitempty"`
BlockID int64 `json:"block_id,omitempty"`
Created time.Time `json:"created_at,omitempty"`
}
@ -25,17 +27,17 @@ type CreateEmailOption struct {
//
// opts := CreateUserOption{Email: "alice@example.com"}
type CreateUserOption struct {
Created time.Time `json:"created_at,omitempty"` // For explicitly setting the user creation timestamp. Useful when users are migrated from other systems. When omitted, the user's creation timestamp will be set to "now".
Email string `json:"email"`
FullName string `json:"full_name,omitempty"`
LoginName string `json:"login_name,omitempty"`
MustChangePassword bool `json:"must_change_password,omitempty"`
Password string `json:"password,omitempty"`
Restricted bool `json:"restricted,omitempty"`
SendNotify bool `json:"send_notify,omitempty"`
SourceID int64 `json:"source_id,omitempty"`
Username string `json:"username"`
Visibility string `json:"visibility,omitempty"`
Created time.Time `json:"created_at,omitempty"` // For explicitly setting the user creation timestamp. Useful when users are migrated from other systems. When omitted, the user's creation timestamp will be set to "now".
Email string `json:"email"`
FullName string `json:"full_name,omitempty"`
LoginName string `json:"login_name,omitempty"`
MustChangePassword bool `json:"must_change_password,omitempty"`
Password string `json:"password,omitempty"`
Restricted bool `json:"restricted,omitempty"`
SendNotify bool `json:"send_notify,omitempty"`
SourceID int64 `json:"source_id,omitempty"`
Username string `json:"username"`
Visibility string `json:"visibility,omitempty"`
}
// DeleteEmailOption — DeleteEmailOption options when deleting email addresses
@ -53,34 +55,38 @@ type DeleteEmailOption struct {
//
// opts := EditUserOption{Description: "example"}
type EditUserOption struct {
Active bool `json:"active,omitempty"`
Admin bool `json:"admin,omitempty"`
AllowCreateOrganization bool `json:"allow_create_organization,omitempty"`
AllowGitHook bool `json:"allow_git_hook,omitempty"`
AllowImportLocal bool `json:"allow_import_local,omitempty"`
Description string `json:"description,omitempty"`
Email string `json:"email,omitempty"`
FullName string `json:"full_name,omitempty"`
Location string `json:"location,omitempty"`
LoginName string `json:"login_name,omitempty"`
MaxRepoCreation int64 `json:"max_repo_creation,omitempty"`
MustChangePassword bool `json:"must_change_password,omitempty"`
Password string `json:"password,omitempty"`
ProhibitLogin bool `json:"prohibit_login,omitempty"`
Pronouns string `json:"pronouns,omitempty"`
Restricted bool `json:"restricted,omitempty"`
SourceID int64 `json:"source_id,omitempty"`
Visibility string `json:"visibility,omitempty"`
Website string `json:"website,omitempty"`
Active bool `json:"active,omitempty"`
Admin bool `json:"admin,omitempty"`
AllowCreateOrganization bool `json:"allow_create_organization,omitempty"`
AllowGitHook bool `json:"allow_git_hook,omitempty"`
AllowImportLocal bool `json:"allow_import_local,omitempty"`
Description string `json:"description,omitempty"`
Email string `json:"email,omitempty"`
FullName string `json:"full_name,omitempty"`
Location string `json:"location,omitempty"`
LoginName string `json:"login_name,omitempty"`
MaxRepoCreation int64 `json:"max_repo_creation,omitempty"`
MustChangePassword bool `json:"must_change_password,omitempty"`
Password string `json:"password,omitempty"`
ProhibitLogin bool `json:"prohibit_login,omitempty"`
Pronouns string `json:"pronouns,omitempty"`
Restricted bool `json:"restricted,omitempty"`
SourceID int64 `json:"source_id,omitempty"`
Visibility string `json:"visibility,omitempty"`
Website string `json:"website,omitempty"`
}
// 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"`
UserID int64 `json:"user_id,omitempty"`
Email string `json:"email,omitempty"`
Primary bool `json:"primary,omitempty"`
UserID int64 `json:"user_id,omitempty"`
UserName string `json:"username,omitempty"`
Verified bool `json:"verified,omitempty"`
Verified bool `json:"verified,omitempty"`
}
// SetUserQuotaGroupsOptions — SetUserQuotaGroupsOptions represents the quota groups of a user
@ -102,51 +108,63 @@ 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"`
Description string `json:"description,omitempty"` // the user's description
Email string `json:"email,omitempty"`
Followers int64 `json:"followers_count,omitempty"` // user counts
Following int64 `json:"following_count,omitempty"`
FullName string `json:"full_name,omitempty"` // the user's full name
HTMLURL string `json:"html_url,omitempty"` // URL to the user's gitea page
ID int64 `json:"id,omitempty"` // the user's id
IsActive bool `json:"active,omitempty"` // Is user active
IsAdmin bool `json:"is_admin,omitempty"` // Is the user an administrator
Language string `json:"language,omitempty"` // User locale
LastLogin time.Time `json:"last_login,omitempty"`
Location string `json:"location,omitempty"` // the user's location
LoginName string `json:"login_name,omitempty"` // the user's authentication sign-in name.
ProhibitLogin bool `json:"prohibit_login,omitempty"` // Is user login prohibited
Pronouns string `json:"pronouns,omitempty"` // the user's pronouns
Restricted bool `json:"restricted,omitempty"` // Is user restricted
SourceID int64 `json:"source_id,omitempty"` // The ID of the user's Authentication Source
StarredRepos int64 `json:"starred_repos_count,omitempty"`
UserName string `json:"login,omitempty"` // the user's username
Visibility string `json:"visibility,omitempty"` // User visibility level option: public, limited, private
Website string `json:"website,omitempty"` // the user's website
AvatarURL string `json:"avatar_url,omitempty"` // URL to the user's avatar
Created time.Time `json:"created,omitempty"`
Description string `json:"description,omitempty"` // the user's description
Email string `json:"email,omitempty"`
Followers int64 `json:"followers_count,omitempty"` // user counts
Following int64 `json:"following_count,omitempty"`
FullName string `json:"full_name,omitempty"` // the user's full name
HTMLURL string `json:"html_url,omitempty"` // URL to the user's gitea page
ID int64 `json:"id,omitempty"` // the user's id
IsActive bool `json:"active,omitempty"` // Is user active
IsAdmin bool `json:"is_admin,omitempty"` // Is the user an administrator
Language string `json:"language,omitempty"` // User locale
LastLogin time.Time `json:"last_login,omitempty"`
Location string `json:"location,omitempty"` // the user's location
LoginName string `json:"login_name,omitempty"` // the user's authentication sign-in name.
ProhibitLogin bool `json:"prohibit_login,omitempty"` // Is user login prohibited
Pronouns string `json:"pronouns,omitempty"` // the user's pronouns
Restricted bool `json:"restricted,omitempty"` // Is user restricted
SourceID int64 `json:"source_id,omitempty"` // The ID of the user's Authentication Source
StarredRepos int64 `json:"starred_repos_count,omitempty"`
UserName string `json:"login,omitempty"` // the user's username
Visibility string `json:"visibility,omitempty"` // User visibility level option: public, limited, private
Website string `json:"website,omitempty"` // the user's website
}
// 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"`
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"`
EnableRepoUnitHints bool `json:"enable_repo_unit_hints,omitempty"`
FullName string `json:"full_name,omitempty"`
HideActivity bool `json:"hide_activity,omitempty"`
HideEmail bool `json:"hide_email,omitempty"` // Privacy
Language string `json:"language,omitempty"`
Location string `json:"location,omitempty"`
Pronouns string `json:"pronouns,omitempty"`
Theme string `json:"theme,omitempty"`
Website string `json:"website,omitempty"`
Description string `json:"description,omitempty"`
DiffViewStyle string `json:"diff_view_style,omitempty"`
EnableRepoUnitHints bool `json:"enable_repo_unit_hints,omitempty"`
FullName string `json:"full_name,omitempty"`
HideActivity bool `json:"hide_activity,omitempty"`
HideEmail bool `json:"hide_email,omitempty"` // Privacy
Language string `json:"language,omitempty"`
Location string `json:"location,omitempty"`
Pronouns string `json:"pronouns,omitempty"`
Theme string `json:"theme,omitempty"`
Website string `json:"website,omitempty"`
}
// UserSettingsOptions — UserSettingsOptions represents options to change user settings
@ -155,15 +173,15 @@ type UserSettings struct {
//
// opts := UserSettingsOptions{Description: "example"}
type UserSettingsOptions struct {
Description string `json:"description,omitempty"`
DiffViewStyle string `json:"diff_view_style,omitempty"`
EnableRepoUnitHints bool `json:"enable_repo_unit_hints,omitempty"`
FullName string `json:"full_name,omitempty"`
HideActivity bool `json:"hide_activity,omitempty"`
HideEmail bool `json:"hide_email,omitempty"` // Privacy
Language string `json:"language,omitempty"`
Location string `json:"location,omitempty"`
Pronouns string `json:"pronouns,omitempty"`
Theme string `json:"theme,omitempty"`
Website string `json:"website,omitempty"`
Description string `json:"description,omitempty"`
DiffViewStyle string `json:"diff_view_style,omitempty"`
EnableRepoUnitHints bool `json:"enable_repo_unit_hints,omitempty"`
FullName string `json:"full_name,omitempty"`
HideActivity bool `json:"hide_activity,omitempty"`
HideEmail bool `json:"hide_email,omitempty"` // Privacy
Language string `json:"language,omitempty"`
Location string `json:"location,omitempty"`
Pronouns string `json:"pronouns,omitempty"`
Theme string `json:"theme,omitempty"`
Website string `json:"website,omitempty"`
}

View file

@ -2,7 +2,6 @@
package types
// CreateWikiPageOptions — CreateWikiPageOptions form for creating wiki
//
// Usage:
@ -10,40 +9,56 @@ package types
// opts := CreateWikiPageOptions{Title: "example"}
type CreateWikiPageOptions struct {
ContentBase64 string `json:"content_base64,omitempty"` // content must be base64 encoded
Message string `json:"message,omitempty"` // optional commit message summarizing the change
Title string `json:"title,omitempty"` // page title. leave empty to keep unchanged
Message string `json:"message,omitempty"` // optional commit message summarizing the change
Title string `json:"title,omitempty"` // page title. leave empty to keep unchanged
}
// WikiCommit — WikiCommit page commit/revision
//
// Usage:
//
// opts := WikiCommit{ID: "example"}
type WikiCommit struct {
Author *CommitUser `json:"author,omitempty"`
Author *CommitUser `json:"author,omitempty"`
Commiter *CommitUser `json:"commiter,omitempty"`
ID string `json:"sha,omitempty"`
Message string `json:"message,omitempty"`
ID string `json:"sha,omitempty"`
Message string `json:"message,omitempty"`
}
// WikiCommitList — WikiCommitList commit/revision list
//
// Usage:
//
// opts := WikiCommitList{Count: 1}
type WikiCommitList struct {
Count int64 `json:"count,omitempty"`
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
Footer string `json:"footer,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
LastCommit *WikiCommit `json:"last_commit,omitempty"`
Sidebar string `json:"sidebar,omitempty"`
SubURL string `json:"sub_url,omitempty"`
Title string `json:"title,omitempty"`
CommitCount int64 `json:"commit_count,omitempty"`
ContentBase64 string `json:"content_base64,omitempty"` // Page content, base64 encoded
Footer string `json:"footer,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
LastCommit *WikiCommit `json:"last_commit,omitempty"`
Sidebar string `json:"sidebar,omitempty"`
SubURL string `json:"sub_url,omitempty"`
Title string `json:"title,omitempty"`
}
// WikiPageMetaData — WikiPageMetaData wiki page meta information
//
// Usage:
//
// opts := WikiPageMetaData{Title: "example"}
type WikiPageMetaData struct {
HTMLURL string `json:"html_url,omitempty"`
HTMLURL string `json:"html_url,omitempty"`
LastCommit *WikiCommit `json:"last_commit,omitempty"`
SubURL string `json:"sub_url,omitempty"`
Title string `json:"title,omitempty"`
SubURL string `json:"sub_url,omitempty"`
Title string `json:"title,omitempty"`
}