当前位置: 首页 > news >正文

企业网站特色建设小学生有没有必要学编程

企业网站特色建设,小学生有没有必要学编程,西安建站平台哪个好,成都政务网站建设gitlab官方文档#xff1a;https://docs.gitlab.com/ee/api/index.html 1、生成密钥 登录gitlab#xff0c;编辑个人资料#xff0c;设置访问令牌 2、获取当前用户所有可见的项目 接口地址 GET请求 http://gitlab访问地址/api/v4/projects?private_tokenxxx 返回参数 …gitlab官方文档https://docs.gitlab.com/ee/api/index.html 1、生成密钥 登录gitlab编辑个人资料设置访问令牌 2、获取当前用户所有可见的项目 接口地址 GET请求 http://gitlab访问地址/api/v4/projects?private_tokenxxx 返回参数 [{id: 1,description: This project is automatically generated and helps monitor this GitLab instance. [Learn more](/help/administration/monitoring/gitlab_self_monitoring_project/index).,name: Monitoring,name_with_namespace: GitLab Instance / Monitoring,path: Monitoring,path_with_namespace: gitlab-instance-d71d8d97/Monitoring,created_at: 2021-07-12T08:41:01.299Z,default_branch: main,tag_list: [],topics: [],ssh_url_to_repo: gitgitlab.example.cn:gitlab-instance-d71d8d97/Monitoring.git,http_url_to_repo: http://gitlab.example.cn/gitlab-instance-d71d8d97/Monitoring.git,web_url: http://gitlab.example.cn/gitlab-instance-d71d8d97/Monitoring,readme_url: null,avatar_url: null,forks_count: 0,star_count: 0,last_activity_at: 2021-07-12T08:41:01.299Z,namespace: {id: 2,name: GitLab Instance,path: gitlab-instance-d71d8d97,kind: group,full_path: gitlab-instance-d71d8d97,parent_id: null,avatar_url: null,web_url: http://gitlab.example.cn/groups/gitlab-instance-d71d8d97},_links: {self: http://gitlab.example.cn/api/v4/projects/1,issues: http://gitlab.example.cn/api/v4/projects/1/issues,merge_requests: http://gitlab.example.cn/api/v4/projects/1/merge_requests,repo_branches: http://gitlab.example.cn/api/v4/projects/1/repository/branches,labels: http://gitlab.example.cn/api/v4/projects/1/labels,events: http://gitlab.example.cn/api/v4/projects/1/events,members: http://gitlab.example.cn/api/v4/projects/1/members},packages_enabled: true,.........} ]这里我们只需要关注项目id即可 3、获取当前项目所有分支 接口地址 GET请求 http://gitlab访问地址/api/v4/projects/项目id/repository/branches?private_tokenxxx 返回参数 [{name: main,commit: {id: 2d3e01fbedf088fccb5000303428df35c09ea07d,short_id: 2d3e01fb,created_at: 2023-01-06T02:52:54.00000:00,parent_ids: null,title: xxxxxx,message: xxxxxx,author_name: xxxx,author_email: xxxxexample.cn,authored_date: 2023-01-06T02:52:54.00000:00,committer_name: xxxx,committer_email: xxxxexample.cn,committed_date: 2023-01-06T02:52:54.00000:00,trailers: null,web_url: http://gitlab.example.cn/example/-/commit/2d3e01fbedf088fccb5000303428df35c09ea07d},merged: false,protected: true,developers_can_push: false,developers_can_merge: false,can_push: true,default: true,web_url: http://gitlab.example.cn/example/-/tree/main} ]4、遍历分支根据分支name获取commits 接口地址 GET请求 http://gitlab访问地址/api/v4/projects/项目id/repository/commits?ref_namemainprivate_tokenxxx 返回参数 [{id: 8fc81980222370d51c11cd9bc609f10f3b7d9828,short_id: 8fc81980,created_at: 2022-07-21T08:46:35.00000:00,parent_ids: [],title: Initial commit,message: Initial commit,author_name: xxxx,author_email: xxxxexample.cn,authored_date: 2022-07-21T08:46:35.00000:00,committer_name: xxxx,committer_email: xxxxexample.cn,committed_date: 2022-07-21T08:46:35.00000:00,trailers: {},web_url: http://gitlab.example.cn/example/-/commit/8fc81980222370d51c11cd9bc609f10f3b7d9828} ]5、根据commit的id获取代码量 接口地址 GET请求 http://gitlab访问地址/api/v4/projects/项目id/repository/commits/commit的id?private_tokenxxx 返回参数 {id: 8fc81980222370d51c11cd9bc609f10f3b7d9828,short_id: 8fc81980,created_at: 2022-07-21T08:46:35.00000:00,parent_ids: [],title: Initial commit,message: Initial commit,author_name: xxxx,author_email: xxxxexample.cn,authored_date: 2022-07-21T08:46:35.00000:00,committer_name: xxxx,committer_email: xxxxexample.cn,committed_date: 2022-07-21T08:46:35.00000:00,trailers: {},web_url: http://gitlab.example.cn/example/-/commit/8fc81980222370d51c11cd9bc609f10f3b7d9828,stats: {additions: 92,deletions: 0,total: 92},status: null,project_id: 1,last_pipeline: null }stats节点下参数就是我们本次提交的代码量additions为新增行数deletions为删除行数total为总数。 修改操作实际上是删除之后再新增。 注通过API获取gitlab项目、分支、commits时默认只能查到20条数据可以增加入参指定每页数量数量最大为50000 Java代码实现 private void gitLab() throws Exception {JSONObject params new JSONObject();params.put(private_token, xxx);params.put(per_page, 50000);//项目列表String result WebUtils.doGet(http://gitlab.example.cn/api/v4/projects, params);JSONArray projects JSONArray.parseArray(result);for (Object project : projects) {JSONObject projectValue JSONObject.parseObject(project.toString());String projectId projectValue.getString(id);//commits列表String url String.format(http://gitlab.example.cn/api/v4/projects/%s/repository/commits, projectId);result WebUtils.doGet(url, params);int additions 0;int deletions 0;int total 0;JSONArray commits JSONArray.parseArray(result);for (Object commit : commits) {JSONObject commitValue JSONObject.parseObject(commit.toString());String commitId commitValue.getString(id);url String.format(http://gitlab.example.cn/api/v4/projects/%s/repository/commits/%s, projectId, commitId);//提交记录result WebUtils.doGet(url, params);JSONObject commitStats JSONObject.parseObject(result);JSONObject stats commitStats.getJSONObject(stats);additions stats.getIntValue(additions);deletions stats.getIntValue(deletions);total stats.getIntValue(total);}String name projectValue.getString(name);LoggerUtils.info(String.format(项目%s 新增%d 删除%d 合计%d, name, additions, deletions, total));} }以上是按照项目统计扩展类似按作者统计是相同道理
http://www.ho-use.cn/article/10814462.html

