Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Gitlab

Index

Constructors

constructor

Properties

Private baseUrl

baseUrl: string

clone

clone: (data: CloneOptions) => Promise<void>

子进程执行git clone

新增于v0.0.23

脚本举例

  import { Gitlab } from '@tomato-js/api';
  (async () => {
     const myGitlab = await Gitlab.create({
       baseUrl: "https://*******",
       token: "******"
     });
     await myGitlab.clone({ link: 'ssh://git@gitlab.com/test/test.git'});
   })();
param

信息

param

ssh链接

param

文件路径

Type declaration

cloneGroup

cloneGroup: (data: Sample) => Promise<void>

根据group id克隆一个组所有项目

新增于v0.0.23

脚本举例

  import { Gitlab } from '@tomato-js/api';
  (async () => {
     const myGitlab = await Gitlab.create({
       baseUrl: "https://*******",
       token: "******"
     });
     await myGitlab.cloneGroup({ id: 12345'});
   })();
param

信息

param

group id

Type declaration

    • (data: Sample): Promise<void>
    • Parameters

      Returns Promise<void>

cloneProject

cloneProject: (data: Sample) => Promise<void>

根据project id克隆项目

新增于v0.0.23

脚本举例

  import { Gitlab } from '@tomato-js/api';
  (async () => {
     const myGitlab = await Gitlab.create({
       baseUrl: "https://*******",
       token: "******"
     });
     await myGitlab.cloneProject({ id: 12345, path: './myDemo'});
   })();
param

信息

param

project id

param

clone到哪个文件路径

Type declaration

    • (data: Sample): Promise<void>
    • Parameters

      Returns Promise<void>

core

Private isNode

isNode: boolean

Private token

token: string | undefined

Methods

fetchFileContent

  • fetchFileContent(options: Download): Promise<{} | {}[]>
  • 获取指定工程下某个文件内容

    新增于v0.0.23

    脚本举例

      import { Gitlab } from '@tomato-js/api';
      (async () => {
         const myGitlab = await Gitlab.create({
           baseUrl: "https://*******",
           token: "******"
         });
         const info = await myGitlab.fetchFileContent({ id: 12343,path:'package.json',ref:'master'});
         console.log(info);
       })();

    Parameters

    Returns Promise<{} | {}[]>

    文件内容

fetchGroupProjects

  • fetchGroupProjects(options: Sample): Promise<(ProjectSchemaDefault | ProjectSchemaCamelized)[]>
  • 获取指定组下所有工程信息

    新增于v0.0.23

    脚本举例

      import { Gitlab } from '@tomato-js/api';
      (async () => {
         const myGitlab = await Gitlab.create({
           baseUrl: "https://*******",
           token: "******"
         });
         const info = await myGitlab.fetchGroupProjects({ id: 12343 });
         console.log(info);
       })();

    Parameters

    Returns Promise<(ProjectSchemaDefault | ProjectSchemaCamelized)[]>

    组内所有工程信息

fetchProject

  • fetchProject(options: Sample): Promise<ObjectType<any>>
  • 获取指定工程的详情信息

    新增于v0.0.23

    脚本举例

      import { Gitlab } from '@tomato-js/api';
      (async () => {
         const myGitlab = await Gitlab.create({
           baseUrl: "https://*******",
           token: "******"
         });
         const info = await myGitlab.fetchProject({ id: 12343});
         console.log(info);
       })();

    Parameters

    Returns Promise<ObjectType<any>>

    工程相关信息

fetchProjectRepositories

  • fetchProjectRepositories(options: Sample): Promise<{} | {}[]>
  • 获取指定工程下所有文件及目录信息

    新增于v0.0.23

    脚本举例

      import { Gitlab } from '@tomato-js/api';
      (async () => {
         const myGitlab = await Gitlab.create({
           baseUrl: "https://*******",
           token: "******"
         });
         const info = await myGitlab.fetchProjectRepositories({ id: 12343 });
         console.log(info);
       })();

    Parameters

    Returns Promise<{} | {}[]>

    工程内所有资源信息

fetchSubGroups

  • fetchSubGroups(options: Sample): Promise<(GroupSchemaDefault | GroupSchemaCamelized)[]>
  • 获取子组信息

    新增于v0.0.23

    脚本举例

      import { Gitlab } from '@tomato-js/api';
      (async () => {
         const myGitlab = await Gitlab.create({
           baseUrl: "https://*******",
           token: "******"
         });
         const info = await myGitlab.fetchSubGroups({ id: 12343 });
         console.log(info);
       })();

    Parameters

    Returns Promise<(GroupSchemaDefault | GroupSchemaCamelized)[]>

    组内所有子组的信息

Private initCore

Static create

  • 创建gitlab对象

    新增于v0.0.23

    脚本举例

      import { Gitlab } from '@tomato-js/api';
      (async () => {
         const myGitlab = await Gitlab.create({
           baseUrl: "https://*******",
           token: "******"
         });
       })();

    Parameters

    Returns Promise<Gitlab>

    gitlab对象

Generated using TypeDoc