设置代码仓库的审查计费规则
curl --request PUT \
--url https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bill_to": {
"id": "<string>"
},
"repository": "<string>"
}
'import requests
url = "https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules"
payload = {
"bill_to": { "id": "<string>" },
"repository": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({bill_to: {id: '<string>'}, repository: '<string>'})
};
fetch('https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'bill_to' => [
'id' => '<string>'
],
'repository' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules"
payload := strings.NewReader("{\n \"bill_to\": {\n \"id\": \"<string>\"\n },\n \"repository\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bill_to\": {\n \"id\": \"<string>\"\n },\n \"repository\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bill_to\": {\n \"id\": \"<string>\"\n },\n \"repository\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"bill_to": {
"id": "<string>",
"type": "organization"
},
"created_at": 123,
"id": "<string>",
"repository": "<string>",
"updated_at": 123
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}审查计费规则(企业)[测试版]
设置代码仓库的审查计费规则
将某个代码仓库后续的审查用量计入指定组织或预算。
PUT
/
v3beta1
/
enterprise
/
organizations
/
{org_id}
/
review-settings
/
repo-billing-rules
设置代码仓库的审查计费规则
curl --request PUT \
--url https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bill_to": {
"id": "<string>"
},
"repository": "<string>"
}
'import requests
url = "https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules"
payload = {
"bill_to": { "id": "<string>" },
"repository": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({bill_to: {id: '<string>'}, repository: '<string>'})
};
fetch('https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'bill_to' => [
'id' => '<string>'
],
'repository' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules"
payload := strings.NewReader("{\n \"bill_to\": {\n \"id\": \"<string>\"\n },\n \"repository\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bill_to\": {\n \"id\": \"<string>\"\n },\n \"repository\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/review-settings/repo-billing-rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bill_to\": {\n \"id\": \"<string>\"\n },\n \"repository\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"bill_to": {
"id": "<string>",
"type": "organization"
},
"created_at": 123,
"id": "<string>",
"repository": "<string>",
"updated_at": 123
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"error_code": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}为指定的单个代码仓库创建或替换计费规则,使该代码仓库今后产生的 Devin Review 用量计入某个组织或某个预算。如需查看现有规则,请使用列出代码仓库计费规则。
权限
需要在该组织中拥有ManageReview 权限的服务用户或个人访问令牌。调用方只能为已交给该组织的仓库管理规则,且只能将费用计入该组织或其管理的预算。
行为
repository接受以下格式:github.com 使用owner/repo,其他服务提供商使用host/path,也可以使用完整的代码仓库 URL。必须指定唯一一个确切的代码仓库。包含通配符的请求会被拒绝,并返回422。- 每个代码仓库最多只能有一条规则。如果提交的代码仓库已有规则,则仅替换付费方,规则
id保持不变。 bill_to.type为organization或budget,bill_to.id为对应的组织 ID 或预算 ID。如果调用方无权使用该目标,则返回400或403。- 该规则仅对之后的审查生效。已计费的用量不会转移。
- 如果该代码仓库已通过同一主机上的另一个 Git 连接完成映射,或规则在请求过程中发生了变更,则返回
409。对于后一种情况,请重试该请求。
请求体
application/json

