gitee

package module
v0.0.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2025 License: MIT Imports: 10 Imported by: 0

README

Gitee SDK

Description

A Golang SDK that provides functionality of Gitee API. It allows you to interact with Gitee's API v8.

Features

  • Issues
  • Members
  • Issue Types
  • Pull Requests
  • Comments
  • Statistics

Usage

This SDK provides functionality to fetch user statistics for a given enterprise and date range.

Client Functions

The Client struct in the SDK provides several methods to interact with the Gitee API. Here are some of the key functions:

  • NewClient(apiBase string) (*Client): Creates a new Gitee API client. If apiBase is an empty string, it defaults to "https://api.gitee.com".
  • SetHTTPCookies(cookiesJar string): Sets the HTTP cookies for the client. Used for cookie-based authentication.
  • SetBearerToken(bearerToken string): Sets the Bearer token for the client. Used for token-based authentication.
  • SetHTTPClient(client *http.Client): Sets the HTTP client for the client.
  • SetLog(log io.Writer): Sets the log writer for the client.
  • Send(req *http.Request, v interface{}) error: Sends an HTTP request and handles the response. It can unmarshal JSON into v, write the raw response body to an io.Writer, or assign the body to a *string or *[]byte. It also handles API error responses.
  • SendWithCookies(req *http.Request, v interface{}) error: Sends an HTTP request specifically using cookies for authentication and unmarshals the response into v.
  • SendWithBearerToken(req *http.Request, v interface{}) error: Sends an HTTP request specifically using a Bearer token for authentication and unmarshals the response into v.
  • SendWithAuth(req *http.Request, v interface{}) error: Sends an HTTP request using the configured authentication method (Bearer token if set, otherwise cookies) and unmarshals the response into v. This is the preferred method for authenticated requests.
  • NewRequest(ctx context.Context, method, url string, payload interface{}) (*http.Request, error): Creates a new HTTP request with the given context, method, URL, and payload (automatically marshalled to JSON if not nil).
User Statistics Functions

The Client struct in the SDK provides a method to interact with the Gitee API for user statistics. Here is the key function:

  • ListUserStatistics(ctx context.Context, enterpriseId int, params *UserStatisticListParams) (*ListUserStatisticsResponse, error): Fetches user statistics for a set of users and a specified date range.
Issues Functions

The Client struct in the SDK provides several methods to interact with the Gitee API for issues. Here are some of the key functions:

  • CreateIssue(ctx context.Context, enterpriseId int, params *IssueCreateParams) (*CreateIssueResponse, error): Creates a new issue.
  • ListIssues(ctx context.Context, enterpriseId int, params *IssueListParams) (*ListIssuesResponse, error): Lists issues.
  • GetIssueDetail(ctx context.Context, enterpriseId int, issueId int) (*IssueResponse, error): Gets the details of an issue.
Members Functions

The Client struct in the SDK provides several methods to interact with the Gitee API for members. Here are some of the key functions:

  • GetMember(ctx context.Context, enterpriseId int, userId int) (*MemberResponse, error): Gets the details of a member.
  • UpdateMember(ctx context.Context, enterpriseId int, userId int, params *MemberUpdateParams) (*MemberResponse, error): Updates a member.
  • ListMembers(ctx context.Context, enterpriseId int, params *MemberListParams) (*ListMembersResponse, error): Lists members within an enterprise.
  • ListProgramMembers(ctx context.Context, enterpriseId, programId int, params *ProgramMemberListParams) (*ListMembersResponse, error): Lists members within a specific program.
Issue Types Functions

The Client struct in the SDK provides several methods to interact with the Gitee API for issue types. Here are some of the key functions:

  • ListIssueTypes(ctx context.Context, enterpriseId int, params *IssueTypeListParams) (*ListIssueTypesResponse, error): Lists issue types.
Pull Requests Functions

The Client struct in the SDK provides methods to interact with Gitee Pull Requests.

  • GetPullDiff(ctx context.Context, enterpriseId, repoId, pullId int) (string, error): Retrieves the diff content of a specific pull request as a string.
  • GetPullDetail(ctx context.Context, enterpriseId, projectId, pullId int) (*PullRequest, error): Retrieves detailed information about a specific pull request including metadata, comments count, and merge status.
  • CreatePullComment(ctx context.Context, enterpriseId, repoId, pullId int, params *PullCommentCreateParams) (*CreatePullCommentResponse, error): Adds a comment to a specific pull request.
Project Configuration Functions

The Client struct provides methods to manage project push configurations:

  • GetProjectPushConfig(ctx context.Context, enterpriseId int, projectId string) (*ProjectPushConfig, error): Retrieves push configuration rules for a project including branch restrictions, commit message rules, and file size limits.
Enterprise Functions

