Documentation ¶
Index ¶
- Constants
- Variables
- func GetToken(appid, appSecret string, expoesIn time.Duration) (token string, exp time.Time, err error)
- type Category
- type Client
- func (c *Client) GetDeptMembers(orgId string, deptId string, omitSubDepartment bool, pageToken string, ...) (resp *Response[[]Member], err error)
- func (c *Client) GetOrgAdmins(orgId string) (resp *Response[[]Member], err error)
- func (c *Client) GetOrgDepartments(orgId string, pageToken string, pageSize int) (resp *Response[[]Dept], err error)
- func (c *Client) GetOrgInfo(orgId string) (resp *Response[Org], err error)
- func (c *Client) GetOrgMembers(orgId string, pageToken string, pageSize int, filter string) (resp *Response[[]Member], err error)
- func (c *Client) GetOrgOwners(orgId string) (resp *Response[[]Member], err error)
- func (c *Client) GetProjectApplications(projectId string, appIds string, scope string) (resp *Response[[]ProjectApplication], err error)
- func (c *Client) GetProjectMembers(projectId string, userIds string, projectRoleId string, limit int, skip int, ...) (resp *Response[[]ProjectMember], err error)
- func (c *Client) GetProjectTasks(projectId, q, pageToken string, pageSize int) (resp *Response[[]Task], err error)
- func (c *Client) GetTaskDetail(taskId, shortIds, parentTaskId string) (resp *Response[[]Task], err error)
- func (c *Client) GetUserJoinedDepartments(orgId string, userId string, pageToken string, pageSize int) (resp *Response[[]Dept], err error)
- func (c *Client) GetWorktimeDetail(userId, startDate, endDate, pageToken string, pageSize int) (resp *Response[[]Worktime], err error)
- func (c *Client) GetWorktimeList(taskId string) (resp *Response[[]Worktime], err error)
- func (c *Client) QueryProject(projectIds string, name string, sourceId string, pageToken string, ...) (resp *Response[[]Project], err error)
- func (c *Client) RefreshToken() error
- func (c *Client) SearchProjectTags(projectId string, tagIds string, q string, pageSize int, pageToken string) (resp *Response[[]ProjectTag], err error)
- func (c *Client) V3CustomFieldCategorySearch(q, categoryIds, pageToken string, pageSize int) (resp *Response[CustomFieldCategory], err error)
- func (c *Client) V3CustomFieldCountByCategory(categoryIds string) (resp *Response[Category], err error)
- func (c *Client) V3ScenarioFieldConfigSearch(q, sfcIds string, pageToken string, pageSize int) (resp *Response[Scenariofieldconfig], err error)
- type CustomFieldCategory
- type Customfield
- type DefaultTokenCacheExecutor
- type Dept
- type Member
- type Options
- func (c *Options) GetAppId() string
- func (c *Options) GetAppSecret() string
- func (c *Options) GetBaseUrl() string
- func (c *Options) GetOrgId() string
- func (c *Options) GetTokenExpies() time.Duration
- func (c *Options) SetBaseUrl(baseUrl string)
- func (c *Options) SetIsCacheToken(isCacheToken bool)
- func (c *Options) SetTokenCacheExecutor(tokenCacheExecutor TokenCacheExecutor)
- func (c *Options) SetTokenExpies(tokenExpies int64)
- type Org
- type Project
- type ProjectApplication
- type ProjectMember
- type ProjectTag
- type Response
- func Delete[T any](c *Client, url string, body any, headers map[string]string) (resp *Response[T], err error)
- func Get[T any](c *Client, url string, headers map[string]string) (resp *Response[T], err error)
- func Post[T any](c *Client, url string, body any, headers map[string]string) (resp *Response[T], err error)
- func PostJson[T any](c *Client, url string, body any, headers map[string]string) (resp *Response[T], err error)
- func Put[T any](c *Client, url string, body any, headers map[string]string) (resp *Response[T], err error)
- func Request[T any](c *Client, method, url string, body any, headers map[string]string) (resp *Response[T], err error)
- type Scenariofield
- type Scenariofieldconfig
- type Task
- type Token
- type TokenCacheExecutor
- type Value
- type Worktime
Constants ¶
const ( GET = "GET" POST = "POST" PUT = "PUT" DELETE = "DELETE" )
Variables ¶
Functions ¶
Types ¶
type Client ¶
type Client struct { *Options // contains filtered or unexported fields }
func (*Client) GetDeptMembers ¶
func (c *Client) GetDeptMembers(orgId string, deptId string, omitSubDepartment bool, pageToken string, pageSize int) (resp *Response[[]Member], err error)
获取部门成员列表 GET https://open.teambition.com/api/departments/members 接口地址: https://open.teambition.com/docs/apis/6321c6ce912d20d3b5a48bfc @param orgId 企业ID @param deptId 部门ID @param omitSubDepartment 是否忽略子孙部门成员 @param pageToken 分页标识 @param pageSize 分页大小
func (*Client) GetOrgAdmins ¶
获取企业的管理员(含拥有者) GET https://open.teambition.com/api/org/admins 接口地址: https://open.teambition.com/docs/apis/6321c6ce912d20d3b5a48974 @param orgId 企业ID 必填
func (*Client) GetOrgDepartments ¶
func (c *Client) GetOrgDepartments(orgId string, pageToken string, pageSize int) (resp *Response[[]Dept], err error)
获取企业部门列表
GET https://open.teambition.com/api/org/departments 接口地址: https://open.teambition.com/docs/apis/6321c6ce912d20d3b5a48bbc @param orgId 企业ID @param pageToken 分页标识 @param pageSize 分页大小
func (*Client) GetOrgInfo ¶
获取企业信息 GET https://open.teambition.com/api/org/info 接口地址: https://open.teambition.com/docs/apis/6321c6ce912d20d3b5a488f4 @param orgId 企业ID
func (*Client) GetOrgMembers ¶
func (c *Client) GetOrgMembers(orgId string, pageToken string, pageSize int, filter string) (resp *Response[[]Member], err error)
获取企业成员列表
GET https://open.teambition.com/api/org/member/list 接口地址:https://open.teambition.com/docs/apis/6321c6ce912d20d3b5a489ee @param orgId 企业ID 必填 @param pageToken 分页标记,第一次请求不填或者空字符串,表示从头开始遍历;分页查询结果还有更多项时返回 nextPageToken,下次遍历可采用该 nextPageToken 入参 pageToken 获取查询结果,示例值:"cfcb90voe9jct71bqkfg" @param pageSize 分页大小,默认值 10 @param filter 该参数用于指定查询范围,initiate:新加入的成员,disabled:已禁用的成员,enabled:未禁用的成员,external:外部成员
func (*Client) GetOrgOwners ¶
获取企业拥有者
GET https://open.teambition.com/api/org/owners 接口地址:https://open.teambition.com/docs/apis/6321c6ce912d20d3b5a489be @param orgId 企业ID 必填
func (*Client) GetProjectApplications ¶
func (c *Client) GetProjectApplications(projectId string, appIds string, scope string) (resp *Response[[]ProjectApplication], err error)
查询项目应用列表 GET https://open.teambition.com/api/v3/project/{projectId}/application/list 接口地址:https://open.teambition.com/docs/apis/6321c6d0912d20d3b5a496c1 @param projectId 项目ID @param appIds 应用ID集合,逗号分隔,如果传递该参数仅查询指定 应用ID @param scope installed 或者 all,默认查询已经安装的应用
func (*Client) GetProjectMembers ¶
func (c *Client) GetProjectMembers(projectId string, userIds string, projectRoleId string, limit int, skip int, pageSize int, pageToken string) (resp *Response[[]ProjectMember], err error)
查询项目成员列表 GET https://open.teambition.com/api/v3/project/{projectId}/member 接口地址:https://open.teambition.com/docs/apis/6321c6d0912d20d3b5a49906 @param projectId 项目ID @param userIds 如果传递,仅查询这些用户ID, 用逗号组合 @param projectRoleId 项目角色ID,仅查询拥有该角色的成员,并且仅支持单个角色查询 @param limit 每一页数量 @param skip 分页 @param pageSize 分页大小 @param pageToken 分页标识
func (*Client) GetProjectTasks ¶
func (c *Client) GetProjectTasks(projectId, q, pageToken string, pageSize int) (resp *Response[[]Task], err error)
查询项目任务 GET /v3/project/{projectId}/task/query @param projectId 项目ID @param q 查询语句 参考[TQL查询文档](doc.fullPath=/tql-doc) @param pageToken 分页标 @param pageSize 每页任务数量,默认为10
func (*Client) GetTaskDetail ¶
func (c *Client) GetTaskDetail(taskId, shortIds, parentTaskId string) (resp *Response[[]Task], err error)
查询任务详情 GET /v3/task/query @param taskId 任务ID集合,使用逗号分隔,和parentTaskId冲突(选其一) @param shortIds 任务短ID集合,使用逗号分隔 @param parentTaskId 父任务ID,和taskIds冲突(选其一)
func (*Client) GetUserJoinedDepartments ¶
func (c *Client) GetUserJoinedDepartments(orgId string, userId string, pageToken string, pageSize int) (resp *Response[[]Dept], err error)
获取用户加入的企业部门列表
GET https://open.teambition.com/api/user/joinedDepartments 接口地址: https://open.teambition.com/docs/apis/6321c6ce912d20d3b5a48c30 @param orgId 企业ID @param userId 用户ID @param pageToken 分页标识 @param pageSize 分页大小
func (*Client) GetWorktimeDetail ¶
func (c *Client) GetWorktimeDetail(userId, startDate, endDate, pageToken string, pageSize int) (resp *Response[[]Worktime], err error)
获取用户所有实际工时详情数据 GET /worktime/query @param userId 用户ID @param startDate 查询起始时间,格式 “2022-08-01” @param endDate 查询结束时间,格式 “2022-08-01”,与起始时间间隔90天内 @param pageToken 分页标 @param pageSize 每页任务数量,默认为10
func (*Client) GetWorktimeList ¶
获取单个任务的实际工时列表 GET /worktime/list/task/{taskId} @param taskId 任务ID
func (*Client) QueryProject ¶
func (c *Client) QueryProject(projectIds string, name string, sourceId string, pageToken string, pageSize int) (resp *Response[[]Project], err error)
查询项目
GET https://open.teambition.com/api/v3/project/query
接口地址: https://open.teambition.com/docs/apis/6321c6d0912d20d3b5a49aa7 @param projectIds 项目ID列表,多个ID用逗号分隔 @param name 项目名称 @param sourceId 原始项目ID @param pageToken 分页标识 @param pageSize 分页大小
func (*Client) SearchProjectTags ¶
func (c *Client) SearchProjectTags(projectId string, tagIds string, q string, pageSize int, pageToken string) (resp *Response[[]ProjectTag], err error)
搜索项目标签
GET /v3/project/{projectId}/tag/search
@param projectId 项目ID @param tagIds 标签ID集合,逗号组合 @param q 模糊查询标签名字 @param pageSize 每页长度 @param pageToken 分页标
func (*Client) V3CustomFieldCategorySearch ¶
func (c *Client) V3CustomFieldCategorySearch(q, categoryIds, pageToken string, pageSize int) (resp *Response[CustomFieldCategory], err error)
搜索企业自定义字段分类 GET https://open.teambition.com/api/v3/customfield-category/search 接口地址: https://open.teambition.com/docs/apis/63ee3ea2912d20d3b543ee57 @param q 搜索关键字 @param categoryIds 自定义字段分类ID集合,逗号组合 @param pageToken 分页标识 @param pageSize 分页大小(默认50)
func (*Client) V3CustomFieldCountByCategory ¶
func (c *Client) V3CustomFieldCountByCategory(categoryIds string) (resp *Response[Category], err error)
根据自定义字段分类统计自定义字段数 GET https://open.teambition.com/api/v3/customfield/count-by-category 接口地址: https://open.teambition.com/docs/apis/63ee3ea2912d20d3b543ee9c @param categoryIds 自定义字段分类ID集合,逗号组合,未分类可使用 uncategory
func (*Client) V3ScenarioFieldConfigSearch ¶
func (c *Client) V3ScenarioFieldConfigSearch(q, sfcIds string, pageToken string, pageSize int) (resp *Response[Scenariofieldconfig], err error)
搜索企业任务类型 GET https://open.teambition.com/api/v3/scenariofieldconfig/search 接口地址: https://open.teambition.com/docs/apis/63ee3ea2912d20d3b543f1ae @param q 模糊查询任务类型名称 @param sfcIds 任务类型ID集合,逗号组合 @param pageToken 分页标识 @param pageSize 分页大小(默认50)
type CustomFieldCategory ¶
type Customfield ¶
type Customfield struct { CFID string `json:"cfId,omitempty"` // 自定义字段ID Type string `json:"type,omitempty"` // 自定义字段类型 Value []Value `json:"value,omitempty"` // 字段值集合 }
自定义字段值
type DefaultTokenCacheExecutor ¶
type DefaultTokenCacheExecutor struct { }
func (*DefaultTokenCacheExecutor) GetToken ¶
func (d *DefaultTokenCacheExecutor) GetToken(tenantId string) (token string, ok bool)
func (*DefaultTokenCacheExecutor) SetToken ¶
func (d *DefaultTokenCacheExecutor) SetToken(tenantId, token string, expireTime int64)
type Dept ¶
type Dept struct { AncestorIDS []string `json:"ancestorIds"` // 所有祖先部门 ID 列表,ancestorIds[0] 为直接父部门,ancestorIds[1] 为父部门的父部门,以此类推 Created string `json:"created"` // 创建时间 CreatorID string `json:"creatorId"` // 创建者 ID DeptID string `json:"deptId"` // 部门 ID LeaderID string `json:"leaderId"` // 部门负责人 ID Name string `json:"name"` // 部门名称 OrgID string `json:"orgId"` // 企业 ID ParentID string `json:"parentId"` // 父部门 ID (没有为空) }
type Member ¶
type Member struct { UserID string `json:"userId"` // 用户 ID MemberID string `json:"memberId"` // 企业成员 ID Name string `json:"name"` // 成员名称 Pinyin string `json:"pinyin"` // 成员名称的拼音 Py string `json:"py"` // 成员名称的拼音简写 Title string `json:"title"` // 职位 Role int64 `json:"role"` // 成员角色,取值为:-1: 外部成员, 0: 成员, 1: 管理员, 2: 拥有者 StaffType string `json:"staffType"` // 员工类型 EmployeeNumber string `json:"employeeNumber"` // 员工工号 Email string `json:"email"` // 电子邮箱 AvatarURL string `json:"avatarUrl"` // 用户头像 Birthday string `json:"birthday"` // 出生日期 City string `json:"city"` // 工作地点(城市) Country string `json:"country"` // 工作地点(国家) EntryTime string `json:"entryTime"` // 入职时间 IsDisabled int64 `json:"isDisabled"` // 成员账号是否被停用:0 启用,1 停用 Phone string `json:"phone"` // 联系电话 Province string `json:"province"` // 工作地点(省份) }
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func NewOptions ¶
func (*Options) GetAppSecret ¶
func (*Options) GetBaseUrl ¶
func (*Options) GetTokenExpies ¶
func (*Options) SetBaseUrl ¶
func (*Options) SetIsCacheToken ¶
func (*Options) SetTokenCacheExecutor ¶
func (c *Options) SetTokenCacheExecutor(tokenCacheExecutor TokenCacheExecutor)
func (*Options) SetTokenExpies ¶
type Org ¶
type Org struct { OrgID string `json:"orgId"` // 企业 ID Name string `json:"name"` // 企业名称 Pinyin string `json:"pinyin"` // 企业名称的拼音 Py string `json:"py"` // 企业名称的拼音缩写 Logo string `json:"logo"` // 企业 Logo 的 URL IsPublic int64 `json:"isPublic"` // 是否公开 Description string `json:"description"` // 企业简介 Created string `json:"created"` // 企业的创建时间 }
Org 企业信息
type Project ¶
type Project struct { Id string `json:"id"` //项目ID Name string `json:"name"` //项目名称 Logo string `json:"logo"` //项目LOGO Description string `json:"description"` //项目描述 OrganizationId string `json:"organizationId"` //企业ID Visibility string `json:"visibility"` //可见性,project | organization IsTemplate bool `json:"isTemplate"` //是模版项目 CreatorId string `json:"creatorId"` //创建人ID IsArchived bool `json:"isArchived"` //是否放入回收站 IsSuspended bool `json:"isSuspended"` //是否归档 UniqueIdPrefix string `json:"uniqueIdPrefix"` //任务ID前缀 Created string `json:"created"` //创建时间 Updated string `json:"updated"` //更新时间 StartDate string `json:"startDate"` //项目开始时间 EndDate string `json:"endDate"` //项目结束时间 Customfields []Customfield `json:"customfields"` //自定义字段 }
type ProjectApplication ¶
type ProjectMember ¶
type ProjectTag ¶
type ProjectTag struct { Color string `json:"color"` // 标签颜色 Created string `json:"created"` // 创建时间 CreatorID string `json:"creatorId"` // 创建人ID ID string `json:"id"` // 标签ID IsArchived bool `json:"isArchived"` // 是否归档 Name string `json:"name"` // 标签名 OrganizationID string `json:"organizationId"` // 企业ID ProjectID string `json:"projectId"` // 项目ID TagcategoryIDS []string `json:"tagcategoryIds"` Updated string `json:"updated"` // 更新时间 }
标签
type Response ¶
type Response[T any] struct { Code int `json:"code"` //返回码,200 表示成功 ErrorMessage string `json:"errorMessage"` // 调用失败时的错误信息 RequestId string `json:"requestId"` // 请求 ID,用于排查问题 NextPageToken string `json:"nextPageToken,omitempty"` TotalSize int64 `json:"totalSize,omitempty"` Result T `json:"result"` }
func Delete ¶
func Delete[T any](c *Client, url string, body any, headers map[string]string) (resp *Response[T], err error)
Delete 请求
func Post ¶
func Post[T any](c *Client, url string, body any, headers map[string]string) (resp *Response[T], err error)
Post 请求
func PostJson ¶
func PostJson[T any](c *Client, url string, body any, headers map[string]string) (resp *Response[T], err error)
PostJson 请求
type Scenariofield ¶
type Scenariofieldconfig ¶
type Scenariofieldconfig struct { BoundToObjectID string `json:"boundToObjectId"` // 所属对象ID BoundToObjectType string `json:"boundToObjectType"` // 所属对象类型 Created string `json:"created"` // 创建时间 CreatorID string `json:"creatorId"` // 创建人ID ID string `json:"id"` // 任务类型ID IsArchived bool `json:"isArchived"` // 是否归档 Name string `json:"name"` // 名称 Scenariofields []Scenariofield `json:"scenariofields"` Source string `json:"source"` // 是否来自安装应用,可能有 application.risk | application.story | application.bug TaskflowID string `json:"taskflowId"` // 工作流ID Type string `json:"type"` // 类型 }
type Task ¶
type Task struct { AccomplishTime string `json:"accomplishTime"` // 任务完成时间(UTC) AncestorIDS []string `json:"ancestorIds"` // 祖先任务ID列表 Content string `json:"content"` // 任务标题 Created string `json:"created"` // 创建时间(UTC) CreatorID string `json:"creatorId"` // 创建人ID Customfields []Customfield `json:"customfields"` // 自定义字段值集合 DueDate string `json:"dueDate"` // 任务截止时间(UTC) ExecutorID string `json:"executorId"` // 执行人ID ID string `json:"id"` // 任务ID InvolveMembers []string `json:"involveMembers"` // 参与者ID集合 IsArchived bool `json:"isArchived"` // 是否任务放入回收站 IsDone bool `json:"isDone"` // 是否任务已完成 Note string `json:"note"` // 任务备注 ParentTaskID string `json:"parentTaskId"` // 父任务ID Priority int64 `json:"priority"` // 任务优先级 ProjectID string `json:"projectId"` // 项目ID Recurrence []string `json:"recurrence"` // 重复规则列表 SfcID string `json:"sfcId"` // 任务类型ID SprintID string `json:"sprintId"` // 迭代ID StageID string `json:"stageId"` // 任务列ID StartDate string `json:"startDate"` // 任务开始时间(UTC) StoryPoint string `json:"storyPoint"` // StoryPoint TagIDS []string `json:"tagIds"` // 标签ID集合 TasklistID string `json:"tasklistId"` // 任务分组ID TfsID string `json:"tfsId"` // 任务状态ID UniqueID string `json:"uniqueId"` // 任务数字ID Updated string `json:"updated"` // 更新时间(UTC) Visible string `json:"visible"` // 任务隐私性,'involves'表达仅参与者可见; 'members'表达项目成员可见 }
任务详情
type TokenCacheExecutor ¶
type Value ¶
type Value struct { ID string `json:"id,omitempty"` // 字段值ID MetaString string `json:"metaString,omitempty"` // 字段值元属性 Title string `json:"title,omitempty"` // 字段值内容 }
字段值
type Worktime ¶
type Worktime struct { CreatedAt string `json:"createdAt"` // 工时创建时间 Date string `json:"date"` // 工时所属日期字符串 ObjectID string `json:"objectId"` // 工时task ID ObjectType string `json:"objectType"` // 工时关联类型,默认task OrgID string `json:"orgId"` // 工时所属企业 ID SubmitterID string `json:"submitterId"` // 工时提交者 ID UpdatedAt string `json:"updatedAt"` // 工时更新时间 UserID string `json:"userId"` // 工时执行者 ID Worktime int64 `json:"worktime"` // 工时时间(单位:毫秒) WorktimeID string `json:"worktimeId"` // 工时 ID }