class LicenseApi(object): """ GroupDocs.Merger Cloud API :param configuration: API configuration """ def __init__(self, configuration): api_client = ApiClient(configuration) self.auth = Auth(configuration, api_client) self.api_client = api_client self.configuration = configuration def close(self): # noqa: E501 """ Closes thread pool. This method should be called when methods are executed asynchronously (is_async=True is passed as parameter) and this instance of LicenseApi is not going to be used any more. """ if self.api_client is not None: if (self.api_client.pool is not None): self.api_client.pool.close() self.api_client.pool.join() self.api_client.pool = None @classmethod def from_keys(cls, app_sid, app_key): """ Initializes new instance of LicenseApi with API keys :param app_sid Application identifier (App SID) :param app_key Application private key (App Key) """ configuration = Configuration(app_sid, app_key) return LicenseApi(configuration) @classmethod def from_config(cls, configuration): """ Initializes new instance of LicenseApi with configuration options :param configuration API configuration """ return LicenseApi(configuration) def get_consumption_credit(self, **kwargs): # noqa: E501 """Get license consumption # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :return: ConsumptionResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._get_consumption_credit_with_http_info( **kwargs) # noqa: E501 (data) = self._get_consumption_credit_with_http_info( **kwargs) # noqa: E501 return data def _get_consumption_credit_with_http_info(self, **kwargs): # noqa: E501 """Get license consumption # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :return: ConsumptionResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method get_consumption_credit" % key) params[key] = val del params['kwargs'] collection_formats = {} path = '/merger/consumption' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'GET', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'ConsumptionResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def __downcase_first_letter(self, s): if len(s) == 0: return str else: return s[0].lower() + s[1:]
def __init__(self, configuration): api_client = ApiClient(configuration) self.auth = Auth(configuration, api_client) self.api_client = api_client self.configuration = configuration
class SecurityApi(object): """ GroupDocs.Merger Cloud API :param configuration: API configuration """ def __init__(self, configuration): api_client = ApiClient(configuration) self.auth = Auth(configuration, api_client) self.api_client = api_client self.configuration = configuration def close(self): # noqa: E501 """ Closes thread pool. This method should be called when methods are executed asynchronously (is_async=True is passed as parameter) and this instance of SecurityApi is not going to be used any more. """ if self.api_client is not None: if (self.api_client.pool is not None): self.api_client.pool.close() self.api_client.pool.join() self.api_client.pool = None @classmethod def from_keys(cls, app_sid, app_key): """ Initializes new instance of SecurityApi with API keys :param app_sid Application identifier (App SID) :param app_key Application private key (App Key) """ configuration = Configuration(app_sid, app_key) return SecurityApi(configuration) @classmethod def from_config(cls, configuration): """ Initializes new instance of SecurityApi with configuration options :param configuration API configuration """ return SecurityApi(configuration) def add_password(self, request, **kwargs): # noqa: E501 """Add document password protection # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param Options options: Options to specify document name and new password (required) :return: DocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._add_password_with_http_info(request, **kwargs) # noqa: E501 (data) = self._add_password_with_http_info(request, **kwargs) # noqa: E501 return data def _add_password_with_http_info(self, request, **kwargs): # noqa: E501 """Add document password protection # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param AddPasswordRequest request object with parameters :return: DocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method add_password" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `add_password`" ) # noqa: E501 collection_formats = {} path = '/merger/password' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'PUT', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'DocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def check_password(self, request, **kwargs): # noqa: E501 """Checks whether document is password protected # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param str file_path: File path (required) :param str storage_name: Storage name :param str version_id: Version Id :return: PasswordResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._check_password_with_http_info(request, **kwargs) # noqa: E501 (data) = self._check_password_with_http_info(request, **kwargs) # noqa: E501 return data def _check_password_with_http_info(self, request, **kwargs): # noqa: E501 """Checks whether document is password protected # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param CheckPasswordRequest request object with parameters :return: PasswordResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method check_password" % key) params[key] = val del params['kwargs'] # verify the required parameter 'file_path' is set if request.file_path is None: raise ValueError( "Missing the required parameter `file_path` when calling `check_password`" ) # noqa: E501 collection_formats = {} path = '/merger/password' path_params = {} query_params = [] if self.__downcase_first_letter('filePath') in path: path = path.replace( '{' + self.__downcase_first_letter('filePath' + '}'), request.file_path if request.file_path is not None else '') else: if request.file_path is not None: query_params.append((self.__downcase_first_letter('filePath'), request.file_path)) # noqa: E501 if self.__downcase_first_letter('storageName') in path: path = path.replace( '{' + self.__downcase_first_letter('storageName' + '}'), request.storage_name if request.storage_name is not None else '') else: if request.storage_name is not None: query_params.append( (self.__downcase_first_letter('storageName'), request.storage_name)) # noqa: E501 if self.__downcase_first_letter('versionId') in path: path = path.replace( '{' + self.__downcase_first_letter('versionId' + '}'), request.version_id if request.version_id is not None else '') else: if request.version_id is not None: query_params.append((self.__downcase_first_letter('versionId'), request.version_id)) # noqa: E501 header_params = {} form_params = [] local_var_files = [] body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'GET', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'PasswordResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def remove_password(self, request, **kwargs): # noqa: E501 """Remove document password protection # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param Options options: Options to specify document name and current password (required) :return: DocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._remove_password_with_http_info(request, **kwargs) # noqa: E501 (data) = self._remove_password_with_http_info(request, **kwargs) # noqa: E501 return data def _remove_password_with_http_info(self, request, **kwargs): # noqa: E501 """Remove document password protection # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param RemovePasswordRequest request object with parameters :return: DocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method remove_password" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `remove_password`" ) # noqa: E501 collection_formats = {} path = '/merger/password' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'DELETE', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'DocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def update_password(self, request, **kwargs): # noqa: E501 """Update document password # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param UpdatePasswordOptions options: Options to specify document name, current and new password (required) :return: DocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._update_password_with_http_info(request, **kwargs) # noqa: E501 (data) = self._update_password_with_http_info(request, **kwargs) # noqa: E501 return data def _update_password_with_http_info(self, request, **kwargs): # noqa: E501 """Update document password # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param UpdatePasswordRequest request object with parameters :return: DocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method update_password" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `update_password`" ) # noqa: E501 collection_formats = {} path = '/merger/password' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'POST', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'DocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def __downcase_first_letter(self, s): if len(s) == 0: return str else: return s[0].lower() + s[1:]
class StorageApi(object): """ GroupDocs.Merger Cloud API :param configuration: API configuration """ def __init__(self, configuration): api_client = ApiClient(configuration) self.auth = Auth(configuration, api_client) self.api_client = api_client self.configuration = configuration def close(self): # noqa: E501 """ Closes thread pool. This method should be called when methods are executed asynchronously (is_async=True is passed as parameter) and this instance of StorageApi is not going to be used any more. """ if self.api_client is not None: if(self.api_client.pool is not None): self.api_client.pool.close() self.api_client.pool.join() self.api_client.pool = None @classmethod def from_keys(cls, app_sid, app_key): """ Initializes new instance of StorageApi with API keys :param app_sid Application identifier (App SID) :param app_key Application private key (App Key) """ configuration = Configuration(app_sid, app_key) return StorageApi(configuration) @classmethod def from_config(cls, configuration): """ Initializes new instance of StorageApi with configuration options :param configuration API configuration """ return StorageApi(configuration) def get_disc_usage(self, request,**kwargs): # noqa: E501 """Get disc usage # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param str storage_name: Storage name :return: DiscUsage If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._get_disc_usage_with_http_info(request, **kwargs) # noqa: E501 (data) = self._get_disc_usage_with_http_info(request, **kwargs) # noqa: E501 return data def _get_disc_usage_with_http_info(self, request, **kwargs): # noqa: E501 """Get disc usage # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param GetDiscUsageRequest request object with parameters :return: DiscUsage If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_disc_usage" % key ) params[key] = val del params['kwargs'] collection_formats = {} path = '/merger/storage/disc' path_params = {} query_params = [] if self.__downcase_first_letter('storageName') in path: path = path.replace('{' + self.__downcase_first_letter('storageName' + '}'), request.storage_name if request.storage_name is not None else '') else: if request.storage_name is not None: query_params.append((self.__downcase_first_letter('storageName'), request.storage_name)) # noqa: E501 header_params = {} form_params = [] local_var_files = [] body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path':path, 'method':'GET', 'path_params':path_params, 'query_params':query_params, 'header_params':header_params, 'body':body_params, 'post_params':form_params, 'files':local_var_files, 'response_type':'DiscUsage', # noqa: E501 'auth_settings':self.auth.get_auth_settings(), 'is_async':params.get('is_async'), '_return_http_data_only':params.get('_return_http_data_only'), '_preload_content':params.get('_preload_content', True), '_request_timeout':params.get('_request_timeout'), 'collection_formats':collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def get_file_versions(self, request,**kwargs): # noqa: E501 """Get file versions # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param str path: File path e.g. '/file.ext' (required) :param str storage_name: Storage name :return: FileVersions If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._get_file_versions_with_http_info(request, **kwargs) # noqa: E501 (data) = self._get_file_versions_with_http_info(request, **kwargs) # noqa: E501 return data def _get_file_versions_with_http_info(self, request, **kwargs): # noqa: E501 """Get file versions # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param GetFileVersionsRequest request object with parameters :return: FileVersions If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_file_versions" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'path' is set if request.path is None: raise ValueError("Missing the required parameter `path` when calling `get_file_versions`") # noqa: E501 collection_formats = {} path = '/merger/storage/version/{path}' path_params = {} if request.path is not None: path_params[self.__downcase_first_letter('path')] = request.path # noqa: E501 query_params = [] if self.__downcase_first_letter('storageName') in path: path = path.replace('{' + self.__downcase_first_letter('storageName' + '}'), request.storage_name if request.storage_name is not None else '') else: if request.storage_name is not None: query_params.append((self.__downcase_first_letter('storageName'), request.storage_name)) # noqa: E501 header_params = {} form_params = [] local_var_files = [] body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path':path, 'method':'GET', 'path_params':path_params, 'query_params':query_params, 'header_params':header_params, 'body':body_params, 'post_params':form_params, 'files':local_var_files, 'response_type':'FileVersions', # noqa: E501 'auth_settings':self.auth.get_auth_settings(), 'is_async':params.get('is_async'), '_return_http_data_only':params.get('_return_http_data_only'), '_preload_content':params.get('_preload_content', True), '_request_timeout':params.get('_request_timeout'), 'collection_formats':collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def object_exists(self, request,**kwargs): # noqa: E501 """Check if file or folder exists # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param str path: File or folder path e.g. '/file.ext' or '/folder' (required) :param str storage_name: Storage name :param str version_id: File version ID :return: ObjectExist If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._object_exists_with_http_info(request, **kwargs) # noqa: E501 (data) = self._object_exists_with_http_info(request, **kwargs) # noqa: E501 return data def _object_exists_with_http_info(self, request, **kwargs): # noqa: E501 """Check if file or folder exists # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param ObjectExistsRequest request object with parameters :return: ObjectExist If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method object_exists" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'path' is set if request.path is None: raise ValueError("Missing the required parameter `path` when calling `object_exists`") # noqa: E501 collection_formats = {} path = '/merger/storage/exist/{path}' path_params = {} if request.path is not None: path_params[self.__downcase_first_letter('path')] = request.path # noqa: E501 query_params = [] if self.__downcase_first_letter('storageName') in path: path = path.replace('{' + self.__downcase_first_letter('storageName' + '}'), request.storage_name if request.storage_name is not None else '') else: if request.storage_name is not None: query_params.append((self.__downcase_first_letter('storageName'), request.storage_name)) # noqa: E501 if self.__downcase_first_letter('versionId') in path: path = path.replace('{' + self.__downcase_first_letter('versionId' + '}'), request.version_id if request.version_id is not None else '') else: if request.version_id is not None: query_params.append((self.__downcase_first_letter('versionId'), request.version_id)) # noqa: E501 header_params = {} form_params = [] local_var_files = [] body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path':path, 'method':'GET', 'path_params':path_params, 'query_params':query_params, 'header_params':header_params, 'body':body_params, 'post_params':form_params, 'files':local_var_files, 'response_type':'ObjectExist', # noqa: E501 'auth_settings':self.auth.get_auth_settings(), 'is_async':params.get('is_async'), '_return_http_data_only':params.get('_return_http_data_only'), '_preload_content':params.get('_preload_content', True), '_request_timeout':params.get('_request_timeout'), 'collection_formats':collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def storage_exists(self, request,**kwargs): # noqa: E501 """Check if storage exists # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param str storage_name: Storage name (required) :return: StorageExist If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._storage_exists_with_http_info(request, **kwargs) # noqa: E501 (data) = self._storage_exists_with_http_info(request, **kwargs) # noqa: E501 return data def _storage_exists_with_http_info(self, request, **kwargs): # noqa: E501 """Check if storage exists # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param StorageExistsRequest request object with parameters :return: StorageExist If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method storage_exists" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'storage_name' is set if request.storage_name is None: raise ValueError("Missing the required parameter `storage_name` when calling `storage_exists`") # noqa: E501 collection_formats = {} path = '/merger/storage/{storageName}/exist' path_params = {} if request.storage_name is not None: path_params[self.__downcase_first_letter('storageName')] = request.storage_name # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path':path, 'method':'GET', 'path_params':path_params, 'query_params':query_params, 'header_params':header_params, 'body':body_params, 'post_params':form_params, 'files':local_var_files, 'response_type':'StorageExist', # noqa: E501 'auth_settings':self.auth.get_auth_settings(), 'is_async':params.get('is_async'), '_return_http_data_only':params.get('_return_http_data_only'), '_preload_content':params.get('_preload_content', True), '_request_timeout':params.get('_request_timeout'), 'collection_formats':collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def __downcase_first_letter(self, s): if len(s) == 0: return str else: return s[0].lower() + s[1:]
class PagesApi(object): """ GroupDocs.Merger Cloud API :param configuration: API configuration """ def __init__(self, configuration): api_client = ApiClient(configuration) self.auth = Auth(configuration, api_client) self.api_client = api_client self.configuration = configuration def close(self): # noqa: E501 """ Closes thread pool. This method should be called when methods are executed asynchronously (is_async=True is passed as parameter) and this instance of PagesApi is not going to be used any more. """ if self.api_client is not None: if (self.api_client.pool is not None): self.api_client.pool.close() self.api_client.pool.join() self.api_client.pool = None @classmethod def from_keys(cls, app_sid, app_key): """ Initializes new instance of PagesApi with API keys :param app_sid Application identifier (App SID) :param app_key Application private key (App Key) """ configuration = Configuration(app_sid, app_key) return PagesApi(configuration) @classmethod def from_config(cls, configuration): """ Initializes new instance of PagesApi with configuration options :param configuration API configuration """ return PagesApi(configuration) def extract(self, request, **kwargs): # noqa: E501 """Make new document with some pages from source document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param ExtractOptions options: Extract options (required) :return: DocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._extract_with_http_info(request, **kwargs) # noqa: E501 (data) = self._extract_with_http_info(request, **kwargs) # noqa: E501 return data def _extract_with_http_info(self, request, **kwargs): # noqa: E501 """Make new document with some pages from source document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param ExtractRequest request object with parameters :return: DocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method extract" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `extract`" ) # noqa: E501 collection_formats = {} path = '/merger/pages/extract' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'POST', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'DocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def move(self, request, **kwargs): # noqa: E501 """Move page to a new position within document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param MoveOptions options: Move options (required) :return: DocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._move_with_http_info(request, **kwargs) # noqa: E501 (data) = self._move_with_http_info(request, **kwargs) # noqa: E501 return data def _move_with_http_info(self, request, **kwargs): # noqa: E501 """Move page to a new position within document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param MoveRequest request object with parameters :return: DocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method move" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `move`" ) # noqa: E501 collection_formats = {} path = '/merger/pages/move' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'POST', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'DocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def orientation(self, request, **kwargs): # noqa: E501 """Make new document and apply new orientation mode for specified pages # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param OrientationOptions options: Orientation options (required) :return: DocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._orientation_with_http_info(request, **kwargs) # noqa: E501 (data) = self._orientation_with_http_info(request, **kwargs) # noqa: E501 return data def _orientation_with_http_info(self, request, **kwargs): # noqa: E501 """Make new document and apply new orientation mode for specified pages # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param OrientationRequest request object with parameters :return: DocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method orientation" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `orientation`" ) # noqa: E501 collection_formats = {} path = '/merger/pages/orientation' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'POST', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'DocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def remove(self, request, **kwargs): # noqa: E501 """Remove pages from document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param RemoveOptions options: Remove options (required) :return: DocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._remove_with_http_info(request, **kwargs) # noqa: E501 (data) = self._remove_with_http_info(request, **kwargs) # noqa: E501 return data def _remove_with_http_info(self, request, **kwargs): # noqa: E501 """Remove pages from document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param RemoveRequest request object with parameters :return: DocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method remove" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `remove`" ) # noqa: E501 collection_formats = {} path = '/merger/pages/remove' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'POST', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'DocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def rotate(self, request, **kwargs): # noqa: E501 """Rotate pages in document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param RotateOptions options: Rotate options (required) :return: DocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._rotate_with_http_info(request, **kwargs) # noqa: E501 (data) = self._rotate_with_http_info(request, **kwargs) # noqa: E501 return data def _rotate_with_http_info(self, request, **kwargs): # noqa: E501 """Rotate pages in document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param RotateRequest request object with parameters :return: DocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method rotate" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `rotate`" ) # noqa: E501 collection_formats = {} path = '/merger/pages/rotate' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'POST', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'DocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def swap(self, request, **kwargs): # noqa: E501 """Swap two pages within document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param SwapOptions options: Swap options (required) :return: DocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._swap_with_http_info(request, **kwargs) # noqa: E501 (data) = self._swap_with_http_info(request, **kwargs) # noqa: E501 return data def _swap_with_http_info(self, request, **kwargs): # noqa: E501 """Swap two pages within document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param SwapRequest request object with parameters :return: DocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method swap" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `swap`" ) # noqa: E501 collection_formats = {} path = '/merger/pages/swap' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'POST', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'DocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def __downcase_first_letter(self, s): if len(s) == 0: return str else: return s[0].lower() + s[1:]
class DocumentApi(object): """ GroupDocs.Merger Cloud API :param configuration: API configuration """ def __init__(self, configuration): api_client = ApiClient(configuration) self.auth = Auth(configuration, api_client) self.api_client = api_client self.configuration = configuration def close(self): # noqa: E501 """ Closes thread pool. This method should be called when methods are executed asynchronously (is_async=True is passed as parameter) and this instance of DocumentApi is not going to be used any more. """ if self.api_client is not None: if (self.api_client.pool is not None): self.api_client.pool.close() self.api_client.pool.join() self.api_client.pool = None @classmethod def from_keys(cls, app_sid, app_key): """ Initializes new instance of DocumentApi with API keys :param app_sid Application identifier (App SID) :param app_key Application private key (App Key) """ configuration = Configuration(app_sid, app_key) return DocumentApi(configuration) @classmethod def from_config(cls, configuration): """ Initializes new instance of DocumentApi with configuration options :param configuration API configuration """ return DocumentApi(configuration) def call_import(self, request, **kwargs): # noqa: E501 """Import attachments into pdf document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param ImportOptions options: Import options (required) :return: DocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._call_import_with_http_info(request, **kwargs) # noqa: E501 (data) = self._call_import_with_http_info(request, **kwargs) # noqa: E501 return data def _call_import_with_http_info(self, request, **kwargs): # noqa: E501 """Import attachments into pdf document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param CallImportRequest request object with parameters :return: DocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method call_import" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `call_import`" ) # noqa: E501 collection_formats = {} path = '/merger/import' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'POST', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'DocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def join(self, request, **kwargs): # noqa: E501 """Join multiple documents into one document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param JoinOptions options: Join options (required) :return: DocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._join_with_http_info(request, **kwargs) # noqa: E501 (data) = self._join_with_http_info(request, **kwargs) # noqa: E501 return data def _join_with_http_info(self, request, **kwargs): # noqa: E501 """Join multiple documents into one document # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param JoinRequest request object with parameters :return: DocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method join" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `join`" ) # noqa: E501 collection_formats = {} path = '/merger/join' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'POST', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'DocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def preview(self, request, **kwargs): # noqa: E501 """Generate document pages preview # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param PreviewOptions options: Preview options (required) :return: MultiDocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._preview_with_http_info(request, **kwargs) # noqa: E501 (data) = self._preview_with_http_info(request, **kwargs) # noqa: E501 return data def _preview_with_http_info(self, request, **kwargs): # noqa: E501 """Generate document pages preview # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param PreviewRequest request object with parameters :return: MultiDocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method preview" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `preview`" ) # noqa: E501 collection_formats = {} path = '/merger/preview' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'POST', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'MultiDocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def split(self, request, **kwargs): # noqa: E501 """Split single document to multiple documents # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param SplitOptions options: SplitOptions (required) :return: MultiDocumentResult If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._split_with_http_info(request, **kwargs) # noqa: E501 (data) = self._split_with_http_info(request, **kwargs) # noqa: E501 return data def _split_with_http_info(self, request, **kwargs): # noqa: E501 """Split single document to multiple documents # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param SplitRequest request object with parameters :return: MultiDocumentResult If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method split" % key) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if request.options is None: raise ValueError( "Missing the required parameter `options` when calling `split`" ) # noqa: E501 collection_formats = {} path = '/merger/split' path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = [] body_params = None if request.options is not None: body_params = request.options # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'POST', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'MultiDocumentResult', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def __downcase_first_letter(self, s): if len(s) == 0: return str else: return s[0].lower() + s[1:]
class FolderApi(object): """ GroupDocs.Merger Cloud API :param configuration: API configuration """ def __init__(self, configuration): api_client = ApiClient(configuration) self.auth = Auth(configuration, api_client) self.api_client = api_client self.configuration = configuration def close(self): # noqa: E501 """ Closes thread pool. This method should be called when methods are executed asynchronously (is_async=True is passed as parameter) and this instance of FolderApi is not going to be used any more. """ if self.api_client is not None: if (self.api_client.pool is not None): self.api_client.pool.close() self.api_client.pool.join() self.api_client.pool = None @classmethod def from_keys(cls, app_sid, app_key): """ Initializes new instance of FolderApi with API keys :param app_sid Application identifier (App SID) :param app_key Application private key (App Key) """ configuration = Configuration(app_sid, app_key) return FolderApi(configuration) @classmethod def from_config(cls, configuration): """ Initializes new instance of FolderApi with configuration options :param configuration API configuration """ return FolderApi(configuration) def copy_folder(self, request, **kwargs): # noqa: E501 """Copy folder # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param str src_path: Source folder path e.g. '/src' (required) :param str dest_path: Destination folder path e.g. '/dst' (required) :param str src_storage_name: Source storage name :param str dest_storage_name: Destination storage name :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._copy_folder_with_http_info(request, **kwargs) # noqa: E501 self._copy_folder_with_http_info(request, **kwargs) # noqa: E501 def _copy_folder_with_http_info(self, request, **kwargs): # noqa: E501 """Copy folder # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param CopyFolderRequest request object with parameters :return: None If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method copy_folder" % key) params[key] = val del params['kwargs'] # verify the required parameter 'src_path' is set if request.src_path is None: raise ValueError( "Missing the required parameter `src_path` when calling `copy_folder`" ) # noqa: E501 # verify the required parameter 'dest_path' is set if request.dest_path is None: raise ValueError( "Missing the required parameter `dest_path` when calling `copy_folder`" ) # noqa: E501 collection_formats = {} path = '/merger/storage/folder/copy/{srcPath}' path_params = {} if request.src_path is not None: path_params[self.__downcase_first_letter( 'srcPath')] = request.src_path # noqa: E501 query_params = [] if self.__downcase_first_letter('destPath') in path: path = path.replace( '{' + self.__downcase_first_letter('destPath' + '}'), request.dest_path if request.dest_path is not None else '') else: if request.dest_path is not None: query_params.append((self.__downcase_first_letter('destPath'), request.dest_path)) # noqa: E501 if self.__downcase_first_letter('srcStorageName') in path: path = path.replace( '{' + self.__downcase_first_letter('srcStorageName' + '}'), request.src_storage_name if request.src_storage_name is not None else '') else: if request.src_storage_name is not None: query_params.append( (self.__downcase_first_letter('srcStorageName'), request.src_storage_name)) # noqa: E501 if self.__downcase_first_letter('destStorageName') in path: path = path.replace( '{' + self.__downcase_first_letter('destStorageName' + '}'), request.dest_storage_name if request.dest_storage_name is not None else '') else: if request.dest_storage_name is not None: query_params.append( (self.__downcase_first_letter('destStorageName'), request.dest_storage_name)) # noqa: E501 header_params = {} form_params = [] local_var_files = [] body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'PUT', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': None, # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def create_folder(self, request, **kwargs): # noqa: E501 """Create the folder # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param str path: Folder path to create e.g. 'folder_1/folder_2/' (required) :param str storage_name: Storage name :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._create_folder_with_http_info(request, **kwargs) # noqa: E501 self._create_folder_with_http_info(request, **kwargs) # noqa: E501 def _create_folder_with_http_info(self, request, **kwargs): # noqa: E501 """Create the folder # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param CreateFolderRequest request object with parameters :return: None If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method create_folder" % key) params[key] = val del params['kwargs'] # verify the required parameter 'path' is set if request.path is None: raise ValueError( "Missing the required parameter `path` when calling `create_folder`" ) # noqa: E501 collection_formats = {} path = '/merger/storage/folder/{path}' path_params = {} if request.path is not None: path_params[self.__downcase_first_letter( 'path')] = request.path # noqa: E501 query_params = [] if self.__downcase_first_letter('storageName') in path: path = path.replace( '{' + self.__downcase_first_letter('storageName' + '}'), request.storage_name if request.storage_name is not None else '') else: if request.storage_name is not None: query_params.append( (self.__downcase_first_letter('storageName'), request.storage_name)) # noqa: E501 header_params = {} form_params = [] local_var_files = [] body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'PUT', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': None, # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def delete_folder(self, request, **kwargs): # noqa: E501 """Delete folder # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param str path: Folder path e.g. '/folder' (required) :param str storage_name: Storage name :param bool recursive: Enable to delete folders, subfolders and files :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._delete_folder_with_http_info(request, **kwargs) # noqa: E501 self._delete_folder_with_http_info(request, **kwargs) # noqa: E501 def _delete_folder_with_http_info(self, request, **kwargs): # noqa: E501 """Delete folder # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param DeleteFolderRequest request object with parameters :return: None If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method delete_folder" % key) params[key] = val del params['kwargs'] # verify the required parameter 'path' is set if request.path is None: raise ValueError( "Missing the required parameter `path` when calling `delete_folder`" ) # noqa: E501 collection_formats = {} path = '/merger/storage/folder/{path}' path_params = {} if request.path is not None: path_params[self.__downcase_first_letter( 'path')] = request.path # noqa: E501 query_params = [] if self.__downcase_first_letter('storageName') in path: path = path.replace( '{' + self.__downcase_first_letter('storageName' + '}'), request.storage_name if request.storage_name is not None else '') else: if request.storage_name is not None: query_params.append( (self.__downcase_first_letter('storageName'), request.storage_name)) # noqa: E501 if self.__downcase_first_letter('recursive') in path: path = path.replace( '{' + self.__downcase_first_letter('recursive' + '}'), request.recursive if request.recursive is not None else '') else: if request.recursive is not None: query_params.append((self.__downcase_first_letter('recursive'), request.recursive)) # noqa: E501 header_params = {} form_params = [] local_var_files = [] body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'DELETE', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': None, # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def get_files_list(self, request, **kwargs): # noqa: E501 """Get all files and folders within a folder # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param str path: Folder path e.g. '/folder' (required) :param str storage_name: Storage name :return: FilesList If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._get_files_list_with_http_info(request, **kwargs) # noqa: E501 (data) = self._get_files_list_with_http_info(request, **kwargs) # noqa: E501 return data def _get_files_list_with_http_info(self, request, **kwargs): # noqa: E501 """Get all files and folders within a folder # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param GetFilesListRequest request object with parameters :return: FilesList If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method get_files_list" % key) params[key] = val del params['kwargs'] # verify the required parameter 'path' is set if request.path is None: raise ValueError( "Missing the required parameter `path` when calling `get_files_list`" ) # noqa: E501 collection_formats = {} path = '/merger/storage/folder/{path}' path_params = {} if request.path is not None: path_params[self.__downcase_first_letter( 'path')] = request.path # noqa: E501 query_params = [] if self.__downcase_first_letter('storageName') in path: path = path.replace( '{' + self.__downcase_first_letter('storageName' + '}'), request.storage_name if request.storage_name is not None else '') else: if request.storage_name is not None: query_params.append( (self.__downcase_first_letter('storageName'), request.storage_name)) # noqa: E501 header_params = {} form_params = [] local_var_files = [] body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'GET', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': 'FilesList', # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def move_folder(self, request, **kwargs): # noqa: E501 """Move folder # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param str src_path: Folder path to move e.g. '/folder' (required) :param str dest_path: Destination folder path to move to e.g '/dst' (required) :param str src_storage_name: Source storage name :param str dest_storage_name: Destination storage name :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('is_async'): return self._move_folder_with_http_info(request, **kwargs) # noqa: E501 self._move_folder_with_http_info(request, **kwargs) # noqa: E501 def _move_folder_with_http_info(self, request, **kwargs): # noqa: E501 """Move folder # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass is_async=True :param is_async bool :param MoveFolderRequest request object with parameters :return: None If the method is called asynchronously, returns the request thread. """ params = locals() params['is_async'] = '' params['_return_http_data_only'] = False params['_preload_content'] = True params['_request_timeout'] = '' for key, val in six.iteritems(params['kwargs']): if key not in params: raise TypeError("Got an unexpected keyword argument '%s'" " to method move_folder" % key) params[key] = val del params['kwargs'] # verify the required parameter 'src_path' is set if request.src_path is None: raise ValueError( "Missing the required parameter `src_path` when calling `move_folder`" ) # noqa: E501 # verify the required parameter 'dest_path' is set if request.dest_path is None: raise ValueError( "Missing the required parameter `dest_path` when calling `move_folder`" ) # noqa: E501 collection_formats = {} path = '/merger/storage/folder/move/{srcPath}' path_params = {} if request.src_path is not None: path_params[self.__downcase_first_letter( 'srcPath')] = request.src_path # noqa: E501 query_params = [] if self.__downcase_first_letter('destPath') in path: path = path.replace( '{' + self.__downcase_first_letter('destPath' + '}'), request.dest_path if request.dest_path is not None else '') else: if request.dest_path is not None: query_params.append((self.__downcase_first_letter('destPath'), request.dest_path)) # noqa: E501 if self.__downcase_first_letter('srcStorageName') in path: path = path.replace( '{' + self.__downcase_first_letter('srcStorageName' + '}'), request.src_storage_name if request.src_storage_name is not None else '') else: if request.src_storage_name is not None: query_params.append( (self.__downcase_first_letter('srcStorageName'), request.src_storage_name)) # noqa: E501 if self.__downcase_first_letter('destStorageName') in path: path = path.replace( '{' + self.__downcase_first_letter('destStorageName' + '}'), request.dest_storage_name if request.dest_storage_name is not None else '') else: if request.dest_storage_name is not None: query_params.append( (self.__downcase_first_letter('destStorageName'), request.dest_storage_name)) # noqa: E501 header_params = {} form_params = [] local_var_files = [] body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params[ 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 call_kwargs = { 'resource_path': path, 'method': 'PUT', 'path_params': path_params, 'query_params': query_params, 'header_params': header_params, 'body': body_params, 'post_params': form_params, 'files': local_var_files, 'response_type': None, # noqa: E501 'auth_settings': self.auth.get_auth_settings(), 'is_async': params.get('is_async'), '_return_http_data_only': params.get('_return_http_data_only'), '_preload_content': params.get('_preload_content', True), '_request_timeout': params.get('_request_timeout'), 'collection_formats': collection_formats } return self.api_client.call_api(**call_kwargs) # noqa: E501 def __downcase_first_letter(self, s): if len(s) == 0: return str else: return s[0].lower() + s[1:]