九游平台/ 代码托管 codearts repo/ api参考/ / / 获取分支目录下的文件
更新时间:2024-11-08 gmt 08:00

获取分支目录下的文件-九游平台

功能介绍

通过调用此接口,您可以获取某分支目录下的文件。

调试

您可以在中调试该接口,支持自动认证鉴权。api explorer可以自动生成sdk代码示例,并提供sdk代码示例调试功能。

uri

get /v1/repositories/{repository_uuid}/branch/{branch_name}/sub-files

表1 路径参数

参数

是否必选

参数类型

描述

repository_uuid

string

参数解释:

仓库uuid(由createrepository接口返回)。

约束限制:

必传。

取值范围:

由数字和字母组成,且长度为32个字符。

默认取值:

不涉及

branch_name

string

参数解释:

用户想要查询的分支名称。

约束限制:

必传。

取值范围:

最小长度:1

最大长度:200

默认取值:

不涉及。

表2 query参数

参数

是否必选

参数类型

描述

path

string

参数解释:

用户想要查询的分支路径。示例:“src/main/java”

约束限制:

无。

取值范围:

不涉及。

默认取值:

无。

offset

integer

参数解释:

分页索引。

约束限制:

无。

取值范围:

最小值:1

最大值:2147483647

默认取值:

1

limit

integer

参数解释:

每页条目数。

约束限制:

无。

取值范围:

最小值:1

最大值:100

默认取值:

100

请求参数

表3 请求header参数

参数

是否必选

参数类型

描述

x-auth-token

string

参数解释:

用户token。通过调用iam服务获取用户token接口获取(响应消息头中x-subject-token的值)。

约束限制:

必传。

取值范围:

字符串长度不少于1,不超过10万。

默认取值:

不涉及。

响应参数

状态码: 200

表4 响应body参数

参数

参数类型

描述

error

error object

参数解释:

响应错误码。

result

logstreelist object

参数解释:

响应结果。

status

string

参数解释:

调用此接口的响应状态。

取值范围:

  • success,表示接口调用成功。
  • failed,表示接口调用失败。
表5 error

参数

参数类型

描述

code

string

参数解释:

错误码。

取值范围:

符合错误码格式字符串,长度[0,100]。

message

string

参数解释:

错误信息。

取值范围:

不涉及。

表6 logstreelist

参数

参数类型

描述

trees

array of logstree objects

参数解释:

文件日志树。

total

integer

参数解释:

记录总数。

表7 logstree

参数

参数类型

描述

blob_id

string

参数解释:

存储块id。

commit

commit object

参数解释:

提交信息。

file_name

string

参数解释:

文件名称。

file_path

string

参数解释:

文件路径。

md5

string

参数解释:

md5。

type

string

参数解释:

存储类型。

表8 commit

参数

参数类型

描述

author_email

string

参数解释:

作者邮箱。

author_name

string

参数解释:

作者。

authored_date

string

参数解释:

作者提交时间。

committed_date

string

参数解释:

提交时间。

committer_email

string

参数解释:

提交作者邮箱。

committer_name

string

参数解释:

提交作者。

format

object

参数解释:

文件变更的详情信息,其格式由请求查询参数 stat_format 决定。

id

string

参数解释:

提交对应的sha id。

message

string

参数解释:

提交的信息。

parent_ids

array of strings

参数解释:

父提交id。

请求示例

get https://{endpoint}/v1/repositories/{repository_uuid}/branch/{branch_name}/sub-files

响应示例

状态码: 200

ok

{
  "result" : {
    "trees" : [ {
      "blob_id" : "ef69ef5dc0c53022fe52a4d02de15f73d96e055c",
      "file_name" : "csharpdemo.png",
      "file_path" : "images/csharpdemo.png",
      "md5" : "8830d25fe6b4e2cd14d75ddb5cae73a7",
      "type" : "blob",
      "commit" : {
        "id" : "1cfd6d81fff948828c7f59bda74c0ef80e53def0",
        "message" : "init",
        "parent_ids" : [ ],
        "author_name" : "repo",
        "author_email" : "repo@test.com",
        "committed_date" : "2019-11-13 11:29:26",
        "committer_name" : "repo",
        "committer_email" : "repo@test.com"
      }
    } ],
    "total" : 5
  },
  "status" : "success"
}

状态码

状态码

描述

200

ok

错误码

请参见错误码

相关文档

网站地图