Code Monkey home page Code Monkey logo

gitlabapi's Introduction

gitlab接口调用sdk

gitlab官方接口文档:

https://docs.gitlab.com/ee/api/api_resources.html

使用composer安装

composer require "fenglangyj/gitlabapi"

创建 apitoken

登录gitlab后台,访问: “http://【您的gitlab域名】/profile/personal_access_tokens” 创建 apitoken

使用方法

  $access_token="【在您gitlab后台获取到的apitoken】";
  $gitlab_url="【您的gitlab访问域名】";
  $GitLabApi = new \fenglangyj\GitLabApi\GitLabApi($access_token,$gitlab_url);
  
  //获取配置信息
  $conf = $GitLabApi->getConfig();
  
  //添加账户
  $res = $GitLabApi->users_add('fenglangyj','[email protected]','asdfasdf');
  print_r($res);

  //查询所有用户
  $user_all = $GitLabApi->users_all();
  print_r($user_all);

  //查询指定用户
  $user_info = $GitLabApi->users_get('username');
  print_r($user_info);
  
  //修改用户数据
  $user_info = $GitLabApi->users_put(2,[
      'password'=>'asdfasdf'
  ]);
  print_r($user_info);

  //删除用户数据
  $res = $GitLabApi->users_del(2);
  print_r($res);

  //建立项目,分组id3是米末分组
  $res = $GitLabApi->projects_add('projects_name2','projects_path2',3);
  print_r($res);
  

gitlabapi's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.