mod(gitea-api): add json encoding informations for all structs

This commit is contained in:
2023-10-20 13:53:38 +02:00
parent 255b35783c
commit 11c57d3485
5 changed files with 73 additions and 73 deletions

View File

@@ -9,17 +9,17 @@ import (
)
type Comment struct {
Id uint
Body string
Issue_url string
Assets []string
Html_url string
User User
Original_author string
Original_author_id uint
Pull_request_url string
Created_at time.Time
Updated_at time.Time
Id uint `json:"id"`
Body string `json:"body"`
Issue_url string `json:"issue_url"`
Assets []string `json:"assets"`
Html_url string `json:"html_url"`
User User `json:"user"`
Original_author string `json:"original_author"`
Original_author_id uint `json:"original_author_id"`
Pull_request_url string `json:"pull_request_url"`
Created_at time.Time `json:"created_at"`
Updated_at time.Time `json:"updated_at"`
}
func (gitea *Gitea) GetComments(repo Repository) ([]Comment, error) {

View File

@@ -9,36 +9,36 @@ import (
)
type PullRequest struct {
Merged bool
Merged_at time.Time
Merged bool `json:"merged"`
Merged_at time.Time `json:"merged_at"`
}
type Issue struct {
Id uint
Url string
Html_url string
Number uint
User User
Original_author string
Original_author_id uint
Title string
Body string
Ref string
Assets []string
Labels []string
Milestone Milestone
Assignee User
Assignees []User
State string
Is_locked bool
Comments uint
Created_at time.Time
Updated_at time.Time
Closed_at time.Time
Due_date time.Time
Pull_request PullRequest
Repository Repository
Pin_order uint
Id uint `json:"id"`
Url string `json:"url"`
Html_url string `json:"html_url"`
Number uint `json:"number"`
User User `json:"user"`
Original_author string `json:"original_author"`
Original_author_id uint `json:"original_author_id"`
Title string `json:"title"`
Body string `json:"body"`
Ref string `json:"ref"`
Assets []string `json:"assets"`
Labels []string `json:"labels"`
Milestone Milestone `json:"milestone"`
Assignee User `json:"assignee"`
Assignees []User `json:"assignees"`
State string `json:"state"`
Is_locked bool `json:"is_locked"`
Comments uint `json:"comments"`
Created_at time.Time `json:"created_at"`
Updated_at time.Time `json:"updated_at"`
Closed_at time.Time `json:"closed_at"`
Due_date time.Time `json:"due_date"`
Pull_request PullRequest `json:"pull_request"`
Repository Repository `json:"repository"`
Pin_order uint `json:"pin_order"`
}
func (gitea *Gitea) GetIssues(repo Repository) ([]Issue, error) {

View File

@@ -9,16 +9,16 @@ import (
)
type Milestone struct {
Id uint
Title string
Description string
State string
Open_issues uint
Closed_issues uint
Created_at time.Time
Updated_at time.Time
Due_on time.Time
Closed_at time.Time
Id uint `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
State string `json:"state"`
Open_issues uint `json:"open_issues"`
Closed_issues uint `json:"closed_issues"`
Created_at time.Time `json:"created_at"`
Updated_at time.Time `json:"updated_at"`
Due_on time.Time `json:"due_on"`
Closed_at time.Time `json:"closed_at"`
}
func (gitea *Gitea) GetMilestones(repo Repository) ([]Milestone, error) {

View File

@@ -7,10 +7,10 @@ import (
)
type Repository struct {
Id uint
Name string
Owner string
Full_name string
Id uint `json:"id"`
Name string `json:"name"`
Owner string `json:"owner"`
Full_name string `json:"full_name"`
}
func NewRepository(name, owner string) (repo Repository) {

View File

@@ -3,25 +3,25 @@ package gitea
import "time"
type User struct {
Id uint
Login string
Login_name string
Full_name string
Email string
Avatar_url string
Language string
Is_admin bool
Last_login time.Time
Created time.Time
Restricted bool
Active bool
Prohibit_login bool
Location string
Website string
Description string
Visibility string
Followers_count uint
Following_count uint
Starred_repos_count uint
Username string
Id uint `json:"id"`
Login string `json:"login"`
Login_name string `json:"login_name"`
Full_name string `json:"full_name"`
Email string `json:"email"`
Avatar_url string `json:"avatar_url"`
Language string `json:"language"`
Is_admin bool `json:"is_admin"`
Last_login time.Time `json:"last_login"`
Created time.Time `json:"created"`
Restricted bool `json:"restricted"`
Active bool `json:"active"`
Prohibit_login bool `json:"prohibit_login"`
Location string `json:"location"`
Website string `json:"website"`
Description string `json:"description"`
Visibility string `json:"visibility"`
Followers_count uint `json:"followers_count"`
Following_count uint `json:"following_count"`
Starred_repos_count uint `json:"starred_repos_count"`
Username string `json:"username"`
}