The Client struct provides methods to query enterprise-level information:

  • GetEnterprise(ctx context.Context, enterpriseID int) (*Enterprise, error): Retrieves basic information for a given enterprise, including its name, description, owner, level, and various settings.

Contributing

How to Contribute

If you are interested in contributing to the Gitee SDK, you can find more information about the contribution process in the Gitee SDK Contribution Guide.

License

The Gitee SDK is released under the MIT License. For more details, please refer to the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignee

type Assignee struct {
	ID                 int    `json:"id"`
	Username           string `json:"username"`
	Name               string `json:"name"`
	Remark             string `json:"remark"`
	Pinyin             string `json:"pinyin"`
	AvatarURL          string `json:"avatar_url"`
	IsEnterpriseMember bool   `json:"is_enterprise_member"`
	IsHistoryMember    bool   `json:"is_history_member"`
	Outsourced         bool   `json:"outsourced"`
}

type Author

type Author struct {
	ID                 int    `json:"id"`
	Username           string `json:"username"`
	Name               string `json:"name"`
	Remark             string `json:"remark"`
	Pinyin             string `json:"pinyin"`
	AvatarURL          string `json:"avatar_url"`
	IsEnterpriseMember bool   `json:"is_enterprise_member"`
	IsHistoryMember    bool   `json:"is_history_member"`
	Outsourced         bool   `json:"outsourced"`
}

type BranchInfo added in v0.0.9

type BranchInfo struct {
	Branch         string      `json:"branch"`
	Name           string      `json:"name"`
	URL            string      `json:"url"`
	ProtectionRule interface{} `json:"protection_rule"` // Can be string or null
	EnterpriseID   int         `json:"enterprise_id"`
}

BranchInfo represents source or target branch details.

type BranchRule added in v0.0.20

type BranchRule struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Wildcard string `json:"wildcard"`
}

type Client

type Client struct {
	Client      *http.Client
	APIBase     string
	CookiesJar  string
	BearerToken string
	Log         io.Writer // If user set log file name all requests will be logged there
	// contains filtered or unexported fields
}

Client represents a Paypal REST API Client

func NewClient

func NewClient(apiBase string) *Client

NewClient returns new Client struct APIBase is a base API URL

func (*Client) CreateIssue added in v0.0.2

func (c *Client) CreateIssue(ctx context.Context, enterpriseId int, params *IssueCreateParams) (*CreateIssueResponse, error)

func (*Client) CreatePullComment added in v0.0.5

func (c *Client) CreatePullComment(ctx context.Context, enterpriseId, repoId, pullId int, params *PullCommentCreateParams) (*CreatePullCommentResponse, error)

func (*Client) GetComment added in v0.0.17

func (c *Client) GetComment(ctx context.Context, enterpriseId, commentId int) (*Comment, error)

func (*Client) GetEnterprise added in v0.0.21

func (c *Client) GetEnterprise(ctx context.Context, enterpriseID int) (*Enterprise, error)

GetEnterprise retrieves basic information for the given enterprise.

func (*Client) GetIssueDetail added in v0.0.3

func (c *Client) GetIssueDetail(ctx context.Context, enterpriseId int, issueId int) (*IssueResponse, error)

func (*Client) GetMember added in v0.0.2

func (c *Client) GetMember(ctx context.Context, enterpriseId int, userId int) (*MemberResponse, error)

func (*Client) GetProjectPushConfig added in v0.0.20

func (c *Client) GetProjectPushConfig(ctx context.Context, enterpriseId int, projectId string) (*ProjectPushConfig, error)

func (*Client) GetPullDetail added in v0.0.18

func (c *Client) GetPullDetail(ctx context.Context, enterpriseId, projectId, pullId int) (*PullRequest, error)

CreatePullComment adds a comment to a specific pull request. GetPullDetail retrieves detailed information about a specific pull request.

func (*Client) GetPullDiff added in v0.0.5

func (c *Client) GetPullDiff(ctx context.Context, enterpriseId, repoId, pullId int) (string, error)

func (*Client) GetRepositorySummary added in v0.0.22

func (c *Client) GetRepositorySummary(ctx context.Context, enterpriseId int, projectId string, ref string) (*RepositorySummary, error)

GetRepositorySummary retrieves repository overview data

func (*Client) GetUserExtraStatistic added in v0.0.16

func (c *Client) GetUserExtraStatistic(ctx context.Context, enterpriseID, userID int) (*ExtraUserStatisticResponse, error)

GetUserExtraStatistic fetches AI enhancement statistics for a specific user

func (*Client) ListIssueTypes added in v0.0.2

func (c *Client) ListIssueTypes(ctx context.Context, enterpriseId int, params *IssueTypeListParams) (*ListIssueTypesResponse, error)

func (*Client) ListIssues

