Пример #1
0
    def PutGenerateMultiple(self, name, file, **kwargs):
        """Generate image with multiple barcodes and put new file on server
        Args:
            name (str): New filename (required)

            format (str): Format of file (optional)

            folder (str): Folder to place file to (optional)

            file (File):  (required)

            

        Returns: SaaSposeResponse
        """

        allParams = dict.fromkeys(['name', 'format', 'folder', 'file'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method PutGenerateMultiple"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/barcode/{name}/generateMultiple/?appSid={appSid}&toFormat={toFormat}&folder={folder}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'name' in allParams and allParams['name'] is not None:
            resourcePath = resourcePath.replace("{" + "name" + "}",
                                                str(allParams['name']))
        else:
            resourcePath = re.sub("[&?]name.*?(?=&|\\?|$)", "", resourcePath)

        if 'format' in allParams and allParams['format'] is not None:
            resourcePath = resourcePath.replace("{" + "format" + "}",
                                                str(allParams['format']))
        else:
            resourcePath = re.sub("[&?]format.*?(?=&|\\?|$)", "", resourcePath)

        if 'folder' in allParams and allParams['folder'] is not None:
            resourcePath = resourcePath.replace("{" + "folder" + "}",
                                                str(allParams['folder']))
        else:
            resourcePath = re.sub("[&?]folder.*?(?=&|\\?|$)", "", resourcePath)

        method = 'PUT'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {'dto': open(file, 'rb')}
        bodyParam = None

        headerParams[
            'Accept'] = 'application/json,application/xml,application/octet-stream'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'SaaSposeResponse',
                    response.headers['Content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #2
0
    def GetEmailAttachment(self, name, attachName, **kwargs):
        """Get email attachment by name.
        Args:
            name (str): The email message name. (required)

            attachName (str): Attachment name. (required)

            storage (str): Message storage. (optional)

            folder (str): Message folder. (optional)

            

        Returns: ResponseMessage
        """

        allParams = dict.fromkeys(['name', 'attachName', 'storage', 'folder'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method GetEmailAttachment"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/email/{name}/attachments/{attachName}/?appSid={appSid}&storage={storage}&folder={folder}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'name' in allParams and allParams['name'] is not None:
            resourcePath = resourcePath.replace("{" + "name" + "}",
                                                str(allParams['name']))
        else:
            resourcePath = re.sub("[&?]name.*?(?=&|\\?|$)", "", resourcePath)

        if 'attachName' in allParams and allParams['attachName'] is not None:
            resourcePath = resourcePath.replace("{" + "attachName" + "}",
                                                str(allParams['attachName']))
        else:
            resourcePath = re.sub("[&?]attachName.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'folder' in allParams and allParams['folder'] is not None:
            resourcePath = resourcePath.replace("{" + "folder" + "}",
                                                str(allParams['folder']))
        else:
            resourcePath = re.sub("[&?]folder.*?(?=&|\\?|$)", "", resourcePath)

        method = 'GET'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'ResponseMessage',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #3
0
    def PutBarcodeGenerateFile(self, name, file, **kwargs):
        """Generate barcode and save on server.
        Args:
            name (str): The image name. (required)

            text (str): Barcode's text. (optional)

            type (str): The barcode type. (optional)

            format (str): The image format. (optional)

            resolutionX (float): Horizontal resolution. (optional)

            resolutionY (float): Vertical resolution. (optional)

            dimensionX (float): Smallest width of barcode unit (bar or space). (optional)

            dimensionY (float): Smallest height of barcode unit (for 2D barcodes). (optional)

            codeLocation (str): property of the barcode. (optional)

            grUnit (str): Measurement of barcode properties. (optional)

            autoSize (str): Sets if barcode size will be updated automatically. (optional)

            barHeight (float): Height of the bar. (optional)

            imageHeight (float): Height of the image. (optional)

            imageWidth (float): Width of the image. (optional)

            imageQuality (str): Detepmines  of the barcode image. (optional)

            rotAngle (float): Angle of barcode orientation. (optional)

            topMargin (float): Top margin. (optional)

            bottomMargin (float): Bottom margin. (optional)

            leftMargin (float): Left margin. (optional)

            rightMargin (float): Right margin. (optional)

            enableChecksum (str): Sets if checksum will be generated. (optional)

            storage (str): Image's storage. (optional)

            folder (str): Image's folder. (optional)

            file (File):  (required)

            

        Returns: SaaSposeResponse
        """

        allParams = dict.fromkeys([
            'name', 'text', 'type', 'format', 'resolutionX', 'resolutionY',
            'dimensionX', 'dimensionY', 'codeLocation', 'grUnit', 'autoSize',
            'barHeight', 'imageHeight', 'imageWidth', 'imageQuality',
            'rotAngle', 'topMargin', 'bottomMargin', 'leftMargin',
            'rightMargin', 'enableChecksum', 'storage', 'folder', 'file'
        ])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method PutBarcodeGenerateFile"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/barcode/{name}/generate/?appSid={appSid}&text={text}&type={type}&toFormat={toFormat}&resolutionX={resolutionX}&resolutionY={resolutionY}&dimensionX={dimensionX}&dimensionY={dimensionY}&codeLocation={codeLocation}&grUnit={grUnit}&autoSize={autoSize}&barHeight={barHeight}&imageHeight={imageHeight}&imageWidth={imageWidth}&imageQuality={imageQuality}&rotAngle={rotAngle}&topMargin={topMargin}&bottomMargin={bottomMargin}&leftMargin={leftMargin}&rightMargin={rightMargin}&enableChecksum={enableChecksum}&storage={storage}&folder={folder}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'name' in allParams and allParams['name'] is not None:
            resourcePath = resourcePath.replace("{" + "name" + "}",
                                                str(allParams['name']))
        else:
            resourcePath = re.sub("[&?]name.*?(?=&|\\?|$)", "", resourcePath)

        if 'text' in allParams and allParams['text'] is not None:
            resourcePath = resourcePath.replace("{" + "text" + "}",
                                                str(allParams['text']))
        else:
            resourcePath = re.sub("[&?]text.*?(?=&|\\?|$)", "", resourcePath)

        if 'type' in allParams and allParams['type'] is not None:
            resourcePath = resourcePath.replace("{" + "type" + "}",
                                                str(allParams['type']))
        else:
            resourcePath = re.sub("[&?]type.*?(?=&|\\?|$)", "", resourcePath)

        if 'format' in allParams and allParams['format'] is not None:
            resourcePath = resourcePath.replace("{" + "format" + "}",
                                                str(allParams['format']))
        else:
            resourcePath = re.sub("[&?]format.*?(?=&|\\?|$)", "", resourcePath)

        if 'resolutionX' in allParams and allParams['resolutionX'] is not None:
            resourcePath = resourcePath.replace("{" + "resolutionX" + "}",
                                                str(allParams['resolutionX']))
        else:
            resourcePath = re.sub("[&?]resolutionX.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'resolutionY' in allParams and allParams['resolutionY'] is not None:
            resourcePath = resourcePath.replace("{" + "resolutionY" + "}",
                                                str(allParams['resolutionY']))
        else:
            resourcePath = re.sub("[&?]resolutionY.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'dimensionX' in allParams and allParams['dimensionX'] is not None:
            resourcePath = resourcePath.replace("{" + "dimensionX" + "}",
                                                str(allParams['dimensionX']))
        else:
            resourcePath = re.sub("[&?]dimensionX.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'dimensionY' in allParams and allParams['dimensionY'] is not None:
            resourcePath = resourcePath.replace("{" + "dimensionY" + "}",
                                                str(allParams['dimensionY']))
        else:
            resourcePath = re.sub("[&?]dimensionY.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'codeLocation' in allParams and allParams[
                'codeLocation'] is not None:
            resourcePath = resourcePath.replace("{" + "codeLocation" + "}",
                                                str(allParams['codeLocation']))
        else:
            resourcePath = re.sub("[&?]codeLocation.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'grUnit' in allParams and allParams['grUnit'] is not None:
            resourcePath = resourcePath.replace("{" + "grUnit" + "}",
                                                str(allParams['grUnit']))
        else:
            resourcePath = re.sub("[&?]grUnit.*?(?=&|\\?|$)", "", resourcePath)

        if 'autoSize' in allParams and allParams['autoSize'] is not None:
            resourcePath = resourcePath.replace("{" + "autoSize" + "}",
                                                str(allParams['autoSize']))
        else:
            resourcePath = re.sub("[&?]autoSize.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'barHeight' in allParams and allParams['barHeight'] is not None:
            resourcePath = resourcePath.replace("{" + "barHeight" + "}",
                                                str(allParams['barHeight']))
        else:
            resourcePath = re.sub("[&?]barHeight.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'imageHeight' in allParams and allParams['imageHeight'] is not None:
            resourcePath = resourcePath.replace("{" + "imageHeight" + "}",
                                                str(allParams['imageHeight']))
        else:
            resourcePath = re.sub("[&?]imageHeight.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'imageWidth' in allParams and allParams['imageWidth'] is not None:
            resourcePath = resourcePath.replace("{" + "imageWidth" + "}",
                                                str(allParams['imageWidth']))
        else:
            resourcePath = re.sub("[&?]imageWidth.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'imageQuality' in allParams and allParams[
                'imageQuality'] is not None:
            resourcePath = resourcePath.replace("{" + "imageQuality" + "}",
                                                str(allParams['imageQuality']))
        else:
            resourcePath = re.sub("[&?]imageQuality.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'rotAngle' in allParams and allParams['rotAngle'] is not None:
            resourcePath = resourcePath.replace("{" + "rotAngle" + "}",
                                                str(allParams['rotAngle']))
        else:
            resourcePath = re.sub("[&?]rotAngle.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'topMargin' in allParams and allParams['topMargin'] is not None:
            resourcePath = resourcePath.replace("{" + "topMargin" + "}",
                                                str(allParams['topMargin']))
        else:
            resourcePath = re.sub("[&?]topMargin.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'bottomMargin' in allParams and allParams[
                'bottomMargin'] is not None:
            resourcePath = resourcePath.replace("{" + "bottomMargin" + "}",
                                                str(allParams['bottomMargin']))
        else:
            resourcePath = re.sub("[&?]bottomMargin.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'leftMargin' in allParams and allParams['leftMargin'] is not None:
            resourcePath = resourcePath.replace("{" + "leftMargin" + "}",
                                                str(allParams['leftMargin']))
        else:
            resourcePath = re.sub("[&?]leftMargin.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'rightMargin' in allParams and allParams['rightMargin'] is not None:
            resourcePath = resourcePath.replace("{" + "rightMargin" + "}",
                                                str(allParams['rightMargin']))
        else:
            resourcePath = re.sub("[&?]rightMargin.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'enableChecksum' in allParams and allParams[
                'enableChecksum'] is not None:
            resourcePath = resourcePath.replace(
                "{" + "enableChecksum" + "}", str(allParams['enableChecksum']))
        else:
            resourcePath = re.sub("[&?]enableChecksum.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'folder' in allParams and allParams['folder'] is not None:
            resourcePath = resourcePath.replace("{" + "folder" + "}",
                                                str(allParams['folder']))
        else:
            resourcePath = re.sub("[&?]folder.*?(?=&|\\?|$)", "", resourcePath)

        method = 'PUT'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}

        if file is not None:
            files = {'file': open(file, 'rb')}

        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'multipart/form-data'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'SaaSposeResponse',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #4
0
    def PutBarcodeRecognizeFromBody(self, name, body, **kwargs):
        """Recognition of a barcode from file on server with parameters in body.
        Args:
            name (str): The image name. (required)

            type (str): The barcode type. (optional)

            folder (str): The image folder. (optional)

            body (BarcodeReader): BarcodeReader object with parameters. (required)

            

        Returns: BarcodeResponseList
        """

        allParams = dict.fromkeys(['name', 'type', 'folder', 'body'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method PutBarcodeRecognizeFromBody"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/barcode/{name}/recognize/?appSid={appSid}&type={type}&folder={folder}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'name' in allParams and allParams['name'] is not None:
            resourcePath = resourcePath.replace("{" + "name" + "}",
                                                str(allParams['name']))
        else:
            resourcePath = re.sub("[&?]name.*?(?=&|\\?|$)", "", resourcePath)

        if 'type' in allParams and allParams['type'] is not None:
            resourcePath = resourcePath.replace("{" + "type" + "}",
                                                str(allParams['type']))
        else:
            resourcePath = re.sub("[&?]type.*?(?=&|\\?|$)", "", resourcePath)

        if 'folder' in allParams and allParams['folder'] is not None:
            resourcePath = resourcePath.replace("{" + "folder" + "}",
                                                str(allParams['folder']))
        else:
            resourcePath = re.sub("[&?]folder.*?(?=&|\\?|$)", "", resourcePath)

        method = 'PUT'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = body

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'BarcodeResponseList',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #5
0
    def GetIsExist(self, Path, **kwargs):
        """Check if a specific file or folder exists. Parameters: path - file or folder path e.g. /file.ext or /Folder1, versionID - file's version, storage - user's storage name.
        Args:
            Path (str):  (required)

            versionId (str):  (optional)

            storage (str):  (optional)

            

        Returns: FileExistResponse
        """

        allParams = dict.fromkeys(['Path', 'versionId', 'storage'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method GetIsExist"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/storage/exist/{path}/?appSid={appSid}&versionId={versionId}&storage={storage}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'Path' in allParams and allParams['Path'] is not None:
            resourcePath = resourcePath.replace("{" + "Path" + "}",
                                                str(allParams['Path']))
        else:
            resourcePath = re.sub("[&?]Path.*?(?=&|\\?|$)", "", resourcePath)

        if 'versionId' in allParams and allParams['versionId'] is not None:
            resourcePath = resourcePath.replace("{" + "versionId" + "}",
                                                str(allParams['versionId']))
        else:
            resourcePath = re.sub("[&?]versionId.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        method = 'GET'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'FileExistResponse',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #6
0
    def PostBarcodeRecognizeFromUrlorContent(self, file, **kwargs):
        """Recognize barcode from an url.
        Args:
            type (str): Barcode type. (optional)

            checksumValidation (str): Checksum validation parameter. (optional)

            stripFnc (bool): Allows to strip FNC symbol in recognition results. (optional)

            rotationAngle (int): Recognition of rotated barcode. Possible angles are 90, 180, 270, default is 0 (optional)

            url (str): The image file url. (optional)

            file (File):  (required)

            

        Returns: BarcodeResponseList
        """

        allParams = dict.fromkeys([
            'type', 'checksumValidation', 'stripFnc', 'rotationAngle', 'url',
            'file'
        ])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method PostBarcodeRecognizeFromUrlorContent"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/barcode/recognize/?appSid={appSid}&type={type}&checksumValidation={checksumValidation}&stripFnc={stripFnc}&rotationAngle={rotationAngle}&url={url}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'type' in allParams and allParams['type'] is not None:
            resourcePath = resourcePath.replace("{" + "type" + "}",
                                                str(allParams['type']))
        else:
            resourcePath = re.sub("[&?]type.*?(?=&|\\?|$)", "", resourcePath)

        if 'checksumValidation' in allParams and allParams[
                'checksumValidation'] is not None:
            resourcePath = resourcePath.replace(
                "{" + "checksumValidation" + "}",
                str(allParams['checksumValidation']))
        else:
            resourcePath = re.sub("[&?]checksumValidation.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'stripFnc' in allParams and allParams['stripFnc'] is not None:
            resourcePath = resourcePath.replace("{" + "stripFnc" + "}",
                                                str(allParams['stripFnc']))
        else:
            resourcePath = re.sub("[&?]stripFnc.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'rotationAngle' in allParams and allParams[
                'rotationAngle'] is not None:
            resourcePath = resourcePath.replace(
                "{" + "rotationAngle" + "}", str(allParams['rotationAngle']))
        else:
            resourcePath = re.sub("[&?]rotationAngle.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'url' in allParams and allParams['url'] is not None:
            resourcePath = resourcePath.replace("{" + "url" + "}",
                                                str(allParams['url']))
        else:
            resourcePath = re.sub("[&?]url.*?(?=&|\\?|$)", "", resourcePath)

        method = 'POST'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}

        if file is not None:
            files = {'file': open(file, 'rb')}

        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'multipart/form-data'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'BarcodeResponseList',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #7
0
    def GetDiscUsage(self, **kwargs):
        """Check the disk usage of the current account. Parameters: storage - user's storage name.
        Args:
            storage (str):  (optional)

            

        Returns: DiscUsageResponse
        """

        allParams = dict.fromkeys(['storage'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method GetDiscUsage"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/storage/disc/?appSid={appSid}&storage={storage}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        method = 'GET'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'DiscUsageResponse',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #8
0
    def GetRecognizeDocument(self, name, **kwargs):
        """Recognize image text, language and text region can be selected, default dictionaries can be used for correction.
        Args:
            name (str): Name of the file to recognize. (required)

            language (str): Language of the document. (optional)

            rectX (int): Top left point X coordinate of  to recognize text inside. (optional)

            rectY (int): Top left point Y coordinate of  to recognize text inside. (optional)

            rectWidth (int): Width of  to recognize text inside. (optional)

            rectHeight (int): Height of  to recognize text inside. (optional)

            useDefaultDictionaries (bool): Use default dictionaries for result correction. (optional)

            storage (str): Image's storage. (optional)

            folder (str): Image's folder. (optional)

            

        Returns: OCRResponse
        """

        allParams = dict.fromkeys([
            'name', 'language', 'rectX', 'rectY', 'rectWidth', 'rectHeight',
            'useDefaultDictionaries', 'storage', 'folder'
        ])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method GetRecognizeDocument"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/ocr/{name}/recognize/?appSid={appSid}&language={language}&rectX={rectX}&rectY={rectY}&rectWidth={rectWidth}&rectHeight={rectHeight}&useDefaultDictionaries={useDefaultDictionaries}&storage={storage}&folder={folder}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'name' in allParams and allParams['name'] is not None:
            resourcePath = resourcePath.replace("{" + "name" + "}",
                                                str(allParams['name']))
        else:
            resourcePath = re.sub("[&?]name.*?(?=&|\\?|$)", "", resourcePath)

        if 'language' in allParams and allParams['language'] is not None:
            resourcePath = resourcePath.replace("{" + "language" + "}",
                                                str(allParams['language']))
        else:
            resourcePath = re.sub("[&?]language.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'rectX' in allParams and allParams['rectX'] is not None:
            resourcePath = resourcePath.replace("{" + "rectX" + "}",
                                                str(allParams['rectX']))
        else:
            resourcePath = re.sub("[&?]rectX.*?(?=&|\\?|$)", "", resourcePath)

        if 'rectY' in allParams and allParams['rectY'] is not None:
            resourcePath = resourcePath.replace("{" + "rectY" + "}",
                                                str(allParams['rectY']))
        else:
            resourcePath = re.sub("[&?]rectY.*?(?=&|\\?|$)", "", resourcePath)

        if 'rectWidth' in allParams and allParams['rectWidth'] is not None:
            resourcePath = resourcePath.replace("{" + "rectWidth" + "}",
                                                str(allParams['rectWidth']))
        else:
            resourcePath = re.sub("[&?]rectWidth.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'rectHeight' in allParams and allParams['rectHeight'] is not None:
            resourcePath = resourcePath.replace("{" + "rectHeight" + "}",
                                                str(allParams['rectHeight']))
        else:
            resourcePath = re.sub("[&?]rectHeight.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'useDefaultDictionaries' in allParams and allParams[
                'useDefaultDictionaries'] is not None:
            resourcePath = resourcePath.replace(
                "{" + "useDefaultDictionaries" + "}",
                str(allParams['useDefaultDictionaries']))
        else:
            resourcePath = re.sub("[&?]useDefaultDictionaries.*?(?=&|\\?|$)",
                                  "", resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'folder' in allParams and allParams['folder'] is not None:
            resourcePath = resourcePath.replace("{" + "folder" + "}",
                                                str(allParams['folder']))
        else:
            resourcePath = re.sub("[&?]folder.*?(?=&|\\?|$)", "", resourcePath)

        method = 'GET'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'OCRResponse',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #9
0
    def GetListFiles(self, **kwargs):
        """Get the file listing of a specific folder. Parametres: path - start with name of storage e.g. root folder '/'or some folder '/folder1/..', storage - user's storage name.
        Args:
            Path (str):  (optional)

            storage (str):  (optional)

            

        Returns: FilesResponse
        """

        allParams = dict.fromkeys(['Path', 'storage'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method GetListFiles"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/storage/folder/{path}/?appSid={appSid}&storage={storage}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'Path' in allParams and allParams['Path'] is not None:
            resourcePath = resourcePath.replace("{" + "Path" + "}",
                                                str(allParams['Path']))
        else:
            resourcePath = re.sub("[&?]Path.*?(?=&|\\?|$)", "", resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        method = 'GET'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'FilesResponse',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #10
0
    def PutCopyFolder(self, Path, newdest, **kwargs):
        """Copy a folder. Parameters: path - source folder path e.g. /Folder1, storage - user's source storage name, newdest - destination folder path e.g. /Folder2, destStorage - user's destination storage name.
        Args:
            Path (str):  (required)

            newdest (str):  (required)

            storage (str):  (optional)

            destStorage (str):  (optional)

            

        Returns: ResponseMessage
        """

        allParams = dict.fromkeys(
            ['Path', 'newdest', 'storage', 'destStorage'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method PutCopyFolder"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/storage/folder/{path}/?appSid={appSid}&newdest={newdest}&storage={storage}&destStorage={destStorage}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'Path' in allParams and allParams['Path'] is not None:
            resourcePath = resourcePath.replace("{" + "Path" + "}",
                                                str(allParams['Path']))
        else:
            resourcePath = re.sub("[&?]Path.*?(?=&|\\?|$)", "", resourcePath)

        if 'newdest' in allParams and allParams['newdest'] is not None:
            resourcePath = resourcePath.replace("{" + "newdest" + "}",
                                                str(allParams['newdest']))
        else:
            resourcePath = re.sub("[&?]newdest.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'destStorage' in allParams and allParams['destStorage'] is not None:
            resourcePath = resourcePath.replace("{" + "destStorage" + "}",
                                                str(allParams['destStorage']))
        else:
            resourcePath = re.sub("[&?]destStorage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        method = 'PUT'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'ResponseMessage',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #11
0
    def DeleteFolder(self, Path, **kwargs):
        """Remove a specific folder. Parameters: path - folder path e.g. /Folder1, storage - user's storage name, recursive - is subfolders and files must be deleted for specified path.
        Args:
            Path (str):  (required)

            storage (str):  (optional)

            recursive (bool):  (optional)

            

        Returns: RemoveFolderResponse
        """

        allParams = dict.fromkeys(['Path', 'storage', 'recursive'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method DeleteFolder"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/storage/folder/{path}/?appSid={appSid}&storage={storage}&recursive={recursive}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'Path' in allParams and allParams['Path'] is not None:
            resourcePath = resourcePath.replace("{" + "Path" + "}",
                                                str(allParams['Path']))
        else:
            resourcePath = re.sub("[&?]Path.*?(?=&|\\?|$)", "", resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'recursive' in allParams and allParams['recursive'] is not None:
            resourcePath = resourcePath.replace("{" + "recursive" + "}",
                                                str(allParams['recursive']))
        else:
            resourcePath = re.sub("[&?]recursive.*?(?=&|\\?|$)", "",
                                  resourcePath)

        method = 'DELETE'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'RemoveFolderResponse',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #12
0
    def PutCreate(self, Path, file, **kwargs):
        """Upload a specific file. Parameters: path - source file path e.g. /file.ext, versionID - source file's version, storage - user's source storage name, newdest - destination file path, destStorage - user's destination storage name.
        Args:
            Path (str):  (required)

            versionId (str):  (optional)

            storage (str):  (optional)

            file (File):  (required)

            

        Returns: ResponseMessage
        """

        allParams = dict.fromkeys(['Path', 'versionId', 'storage', 'file'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method PutCreate"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/storage/file/{path}/?appSid={appSid}&versionId={versionId}&storage={storage}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'Path' in allParams and allParams['Path'] is not None:
            resourcePath = resourcePath.replace("{" + "Path" + "}",
                                                str(allParams['Path']))
        else:
            resourcePath = re.sub("[&?]Path.*?(?=&|\\?|$)", "", resourcePath)

        if 'versionId' in allParams and allParams['versionId'] is not None:
            resourcePath = resourcePath.replace("{" + "versionId" + "}",
                                                str(allParams['versionId']))
        else:
            resourcePath = re.sub("[&?]versionId.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        method = 'PUT'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {'file': open(file, 'rb')}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'multipart/form-data'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'ResponseMessage',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #13
0
    def PostMoveFile(self, src, dest, **kwargs):
        """Move a specific file.
        Args:
            src (str): source file path e.g. /file.ext (required)

            dest (str):  (required)

            versionId (str): source file's version, (optional)

            storage (str): user's source storage name (optional)

            destStorage (str): user's destination storage name (optional)

            

        Returns: MoveFileResponse
        """

        allParams = dict.fromkeys(
            ['src', 'dest', 'versionId', 'storage', 'destStorage'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method PostMoveFile"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/storage/file/{src}/?dest={dest}&appSid={appSid}&versionId={versionId}&storage={storage}&destStorage={destStorage}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'src' in allParams and allParams['src'] is not None:
            resourcePath = resourcePath.replace("{" + "src" + "}",
                                                str(allParams['src']))
        else:
            resourcePath = re.sub("[&?]src.*?(?=&|\\?|$)", "", resourcePath)

        if 'dest' in allParams and allParams['dest'] is not None:
            resourcePath = resourcePath.replace("{" + "dest" + "}",
                                                str(allParams['dest']))
        else:
            resourcePath = re.sub("[&?]dest.*?(?=&|\\?|$)", "", resourcePath)

        if 'versionId' in allParams and allParams['versionId'] is not None:
            resourcePath = resourcePath.replace("{" + "versionId" + "}",
                                                str(allParams['versionId']))
        else:
            resourcePath = re.sub("[&?]versionId.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'destStorage' in allParams and allParams['destStorage'] is not None:
            resourcePath = resourcePath.replace("{" + "destStorage" + "}",
                                                str(allParams['destStorage']))
        else:
            resourcePath = re.sub("[&?]destStorage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        method = 'POST'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'MoveFileResponse',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #14
0
    def PutSetEmailProperty(self, name, propertyName, body, **kwargs):
        """Set document property.
        Args:
            name (str):  (required)

            propertyName (str):  (required)

            storage (str):  (optional)

            folder (str):  (optional)

            body (EmailProperty):  (required)

            

        Returns: EmailPropertyResponse
        """

        allParams = dict.fromkeys(
            ['name', 'propertyName', 'storage', 'folder', 'body'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method PutSetEmailProperty"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/email/{name}/properties/{propertyName}/?appSid={appSid}&storage={storage}&folder={folder}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'name' in allParams and allParams['name'] is not None:
            resourcePath = resourcePath.replace("{" + "name" + "}",
                                                str(allParams['name']))
        else:
            resourcePath = re.sub("[&?]name.*?(?=&|\\?|$)", "", resourcePath)

        if 'propertyName' in allParams and allParams[
                'propertyName'] is not None:
            resourcePath = resourcePath.replace("{" + "propertyName" + "}",
                                                str(allParams['propertyName']))
        else:
            resourcePath = re.sub("[&?]propertyName.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'folder' in allParams and allParams['folder'] is not None:
            resourcePath = resourcePath.replace("{" + "folder" + "}",
                                                str(allParams['folder']))
        else:
            resourcePath = re.sub("[&?]folder.*?(?=&|\\?|$)", "", resourcePath)

        method = 'PUT'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = body

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'EmailPropertyResponse',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #15
0
    def GetBarcodeRecognize(self, name, **kwargs):
        """Recognize barcode from a file on server.
        Args:
            name (str): The image name. (required)

            type (str): The barcode type. (optional)

            checksumValidation (str): Checksum validation parameter. (optional)

            stripFnc (bool): Allows to strip FNC symbol in recognition results. (optional)

            rotationAngle (int): Allows to correct angle of barcode. (optional)

            barcodesCount (int): Count of barcodes to recognize. (optional)

            rectX (int): Top left point X coordinate of  to recognize barcode inside. (optional)

            rectY (int): Top left point Y coordinate of  to recognize barcode inside. (optional)

            rectWidth (int): Width of  to recognize barcode inside. (optional)

            rectHeight (int): Height of  to recognize barcode inside. (optional)

            storage (str): The image storage. (optional)

            folder (str): The image folder. (optional)

            

        Returns: BarcodeResponseList
        """

        allParams = dict.fromkeys([
            'name', 'type', 'checksumValidation', 'stripFnc', 'rotationAngle',
            'barcodesCount', 'rectX', 'rectY', 'rectWidth', 'rectHeight',
            'storage', 'folder'
        ])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method GetBarcodeRecognize"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/barcode/{name}/recognize/?appSid={appSid}&type={type}&checksumValidation={checksumValidation}&stripFnc={stripFnc}&rotationAngle={rotationAngle}&barcodesCount={barcodesCount}&rectX={rectX}&rectY={rectY}&rectWidth={rectWidth}&rectHeight={rectHeight}&storage={storage}&folder={folder}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'name' in allParams and allParams['name'] is not None:
            resourcePath = resourcePath.replace("{" + "name" + "}",
                                                str(allParams['name']))
        else:
            resourcePath = re.sub("[&?]name.*?(?=&|\\?|$)", "", resourcePath)

        if 'type' in allParams and allParams['type'] is not None:
            resourcePath = resourcePath.replace("{" + "type" + "}",
                                                str(allParams['type']))
        else:
            resourcePath = re.sub("[&?]type.*?(?=&|\\?|$)", "", resourcePath)

        if 'checksumValidation' in allParams and allParams[
                'checksumValidation'] is not None:
            resourcePath = resourcePath.replace(
                "{" + "checksumValidation" + "}",
                str(allParams['checksumValidation']))
        else:
            resourcePath = re.sub("[&?]checksumValidation.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'stripFnc' in allParams and allParams['stripFnc'] is not None:
            resourcePath = resourcePath.replace("{" + "stripFnc" + "}",
                                                str(allParams['stripFnc']))
        else:
            resourcePath = re.sub("[&?]stripFnc.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'rotationAngle' in allParams and allParams[
                'rotationAngle'] is not None:
            resourcePath = resourcePath.replace(
                "{" + "rotationAngle" + "}", str(allParams['rotationAngle']))
        else:
            resourcePath = re.sub("[&?]rotationAngle.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'barcodesCount' in allParams and allParams[
                'barcodesCount'] is not None:
            resourcePath = resourcePath.replace(
                "{" + "barcodesCount" + "}", str(allParams['barcodesCount']))
        else:
            resourcePath = re.sub("[&?]barcodesCount.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'rectX' in allParams and allParams['rectX'] is not None:
            resourcePath = resourcePath.replace("{" + "rectX" + "}",
                                                str(allParams['rectX']))
        else:
            resourcePath = re.sub("[&?]rectX.*?(?=&|\\?|$)", "", resourcePath)

        if 'rectY' in allParams and allParams['rectY'] is not None:
            resourcePath = resourcePath.replace("{" + "rectY" + "}",
                                                str(allParams['rectY']))
        else:
            resourcePath = re.sub("[&?]rectY.*?(?=&|\\?|$)", "", resourcePath)

        if 'rectWidth' in allParams and allParams['rectWidth'] is not None:
            resourcePath = resourcePath.replace("{" + "rectWidth" + "}",
                                                str(allParams['rectWidth']))
        else:
            resourcePath = re.sub("[&?]rectWidth.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'rectHeight' in allParams and allParams['rectHeight'] is not None:
            resourcePath = resourcePath.replace("{" + "rectHeight" + "}",
                                                str(allParams['rectHeight']))
        else:
            resourcePath = re.sub("[&?]rectHeight.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'folder' in allParams and allParams['folder'] is not None:
            resourcePath = resourcePath.replace("{" + "folder" + "}",
                                                str(allParams['folder']))
        else:
            resourcePath = re.sub("[&?]folder.*?(?=&|\\?|$)", "", resourcePath)

        method = 'GET'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'BarcodeResponseList',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #16
0
    def GetDocumentWithFormat(self, name, format, **kwargs):
        """Convert mail message to target format.
        Args:
            name (str): File name. (required)

            format (str): Target format. (required)

            storage (str): The document storage. (optional)

            folder (str): Folder path. (optional)

            outPath (str): Path to save result (optional)

            

        Returns: ResponseMessage
        """

        allParams = dict.fromkeys(
            ['name', 'format', 'storage', 'folder', 'outPath'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method GetDocumentWithFormat"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/email/{name}/?appSid={appSid}&toFormat={toFormat}&storage={storage}&folder={folder}&outPath={outPath}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'name' in allParams and allParams['name'] is not None:
            resourcePath = resourcePath.replace("{" + "name" + "}",
                                                str(allParams['name']))
        else:
            resourcePath = re.sub("[&?]name.*?(?=&|\\?|$)", "", resourcePath)

        if 'format' in allParams and allParams['format'] is not None:
            resourcePath = resourcePath.replace("{" + "format" + "}",
                                                str(allParams['format']))
        else:
            resourcePath = re.sub("[&?]format.*?(?=&|\\?|$)", "", resourcePath)

        if 'storage' in allParams and allParams['storage'] is not None:
            resourcePath = resourcePath.replace("{" + "storage" + "}",
                                                str(allParams['storage']))
        else:
            resourcePath = re.sub("[&?]storage.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'folder' in allParams and allParams['folder'] is not None:
            resourcePath = resourcePath.replace("{" + "folder" + "}",
                                                str(allParams['folder']))
        else:
            resourcePath = re.sub("[&?]folder.*?(?=&|\\?|$)", "", resourcePath)

        if 'outPath' in allParams and allParams['outPath'] is not None:
            resourcePath = resourcePath.replace("{" + "outPath" + "}",
                                                str(allParams['outPath']))
        else:
            resourcePath = re.sub("[&?]outPath.*?(?=&|\\?|$)", "",
                                  resourcePath)

        method = 'GET'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/octet-stream'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'ResponseMessage',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #17
0
    def GetBarcodeGenerate(self, **kwargs):
        """Generate barcode.
        Args:
            text (str): The code text. (optional)

            type (str): Barcode type. (optional)

            format (str): Result format. (optional)

            resolutionX (float): Horizontal resolution. (optional)

            resolutionY (float): Vertical resolution. (optional)

            dimensionX (float): Smallest width of barcode unit (bar or space). (optional)

            dimensionY (float): Smallest height of barcode unit (for 2D barcodes). (optional)

            enableChecksum (str): Sets if checksum will be generated. (optional)

            

        Returns: ResponseMessage
        """

        allParams = dict.fromkeys([
            'text', 'type', 'format', 'resolutionX', 'resolutionY',
            'dimensionX', 'dimensionY', 'enableChecksum'
        ])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method GetBarcodeGenerate"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/barcode/generate/?appSid={appSid}&text={text}&type={type}&toFormat={toFormat}&resolutionX={resolutionX}&resolutionY={resolutionY}&dimensionX={dimensionX}&dimensionY={dimensionY}&enableChecksum={enableChecksum}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'text' in allParams and allParams['text'] is not None:
            resourcePath = resourcePath.replace("{" + "text" + "}",
                                                str(allParams['text']))
        else:
            resourcePath = re.sub("[&?]text.*?(?=&|\\?|$)", "", resourcePath)

        if 'type' in allParams and allParams['type'] is not None:
            resourcePath = resourcePath.replace("{" + "type" + "}",
                                                str(allParams['type']))
        else:
            resourcePath = re.sub("[&?]type.*?(?=&|\\?|$)", "", resourcePath)

        if 'format' in allParams and allParams['format'] is not None:
            resourcePath = resourcePath.replace("{" + "format" + "}",
                                                str(allParams['format']))
        else:
            resourcePath = re.sub("[&?]format.*?(?=&|\\?|$)", "", resourcePath)

        if 'resolutionX' in allParams and allParams['resolutionX'] is not None:
            resourcePath = resourcePath.replace("{" + "resolutionX" + "}",
                                                str(allParams['resolutionX']))
        else:
            resourcePath = re.sub("[&?]resolutionX.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'resolutionY' in allParams and allParams['resolutionY'] is not None:
            resourcePath = resourcePath.replace("{" + "resolutionY" + "}",
                                                str(allParams['resolutionY']))
        else:
            resourcePath = re.sub("[&?]resolutionY.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'dimensionX' in allParams and allParams['dimensionX'] is not None:
            resourcePath = resourcePath.replace("{" + "dimensionX" + "}",
                                                str(allParams['dimensionX']))
        else:
            resourcePath = re.sub("[&?]dimensionX.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'dimensionY' in allParams and allParams['dimensionY'] is not None:
            resourcePath = resourcePath.replace("{" + "dimensionY" + "}",
                                                str(allParams['dimensionY']))
        else:
            resourcePath = re.sub("[&?]dimensionY.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'enableChecksum' in allParams and allParams[
                'enableChecksum'] is not None:
            resourcePath = resourcePath.replace(
                "{" + "enableChecksum" + "}", str(allParams['enableChecksum']))
        else:
            resourcePath = re.sub("[&?]enableChecksum.*?(?=&|\\?|$)", "",
                                  resourcePath)

        method = 'GET'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/octet-stream'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'ResponseMessage',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #18
0
    def PostOcrFromUrlOrContent(self, file, **kwargs):
        """Recognize image text from some url if provided or from the request body content, language can be selected, default dictionaries can be used for correction.
        Args:
            url (str): The image file url. (optional)

            language (str): Language of the document. (optional)

            useDefaultDictionaries (bool): Use default dictionaries for result correction. (optional)

            file (File):  (required)

            

        Returns: OCRResponse
        """

        allParams = dict.fromkeys(
            ['url', 'language', 'useDefaultDictionaries', 'file'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method PostOcrFromUrlOrContent"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/ocr/recognize/?appSid={appSid}&url={url}&language={language}&useDefaultDictionaries={useDefaultDictionaries}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'url' in allParams and allParams['url'] is not None:
            resourcePath = resourcePath.replace("{" + "url" + "}",
                                                str(allParams['url']))
        else:
            resourcePath = re.sub("[&?]url.*?(?=&|\\?|$)", "", resourcePath)

        if 'language' in allParams and allParams['language'] is not None:
            resourcePath = resourcePath.replace("{" + "language" + "}",
                                                str(allParams['language']))
        else:
            resourcePath = re.sub("[&?]language.*?(?=&|\\?|$)", "",
                                  resourcePath)

        if 'useDefaultDictionaries' in allParams and allParams[
                'useDefaultDictionaries'] is not None:
            resourcePath = resourcePath.replace(
                "{" + "useDefaultDictionaries" + "}",
                str(allParams['useDefaultDictionaries']))
        else:
            resourcePath = re.sub("[&?]useDefaultDictionaries.*?(?=&|\\?|$)",
                                  "", resourcePath)

        method = 'POST'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}

        if file is not None:
            files = {'file': open(file, 'rb')}

        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'multipart/form-data'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'OCRResponse',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)
Пример #19
0
    def GetIsStorageExist(self, name, **kwargs):
        """Check if a specific storage exists.
        Args:
            name (str): Storage name (required)

            

        Returns: StorageExistResponse
        """

        allParams = dict.fromkeys(['name'])

        params = locals()
        for (key, val) in params['kwargs'].iteritems():
            if key not in allParams:
                raise TypeError(
                    "Got an unexpected keyword argument '%s' to method GetIsStorageExist"
                    % key)
            params[key] = val

        for (key, val) in params.iteritems():
            if key in allParams:
                allParams[key] = val

        resourcePath = '/storage/{name}/exist/?appSid={appSid}'

        resourcePath = resourcePath.replace('&', '&').replace(
            "/?", "?").replace("toFormat={toFormat}",
                               "format={format}").replace("{path}", "{Path}")

        if 'name' in allParams and allParams['name'] is not None:
            resourcePath = resourcePath.replace("{" + "name" + "}",
                                                str(allParams['name']))
        else:
            resourcePath = re.sub("[&?]name.*?(?=&|\\?|$)", "", resourcePath)

        method = 'GET'
        queryParams = {}
        headerParams = {}
        formParams = {}
        files = {}
        bodyParam = None

        headerParams['Accept'] = 'application/xml,application/json'
        headerParams['Content-Type'] = 'application/json'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath,
                                          method,
                                          queryParams,
                                          postData,
                                          headerParams,
                                          files=files)

        try:
            if response.status_code in [200, 201, 202]:
                responseObject = self.apiClient.pre_deserialize(
                    response.content, 'StorageExistResponse',
                    response.headers['content-type'])
                return responseObject
            else:
                raise ApiException(response.status_code, response.content)
        except Exception:
            raise ApiException(response.status_code, response.content)