3 Star 0 Fork 0

GiteeStudio/go-gitee-sdk

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
issue_types.go 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
package gitee
import (
"context"
"fmt"
"net/http"
)
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"`
}
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"`
}
ListIssueTypesResponse struct {
IssueTypes []IssueType `json:"data"`
SharedListResponse
}
)
func (c *Client) ListIssueTypes(ctx context.Context, enterpriseId int, params *IssueTypeListParams) (*ListIssueTypesResponse, error) {
req, err := c.NewRequest(ctx, http.MethodGet, fmt.Sprintf("%s/enterprises/%d/issue_types", c.APIBase, enterpriseId), nil)
if err != nil {
return nil, err
}
if params != nil {
q := req.URL.Query()
q.Set("sort", params.Sort)
q.Set("direction", params.Direction)
q.Set("scope", params.Scope)
q.Set("category", params.Category)
q.Set("page", params.Page)
q.Set("per_page", params.PerPage)
req.URL.RawQuery = q.Encode()
}
response := &ListIssueTypesResponse{}
err = c.SendWithAuth(req, response)
return response, err
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/oscstudio/go-gitee-sdk.git
git@gitee.com:oscstudio/go-gitee-sdk.git
oscstudio
go-gitee-sdk
go-gitee-sdk
v0.0.22

搜索帮助