func (c *Client) ListIssues(ctx context.Context, enterpriseId int, params *IssueListParams) (*ListIssuesResponse, error)

func (*Client) ListMemberWeekReports added in v0.0.11

func (c *Client) ListMemberWeekReports(ctx context.Context, enterpriseId int, params *MemberReportListParams) (*ListMemberWeekReportsResponse, error)

func (*Client) ListMembers added in v0.0.3

func (c *Client) ListMembers(ctx context.Context, enterpriseId int, params *MemberListParams) (*ListMembersResponse, error)

func (*Client) ListProgramMembers added in v0.0.4

func (c *Client) ListProgramMembers(ctx context.Context, enterpriseId, programId int, params *ProgramMemberListParams) (*ListMembersResponse, error)

func (*Client) ListPullRequests added in v0.0.9

func (c *Client) ListPullRequests(ctx context.Context, enterpriseId int, params *PullRequestListParams) (*ListPullRequestsResponse, error)

func (*Client) ListUserStatistics added in v0.0.14

func (c *Client) ListUserStatistics(ctx context.Context, enterpriseId int, params *UserStatisticListParams) (*ListUserStatisticsResponse, error)

ListUserStatistics fetches user statistics for the given enterprise and parameters.

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, url string, payload interface{}) (*http.Request, error)

NewRequest constructs a request Convert payload to a JSON

func (*Client) Send

func (c *Client) Send(req *http.Request, v interface{}) error

Send makes a request to the API, the response body will be unmarshalled into v, or if v is an io.Writer, the response will be written to it without decoding

func (*Client) SendWithAuth added in v0.0.5

func (c *Client) SendWithAuth(req *http.Request, v interface{}) error

func (*Client) SendWithBearerToken added in v0.0.5

func (c *Client) SendWithBearerToken(req *http.Request, v interface{}) error

func (*Client) SendWithCookies

func (c *Client) SendWithCookies(req *http.Request, v interface{}) error

func (*Client) SetBearerToken added in v0.0.7

func (c *Client) SetBearerToken(bearerToken string)

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(client *http.Client)

SetHTTPClient sets *http.Client to current client

func (*Client) SetHTTPCookies

func (c *Client) SetHTTPCookies(cookiesJar string)

SetHTTPClient sets cookies to current client

func (*Client) SetLog

func (c *Client) SetLog(log io.Writer)

SetLog will set/change the output destination. If log file is set paypal will log all requests and responses to this Writer

func (*Client) UpdateComment added in v0.0.6

func (c *Client) UpdateComment(ctx context.Context, enterpriseId, commentId int, params *CommentUpdateParams) (*UpdateCommentResponse, error)

func (*Client) UpdateMember added in v0.0.2

func (c *Client) UpdateMember(ctx context.Context, enterpriseId int, userId int, params *MemberUpdateParams) (*MemberResponse, error)

type Comment added in v0.0.5

