文档

创建代码库

更新时间:

创建代码库API - CreateRepository

该接口用于创建Codeup代码库

请求方式POST/api/v3/projects

请求Action:CreateRepository

请求参数:

参数名

类型

说明

是否必须

默认值

Sync

boolean

是否采用同步调用

false

CreateParentPath

boolean

自动创建父路径

false

请求 body

{
  "avatar_url": "string",
  "description": "string",
  "import_account": "string",
  "import_demo_project": true,
  "import_token": "string",
  "import_token_encrypted": "text,rsa",
  "import_url": "string",
  "name": "string",
  "namespace_id": 0,
  "path": "string",
  "readme_type": "EMPTY",
  "visibility_level": "0"
}

body参数说明

参数名

类型

说明

是否必须

默认值

name

string

代码库名称(仅展示,不能包含/)

namespace_id

long

代码库父路径id。

在企业下创建代码库传企业的namespace_id,可通过获取Codeup企业信息接口取得;

在组下创建代码库传组的ID

path

string

代码库路径(浏览器url以及克隆地址使用)

visibility_level

integer

可见性。

0:私有,10:内部公开

readme_type

string

自动创建readme类型

"empty": 项目模板

"user_guide":新手引导

description

string

代码库描述

import_account

string

导入代码库使用的账号

import_demo_project

boolean

使用demo库内容进行初始化

false

import_token

string

导入时账号的token

import_token_encrypted

string

import_token字段的传输格式,使用明文或rsa加密,可选值:

"text"

"rsa"

import_url

string

导入地址(HTTP协议地址)

重要

import_token RSA加密公钥:MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCNe7wKpTaYIdzrhoNXJ0YEFj+NF/o0MMRbixhXLJLq5c44xumOSBS5W8cgwlHwWkyPJs2B6byWsK3oYm6h/gIOS/LPCAaBpjiGw0GXSV4K7LAgZIP/T95J+prcTV2L86DtiH7CcWNGL9TlC4ATGi8fL7Elk+crkRHz9D9d6UGPPQIDAQAB

返回body:

{
   "ErrorCode": "",
   "ErrorMessage": "",
   "RequestId": "",
   "Success": true,
   "Result": {
   "Archive": true,
   "AvatarUrl": "string",
   "CreatedAt": "2020-06-19T04:02:00.744Z",
   "CreatorId": 0,
   "DefaultBranch": "string",
   "DemoProject": true,
   "Description": "string",
   "HttpUrlToRepo": "string",
   "Id": 0,
   "LastActivityAt": "2020-06-19T04:02:00.744Z",
   "Name": "string",
   "NameWithNamespace": "string",
   "Namespace": {
     "Avatar": "string",
     "CreatedAt": "2020-06-19T04:02:00.744Z",
     "Description": "string",
     "Id": 0,
     "Name": "string",
     "OwnerId": 0,
     "Path": "string",
     "Public": true,
     "UpdatedAt": "2020-06-19T04:02:00.744Z",
     "VisibilityLevel": "0"
   },
   "Path": "string",
   "PathWithNamespace": "string",
   "SshUrlToRepo": "string",
   "VisibilityLevel": "0",
   "WebUrl": "string"
    }
}

返回结果说明:

参数名

类型

说明

Archive

boolean

归档标识

AvatarUrl

string

代码库头像地址

CreatedAt

string

创建时间

CreatorId

long

创建者id

DefaultBranch

string

默认分支

DemoProjectStatus

boolean

demo库标识

Description

string

描述

HttpUrlToRepo

string

HTTP访问地址

Id

long

id

LastActivityAt

string

最后活跃时间

Name

string

名称

NameWithNamespace

string

名称(含父名称)

Namespace

struct

Path

string

路径

PathWithNamespace

string

路径(含父路径)

SshUrlToRepo

string

ssh地址

VisibilityLevel

string

可见性。0:私有,10:内部公开

WebUrl

string

页面访问地址

Namespace结构:

参数名

类型

说明

Avatar

string

头像地址

CreatedAt

string

创建时间

Description

string

描述

Id

long

id

Name

string

名称

OwnerId

long

归属者id

Path

string

路径

Public

boolean

公开性

UpdatedAt

string

更新时间

VisibilityLevel

string

可见性。0:私有,10:内部公开

  • 本页导读 (0)
文档反馈