github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python-legacy/lakefs_client/api/commits_api.py (about)

     1  """
     2      lakeFS API
     3  
     4      lakeFS HTTP API  # noqa: E501
     5  
     6      The version of the OpenAPI document: 1.0.0
     7      Contact: services@treeverse.io
     8      Generated by: https://openapi-generator.tech
     9  """
    10  
    11  
    12  import re  # noqa: F401
    13  import sys  # noqa: F401
    14  
    15  from lakefs_client.api_client import ApiClient, Endpoint as _Endpoint
    16  from lakefs_client.model_utils import (  # noqa: F401
    17      check_allowed_values,
    18      check_validations,
    19      date,
    20      datetime,
    21      file_type,
    22      none_type,
    23      validate_and_convert_types
    24  )
    25  from lakefs_client.model.commit import Commit
    26  from lakefs_client.model.commit_creation import CommitCreation
    27  from lakefs_client.model.error import Error
    28  
    29  
    30  class CommitsApi(object):
    31      """NOTE: This class is auto generated by OpenAPI Generator
    32      Ref: https://openapi-generator.tech
    33  
    34      Do not edit the class manually.
    35      """
    36  
    37      def __init__(self, api_client=None):
    38          if api_client is None:
    39              api_client = ApiClient()
    40          self.api_client = api_client
    41          self.commit_endpoint = _Endpoint(
    42              settings={
    43                  'response_type': (Commit,),
    44                  'auth': [
    45                      'basic_auth',
    46                      'cookie_auth',
    47                      'jwt_token',
    48                      'oidc_auth',
    49                      'saml_auth'
    50                  ],
    51                  'endpoint_path': '/repositories/{repository}/branches/{branch}/commits',
    52                  'operation_id': 'commit',
    53                  'http_method': 'POST',
    54                  'servers': None,
    55              },
    56              params_map={
    57                  'all': [
    58                      'repository',
    59                      'branch',
    60                      'commit_creation',
    61                      'source_metarange',
    62                  ],
    63                  'required': [
    64                      'repository',
    65                      'branch',
    66                      'commit_creation',
    67                  ],
    68                  'nullable': [
    69                  ],
    70                  'enum': [
    71                  ],
    72                  'validation': [
    73                  ]
    74              },
    75              root_map={
    76                  'validations': {
    77                  },
    78                  'allowed_values': {
    79                  },
    80                  'openapi_types': {
    81                      'repository':
    82                          (str,),
    83                      'branch':
    84                          (str,),
    85                      'commit_creation':
    86                          (CommitCreation,),
    87                      'source_metarange':
    88                          (str,),
    89                  },
    90                  'attribute_map': {
    91                      'repository': 'repository',
    92                      'branch': 'branch',
    93                      'source_metarange': 'source_metarange',
    94                  },
    95                  'location_map': {
    96                      'repository': 'path',
    97                      'branch': 'path',
    98                      'commit_creation': 'body',
    99                      'source_metarange': 'query',
   100                  },
   101                  'collection_format_map': {
   102                  }
   103              },
   104              headers_map={
   105                  'accept': [
   106                      'application/json'
   107                  ],
   108                  'content_type': [
   109                      'application/json'
   110                  ]
   111              },
   112              api_client=api_client
   113          )
   114          self.get_commit_endpoint = _Endpoint(
   115              settings={
   116                  'response_type': (Commit,),
   117                  'auth': [
   118                      'basic_auth',
   119                      'cookie_auth',
   120                      'jwt_token',
   121                      'oidc_auth',
   122                      'saml_auth'
   123                  ],
   124                  'endpoint_path': '/repositories/{repository}/commits/{commitId}',
   125                  'operation_id': 'get_commit',
   126                  'http_method': 'GET',
   127                  'servers': None,
   128              },
   129              params_map={
   130                  'all': [
   131                      'repository',
   132                      'commit_id',
   133                  ],
   134                  'required': [
   135                      'repository',
   136                      'commit_id',
   137                  ],
   138                  'nullable': [
   139                  ],
   140                  'enum': [
   141                  ],
   142                  'validation': [
   143                  ]
   144              },
   145              root_map={
   146                  'validations': {
   147                  },
   148                  'allowed_values': {
   149                  },
   150                  'openapi_types': {
   151                      'repository':
   152                          (str,),
   153                      'commit_id':
   154                          (str,),
   155                  },
   156                  'attribute_map': {
   157                      'repository': 'repository',
   158                      'commit_id': 'commitId',
   159                  },
   160                  'location_map': {
   161                      'repository': 'path',
   162                      'commit_id': 'path',
   163                  },
   164                  'collection_format_map': {
   165                  }
   166              },
   167              headers_map={
   168                  'accept': [
   169                      'application/json'
   170                  ],
   171                  'content_type': [],
   172              },
   173              api_client=api_client
   174          )
   175  
   176      def commit(
   177          self,
   178          repository,
   179          branch,
   180          commit_creation,
   181          **kwargs
   182      ):
   183          """create commit  # noqa: E501
   184  
   185          This method makes a synchronous HTTP request by default. To make an
   186          asynchronous HTTP request, please pass async_req=True
   187  
   188          >>> thread = api.commit(repository, branch, commit_creation, async_req=True)
   189          >>> result = thread.get()
   190  
   191          Args:
   192              repository (str):
   193              branch (str):
   194              commit_creation (CommitCreation):
   195  
   196          Keyword Args:
   197              source_metarange (str): The source metarange to commit. Branch must not have uncommitted changes.. [optional]
   198              _return_http_data_only (bool): response data without head status
   199                  code and headers. Default is True.
   200              _preload_content (bool): if False, the urllib3.HTTPResponse object
   201                  will be returned without reading/decoding response data.
   202                  Default is True.
   203              _request_timeout (int/float/tuple): timeout setting for this request. If
   204                  one number provided, it will be total request timeout. It can also
   205                  be a pair (tuple) of (connection, read) timeouts.
   206                  Default is None.
   207              _check_input_type (bool): specifies if type checking
   208                  should be done one the data sent to the server.
   209                  Default is True.
   210              _check_return_type (bool): specifies if type checking
   211                  should be done one the data received from the server.
   212                  Default is True.
   213              _host_index (int/None): specifies the index of the server
   214                  that we want to use.
   215                  Default is read from the configuration.
   216              async_req (bool): execute request asynchronously
   217  
   218          Returns:
   219              Commit
   220                  If the method is called asynchronously, returns the request
   221                  thread.
   222          """
   223          kwargs['async_req'] = kwargs.get(
   224              'async_req', False
   225          )
   226          kwargs['_return_http_data_only'] = kwargs.get(
   227              '_return_http_data_only', True
   228          )
   229          kwargs['_preload_content'] = kwargs.get(
   230              '_preload_content', True
   231          )
   232          kwargs['_request_timeout'] = kwargs.get(
   233              '_request_timeout', None
   234          )
   235          kwargs['_check_input_type'] = kwargs.get(
   236              '_check_input_type', True
   237          )
   238          kwargs['_check_return_type'] = kwargs.get(
   239              '_check_return_type', True
   240          )
   241          kwargs['_host_index'] = kwargs.get('_host_index')
   242          kwargs['repository'] = \
   243              repository
   244          kwargs['branch'] = \
   245              branch
   246          kwargs['commit_creation'] = \
   247              commit_creation
   248          return self.commit_endpoint.call_with_http_info(**kwargs)
   249  
   250      def get_commit(
   251          self,
   252          repository,
   253          commit_id,
   254          **kwargs
   255      ):
   256          """get commit  # noqa: E501
   257  
   258          This method makes a synchronous HTTP request by default. To make an
   259          asynchronous HTTP request, please pass async_req=True
   260  
   261          >>> thread = api.get_commit(repository, commit_id, async_req=True)
   262          >>> result = thread.get()
   263  
   264          Args:
   265              repository (str):
   266              commit_id (str):
   267  
   268          Keyword Args:
   269              _return_http_data_only (bool): response data without head status
   270                  code and headers. Default is True.
   271              _preload_content (bool): if False, the urllib3.HTTPResponse object
   272                  will be returned without reading/decoding response data.
   273                  Default is True.
   274              _request_timeout (int/float/tuple): timeout setting for this request. If
   275                  one number provided, it will be total request timeout. It can also
   276                  be a pair (tuple) of (connection, read) timeouts.
   277                  Default is None.
   278              _check_input_type (bool): specifies if type checking
   279                  should be done one the data sent to the server.
   280                  Default is True.
   281              _check_return_type (bool): specifies if type checking
   282                  should be done one the data received from the server.
   283                  Default is True.
   284              _host_index (int/None): specifies the index of the server
   285                  that we want to use.
   286                  Default is read from the configuration.
   287              async_req (bool): execute request asynchronously
   288  
   289          Returns:
   290              Commit
   291                  If the method is called asynchronously, returns the request
   292                  thread.
   293          """
   294          kwargs['async_req'] = kwargs.get(
   295              'async_req', False
   296          )
   297          kwargs['_return_http_data_only'] = kwargs.get(
   298              '_return_http_data_only', True
   299          )
   300          kwargs['_preload_content'] = kwargs.get(
   301              '_preload_content', True
   302          )
   303          kwargs['_request_timeout'] = kwargs.get(
   304              '_request_timeout', None
   305          )
   306          kwargs['_check_input_type'] = kwargs.get(
   307              '_check_input_type', True
   308          )
   309          kwargs['_check_return_type'] = kwargs.get(
   310              '_check_return_type', True
   311          )
   312          kwargs['_host_index'] = kwargs.get('_host_index')
   313          kwargs['repository'] = \
   314              repository
   315          kwargs['commit_id'] = \
   316              commit_id
   317          return self.get_commit_endpoint.call_with_http_info(**kwargs)
   318