type Comment struct {
	ID        int       `json:"id"`
	Type      string    `json:"type"`
	Author    Member    `json:"author"`
	Content   string    `json:"content"`
	CanModify bool      `json:"can_modify"`
	CanDelete bool      `json:"can_delete"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Outdated  bool      `json:"outdated"`
	Resolved  bool      `json:"resolved"`
}

type CommentUpdateParams added in v0.0.6

type CommentUpdateParams struct {
	// body*: Comment content, use “`suggestion “` for code suggestions
	Body string `json:"body"`
	// line_code: Code line marker value
	LineCode string `json:"line_code,omitempty"`
	// diff_position_id: Code comment group ID, pass when there are existing comments in the same position
	DiffPositionID int `json:"diff_position_id,omitempty"`
	// reply_id: ID of the parent comment being replied to
	ReplyID int `json:"reply_id,omitempty"`
}

type CreateIssueResponse added in v0.0.2

type CreateIssueResponse struct {
	Issue
}

type CreatePullCommentResponse added in v0.0.5

type CreatePullCommentResponse struct {
	Comment
}

CreatePullCommentResponse represents the response when creating a pull comment. Often, this is just the created comment itself.

type DataRange added in v0.0.14

type DataRange struct {
	StartDate string `json:"start_date"`
	EndDate   string `json:"end_date"`
}

type Enterprise added in v0.0.21

type Enterprise struct {
	ID                int       `json:"id"`
	Name              string    `json:"name"`
	Path              string    `json:"path"`
	Description       string    `json:"description"`
	Public            bool      `json:"public"`
	Website           string    `json:"website,omitempty"`
	Email             string    `json:"email"`
	Phone             string    `json:"phone"`
	AvatarURL         string    `json:"avatar_url"`
	Level             int       `json:"level"`
	Title             string    `json:"title"`
	Owner             User      `json:"owner,omitempty"`
	Notice            string    `json:"notice,omitempty"`
	WelcomeMessage    string    `json:"welcome_message,omitempty"`
	ForceVerify       bool      `json:"force_verify"`
	DefaultRoleID     int       `json:"default_role_id"`
	OpenApplication   bool      `json:"open_application"`
	Version           int       `json:"version"`
	StartAt           time.Time `json:"start_at,omitempty"`
	StopAt            time.Time `json:"stop_at,omitempty"`
	Overdue           bool      `json:"overdue"`
	Charged           bool      `json:"charged"`
	CreatedAt         time.Time `json:"created_at,omitempty"`
	UpdatedAt         time.Time `json:"updated_at,omitempty"`
	Watermark         bool      `json:"watermark"`
	GiteeSearchStatus string    `json:"gitee_search_status"`
	HasHedgeOrder     bool      `json:"has_hedge_order"`
	LDAPEnabled       bool      `json:"ldap_enabled"`
	RegisterEnabled   bool      `json:"register_enabled"`
}

type EnterpriseRole added in v0.0.2

type EnterpriseRole struct {
	ID              int    `json:"id"`
	Name            string `json:"name"`
	Description     string `json:"description"`
	IsSystemDefault bool   `json:"is_system_default"`
	Ident           string `json:"ident"`
	IsDefault       bool   `json:"is_default"`
}

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response `json:"-"`
	Message  string         `json:"message"`
}

ErrorResponse

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type ExtraUserStatisticResponse added in v0.0.16

type ExtraUserStatisticResponse struct {
	ReceivedLikesCount  int `json:"received_likes_count"`
	RevealedIssuesCount int `json:"revealed_issues_count"`
}

type Issue

type Issue struct {
	ID                 int        `json:"id"`
	RootID             int        `json:"root_id"`
	ParentID           int        `json:"parent_id"`
	ProjectID          int        `json:"project_id"`
	Ident              string     `json:"ident"`
	Title              string     `json:"title"`
	Description        string     `json:"description,omitempty"`
	IssueStateID       int        `json:"issue_state_id"`
	ProgramID          int        `json:"program_id"`
	State              string     `json:"state"`
	CommentsCount      int        `json:"comments_count"`
	Priority           int        `json:"priority"`
	Branch             string     `json:"branch"`
	PriorityHuman      string     `json:"priority_human"`
	Assignee           Assignee   `json:"assignee"`
	Duration           int        `json:"duration"`
	CreatedAt          string     `json:"created_at"`
	UpdatedAt          string     `json:"updated_at"`
	Author             Author     `json:"author"`
	IssueState         IssueState `json:"issue_state"`
	IssueType          IssueType  `json:"issue_type"`
	PlanStartedAt      string     `json:"plan_started_at,omitempty"`
	Deadline           string     `json:"deadline,omitempty"`
	FinishedAt         string     `json:"finished_at,omitempty"`
	StartedAt          string     `json:"started_at,omitempty"`
	SecurityHole       bool       `json:"security_hole"`
	IsStar             bool       `json:"is_star"`
	EstimatedDuration  int        `json:"estimated_duration"`
	RegisteredDuration int        `json:"registered_duration"`
}

type IssueCreateParams added in v0.0.2

type IssueCreateParams struct {
	Title             string                   `json:"title"`
	Description       string                   `json:"description"`
	AssigneeID        int                      `json:"assignee_id,omitempty"`
	CollaboratorIDs   string                   `json:"collaborator_ids,omitempty"`
	IssueTypeID       int                      `json:"issue_type_id,omitempty"`
	ProgramID         int                      `json:"program_id,omitempty"`
	ProjectID         int                      `json:"project_id,omitempty"`
	MilestoneID       int                      `json:"milestone_id,omitempty"`
	LabelIDs          string                   `json:"label_ids,omitempty"`
	Priority          int                      `json:"priority,omitempty"`
	ParentID          int                      `json:"parent_id,omitempty"`
	Branch            string                   `json:"branch,omitempty"`
	PlanStartedAt     string                   `json:"plan_started_at,omitempty"`
	Deadline          string                   `json:"deadline,omitempty"`
	StartedAt         string                   `json:"started_at,omitempty"`
	FinishedAt        string                   `json:"finished_at,omitempty"`
	AttachmentIDs     string                   `json:"attachment_ids,omitempty"`
	SecurityHole      int                      `json:"security_hole,omitempty"`
	ExtraFields       []map[string]interface{} `json:"extra_fields,omitempty"`
	KanbanID          int                      `json:"kanban_id,omitempty"`
	KanbanColumnID    int                      `json:"kanban_column_id,omitempty"`
	ScrumSprintID     int                      `json:"scrum_sprint_id,omitempty"`
	ScrumVersionID    int                      `json:"scrum_version_id,omitempty"`
	EstimatedDuration float64                  `json:"estimated_duration,omitempty"`
	Duration          int                      `json:"duration,omitempty"`
	TestPlanCaseID    string                   `json:"test_plan_case_id,omitempty"`
	PullRequestID     int                      `json:"pull_request_id,omitempty"`
	Category          string                   `json:"category,omitempty"`
	LinkIssueID       int                      `json:"link_issue_id,omitempty"`
	LinkRefType       string                   `json:"link_ref_type,omitempty"`
	LinkDirection     string                   `json:"link_direction,omitempty"`
	LinkResultType    string                   `json:"link_result_type,omitempty"`
	LinkDocNodeID     int                      `json:"link_doc_node_id,omitempty"`
}

type IssueDetailParams added in v0.0.3

type IssueDetailParams struct {
	Id int `json:"id,omitempty"`
}

type IssueListParams

type IssueListParams struct {
	ProjectID       string `json:"project_id,omitempty"`
	ProgramID       string `json:"program_id,omitempty"`
	MilestoneID     string `json:"milestone_id,omitempty"`
	State           string `json:"state,omitempty"`
	OnlyRelatedMe   string `json:"only_related_me,omitempty"`
	AssigneeID      string `json:"assignee_id,omitempty"`
	AuthorID        string `json:"author_id,omitempty"`
	CollaboratorIDs string `json:"collaborator_ids,omitempty"`
	CreatedAt       string `json:"created_at,omitempty"`
	FinishedAt      string `json:"finished_at,omitempty"`
	PlanStartedAt   string `json:"plan_started_at,omitempty"`
	Deadline        string `json:"deadline,omitempty"`
	Search          string `json:"search,omitempty"`
	FilterChild     string `json:"filter_child,omitempty"`
	IssueStateIDs   string `json:"issue_state_ids,omitempty"`
	IssueTypeID     string `json:"issue_type_id,omitempty"`
	LabelIDs        string `json:"label_ids,omitempty"`
	Priority        string `json:"priority,omitempty"`
	Sort            string `json:"sort,omitempty"`
	Direction       string `json:"direction,omitempty"`
	Page            string `json:"page,omitempty"`
	PerPage         string `json:"per_page,omitempty"`
	ScrumSprintIDs  string `json:"scrum_sprint_ids,omitempty"` // Added ScrumSprintIDs
	DeadlineType    string `json:"deadline_type,omitempty"`    // Added DeadlineType
}

type IssueResponse added in v0.0.3

type IssueResponse struct {
	Issue
}

type IssueState

type IssueState struct {
	IssueState string      `json:"issue_state"`
	ID         int         `json:"id"`
	Title      string      `json:"title"`
	Color      string      `json:"color"`
	Icon       string      `json:"icon"`
	Command    string      `json:"command"`
	Serial     int         `json:"serial"`
	IssueTypes []IssueType `json:"issue_types"`
	CreatedAt  string      `json:"created_at"`
	UpdatedAt  string      `json:"updated_at"`
}

type IssueType

type IssueType struct {
	ID          int    `json:"id"`
	Title       string `json:"title"`
	Template    string `json:"template"`
	Ident       string `json:"ident"`
	Color       string `json:"color"`
	IsSystem    bool   `json:"is_system"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	Category    string `json:"category"`
	Description string `json:"description"`
}

