Skip to content

lib part of Gitee import (Gitee import 1/4)

张泽华请求将gitee-import合并到main-jh

What does this MR do and why?

Related to issue https://jihulab.com/gitlab-cn/gitlab/-/issues/1521.

This MR added lib part of Gitee import feature.

├── client.rb                    # 导入的 client,里边声明了获取各个资源的 URL,使用 personal_access_token 做权限校验
├── collection.rb                # 使用 Enumerator 分页获取资源
├── connection.rb                # 发送 api 请求的类
├── error
│   └── unauthorized.rb          
├── page.rb                      # Page 类,用于解析每页的数据,在 Paginator 类中使用
├── paginator.rb                 # 分页类,使用 items 分页获取数据
└── representation               # 对接口返回的数据进行序列化的目录
    ├── base.rb
    ├── label.rb
    ├── milestone.rb
    ├── issue_comment.rb
    ├── issue.rb
    ├── pull_request.rb
    ├── pull_request_comment.rb
    ├── repo.rb
    └── user.rb

How to use

client = Gitee::Client.new(gitee_access_token: '')

# get repos
client.repos.to_a

# get repo
client.repo(repo_name)

# get issues
client.issues(repo_name)

# get issue comments
client.issue_comments(repo_name, issue_number)

# get PRs
client.pull_requests(repo_name)

# get PR comments
client.pull_request_comments(repo_name, pull_request_number)

# get labels
client.labels(repo_name)

# get milestones
client.milestones(repo_name)

# get user info
client.user

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

张泽华 编辑于

合并请求报告

加载中