安装 SDK
调用 Codeup API
以 CreateRepository 为例:
创建个人访问令牌见 个人访问令牌
# gem install aliyunsdkcore
require 'aliyunsdkcore'
client = ROAClient.new(
access_key_id: '<accessKeyId>',
access_key_secret: '<accessSecret>',
endpoint: 'https://codeup.cn-hangzhou.aliyuncs.com',
api_version: '2020-04-14'
)
response = client.request(
method: 'POST',
uri: '/api/v3/projects',
queries: {
"RegionId": "cn-hangzhou",
"OrganizationId": "<OrganizationId>"
},
headers: {
"Content-Type": "application/json"
},
body: `{
"name": "<RepoName>",
"path": "<RepoPath>",
"visibility_level": 10,
"namespace_id": 123
}`,
options: {}
)
print response
文档内容是否对您有帮助?