type IssueTypeListParams added in v0.0.2

type IssueTypeListParams struct {
	Sort      string `json:"sort,omitempty"`
	Direction string `json:"direction,omitempty"`
	ProgramID string `json:"program_id,omitempty"`
	Scope     string `json:"scope,omitempty"`    // all, customize
	Category  string `json:"category,omitempty"` // task, bug, requirement, feature
	Page      string `json:"page,omitempty"`
	PerPage   string `json:"per_page,omitempty"`
}

type Label added in v0.0.9

type Label struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Color string `json:"color"`
}

Label represents a label attached to a pull request or issue. Basic definition based on common patterns, might need adjustment.

type ListIssueTypesResponse added in v0.0.2

type ListIssueTypesResponse struct {
	IssueTypes []IssueType `json:"data"`
	SharedListResponse
}

type ListIssuesResponse

type ListIssuesResponse struct {
	Issues []Issue `json:"data"`
	SharedListResponse
}

type ListMemberWeekReportsResponse added in v0.0.11

type ListMemberWeekReportsResponse struct {
	MemberReports []WeekReport `json:"data"`
	SharedListResponse
}

type ListMembersResponse added in v0.0.3

type ListMembersResponse struct {
	Members []Member `json:"data"`
	SharedListResponse
}

type ListPullRequestsResponse added in v0.0.9

type ListPullRequestsResponse struct {
	PullRequests []PullRequest `json:"data"`
	SharedListResponse
}

type ListUserStatisticsResponse added in v0.0.14

