xia_engine_gitlab.engine_code.GitlabCodeEngineClient
- class xia_engine_gitlab.engine_code.GitlabCodeEngineClient(api_host: str, api_token: str, **kwargs)
Bases:
GitlabEngineClient
- __init__(api_host: str, api_token: str, **kwargs)
Methods
__init__
(api_host, api_token, **kwargs)check_file_exists
(project_id, branch, path)check_response
(response)commit_file
(project_id, branch, path, ...[, ...])copy_branch
(project_name, source_target, ...)Copy branch
create_branch
(project_id, branch_name, ref)create_code
(project_name, code_path, ...)Create code page
create_merge_request
(project_id, title, ...)delete_branch
(project_id, branch_name)delete_code
(project_name, code_path, ...)Delete code page content
drop_branch
(project_name, target_name)Drop Branch
get_branch_info
(project_id, branch_name)get_branch_name
(project_id, code_version)get_code
(project_name, code_path, code_version)Get code page content
get_code_path
(repo_path)Get code path from repository path
get_default_branch_from_name
(api_endpoint, ...)Get default branch name from the given name
get_file_content
(project_id, branch, path[, ...])Get file content
get_group_id_from_name
(api_endpoint, ...)get_issue_branch_name
(issue_name, issue_iid)get_issue_commit_name
(issue_name, issue_iid)get_issue_iid_from_name
(api_endpoint, ...)get_issue_mr_name
(issue_name, issue_iid)get_merge_request_commits
(project_id, title)get_milestone_branch_name
(milestone_name)get_milestone_id_from_name
(api_endpoint, ...)get_milestone_info_from_issue
(api_endpoint, ...)get_milestone_mr_name
(milestone_name)get_mr_iid_from_branch
(api_endpoint, ...[, ...])get_mr_iid_from_name
(api_endpoint, ...)get_mr_iid_from_title
(api_endpoint, ...)get_project_id_from_name
(api_endpoint, ...)get_repo_path
(code_path)Get repository path from code path
list_code
(**kwargs)merge_branch
(project_name, source_target, ...)Merge branch
merge_merge_request
(project_id, title[, ...])pipeline_exists
(api_endpoint, api_token, ...)rebase_merge_request
(project_id, title)split_header_body
(full_content)update_code
(project_name, code_path, ...)Update code page
- copy_branch(project_name: str, source_target: str, target_target: str, force: bool = False)
Copy branch
- Parameters
project_name – Project Name
source_target – Source target Name
target_target – Target target Name
force – will drop the target if exists
- Returns
created branch information
- create_code(project_name: str, code_path: str, code_version: str, code_content: str, code_encoding: str)
Create code page
- Parameters
project_name – Project name
code_path – document id
code_version – document version
code_content – database content
code_encoding – content encoding, should be ‘text’ or ‘base64’
- delete_code(project_name: str, code_path: str, code_version: str)
Delete code page content
- Parameters
project_name – Project name
code_path – document id
code_version – document version
- drop_branch(project_name: str, target_name: str)
Drop Branch
- Parameters
project_name – Project Name
target_name – Target name
- Returns
True if successful
- get_code(project_name: str, code_path: str, code_version: str)
Get code page content
- Parameters
project_name – Project name
code_path – document id
code_version – document version
- classmethod get_code_path(repo_path: str)
Get code path from repository path
- Parameters
repo_path – repository path
- Returns
code path
- classmethod get_default_branch_from_name(api_endpoint: str, api_token: str, project_id: int) str
Get default branch name from the given name
- Parameters
api_endpoint –
api_token –
project_id –
Returns:
- get_file_content(project_id, branch: str, path: str, with_encoding: bool = False)
Get file content
- Returns
when with_encoding is true and the content is binary, will return base64 string instead binary result
- classmethod get_repo_path(code_path: str)
Get repository path from code path
- Parameters
code_path – code path
- Returns
repository path
- merge_branch(project_name: str, source_target: str, target_target: str, remove_source: bool = True)
Merge branch
- Parameters
project_name – Project Name
source_target – Source target Name
target_target – Target target Name
remove_source – will drop the source version after merge
- Returns
created branch information
- update_code(project_name: str, code_path: str, code_version: str, code_content: str, code_encoding: str)
Update code page
- Parameters
project_name – Project name
code_path – document id
code_version – document version
code_content – database content
code_encoding – content encoding, should be ‘text’ or ‘base64’