github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/api/branches_api.py (about) 1 # coding: utf-8 2 3 """ 4 lakeFS API 5 6 lakeFS HTTP API 7 8 The version of the OpenAPI document: 1.0.0 9 Contact: services@treeverse.io 10 Generated by OpenAPI Generator (https://openapi-generator.tech) 11 12 Do not edit the class manually. 13 """ # noqa: E501 14 15 16 import re # noqa: F401 17 import io 18 import warnings 19 20 try: 21 from pydantic.v1 import validate_arguments, ValidationError 22 except ImportError: 23 from pydantic import validate_arguments, ValidationError 24 from typing_extensions import Annotated 25 26 try: 27 from pydantic.v1 import Field, StrictBool, StrictStr, conint 28 except ImportError: 29 from pydantic import Field, StrictBool, StrictStr, conint 30 31 from typing import Optional 32 33 from lakefs_sdk.models.branch_creation import BranchCreation 34 from lakefs_sdk.models.cherry_pick_creation import CherryPickCreation 35 from lakefs_sdk.models.commit import Commit 36 from lakefs_sdk.models.diff_list import DiffList 37 from lakefs_sdk.models.ref import Ref 38 from lakefs_sdk.models.ref_list import RefList 39 from lakefs_sdk.models.reset_creation import ResetCreation 40 from lakefs_sdk.models.revert_creation import RevertCreation 41 42 from lakefs_sdk.api_client import ApiClient 43 from lakefs_sdk.api_response import ApiResponse 44 from lakefs_sdk.exceptions import ( # noqa: F401 45 ApiTypeError, 46 ApiValueError 47 ) 48 49 50 class BranchesApi(object): 51 """NOTE: This class is auto generated by OpenAPI Generator 52 Ref: https://openapi-generator.tech 53 54 Do not edit the class manually. 55 """ 56 57 def __init__(self, api_client=None): 58 if api_client is None: 59 api_client = ApiClient.get_default() 60 self.api_client = api_client 61 62 @validate_arguments 63 def cherry_pick(self, repository : StrictStr, branch : StrictStr, cherry_pick_creation : CherryPickCreation, **kwargs) -> Commit: # noqa: E501 64 """Replay the changes from the given commit on the branch # noqa: E501 65 66 This method makes a synchronous HTTP request by default. To make an 67 asynchronous HTTP request, please pass async_req=True 68 69 >>> thread = api.cherry_pick(repository, branch, cherry_pick_creation, async_req=True) 70 >>> result = thread.get() 71 72 :param repository: (required) 73 :type repository: str 74 :param branch: (required) 75 :type branch: str 76 :param cherry_pick_creation: (required) 77 :type cherry_pick_creation: CherryPickCreation 78 :param async_req: Whether to execute the request asynchronously. 79 :type async_req: bool, optional 80 :param _request_timeout: timeout setting for this request. If one 81 number provided, it will be total request 82 timeout. It can also be a pair (tuple) of 83 (connection, read) timeouts. 84 :return: Returns the result object. 85 If the method is called asynchronously, 86 returns the request thread. 87 :rtype: Commit 88 """ 89 kwargs['_return_http_data_only'] = True 90 if '_preload_content' in kwargs: 91 raise ValueError("Error! Please call the cherry_pick_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 92 return self.cherry_pick_with_http_info(repository, branch, cherry_pick_creation, **kwargs) # noqa: E501 93 94 @validate_arguments 95 def cherry_pick_with_http_info(self, repository : StrictStr, branch : StrictStr, cherry_pick_creation : CherryPickCreation, **kwargs) -> ApiResponse: # noqa: E501 96 """Replay the changes from the given commit on the branch # noqa: E501 97 98 This method makes a synchronous HTTP request by default. To make an 99 asynchronous HTTP request, please pass async_req=True 100 101 >>> thread = api.cherry_pick_with_http_info(repository, branch, cherry_pick_creation, async_req=True) 102 >>> result = thread.get() 103 104 :param repository: (required) 105 :type repository: str 106 :param branch: (required) 107 :type branch: str 108 :param cherry_pick_creation: (required) 109 :type cherry_pick_creation: CherryPickCreation 110 :param async_req: Whether to execute the request asynchronously. 111 :type async_req: bool, optional 112 :param _preload_content: if False, the ApiResponse.data will 113 be set to none and raw_data will store the 114 HTTP response body without reading/decoding. 115 Default is True. 116 :type _preload_content: bool, optional 117 :param _return_http_data_only: response data instead of ApiResponse 118 object with status code, headers, etc 119 :type _return_http_data_only: bool, optional 120 :param _request_timeout: timeout setting for this request. If one 121 number provided, it will be total request 122 timeout. It can also be a pair (tuple) of 123 (connection, read) timeouts. 124 :param _request_auth: set to override the auth_settings for an a single 125 request; this effectively ignores the authentication 126 in the spec for a single request. 127 :type _request_auth: dict, optional 128 :type _content_type: string, optional: force content-type for the request 129 :return: Returns the result object. 130 If the method is called asynchronously, 131 returns the request thread. 132 :rtype: tuple(Commit, status_code(int), headers(HTTPHeaderDict)) 133 """ 134 135 _params = locals() 136 137 _all_params = [ 138 'repository', 139 'branch', 140 'cherry_pick_creation' 141 ] 142 _all_params.extend( 143 [ 144 'async_req', 145 '_return_http_data_only', 146 '_preload_content', 147 '_request_timeout', 148 '_request_auth', 149 '_content_type', 150 '_headers' 151 ] 152 ) 153 154 # validate the arguments 155 for _key, _val in _params['kwargs'].items(): 156 if _key not in _all_params: 157 raise ApiTypeError( 158 "Got an unexpected keyword argument '%s'" 159 " to method cherry_pick" % _key 160 ) 161 _params[_key] = _val 162 del _params['kwargs'] 163 164 _collection_formats = {} 165 166 # process the path parameters 167 _path_params = {} 168 if _params['repository']: 169 _path_params['repository'] = _params['repository'] 170 171 if _params['branch']: 172 _path_params['branch'] = _params['branch'] 173 174 175 # process the query parameters 176 _query_params = [] 177 # process the header parameters 178 _header_params = dict(_params.get('_headers', {})) 179 # process the form parameters 180 _form_params = [] 181 _files = {} 182 # process the body parameter 183 _body_params = None 184 if _params['cherry_pick_creation'] is not None: 185 _body_params = _params['cherry_pick_creation'] 186 187 # set the HTTP header `Accept` 188 _header_params['Accept'] = self.api_client.select_header_accept( 189 ['application/json']) # noqa: E501 190 191 # set the HTTP header `Content-Type` 192 _content_types_list = _params.get('_content_type', 193 self.api_client.select_header_content_type( 194 ['application/json'])) 195 if _content_types_list: 196 _header_params['Content-Type'] = _content_types_list 197 198 # authentication setting 199 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 200 201 _response_types_map = { 202 '201': "Commit", 203 '400': "Error", 204 '401': "Error", 205 '403': "Error", 206 '404': "Error", 207 '409': "Error", 208 '420': None, 209 } 210 211 return self.api_client.call_api( 212 '/repositories/{repository}/branches/{branch}/cherry-pick', 'POST', 213 _path_params, 214 _query_params, 215 _header_params, 216 body=_body_params, 217 post_params=_form_params, 218 files=_files, 219 response_types_map=_response_types_map, 220 auth_settings=_auth_settings, 221 async_req=_params.get('async_req'), 222 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 223 _preload_content=_params.get('_preload_content', True), 224 _request_timeout=_params.get('_request_timeout'), 225 collection_formats=_collection_formats, 226 _request_auth=_params.get('_request_auth')) 227 228 @validate_arguments 229 def create_branch(self, repository : StrictStr, branch_creation : BranchCreation, **kwargs) -> str: # noqa: E501 230 """create branch # noqa: E501 231 232 This method makes a synchronous HTTP request by default. To make an 233 asynchronous HTTP request, please pass async_req=True 234 235 >>> thread = api.create_branch(repository, branch_creation, async_req=True) 236 >>> result = thread.get() 237 238 :param repository: (required) 239 :type repository: str 240 :param branch_creation: (required) 241 :type branch_creation: BranchCreation 242 :param async_req: Whether to execute the request asynchronously. 243 :type async_req: bool, optional 244 :param _request_timeout: timeout setting for this request. If one 245 number provided, it will be total request 246 timeout. It can also be a pair (tuple) of 247 (connection, read) timeouts. 248 :return: Returns the result object. 249 If the method is called asynchronously, 250 returns the request thread. 251 :rtype: str 252 """ 253 kwargs['_return_http_data_only'] = True 254 if '_preload_content' in kwargs: 255 raise ValueError("Error! Please call the create_branch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 256 return self.create_branch_with_http_info(repository, branch_creation, **kwargs) # noqa: E501 257 258 @validate_arguments 259 def create_branch_with_http_info(self, repository : StrictStr, branch_creation : BranchCreation, **kwargs) -> ApiResponse: # noqa: E501 260 """create branch # noqa: E501 261 262 This method makes a synchronous HTTP request by default. To make an 263 asynchronous HTTP request, please pass async_req=True 264 265 >>> thread = api.create_branch_with_http_info(repository, branch_creation, async_req=True) 266 >>> result = thread.get() 267 268 :param repository: (required) 269 :type repository: str 270 :param branch_creation: (required) 271 :type branch_creation: BranchCreation 272 :param async_req: Whether to execute the request asynchronously. 273 :type async_req: bool, optional 274 :param _preload_content: if False, the ApiResponse.data will 275 be set to none and raw_data will store the 276 HTTP response body without reading/decoding. 277 Default is True. 278 :type _preload_content: bool, optional 279 :param _return_http_data_only: response data instead of ApiResponse 280 object with status code, headers, etc 281 :type _return_http_data_only: bool, optional 282 :param _request_timeout: timeout setting for this request. If one 283 number provided, it will be total request 284 timeout. It can also be a pair (tuple) of 285 (connection, read) timeouts. 286 :param _request_auth: set to override the auth_settings for an a single 287 request; this effectively ignores the authentication 288 in the spec for a single request. 289 :type _request_auth: dict, optional 290 :type _content_type: string, optional: force content-type for the request 291 :return: Returns the result object. 292 If the method is called asynchronously, 293 returns the request thread. 294 :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) 295 """ 296 297 _params = locals() 298 299 _all_params = [ 300 'repository', 301 'branch_creation' 302 ] 303 _all_params.extend( 304 [ 305 'async_req', 306 '_return_http_data_only', 307 '_preload_content', 308 '_request_timeout', 309 '_request_auth', 310 '_content_type', 311 '_headers' 312 ] 313 ) 314 315 # validate the arguments 316 for _key, _val in _params['kwargs'].items(): 317 if _key not in _all_params: 318 raise ApiTypeError( 319 "Got an unexpected keyword argument '%s'" 320 " to method create_branch" % _key 321 ) 322 _params[_key] = _val 323 del _params['kwargs'] 324 325 _collection_formats = {} 326 327 # process the path parameters 328 _path_params = {} 329 if _params['repository']: 330 _path_params['repository'] = _params['repository'] 331 332 333 # process the query parameters 334 _query_params = [] 335 # process the header parameters 336 _header_params = dict(_params.get('_headers', {})) 337 # process the form parameters 338 _form_params = [] 339 _files = {} 340 # process the body parameter 341 _body_params = None 342 if _params['branch_creation'] is not None: 343 _body_params = _params['branch_creation'] 344 345 # set the HTTP header `Accept` 346 _header_params['Accept'] = self.api_client.select_header_accept( 347 ['text/html', 'application/json']) # noqa: E501 348 349 # set the HTTP header `Content-Type` 350 _content_types_list = _params.get('_content_type', 351 self.api_client.select_header_content_type( 352 ['application/json'])) 353 if _content_types_list: 354 _header_params['Content-Type'] = _content_types_list 355 356 # authentication setting 357 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 358 359 _response_types_map = { 360 '201': "str", 361 '400': "Error", 362 '401': "Error", 363 '403': "Error", 364 '404': "Error", 365 '409': "Error", 366 '420': None, 367 } 368 369 return self.api_client.call_api( 370 '/repositories/{repository}/branches', 'POST', 371 _path_params, 372 _query_params, 373 _header_params, 374 body=_body_params, 375 post_params=_form_params, 376 files=_files, 377 response_types_map=_response_types_map, 378 auth_settings=_auth_settings, 379 async_req=_params.get('async_req'), 380 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 381 _preload_content=_params.get('_preload_content', True), 382 _request_timeout=_params.get('_request_timeout'), 383 collection_formats=_collection_formats, 384 _request_auth=_params.get('_request_auth')) 385 386 @validate_arguments 387 def delete_branch(self, repository : StrictStr, branch : StrictStr, force : Optional[StrictBool] = None, **kwargs) -> None: # noqa: E501 388 """delete branch # noqa: E501 389 390 This method makes a synchronous HTTP request by default. To make an 391 asynchronous HTTP request, please pass async_req=True 392 393 >>> thread = api.delete_branch(repository, branch, force, async_req=True) 394 >>> result = thread.get() 395 396 :param repository: (required) 397 :type repository: str 398 :param branch: (required) 399 :type branch: str 400 :param force: 401 :type force: bool 402 :param async_req: Whether to execute the request asynchronously. 403 :type async_req: bool, optional 404 :param _request_timeout: timeout setting for this request. If one 405 number provided, it will be total request 406 timeout. It can also be a pair (tuple) of 407 (connection, read) timeouts. 408 :return: Returns the result object. 409 If the method is called asynchronously, 410 returns the request thread. 411 :rtype: None 412 """ 413 kwargs['_return_http_data_only'] = True 414 if '_preload_content' in kwargs: 415 raise ValueError("Error! Please call the delete_branch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 416 return self.delete_branch_with_http_info(repository, branch, force, **kwargs) # noqa: E501 417 418 @validate_arguments 419 def delete_branch_with_http_info(self, repository : StrictStr, branch : StrictStr, force : Optional[StrictBool] = None, **kwargs) -> ApiResponse: # noqa: E501 420 """delete branch # noqa: E501 421 422 This method makes a synchronous HTTP request by default. To make an 423 asynchronous HTTP request, please pass async_req=True 424 425 >>> thread = api.delete_branch_with_http_info(repository, branch, force, async_req=True) 426 >>> result = thread.get() 427 428 :param repository: (required) 429 :type repository: str 430 :param branch: (required) 431 :type branch: str 432 :param force: 433 :type force: bool 434 :param async_req: Whether to execute the request asynchronously. 435 :type async_req: bool, optional 436 :param _preload_content: if False, the ApiResponse.data will 437 be set to none and raw_data will store the 438 HTTP response body without reading/decoding. 439 Default is True. 440 :type _preload_content: bool, optional 441 :param _return_http_data_only: response data instead of ApiResponse 442 object with status code, headers, etc 443 :type _return_http_data_only: bool, optional 444 :param _request_timeout: timeout setting for this request. If one 445 number provided, it will be total request 446 timeout. It can also be a pair (tuple) of 447 (connection, read) timeouts. 448 :param _request_auth: set to override the auth_settings for an a single 449 request; this effectively ignores the authentication 450 in the spec for a single request. 451 :type _request_auth: dict, optional 452 :type _content_type: string, optional: force content-type for the request 453 :return: Returns the result object. 454 If the method is called asynchronously, 455 returns the request thread. 456 :rtype: None 457 """ 458 459 _params = locals() 460 461 _all_params = [ 462 'repository', 463 'branch', 464 'force' 465 ] 466 _all_params.extend( 467 [ 468 'async_req', 469 '_return_http_data_only', 470 '_preload_content', 471 '_request_timeout', 472 '_request_auth', 473 '_content_type', 474 '_headers' 475 ] 476 ) 477 478 # validate the arguments 479 for _key, _val in _params['kwargs'].items(): 480 if _key not in _all_params: 481 raise ApiTypeError( 482 "Got an unexpected keyword argument '%s'" 483 " to method delete_branch" % _key 484 ) 485 _params[_key] = _val 486 del _params['kwargs'] 487 488 _collection_formats = {} 489 490 # process the path parameters 491 _path_params = {} 492 if _params['repository']: 493 _path_params['repository'] = _params['repository'] 494 495 if _params['branch']: 496 _path_params['branch'] = _params['branch'] 497 498 499 # process the query parameters 500 _query_params = [] 501 if _params.get('force') is not None: # noqa: E501 502 _query_params.append(('force', _params['force'])) 503 504 # process the header parameters 505 _header_params = dict(_params.get('_headers', {})) 506 # process the form parameters 507 _form_params = [] 508 _files = {} 509 # process the body parameter 510 _body_params = None 511 # set the HTTP header `Accept` 512 _header_params['Accept'] = self.api_client.select_header_accept( 513 ['application/json']) # noqa: E501 514 515 # authentication setting 516 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 517 518 _response_types_map = {} 519 520 return self.api_client.call_api( 521 '/repositories/{repository}/branches/{branch}', 'DELETE', 522 _path_params, 523 _query_params, 524 _header_params, 525 body=_body_params, 526 post_params=_form_params, 527 files=_files, 528 response_types_map=_response_types_map, 529 auth_settings=_auth_settings, 530 async_req=_params.get('async_req'), 531 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 532 _preload_content=_params.get('_preload_content', True), 533 _request_timeout=_params.get('_request_timeout'), 534 collection_formats=_collection_formats, 535 _request_auth=_params.get('_request_auth')) 536 537 @validate_arguments 538 def diff_branch(self, repository : StrictStr, branch : StrictStr, after : Annotated[Optional[StrictStr], Field(description="return items after this value")] = None, amount : Annotated[Optional[conint(strict=True, le=1000, ge=-1)], Field(description="how many items to return")] = None, prefix : Annotated[Optional[StrictStr], Field(description="return items prefixed with this value")] = None, delimiter : Annotated[Optional[StrictStr], Field(description="delimiter used to group common prefixes by")] = None, **kwargs) -> DiffList: # noqa: E501 539 """diff branch # noqa: E501 540 541 This method makes a synchronous HTTP request by default. To make an 542 asynchronous HTTP request, please pass async_req=True 543 544 >>> thread = api.diff_branch(repository, branch, after, amount, prefix, delimiter, async_req=True) 545 >>> result = thread.get() 546 547 :param repository: (required) 548 :type repository: str 549 :param branch: (required) 550 :type branch: str 551 :param after: return items after this value 552 :type after: str 553 :param amount: how many items to return 554 :type amount: int 555 :param prefix: return items prefixed with this value 556 :type prefix: str 557 :param delimiter: delimiter used to group common prefixes by 558 :type delimiter: str 559 :param async_req: Whether to execute the request asynchronously. 560 :type async_req: bool, optional 561 :param _request_timeout: timeout setting for this request. If one 562 number provided, it will be total request 563 timeout. It can also be a pair (tuple) of 564 (connection, read) timeouts. 565 :return: Returns the result object. 566 If the method is called asynchronously, 567 returns the request thread. 568 :rtype: DiffList 569 """ 570 kwargs['_return_http_data_only'] = True 571 if '_preload_content' in kwargs: 572 raise ValueError("Error! Please call the diff_branch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 573 return self.diff_branch_with_http_info(repository, branch, after, amount, prefix, delimiter, **kwargs) # noqa: E501 574 575 @validate_arguments 576 def diff_branch_with_http_info(self, repository : StrictStr, branch : StrictStr, after : Annotated[Optional[StrictStr], Field(description="return items after this value")] = None, amount : Annotated[Optional[conint(strict=True, le=1000, ge=-1)], Field(description="how many items to return")] = None, prefix : Annotated[Optional[StrictStr], Field(description="return items prefixed with this value")] = None, delimiter : Annotated[Optional[StrictStr], Field(description="delimiter used to group common prefixes by")] = None, **kwargs) -> ApiResponse: # noqa: E501 577 """diff branch # noqa: E501 578 579 This method makes a synchronous HTTP request by default. To make an 580 asynchronous HTTP request, please pass async_req=True 581 582 >>> thread = api.diff_branch_with_http_info(repository, branch, after, amount, prefix, delimiter, async_req=True) 583 >>> result = thread.get() 584 585 :param repository: (required) 586 :type repository: str 587 :param branch: (required) 588 :type branch: str 589 :param after: return items after this value 590 :type after: str 591 :param amount: how many items to return 592 :type amount: int 593 :param prefix: return items prefixed with this value 594 :type prefix: str 595 :param delimiter: delimiter used to group common prefixes by 596 :type delimiter: str 597 :param async_req: Whether to execute the request asynchronously. 598 :type async_req: bool, optional 599 :param _preload_content: if False, the ApiResponse.data will 600 be set to none and raw_data will store the 601 HTTP response body without reading/decoding. 602 Default is True. 603 :type _preload_content: bool, optional 604 :param _return_http_data_only: response data instead of ApiResponse 605 object with status code, headers, etc 606 :type _return_http_data_only: bool, optional 607 :param _request_timeout: timeout setting for this request. If one 608 number provided, it will be total request 609 timeout. It can also be a pair (tuple) of 610 (connection, read) timeouts. 611 :param _request_auth: set to override the auth_settings for an a single 612 request; this effectively ignores the authentication 613 in the spec for a single request. 614 :type _request_auth: dict, optional 615 :type _content_type: string, optional: force content-type for the request 616 :return: Returns the result object. 617 If the method is called asynchronously, 618 returns the request thread. 619 :rtype: tuple(DiffList, status_code(int), headers(HTTPHeaderDict)) 620 """ 621 622 _params = locals() 623 624 _all_params = [ 625 'repository', 626 'branch', 627 'after', 628 'amount', 629 'prefix', 630 'delimiter' 631 ] 632 _all_params.extend( 633 [ 634 'async_req', 635 '_return_http_data_only', 636 '_preload_content', 637 '_request_timeout', 638 '_request_auth', 639 '_content_type', 640 '_headers' 641 ] 642 ) 643 644 # validate the arguments 645 for _key, _val in _params['kwargs'].items(): 646 if _key not in _all_params: 647 raise ApiTypeError( 648 "Got an unexpected keyword argument '%s'" 649 " to method diff_branch" % _key 650 ) 651 _params[_key] = _val 652 del _params['kwargs'] 653 654 _collection_formats = {} 655 656 # process the path parameters 657 _path_params = {} 658 if _params['repository']: 659 _path_params['repository'] = _params['repository'] 660 661 if _params['branch']: 662 _path_params['branch'] = _params['branch'] 663 664 665 # process the query parameters 666 _query_params = [] 667 if _params.get('after') is not None: # noqa: E501 668 _query_params.append(('after', _params['after'])) 669 670 if _params.get('amount') is not None: # noqa: E501 671 _query_params.append(('amount', _params['amount'])) 672 673 if _params.get('prefix') is not None: # noqa: E501 674 _query_params.append(('prefix', _params['prefix'])) 675 676 if _params.get('delimiter') is not None: # noqa: E501 677 _query_params.append(('delimiter', _params['delimiter'])) 678 679 # process the header parameters 680 _header_params = dict(_params.get('_headers', {})) 681 # process the form parameters 682 _form_params = [] 683 _files = {} 684 # process the body parameter 685 _body_params = None 686 # set the HTTP header `Accept` 687 _header_params['Accept'] = self.api_client.select_header_accept( 688 ['application/json']) # noqa: E501 689 690 # authentication setting 691 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 692 693 _response_types_map = { 694 '200': "DiffList", 695 '401': "Error", 696 '404': "Error", 697 '420': None, 698 } 699 700 return self.api_client.call_api( 701 '/repositories/{repository}/branches/{branch}/diff', 'GET', 702 _path_params, 703 _query_params, 704 _header_params, 705 body=_body_params, 706 post_params=_form_params, 707 files=_files, 708 response_types_map=_response_types_map, 709 auth_settings=_auth_settings, 710 async_req=_params.get('async_req'), 711 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 712 _preload_content=_params.get('_preload_content', True), 713 _request_timeout=_params.get('_request_timeout'), 714 collection_formats=_collection_formats, 715 _request_auth=_params.get('_request_auth')) 716 717 @validate_arguments 718 def get_branch(self, repository : StrictStr, branch : StrictStr, **kwargs) -> Ref: # noqa: E501 719 """get branch # noqa: E501 720 721 This method makes a synchronous HTTP request by default. To make an 722 asynchronous HTTP request, please pass async_req=True 723 724 >>> thread = api.get_branch(repository, branch, async_req=True) 725 >>> result = thread.get() 726 727 :param repository: (required) 728 :type repository: str 729 :param branch: (required) 730 :type branch: str 731 :param async_req: Whether to execute the request asynchronously. 732 :type async_req: bool, optional 733 :param _request_timeout: timeout setting for this request. If one 734 number provided, it will be total request 735 timeout. It can also be a pair (tuple) of 736 (connection, read) timeouts. 737 :return: Returns the result object. 738 If the method is called asynchronously, 739 returns the request thread. 740 :rtype: Ref 741 """ 742 kwargs['_return_http_data_only'] = True 743 if '_preload_content' in kwargs: 744 raise ValueError("Error! Please call the get_branch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 745 return self.get_branch_with_http_info(repository, branch, **kwargs) # noqa: E501 746 747 @validate_arguments 748 def get_branch_with_http_info(self, repository : StrictStr, branch : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 749 """get branch # noqa: E501 750 751 This method makes a synchronous HTTP request by default. To make an 752 asynchronous HTTP request, please pass async_req=True 753 754 >>> thread = api.get_branch_with_http_info(repository, branch, async_req=True) 755 >>> result = thread.get() 756 757 :param repository: (required) 758 :type repository: str 759 :param branch: (required) 760 :type branch: str 761 :param async_req: Whether to execute the request asynchronously. 762 :type async_req: bool, optional 763 :param _preload_content: if False, the ApiResponse.data will 764 be set to none and raw_data will store the 765 HTTP response body without reading/decoding. 766 Default is True. 767 :type _preload_content: bool, optional 768 :param _return_http_data_only: response data instead of ApiResponse 769 object with status code, headers, etc 770 :type _return_http_data_only: bool, optional 771 :param _request_timeout: timeout setting for this request. If one 772 number provided, it will be total request 773 timeout. It can also be a pair (tuple) of 774 (connection, read) timeouts. 775 :param _request_auth: set to override the auth_settings for an a single 776 request; this effectively ignores the authentication 777 in the spec for a single request. 778 :type _request_auth: dict, optional 779 :type _content_type: string, optional: force content-type for the request 780 :return: Returns the result object. 781 If the method is called asynchronously, 782 returns the request thread. 783 :rtype: tuple(Ref, status_code(int), headers(HTTPHeaderDict)) 784 """ 785 786 _params = locals() 787 788 _all_params = [ 789 'repository', 790 'branch' 791 ] 792 _all_params.extend( 793 [ 794 'async_req', 795 '_return_http_data_only', 796 '_preload_content', 797 '_request_timeout', 798 '_request_auth', 799 '_content_type', 800 '_headers' 801 ] 802 ) 803 804 # validate the arguments 805 for _key, _val in _params['kwargs'].items(): 806 if _key not in _all_params: 807 raise ApiTypeError( 808 "Got an unexpected keyword argument '%s'" 809 " to method get_branch" % _key 810 ) 811 _params[_key] = _val 812 del _params['kwargs'] 813 814 _collection_formats = {} 815 816 # process the path parameters 817 _path_params = {} 818 if _params['repository']: 819 _path_params['repository'] = _params['repository'] 820 821 if _params['branch']: 822 _path_params['branch'] = _params['branch'] 823 824 825 # process the query parameters 826 _query_params = [] 827 # process the header parameters 828 _header_params = dict(_params.get('_headers', {})) 829 # process the form parameters 830 _form_params = [] 831 _files = {} 832 # process the body parameter 833 _body_params = None 834 # set the HTTP header `Accept` 835 _header_params['Accept'] = self.api_client.select_header_accept( 836 ['application/json']) # noqa: E501 837 838 # authentication setting 839 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 840 841 _response_types_map = { 842 '200': "Ref", 843 '401': "Error", 844 '404': "Error", 845 '420': None, 846 } 847 848 return self.api_client.call_api( 849 '/repositories/{repository}/branches/{branch}', 'GET', 850 _path_params, 851 _query_params, 852 _header_params, 853 body=_body_params, 854 post_params=_form_params, 855 files=_files, 856 response_types_map=_response_types_map, 857 auth_settings=_auth_settings, 858 async_req=_params.get('async_req'), 859 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 860 _preload_content=_params.get('_preload_content', True), 861 _request_timeout=_params.get('_request_timeout'), 862 collection_formats=_collection_formats, 863 _request_auth=_params.get('_request_auth')) 864 865 @validate_arguments 866 def list_branches(self, repository : StrictStr, prefix : Annotated[Optional[StrictStr], Field(description="return items prefixed with this value")] = None, after : Annotated[Optional[StrictStr], Field(description="return items after this value")] = None, amount : Annotated[Optional[conint(strict=True, le=1000, ge=-1)], Field(description="how many items to return")] = None, **kwargs) -> RefList: # noqa: E501 867 """list branches # noqa: E501 868 869 This method makes a synchronous HTTP request by default. To make an 870 asynchronous HTTP request, please pass async_req=True 871 872 >>> thread = api.list_branches(repository, prefix, after, amount, async_req=True) 873 >>> result = thread.get() 874 875 :param repository: (required) 876 :type repository: str 877 :param prefix: return items prefixed with this value 878 :type prefix: str 879 :param after: return items after this value 880 :type after: str 881 :param amount: how many items to return 882 :type amount: int 883 :param async_req: Whether to execute the request asynchronously. 884 :type async_req: bool, optional 885 :param _request_timeout: timeout setting for this request. If one 886 number provided, it will be total request 887 timeout. It can also be a pair (tuple) of 888 (connection, read) timeouts. 889 :return: Returns the result object. 890 If the method is called asynchronously, 891 returns the request thread. 892 :rtype: RefList 893 """ 894 kwargs['_return_http_data_only'] = True 895 if '_preload_content' in kwargs: 896 raise ValueError("Error! Please call the list_branches_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 897 return self.list_branches_with_http_info(repository, prefix, after, amount, **kwargs) # noqa: E501 898 899 @validate_arguments 900 def list_branches_with_http_info(self, repository : StrictStr, prefix : Annotated[Optional[StrictStr], Field(description="return items prefixed with this value")] = None, after : Annotated[Optional[StrictStr], Field(description="return items after this value")] = None, amount : Annotated[Optional[conint(strict=True, le=1000, ge=-1)], Field(description="how many items to return")] = None, **kwargs) -> ApiResponse: # noqa: E501 901 """list branches # noqa: E501 902 903 This method makes a synchronous HTTP request by default. To make an 904 asynchronous HTTP request, please pass async_req=True 905 906 >>> thread = api.list_branches_with_http_info(repository, prefix, after, amount, async_req=True) 907 >>> result = thread.get() 908 909 :param repository: (required) 910 :type repository: str 911 :param prefix: return items prefixed with this value 912 :type prefix: str 913 :param after: return items after this value 914 :type after: str 915 :param amount: how many items to return 916 :type amount: int 917 :param async_req: Whether to execute the request asynchronously. 918 :type async_req: bool, optional 919 :param _preload_content: if False, the ApiResponse.data will 920 be set to none and raw_data will store the 921 HTTP response body without reading/decoding. 922 Default is True. 923 :type _preload_content: bool, optional 924 :param _return_http_data_only: response data instead of ApiResponse 925 object with status code, headers, etc 926 :type _return_http_data_only: bool, optional 927 :param _request_timeout: timeout setting for this request. If one 928 number provided, it will be total request 929 timeout. It can also be a pair (tuple) of 930 (connection, read) timeouts. 931 :param _request_auth: set to override the auth_settings for an a single 932 request; this effectively ignores the authentication 933 in the spec for a single request. 934 :type _request_auth: dict, optional 935 :type _content_type: string, optional: force content-type for the request 936 :return: Returns the result object. 937 If the method is called asynchronously, 938 returns the request thread. 939 :rtype: tuple(RefList, status_code(int), headers(HTTPHeaderDict)) 940 """ 941 942 _params = locals() 943 944 _all_params = [ 945 'repository', 946 'prefix', 947 'after', 948 'amount' 949 ] 950 _all_params.extend( 951 [ 952 'async_req', 953 '_return_http_data_only', 954 '_preload_content', 955 '_request_timeout', 956 '_request_auth', 957 '_content_type', 958 '_headers' 959 ] 960 ) 961 962 # validate the arguments 963 for _key, _val in _params['kwargs'].items(): 964 if _key not in _all_params: 965 raise ApiTypeError( 966 "Got an unexpected keyword argument '%s'" 967 " to method list_branches" % _key 968 ) 969 _params[_key] = _val 970 del _params['kwargs'] 971 972 _collection_formats = {} 973 974 # process the path parameters 975 _path_params = {} 976 if _params['repository']: 977 _path_params['repository'] = _params['repository'] 978 979 980 # process the query parameters 981 _query_params = [] 982 if _params.get('prefix') is not None: # noqa: E501 983 _query_params.append(('prefix', _params['prefix'])) 984 985 if _params.get('after') is not None: # noqa: E501 986 _query_params.append(('after', _params['after'])) 987 988 if _params.get('amount') is not None: # noqa: E501 989 _query_params.append(('amount', _params['amount'])) 990 991 # process the header parameters 992 _header_params = dict(_params.get('_headers', {})) 993 # process the form parameters 994 _form_params = [] 995 _files = {} 996 # process the body parameter 997 _body_params = None 998 # set the HTTP header `Accept` 999 _header_params['Accept'] = self.api_client.select_header_accept( 1000 ['application/json']) # noqa: E501 1001 1002 # authentication setting 1003 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 1004 1005 _response_types_map = { 1006 '200': "RefList", 1007 '401': "Error", 1008 '404': "Error", 1009 '420': None, 1010 } 1011 1012 return self.api_client.call_api( 1013 '/repositories/{repository}/branches', 'GET', 1014 _path_params, 1015 _query_params, 1016 _header_params, 1017 body=_body_params, 1018 post_params=_form_params, 1019 files=_files, 1020 response_types_map=_response_types_map, 1021 auth_settings=_auth_settings, 1022 async_req=_params.get('async_req'), 1023 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 1024 _preload_content=_params.get('_preload_content', True), 1025 _request_timeout=_params.get('_request_timeout'), 1026 collection_formats=_collection_formats, 1027 _request_auth=_params.get('_request_auth')) 1028 1029 @validate_arguments 1030 def reset_branch(self, repository : StrictStr, branch : StrictStr, reset_creation : ResetCreation, **kwargs) -> None: # noqa: E501 1031 """reset branch # noqa: E501 1032 1033 This method makes a synchronous HTTP request by default. To make an 1034 asynchronous HTTP request, please pass async_req=True 1035 1036 >>> thread = api.reset_branch(repository, branch, reset_creation, async_req=True) 1037 >>> result = thread.get() 1038 1039 :param repository: (required) 1040 :type repository: str 1041 :param branch: (required) 1042 :type branch: str 1043 :param reset_creation: (required) 1044 :type reset_creation: ResetCreation 1045 :param async_req: Whether to execute the request asynchronously. 1046 :type async_req: bool, optional 1047 :param _request_timeout: timeout setting for this request. If one 1048 number provided, it will be total request 1049 timeout. It can also be a pair (tuple) of 1050 (connection, read) timeouts. 1051 :return: Returns the result object. 1052 If the method is called asynchronously, 1053 returns the request thread. 1054 :rtype: None 1055 """ 1056 kwargs['_return_http_data_only'] = True 1057 if '_preload_content' in kwargs: 1058 raise ValueError("Error! Please call the reset_branch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 1059 return self.reset_branch_with_http_info(repository, branch, reset_creation, **kwargs) # noqa: E501 1060 1061 @validate_arguments 1062 def reset_branch_with_http_info(self, repository : StrictStr, branch : StrictStr, reset_creation : ResetCreation, **kwargs) -> ApiResponse: # noqa: E501 1063 """reset branch # noqa: E501 1064 1065 This method makes a synchronous HTTP request by default. To make an 1066 asynchronous HTTP request, please pass async_req=True 1067 1068 >>> thread = api.reset_branch_with_http_info(repository, branch, reset_creation, async_req=True) 1069 >>> result = thread.get() 1070 1071 :param repository: (required) 1072 :type repository: str 1073 :param branch: (required) 1074 :type branch: str 1075 :param reset_creation: (required) 1076 :type reset_creation: ResetCreation 1077 :param async_req: Whether to execute the request asynchronously. 1078 :type async_req: bool, optional 1079 :param _preload_content: if False, the ApiResponse.data will 1080 be set to none and raw_data will store the 1081 HTTP response body without reading/decoding. 1082 Default is True. 1083 :type _preload_content: bool, optional 1084 :param _return_http_data_only: response data instead of ApiResponse 1085 object with status code, headers, etc 1086 :type _return_http_data_only: bool, optional 1087 :param _request_timeout: timeout setting for this request. If one 1088 number provided, it will be total request 1089 timeout. It can also be a pair (tuple) of 1090 (connection, read) timeouts. 1091 :param _request_auth: set to override the auth_settings for an a single 1092 request; this effectively ignores the authentication 1093 in the spec for a single request. 1094 :type _request_auth: dict, optional 1095 :type _content_type: string, optional: force content-type for the request 1096 :return: Returns the result object. 1097 If the method is called asynchronously, 1098 returns the request thread. 1099 :rtype: None 1100 """ 1101 1102 _params = locals() 1103 1104 _all_params = [ 1105 'repository', 1106 'branch', 1107 'reset_creation' 1108 ] 1109 _all_params.extend( 1110 [ 1111 'async_req', 1112 '_return_http_data_only', 1113 '_preload_content', 1114 '_request_timeout', 1115 '_request_auth', 1116 '_content_type', 1117 '_headers' 1118 ] 1119 ) 1120 1121 # validate the arguments 1122 for _key, _val in _params['kwargs'].items(): 1123 if _key not in _all_params: 1124 raise ApiTypeError( 1125 "Got an unexpected keyword argument '%s'" 1126 " to method reset_branch" % _key 1127 ) 1128 _params[_key] = _val 1129 del _params['kwargs'] 1130 1131 _collection_formats = {} 1132 1133 # process the path parameters 1134 _path_params = {} 1135 if _params['repository']: 1136 _path_params['repository'] = _params['repository'] 1137 1138 if _params['branch']: 1139 _path_params['branch'] = _params['branch'] 1140 1141 1142 # process the query parameters 1143 _query_params = [] 1144 # process the header parameters 1145 _header_params = dict(_params.get('_headers', {})) 1146 # process the form parameters 1147 _form_params = [] 1148 _files = {} 1149 # process the body parameter 1150 _body_params = None 1151 if _params['reset_creation'] is not None: 1152 _body_params = _params['reset_creation'] 1153 1154 # set the HTTP header `Accept` 1155 _header_params['Accept'] = self.api_client.select_header_accept( 1156 ['application/json']) # noqa: E501 1157 1158 # set the HTTP header `Content-Type` 1159 _content_types_list = _params.get('_content_type', 1160 self.api_client.select_header_content_type( 1161 ['application/json'])) 1162 if _content_types_list: 1163 _header_params['Content-Type'] = _content_types_list 1164 1165 # authentication setting 1166 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 1167 1168 _response_types_map = {} 1169 1170 return self.api_client.call_api( 1171 '/repositories/{repository}/branches/{branch}', 'PUT', 1172 _path_params, 1173 _query_params, 1174 _header_params, 1175 body=_body_params, 1176 post_params=_form_params, 1177 files=_files, 1178 response_types_map=_response_types_map, 1179 auth_settings=_auth_settings, 1180 async_req=_params.get('async_req'), 1181 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 1182 _preload_content=_params.get('_preload_content', True), 1183 _request_timeout=_params.get('_request_timeout'), 1184 collection_formats=_collection_formats, 1185 _request_auth=_params.get('_request_auth')) 1186 1187 @validate_arguments 1188 def revert_branch(self, repository : StrictStr, branch : StrictStr, revert_creation : RevertCreation, **kwargs) -> None: # noqa: E501 1189 """revert # noqa: E501 1190 1191 This method makes a synchronous HTTP request by default. To make an 1192 asynchronous HTTP request, please pass async_req=True 1193 1194 >>> thread = api.revert_branch(repository, branch, revert_creation, async_req=True) 1195 >>> result = thread.get() 1196 1197 :param repository: (required) 1198 :type repository: str 1199 :param branch: (required) 1200 :type branch: str 1201 :param revert_creation: (required) 1202 :type revert_creation: RevertCreation 1203 :param async_req: Whether to execute the request asynchronously. 1204 :type async_req: bool, optional 1205 :param _request_timeout: timeout setting for this request. If one 1206 number provided, it will be total request 1207 timeout. It can also be a pair (tuple) of 1208 (connection, read) timeouts. 1209 :return: Returns the result object. 1210 If the method is called asynchronously, 1211 returns the request thread. 1212 :rtype: None 1213 """ 1214 kwargs['_return_http_data_only'] = True 1215 if '_preload_content' in kwargs: 1216 raise ValueError("Error! Please call the revert_branch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 1217 return self.revert_branch_with_http_info(repository, branch, revert_creation, **kwargs) # noqa: E501 1218 1219 @validate_arguments 1220 def revert_branch_with_http_info(self, repository : StrictStr, branch : StrictStr, revert_creation : RevertCreation, **kwargs) -> ApiResponse: # noqa: E501 1221 """revert # noqa: E501 1222 1223 This method makes a synchronous HTTP request by default. To make an 1224 asynchronous HTTP request, please pass async_req=True 1225 1226 >>> thread = api.revert_branch_with_http_info(repository, branch, revert_creation, async_req=True) 1227 >>> result = thread.get() 1228 1229 :param repository: (required) 1230 :type repository: str 1231 :param branch: (required) 1232 :type branch: str 1233 :param revert_creation: (required) 1234 :type revert_creation: RevertCreation 1235 :param async_req: Whether to execute the request asynchronously. 1236 :type async_req: bool, optional 1237 :param _preload_content: if False, the ApiResponse.data will 1238 be set to none and raw_data will store the 1239 HTTP response body without reading/decoding. 1240 Default is True. 1241 :type _preload_content: bool, optional 1242 :param _return_http_data_only: response data instead of ApiResponse 1243 object with status code, headers, etc 1244 :type _return_http_data_only: bool, optional 1245 :param _request_timeout: timeout setting for this request. If one 1246 number provided, it will be total request 1247 timeout. It can also be a pair (tuple) of 1248 (connection, read) timeouts. 1249 :param _request_auth: set to override the auth_settings for an a single 1250 request; this effectively ignores the authentication 1251 in the spec for a single request. 1252 :type _request_auth: dict, optional 1253 :type _content_type: string, optional: force content-type for the request 1254 :return: Returns the result object. 1255 If the method is called asynchronously, 1256 returns the request thread. 1257 :rtype: None 1258 """ 1259 1260 _params = locals() 1261 1262 _all_params = [ 1263 'repository', 1264 'branch', 1265 'revert_creation' 1266 ] 1267 _all_params.extend( 1268 [ 1269 'async_req', 1270 '_return_http_data_only', 1271 '_preload_content', 1272 '_request_timeout', 1273 '_request_auth', 1274 '_content_type', 1275 '_headers' 1276 ] 1277 ) 1278 1279 # validate the arguments 1280 for _key, _val in _params['kwargs'].items(): 1281 if _key not in _all_params: 1282 raise ApiTypeError( 1283 "Got an unexpected keyword argument '%s'" 1284 " to method revert_branch" % _key 1285 ) 1286 _params[_key] = _val 1287 del _params['kwargs'] 1288 1289 _collection_formats = {} 1290 1291 # process the path parameters 1292 _path_params = {} 1293 if _params['repository']: 1294 _path_params['repository'] = _params['repository'] 1295 1296 if _params['branch']: 1297 _path_params['branch'] = _params['branch'] 1298 1299 1300 # process the query parameters 1301 _query_params = [] 1302 # process the header parameters 1303 _header_params = dict(_params.get('_headers', {})) 1304 # process the form parameters 1305 _form_params = [] 1306 _files = {} 1307 # process the body parameter 1308 _body_params = None 1309 if _params['revert_creation'] is not None: 1310 _body_params = _params['revert_creation'] 1311 1312 # set the HTTP header `Accept` 1313 _header_params['Accept'] = self.api_client.select_header_accept( 1314 ['application/json']) # noqa: E501 1315 1316 # set the HTTP header `Content-Type` 1317 _content_types_list = _params.get('_content_type', 1318 self.api_client.select_header_content_type( 1319 ['application/json'])) 1320 if _content_types_list: 1321 _header_params['Content-Type'] = _content_types_list 1322 1323 # authentication setting 1324 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 1325 1326 _response_types_map = {} 1327 1328 return self.api_client.call_api( 1329 '/repositories/{repository}/branches/{branch}/revert', 'POST', 1330 _path_params, 1331 _query_params, 1332 _header_params, 1333 body=_body_params, 1334 post_params=_form_params, 1335 files=_files, 1336 response_types_map=_response_types_map, 1337 auth_settings=_auth_settings, 1338 async_req=_params.get('async_req'), 1339 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 1340 _preload_content=_params.get('_preload_content', True), 1341 _request_timeout=_params.get('_request_timeout'), 1342 collection_formats=_collection_formats, 1343 _request_auth=_params.get('_request_auth'))