type ListUserStatisticsResponse struct {
	DataRange  DataRange       `json:"date_range,omitempty"`
	Statistics []UserStatistic `json:"data"`
}

ListUserStatisticsResponse wraps the API response.

type Member added in v0.0.2

type Member struct {
	Username            string         `json:"username"`
	Name                string         `json:"name"`
	Remark              string         `json:"remark"`
	Pinyin              string         `json:"pinyin"`
	Occupation          string         `json:"occupation"`
	IsBlock             bool           `json:"is_block"`
	BlockMessage        string         `json:"block_message"`
	Phone               string         `json:"phone"`
	Email               string         `json:"email"`
	CreatedAt           string         `json:"created_at"`
	FeedbackTime        string         `json:"feedback_time"`
	IsFeedback          bool           `json:"is_feedback"`
	IsAIBot             bool           `json:"is_ai_bot"`
	UserGuideClosed     bool           `json:"user_guide_closed"`
	OtpRequiredForLogin bool           `json:"otp_required_for_login"`
	BlockStatus         int            `json:"block_status"`
	User                User           `json:"user"`
	EnterpriseRole      EnterpriseRole `json:"enterprise_role"`
}

type MemberListParams added in v0.0.3

type MemberListParams struct {
	Ident                  string `json:"ident,omitempty"`
	IsBlock                string `json:"is_block,omitempty"`
	GroupID                string `json:"group_id,omitempty"`
	RoleID                 string `json:"role_id,omitempty"`
	Search                 string `json:"search,omitempty"`
	Sort                   string `json:"sort,omitempty"`
	Direction              string `json:"direction,omitempty"`
	IncludeMemberHistories string `json:"include_member_histories,omitempty"`
	Page                   string `json:"page,omitempty"`
	PerPage                string `json:"per_page,omitempty"`
}

type MemberReportListParams added in v0.0.11

type MemberReportListParams struct {
	Year      int    `json:"year,omitempty"`
	StartWeek string `json:"start_week,omitempty"`
	EndWeek   string `json:"end_week,omitempty"`
	WeekIndex int    `json:"week_index,omitempty"`
	Username  string `json:"username,omitempty"`
	ProgramID int    `json:"program_id,omitempty"`
	MemberIDs string `json:"member_ids,omitempty"`
	GroupIDs  string `json:"group_ids,omitempty"`
	Date      string `json:"date,omitempty"`
	Page      int    `json:"page,omitempty"`
	PerPage   int    `json:"per_page,omitempty"`
}

type MemberResponse added in v0.0.2

type MemberResponse struct {
	Member
}

type MemberUpdateParams added in v0.0.2

type MemberUpdateParams struct {
	Remark     string `json:"remark"`
	Occupation string `json:"occupation"`
	Phone      string `json:"phone"`
	RoleID     string `json:"role_id"`
}

type Namespace added in v0.0.9

type Namespace struct {
	ID           int    `json:"id"`
	Type         string `json:"type"`
	Name         string `json:"name"`
	Path         string `json:"path"`
	CompleteName string `json:"complete_name"`
	CompletePath string `json:"complete_path"`
	Description  string `json:"description"`
}

Namespace represents a Gitee namespace (user or organization).

type ProgramDetailParams added in v0.0.4

type ProgramDetailParams struct {
	Id int `json:"id",omitempty`
}

type ProgramMemberListParams added in v0.0.4

type ProgramMemberListParams struct {
	Search             string `json:"search,omitempty"`
	Sort               string `json:"sort,omitempty"`
	Direction          string `json:"direction,omitempty"`
	FlattenGroupMember string `json:"flatten_group_member,omitempty"`
	Page               string `json:"page,omitempty"`
	PerPage            string `json:"per_page,omitempty"`
}

type Project added in v0.0.9

type Project struct {
	ID                  int       `json:"id"`
	Name                string    `json:"name"`
	Path                string    `json:"path"`
	Public              int       `json:"public"` // Assuming 0 mean private 1 mean public 2 mean internal
	EnterpriseID        int       `json:"enterprise_id"`
	CreatedAt           time.Time `json:"created_at"`
	UpdatedAt           time.Time `json:"updated_at"`
	SecurityHoleEnabled bool      `json:"security_hole_enabled"`
	Namespace           Namespace `json:"namespace"`
	Creator             Author    `json:"creator"` // Reusing Author struct from assignees.go
	PathWithNamespace   string    `json:"path_with_namespace"`
	NameWithNamespace   string    `json:"name_with_namespace"`
	ScanCheckRun        bool      `json:"scan_check_run"`
}

Project represents a Gitee project associated with a Pull Request.

type ProjectPushConfig added in v0.0.20

