
# 获取MR详情 - ShowMergeRequestDetail
#### 功能介绍
获取MR详情
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/CodeArtsRepo/doc?api=ShowMergeRequestDetail&version=v4)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号根用户具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备如下身份策略权限，更多的权限说明请参见[权限和授权项](https://support.huaweicloud.com/api-codeartsrepo/codeartsrepo_05_0036.html)。
| 授权项                                     | 访问级别 | 资源类型（\*为必须） | 条件键 | 别名 | 依赖的授权项 |
|:---|:---|:---|:---|:---|:---|
| codeartsrepo:repository:getMergeRequest | Read | -           | -   | -  | -      |
   
#### URI
GET /v4/repositories/{repository_id}/merge-requests/{merge_request_iid}
表1路径参数 
| 参数                | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|
| repository_id     | 是    | Integer | **参数解释：** 仓库的ID，通过[查询用户所有仓库](https://support.huaweicloud.com/api-codeartsrepo/ListUserAllRepositories.html)接口查询项目列表获取。 **约束限制：** 不涉及。 **默认取值：** 不涉及。 **取值范围：** 1\~2147483647 |
| merge_request_iid | 是    | Integer | **参数解释：** 合并请求 iid。 **取值范围：** 1\~2147483647                                                                                                                                                                                                                                                                                                          |
   
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | **参数解释：** 用户Token。 通过调用IAM服务[获取用户Token](https://support.huaweicloud.com/api-iam/iam_30_0001.html)接口获取（响应消息头中X-Subject-Token的值）。 **约束限制：** 不涉及。 **取值范围：** 字符串长度不少于1，不超过10万。 **默认取值：** 不涉及。 |
   
#### 响应参数
**状态码：200**
表3响应Body参数 
| 参数                               | 参数类型                                                                                                                  | 描述                                                                                                                           |
|:---|:---|:---|
| id                               | Integer                                                                                                               | 合并请求id                                                                                                                       |
| iid                              | Integer                                                                                                               | 合并请求iid                                                                                                                      |
| repository_id                    | Integer                                                                                                               | 目标仓库id                                                                                                                       |
| title                            | String                                                                                                                | 合并请求标题                                                                                                                       |
| description                      | String                                                                                                                | 合并请求描述                                                                                                                       |
| state                            | String                                                                                                                | 合并请求状态                                                                                                                       |
| created_at                       | String                                                                                                                | 创建时间                                                                                                                         |
| updated_at                       | String                                                                                                                | 更新时间                                                                                                                         |
| source_branch                    | String                                                                                                                | 源分支                                                                                                                          |
| target_branch                    | String                                                                                                                | 目标分支                                                                                                                         |
| is_source_branch_protected       | Boolean                                                                                                               | 源分支是否为保护分支                                                                                                                   |
| is_source_branch_default         | Boolean                                                                                                               | 源分支是否为默认分支                                                                                                                   |
| devcloud_source_branch           | String                                                                                                                | 源分支                                                                                                                          |
| upvotes                          | Integer                                                                                                               | MR点赞数                                                                                                                        |
| downvotes                        | Integer                                                                                                               | MR倒赞数                                                                                                                        |
| author                           | [UserBasicExternalDto] object                                 | 作者                                                                                                                           |
| assignee                         | [UserBasicExternalDto] object                                 | 合并人                                                                                                                          |
| source_repository_id             | Integer                                                                                                               | 源仓库id                                                                                                                        |
| target_repository_id             | Integer                                                                                                               | 目标仓库id                                                                                                                       |
| source_project_id                | String                                                                                                                | 源项目id                                                                                                                        |
| target_project_id                | String                                                                                                                | 目标项目id                                                                                                                       |
| labels                           | Array of objects                                                                                                      | 标签                                                                                                                           |
| work_in_progress                 | Boolean                                                                                                               | WIP状态                                                                                                                        |
| milestone                        | [MilestoneBasicDto] object                                       | 里程碑                                                                                                                          |
| merge_when_build_succeeds        | Boolean                                                                                                               | 流水线成功后自动合入                                                                                                                   |
| merge_status                     | String                                                                                                                | 可合并状态                                                                                                                        |
| sha                              | String                                                                                                                | 当前合并请求最新commit                                                                                                               |
| merge_commit_sha                 | String                                                                                                                | 合入commit节点                                                                                                                   |
| subscribed                       | Boolean                                                                                                               | 订阅                                                                                                                           |
| merged_by                        | [UserBasicExternalDto] object                                 | 合并人                                                                                                                          |
| merged_at                        | String                                                                                                                | 合并时间                                                                                                                         |
| closed_by                        | [UserBasicExternalDto] object                                 | 关闭人                                                                                                                          |
| closed_at                        | String                                                                                                                | 关闭时间                                                                                                                         |
| user_notes_count                 | Integer                                                                                                               | 检视意见数量                                                                                                                       |
| should_remove_source_branch      | Boolean                                                                                                               | 是否需要删除源分支                                                                                                                    |
| force_remove_source_branch       | Boolean                                                                                                               | 合入后删除源分支                                                                                                                     |
| web_url                          | String                                                                                                                | 主页url                                                                                                                        |
| merge_request_diff               | [MergeRequestDiffExternalDto] object                   | 合并请求diff                                                                                                                     |
| merge_request_reviewers_count    | Integer                                                                                                               | 评审人数量                                                                                                                        |
| merge_request_review_count       | Integer                                                                                                               | 打分                                                                                                                           |
| merge_request_reviewer_list      | Array of [MergeRequestReviewerExternalDto] objects | 评审人列表                                                                                                                        |
| merge_request_assignee_list      | Array of [UserBasicExternalDto] objects                       | 合并人列表                                                                                                                        |
| notes                            | Integer                                                                                                               | 检视意见                                                                                                                         |
| codecheck_state                  | Integer                                                                                                               | 代码检查状态                                                                                                                       |
| codecheck_defect_count           | Integer                                                                                                               | 代码检查问题数                                                                                                                      |
| merge_request_related_work_items | Array of [MergeRequestRelatedWorkItemDto] objects   | 合并请求关联单数量                                                                                                                    |
| diverged_commits_count           | Integer                                                                                                               | 源分支落后commit数                                                                                                                 |
| moderation_result                | Boolean                                                                                                               | 送审结果                                                                                                                         |
| moderation_time                  | Long                                                                                                                  | 送审时间时间戳 **取值范围：** 1\~9223372036854775807 |
| moderation_status                | Integer                                                                                                               | 送审状态码 **取值范围：** 1\~2147483647            |
| is_use_temp_branch               | Boolean                                                                                                               | 是否使用临时分支                                                                                                                     |
| only_assignee_can_merge          | Boolean                                                                                                               | 只有合并人允许合入                                                                                                                    |
| review_mode                      | String                                                                                                                | 检视模式                                                                                                                         |
| squash                           | Boolean                                                                                                               | squash合入                                                                                                                     |
| approval_merge_request_approvers | Array of [ApprovalUserDto] objects                                 | 审核模式审核人                                                                                                                      |
| approval_merge_request_reviewers | Array of [ApprovalUserDto] objects                                 | 审核模式检视人                                                                                                                      |
| topic                            | String                                                                                                                | MR主题                                                                                                                         |
| source_repository                | [ProjectSimpleDto] object                                         | 源仓库                                                                                                                          |
| target_repository                | [ProjectSimpleDto] object                                         | 目标仓库                                                                                                                         |
| is_source_branch_exist           | Boolean                                                                                                               | 源分支存在                                                                                                                        |
| merge_request_type               | String                                                                                                                | 合并请求类型                                                                                                                       |
| squash_commit_message            | String                                                                                                                | squash提交信息                                                                                                                   |
| auto_merge                       | Boolean                                                                                                               | 自动合入                                                                                                                         |
| merge_error                      | String                                                                                                                | MR原始错误信息                                                                                                                     |
| json_merge_error                 | [MergeErrorDto] object                                               | MR错误信息                                                                                                                       |
| rebase_in_progress               | Boolean                                                                                                               | 是否正在rebase                                                                                                                   |
   
 表4MilestoneBasicDto 
| 参数              | 参数类型    | 描述                                                                                                                 |
|:---|:---|:---|
| id              | Integer | 里程碑id **取值范围：** 1\~2147483647  |
| iid             | Integer | 里程碑iid **取值范围：** 1\~2147483647 |
| repository_id   | Integer | 仓库id **取值范围：** 1\~2147483647   |
| title           | String  | 里程碑标题                                                                                                              |
| description     | String  | 里程碑描述                                                                                                              |
| state           | String  | 状态                                                                                                                 |
| created_at      | String  | 创建时间                                                                                                               |
| updated_at      | String  | 更新时间                                                                                                               |
| due_date        | String  | 到期时间                                                                                                               |
| start_date      | String  | 开始时间                                                                                                               |
| repository_path | String  | 仓库路径                                                                                                               |
| web_url         | String  | 主页url                                                                                                              |
   
 表5UserBasicExternalDto 
| 参数             | 参数类型    | 描述                                                                                                                                                                                                                        |
|:---|:---|:---|
| id             | Integer | 用户id **取值范围：** 1\~2147483647                                                                                                          |
| name           | String  | 名称                                                                                                                                                                                                                        |
| username       | String  | 用户名称                                                                                                                                                                                                                      |
| state          | String  | 状态                                                                                                                                                                                                                        |
| avatar_url     | String  | 头像url                                                                                                                                                                                                                     |
| web_url        | String  | 主页url                                                                                                                                                                                                                     |
| nick_name      | String  | 用户昵称                                                                                                                                                                                                                      |
| tenant_name    | String  | 租户名称                                                                                                                                                                                                                      |
| has_permission | Boolean | **参数解释：** 是否有相关权限。 **取值范围：** true：有权限。 false：没权限。 |
   
 表6MergeRequestDiffExternalDto 
| 参数                  | 参数类型    | 描述                                                                                                                      |
|:---|:---|:---|
| id                  | Integer | 合并请求diff id **取值范围：** 1\~2147483647 |
| state               | String  | 状态                                                                                                                      |
| merge_request_id    | Integer | 合并请求id **取值范围：** 1\~2147483647      |
| created_at          | String  | 创建时间                                                                                                                    |
| updated_at          | String  | 更新时间                                                                                                                    |
| base_commit_sha     | String  | base commit节点                                                                                                           |
| real_size           | String  | diff文件数量                                                                                                                |
| head_commit_sha     | String  | head commit节点                                                                                                           |
| start_commit_sha    | String  | start commit节点                                                                                                          |
| commits_count       | Integer | commit数量 **取值范围：** 1\~2147483647    |
| external_diff       | String  | 外部diff文件                                                                                                                |
| external_diff_store | Integer | 外部差异存储 **取值范围：** 1\~2147483647      |
| stored_externally   | Boolean | 是否外部存储                                                                                                                  |
| added_lines         | Integer | 新增行数 **取值范围：** 0\~2147483647        |
| removed_lines       | Integer | 删除行数 **取值范围：** 0\~2147483647        |
   
 表7MergeRequestReviewerExternalDto 
| 参数          | 参数类型    | 描述                                                                                                                |
|:---|:---|:---|
| id          | Integer | 评审人id **取值范围：** 1\~2147483647 |
| username    | String  | 评审人名称                                                                                                             |
| name        | String  | 评审人名称                                                                                                             |
| nick_name   | String  | 评审人昵称                                                                                                             |
| state       | Boolean | 评审人状态                                                                                                             |
| score       | Integer | 打分 **取值范围：** -2\~2            |
| tenant_name | String  | 租户名称                                                                                                              |
   
 表8MergeRequestRelatedWorkItemDto 
| 参数                  | 参数类型    | 描述                                                                                                                 |
|:---|:---|:---|
| id                  | Integer | 关联id **取值范围：** 1\~2147483647   |
| user_id             | String  | 用户id                                                                                                               |
| repo_id             | Integer | 仓库id **取值范围：** 1\~2147483647   |
| merge_request_id    | Integer | 合并请求id **取值范围：** 1\~2147483647 |
| target_branch       | String  | 目标分支                                                                                                               |
| source_branch       | String  | 源分支                                                                                                                |
| merge_request_title | String  | 合并请求标题                                                                                                             |
| merge_request_url   | String  | 合并请求url                                                                                                            |
| merge_request_state | String  | 合并请求状态                                                                                                             |
| related_id          | String  | 关联单id                                                                                                              |
| related_title       | String  | 关联单标题                                                                                                              |
| related_url         | String  | 关联单url                                                                                                             |
| result              | Integer | 关联结果                                                                                                               |
| message             | String  | 关联结果信息                                                                                                             |
| create_at           | String  | 创建时间                                                                                                               |
| update_at           | String  | 更新时间                                                                                                               |
| subject             | String  | 话题                                                                                                                 |
| tracker             | Object  | 跟单人                                                                                                                |
| status              | Object  | 状态                                                                                                                 |
   
 表9ApprovalUserDto 
| 参数               | 参数类型    | 描述                                                                                                               |
|:---|:---|:---|
| id               | Integer | 用户id **取值范围：** 1\~2147483647 |
| username         | String  | 用户名称                                                                                                             |
| name             | String  | 用户名称                                                                                                             |
| nick_name        | String  | 用户昵称                                                                                                             |
| name_cn          | String  | 中文名称                                                                                                             |
| email            | String  | 电子邮箱                                                                                                             |
| state            | String  | 状态                                                                                                               |
| updated_at       | String  | 更新时间                                                                                                             |
| avatar_url       | String  | 头像url                                                                                                            |
| tenant_name      | String  | 租户名称                                                                                                             |
| approver_comment | String  | 审核意见                                                                                                             |
   
 表10ProjectSimpleDto 
| 参数                  | 参数类型    | 描述               |
|:---|:---|:---|
| id                  | Integer | 仓库id             |
| description         | String  | 仓库描述信息           |
| name                | String  | 仓库名称             |
| name_with_namespace | String  | 组织名/组织名.../仓库名   |
| path                | String  | 仓库路径             |
| path_with_namespace | String  | 仓库完整路径           |
| created_at          | String  | 创建时间             |
| updated_at          | String  | 更新时间             |
| archived            | Boolean | 是否归档             |
| is_kia              | Boolean | 是否机密             |
| ssh_url_to_repo     | String  | 仓库ssh地址          |
| http_url_to_repo    | String  | 仓库http地址         |
| web_url             | String  | 仓库页面链接           |
| readme_url          | String  | 仓库readme文件链接     |
| project_id          | String  | 项目id             |
| project_name        | String  | 项目名称             |
| develop_mode        | String  | 仓库开发模式：normal、CR |
| moderation_result   | Boolean | 审核状态             |
   
 表11MergeErrorDto 
| 参数               | 参数类型   | 描述    |
|:---|:---|:---|
| merge_user_name  | String | 合并人名字 |
| merge_start_time | String | 合入时间  |
| error_title      | String | 错误标题  |
| http_code_status | String | 状态码   |
| error_code       | String | 错误码   |
| error_message    | String | 错误信息  |
   
**状态码：401**
表12响应Body参数 
| 参数         | 参数类型   | 描述                                                        |
|:---|:---|:---|
| error_code | String | **参数解释：** 错误码。  |
| error_msg  | String | **参数解释：** 错误信息。 |
   
**状态码：404**
表13响应Body参数 
| 参数         | 参数类型   | 描述                                                        |
|:---|:---|:---|
| error_code | String | **参数解释：** 错误码。  |
| error_msg  | String | **参数解释：** 错误信息。 |
   
#### 请求示例
无
#### 响应示例
**状态码：200**
OK
```
{
  "id" : 47858,
  "iid" : 1,
  "repository_id" : 2111983939,
  "title" : "新建文件 d",
  "description" : "merge \"ddd\" into \"master\"\n新建文件 d",
  "state" : "opened",
  "created_at" : "2024-11-30T17:47:53.000+08:00",
  "updated_at" : "2025-03-06T17:43:39.000+08:00",
  "source_branch" : "ddd",
  "target_branch" : "master",
  "is_source_branch_protected" : false,
  "devcloud_source_branch" : "ddd",
  "author" : {
    "id" : 9124,
    "name" : "example_name",
    "username" : "c369c68f1ff84679b5a8ed904d8bff1c",
    "state" : "active",
    "avatar_url" : "",
    "web_url" : "https://example.com/c369c68f1ff84679b5a8ed904d8bff1c",
    "nick_name" : "dev",
    "tenant_name" : "example_name"
  },
  "source_repository_id" : 2111983939,
  "target_repository_id" : 2111983939,
  "source_project_id" : "3e1f6634946144c2b1ccb46fb8152b8f",
  "target_project_id" : "3e1f6634946144c2b1ccb46fb8152b8f",
  "labels" : [ ],
  "work_in_progress" : false,
  "milestone" : null,
  "merge_when_build_succeeds" : false,
  "merge_status" : "can_be_merged",
  "sha" : "4f14849504009dd415b288f7ab21420933ecb516",
  "merge_commit_sha" : null,
  "subscribed" : true,
  "merged_by" : null,
  "merged_at" : null,
  "closed_by" : null,
  "closed_at" : null,
  "user_notes_count" : 0,
  "force_remove_source_branch" : false,
  "web_url" : "https://example.com/********/2111983939/1/mergedetail?source=ddd&target=master",
  "merge_request_diff" : {
    "id" : 70760,
    "state" : "collected",
    "merge_request_id" : 47858,
    "created_at" : "2024-11-30T17:47:53.000+08:00",
    "updated_at" : "2024-11-30T17:47:53.000+08:00",
    "base_commit_sha" : "c4f7b1bed9a869f64c90050311fad29ad4e40eb4",
    "real_size" : "1",
    "head_commit_sha" : "4f14849504009dd415b288f7ab21420933ecb516",
    "start_commit_sha" : "c4f7b1bed9a869f64c90050311fad29ad4e40eb4",
    "commits_count" : 1,
    "external_diff" : "diff-70760",
    "external_diff_store" : 1,
    "stored_externally" : true,
    "added_lines" : 1,
    "removed_lines" : 0
  },
  "merge_request_reviewers_count" : 0,
  "merge_request_review_count" : 0,
  "merge_request_reviewer_list" : [ ],
  "merge_request_assignee_list" : [ ],
  "notes" : 0,
  "codecheck_state" : 7,
  "codecheck_defect_count" : 0,
  "merge_request_related_work_items" : [ ],
  "diverged_commits_count" : 6,
  "moderation_result" : true,
  "moderation_time" : 0,
  "moderation_status" : 0,
  "is_use_temp_branch" : false,
  "review_mode" : "approval",
  "squash" : false,
  "approval_merge_request_approvers" : [ ],
  "approval_merge_request_reviewers" : [ ],
  "topic" : null,
  "source_repository" : {
    "id" : 2111983939,
    "description" : "ddd",
    "name" : "dddd",
    "name_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f / dddd",
    "path" : "dddd",
    "path_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f/dddd",
    "created_at" : "2024-11-30T17:46:46.000+08:00",
    "updated_at" : "2024-11-30T17:46:46.000+08:00",
    "archived" : false,
    "is_kia" : false,
    "ssh_url_to_repo" : "git@example.com:3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
    "http_url_to_repo" : "https://example.com/3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
    "web_url" : "https://example.com/3e1f6634946144c2b1ccb46fb8152b8f/dddd",
    "readme_url" : null,
    "project_id" : "3e1f6634946144c2b1ccb46fb8152b8f",
    "project_name" : null,
    "develop_mode" : "normal",
    "moderation_result" : true
  },
  "target_repository" : {
    "id" : 2111983939,
    "description" : "ddd",
    "name" : "dddd",
    "name_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f / dddd",
    "path" : "dddd",
    "path_with_namespace" : "3e1f6634946144c2b1ccb46fb8152b8f/dddd",
    "created_at" : "2024-11-30T17:46:46.000+08:00",
    "updated_at" : "2024-11-30T17:46:46.000+08:00",
    "archived" : false,
    "is_kia" : false,
    "ssh_url_to_repo" : "git@example.com:3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
    "http_url_to_repo" : "https://example.com/3e1f6634946144c2b1ccb46fb8152b8f/dddd.git",
    "web_url" : "https://example.com/3e1f6634946144c2b1ccb46fb8152b8f/dddd",
    "readme_url" : null,
    "project_id" : "3e1f6634946144c2b1ccb46fb8152b8f",
    "project_name" : null,
    "develop_mode" : "normal",
    "moderation_result" : true
  },
  "is_source_branch_exist" : true,
  "merge_request_type" : "MergeRequest",
  "squash_commit_message" : null,
  "auto_merge" : false,
  "merge_error" : null,
  "json_merge_error" : null,
  "rebase_in_progress" : false
}
```
**状态码：401**
Unauthorized
```
{
  "error_code" : "CH.00000002",
  "error_msg" : "认证信息无法识别"
}
```
**状态码：404**
Not Found
```
{
  "error_code" : "CH.00402000",
  "error_msg" : "该仓库不存在,请检查后重试。"
}
```
#### SDK代码示例
SDK代码示例如下。
#### Java
```
package com.huaweicloud.sdk.test;
import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.codeartsrepo.v4.region.CodeArtsRepoRegion;
import com.huaweicloud.sdk.codeartsrepo.v4.*;
import com.huaweicloud.sdk.codeartsrepo.v4.model.*;
public class ShowMergeRequestDetailSolution {
    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);
        CodeArtsRepoClient client = CodeArtsRepoClient.newBuilder()
                .withCredential(auth)
                .withRegion(CodeArtsRepoRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowMergeRequestDetailRequest request = new ShowMergeRequestDetailRequest();
        request.withRepositoryId({repository_id});
        request.withMergeRequestIid({merge_request_iid});
        try {
            ShowMergeRequestDetailResponse response = client.showMergeRequestDetail(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
```
#### Python
```
# coding: utf-8
import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcodeartsrepo.v4.region.codeartsrepo_region import CodeArtsRepoRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcodeartsrepo.v4 import *
if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    credentials = BasicCredentials(ak, sk)
    client = CodeArtsRepoClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CodeArtsRepoRegion.value_of("<YOUR REGION>")) \
        .build()
    try:
        request = ShowMergeRequestDetailRequest()
        request.repository_id = {repository_id}
        request.merge_request_iid = {merge_request_iid}
        response = client.show_merge_request_detail(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
```
#### Go
```
package main
import (
"fmt"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    codeartsrepo "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsrepo/v4"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsrepo/v4/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsrepo/v4/region"
)
func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    auth, err := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        SafeBuild()
    if err != nil {
        fmt.Println(err)
        return
    }
    hcClient, err := codeartsrepo.CodeArtsRepoClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()
    if err != nil {
        fmt.Println(err)
        return
    }
    client := codeartsrepo.NewCodeArtsRepoClient(hcClient)
    request := &model.ShowMergeRequestDetailRequest{}
request.RepositoryId = int32({repository_id})
request.MergeRequestIid = int32({merge_request_iid})
response, err := client.ShowMergeRequestDetail(request)
if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}
```
#### 更多
更多编程语言的SDK代码示例，请参见[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/CodeArtsRepo/sdk?api=ShowMergeRequestDetail&version=v4)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述           |
|:---|:---|
| 200 | OK           |
| 401 | Unauthorized |
| 404 | Not Found    |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-codeartsrepo/ErrorCode.html)。
