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

View File

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

View File

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

View File

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

View File

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