type ProjectPushConfig struct {
	AuthorEmailSuffix          string       `json:"author_email_suffix"`
	BranchCreateAllowed        []string     `json:"branch_create_allowed"`
	BranchDeleteAllowed        []string     `json:"branch_delete_allowed"`
	BranchRules                []BranchRule `json:"branch_rules"`
	CommitMessageRegex         string       `json:"commit_message_regex"`
	ExceptManager              bool         `json:"except_manager"`
	MaxFileSize                int          `json:"max_file_size"`
	RestrictAuthorEmailSuffix  bool         `json:"restrict_author_email_suffix"`
	RestrictBranch             bool         `json:"restrict_branch"`
	RestrictBranchCreate       bool         `json:"restrict_branch_create"`
	RestrictBranchDelete       bool         `json:"restrict_branch_delete"`
	RestrictCommitMessage      bool         `json:"restrict_commit_message"`
	RestrictFileSize           bool         `json:"restrict_file_size"`
	RestrictPushOwnCommit      bool         `json:"restrict_push_own_commit"`
	RestrictSubmissionUsername bool         `json:"restrict_submission_username"`
}

type PullCommentCreateParams added in v0.0.5

type PullCommentCreateParams struct {
	// body*: Comment content, use “`suggestion “` for code suggestions
	Body string `json:"body"`
	// line_code: Code line marker value
	LineCode string `json:"line_code,omitempty"`
	// diff_position_id: Code comment group ID, pass when there are existing comments in the same position
	DiffPositionID int `json:"diff_position_id,omitempty"`
	// reply_id: ID of the parent comment being replied to
	ReplyID int `json:"reply_id,omitempty"`
}

type PullRequest added in v0.0.9

type PullRequest struct {
	ID                  int        `json:"id"`
	IID                 int        `json:"iid"`
	Title               string     `json:"title"`
	ProjectID           int        `json:"project_id"`
	State               string     `json:"state"`
	Draft               bool       `json:"draft"`
	CheckState          int        `json:"check_state"`
	TestState           int        `json:"test_state"`
	Priority            int        `json:"priority"`
	PriorityHuman       string     `json:"priority_human"`
	Lightweight         bool       `json:"lightweight"`
	CreatedAt           time.Time  `json:"created_at"`
	UpdatedAt           time.Time  `json:"updated_at"`
	MergedAt            time.Time  `json:"merged_at"` // Pointer for nullable time
	Labels              []Label    `json:"labels"`
	Author              Author     `json:"author"` // Reusing Author struct from assignees.go
	Conflict            bool       `json:"conflict"`
	Project             Project    `json:"project"`
	SourceBranch        BranchInfo `json:"source_branch"`
	TargetBranch        BranchInfo `json:"target_branch"`
	CanMerge            bool       `json:"can_merge"`
	Assignees           []Assignee `json:"assignees"` // Reusing Assignee struct from assignees.go
	PRAssignNum         int        `json:"pr_assign_num"`
	Testers             []Assignee `json:"testers"` // Assuming Assignee struct is used for testers too
	CloseRelatedIssue   int        `json:"close_related_issue"`
	PruneBranch         int        `json:"prune_branch"`
	PRTestNum           int        `json:"pr_test_num"`
	GiteeGoEnabled      bool       `json:"gitee_go_enabled"`
	ScanStatus          int        `json:"scan_status"`
	ScanStatusDesc      string     `json:"scan_status_desc"`
	ScanFlag            int        `json:"scan_flag"`
	ReviewStrategy      string     `json:"review_strategy"`
	ReviewScore         int        `json:"review_score"`
	CurrentReviewScore  int        `json:"current_review_score"`
	Body                string     `json:"body"`
	BodyHTML            string     `json:"body_html"`
	CanBeResolve        bool       `json:"can_be_resolve"`
	CheckRunFailedCount int        `json:"check_run_failed_count"`
	CloneURL            struct {
		HTTP string `json:"http"`
		SSH  string `json:"ssh"`
	} `json:"clone_url"`
	CommentsCount          int    `json:"comments_count"`
	CommitsCount           int    `json:"commits_count"`
	FilesCount             string `json:"files_count"`
	ExistUnresolvedComment bool   `json:"exist_unresolved_comment"`
	NeedPassCheckRun       bool   `json:"need_pass_check_run"`
	RequireCommentResolved bool   `json:"require_comment_resolved"`
	Squash                 bool   `json:"squash"`
	DiffRefs               struct {
		BaseSHA string `json:"base_sha"`
		HeadSHA string `json:"head_sha"`
	} `json:"diff_refs"`
}

PullRequest represents a Gitee Pull Request.

type PullRequestListParams added in v0.0.4