相关文章:

  • 湛江网站开发公司开源门户网站
  • 能够做网站的资质学校为什么要建设网站
  • 中安消防安全网站建设系统官网网站模板
  • 公司域名注册要收费吗搜狗推广优化
  • 途牛的旅游网站是谁做的网站建设申请理由
  • 建设通属于什么网站网站如何制作建设
  • 学网站建设怎么样爱网之家下载
  • 如何检测做的网站的兼容性网站用什么软件做
  • 佛山网站建设冯哥网站的建设维护及管理制度
  • mt4外汇金融网站建设网销怎么找客户
  • vue适合什么网站开发工程与建设官网
  • 用路由器做简单的网站德州乐陵德州seo公司
  • 郴州市网站建设公司搭建wordpress服务器
  • 附近做网站为什么做的网站别的浏览器打不开怎么回事
  • 北京企业建站哪家好wordpress安装提示500
  • 零起飞网站建设工作室查商标有没有被注册
  • 微网站好制作吗wordpress页脚美化
  • 网页设计接单网站万网虚拟主机wordpress
  • 网站标题的设置方法电脑怎样重新安装wordpress
  • wordpress朋友圈百度排名优化专家
  • 合肥制作网站单位有哪些代理网址ag80hncom
  • 同一个阿里云可以做两个网站吗贵州遵义知名网站建设
  • 活泼风格的网站外贸网站建设soho
  • 百度站长平台开绿色收录通道加快网站收录怎么找厂家生产产品
  • 网站设置伪静态乐山市住房和城乡规划建设局网站
  • 网站开发环境有哪些门户网站 建设 如何写
  • 住房城乡建设部官网站怎么制作一个简单的网站
  • 漳州博大网站建设装潢设计师要学什么
  • 企业网站源码 非织梦企业网站有什么功能
  • 建立网站的链接结构有哪几种形式怎么去掉2345网址导航