type PullRequestListParams struct {
	State                    string `json:"state,omitempty"`
	Scope                    string `json:"scope,omitempty"`
	AuthorID                 string `json:"author_id,omitempty"`
	AssigneeID               string `json:"assignee_id,omitempty"`
	TesterID                 string `json:"tester_id,omitempty"`
	Search                   string `json:"search,omitempty"`
	Sort                     string `json:"sort,omitempty"`
	Direction                string `json:"direction,omitempty"`
	GroupID                  string `json:"group_id,omitempty"`
	MilestoneID              string `json:"milestone_id,omitempty"`
	Labels                   string `json:"labels,omitempty"`
	LabelIDs                 string `json:"label_ids,omitempty"`
	CanBeMerged              string `json:"can_be_merged,omitempty"`
	Category                 string `json:"category,omitempty"`
	CreatedAt                string `json:"created_at,omitempty"`
	UpdatedAt                string `json:"updated_at,omitempty"`
	MergedAt                 string `json:"merged_at,omitempty"`
	TargetBranch             string `json:"target_branch,omitempty"`
	SourceBranch             string `json:"source_branch,omitempty"`
	ProjectID                string `json:"project_id,omitempty"`
	NeedStateCount           string `json:"need_state_count,omitempty"`
	PublicOrInternalOpenOnly string `json:"public_or_internal_open_only,omitempty"`
	Page                     string `json:"page,omitempty"`
	PerPage                  string `json:"per_page,omitempty"`
}

type RepositoryLanguage added in v0.0.22

type RepositoryLanguage struct {
	Language string  `json:"language"`
	Color    string  `json:"color"`
	Percent  float64 `json:"percent"`
}

RepositoryLanguage represents programming language information

type RepositorySummary added in v0.0.22

type RepositorySummary struct {
	Ref                   string               `json:"ref"`
	ReleasesCount         int                  `json:"releases_count"`
	DefaultProtectionRule interface{}          `json:"default_protection_rule"`
	Languages             []RepositoryLanguage `json:"languages"`
	CreateLightweightPR   bool                 `json:"create_lightweight_pr"`
	OnlineEditEnabled     bool                 `json:"online_edit_enabled"`
	HTTPSURL              string               `json:"https_url"`
	SSHURL                string               `json:"ssh_url"`
	SVNURL                interface{}          `json:"svn_url"`
	SVNAndSSHURL          interface{}          `json:"svn_and_ssh_url"`
	CanDownloadZip        bool                 `json:"can_download_zip"`
	CanCreateIssue        bool                 `json:"can_create_issue"`
}

RepositorySummary represents repository overview data

type SharedListResponse

type SharedListResponse struct {
	TotalCount int `json:"total_count,omitempty"`
}

type UpdateCommentResponse added in v0.0.6

type UpdateCommentResponse struct {
	Comment
}

type User added in v0.0.8

type User struct {
	ID                 int    `json:"id"`
	Login              string `json:"login,omitempty"`
	Username           string `json:"username"`
	Name               string `json:"name"`
	Remark             string `json:"remark,omitempty"`
	AvatarURL          string `json:"avatar_url"`
	State              string `json:"state,omitempty"`
	CreatedAt          string `json:"created_at,omitempty"`
	UpdatedAt          string `json:"updated_at,omitempty"`
	UserColor          int    `json:"user_color,omitempty"`
	AuthenWay          string `json:"authen_way,omitempty"`
	Email              string `json:"email,omitempty"`
	NeedChangePassword bool   `json:"need_change_password,omitempty"`
}

type UserStatistic added in v0.0.14

type UserStatistic struct {
	ID               int `json:"id"`
	UserID           int `json:"user_id"`
	EnterpriseID     int `json:"enterprise_id"`
	CloseIssueCount  int `json:"close_issue_count"`
	CommitCount      int `json:"commit_count"`
	CreateIssueCount int `json:"create_issue_count"`
	CreatePRCount    int `json:"create_pr_count"`
	MergePRCount     int `json:"merge_pr_count"`
	AddCodeLine      int `json:"add_code_line"`
}

UserStatistic represents a single user's statistics for a given day.

type UserStatisticListParams added in v0.0.14

type UserStatisticListParams struct {
	UserIDs   string `json:"user_ids"`             // Comma-separated user IDs (required)
	ProjectID string `json:"project_id,omitempty"` // Optional
	StartDate string `json:"start_date"`           // Required, format: yyyy-mm-dd
	EndDate   string `json:"end_date"`             // Required, format: yyyy-mm-dd
}

UserStatisticListParams defines the query parameters for the statistics API.

type WeekReport added in v0.0.11

type WeekReport struct {
	ID        int    `json:"id"`
	Year      int    `json:"year"`
	Month     int    `json:"month"`
	WeekIndex int    `json:"week_index"`
	BeginDay  string `json:"begin_day"`
	EndDay    string `json:"end_day"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
	Content   string `json:"content"`
	User      User   `json:"user"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL