|
| 1 | +# coding: utf-8 |
| 2 | +# ----------------------------------------------------------------------------------- |
| 3 | +# <copyright company="Aspose" file="delete_structured_document_tag_online_request.py"> |
| 4 | +# Copyright (c) 2023 Aspose.Words for Cloud |
| 5 | +# </copyright> |
| 6 | +# <summary> |
| 7 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | +# of this software and associated documentation files (the "Software"), to deal |
| 9 | +# in the Software without restriction, including without limitation the rights |
| 10 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | +# copies of the Software, and to permit persons to whom the Software is |
| 12 | +# furnished to do so, subject to the following conditions: |
| 13 | +# |
| 14 | +# The above copyright notice and this permission notice shall be included in all |
| 15 | +# copies or substantial portions of the Software. |
| 16 | +# |
| 17 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | +# SOFTWARE. |
| 24 | +# </summary> |
| 25 | +# ----------------------------------------------------------------------------------- |
| 26 | +import json |
| 27 | + |
| 28 | +from six.moves.urllib.parse import quote |
| 29 | +from asposewordscloud import * |
| 30 | +from asposewordscloud.models import * |
| 31 | +from asposewordscloud.models.requests import * |
| 32 | +from asposewordscloud.models.responses import * |
| 33 | + |
| 34 | +class DeleteStructuredDocumentTagOnlineRequest(BaseRequestObject): |
| 35 | + """ |
| 36 | + Request model for delete_structured_document_tag_online operation. |
| 37 | + Initializes a new instance. |
| 38 | + :param document The document. |
| 39 | + :param index Object index. |
| 40 | + :param node_path The path to the node in the document tree. |
| 41 | + :param load_encoding Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML. |
| 42 | + :param password Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API. |
| 43 | + :param encrypted_password Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details. |
| 44 | + :param dest_file_name Result path of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document. |
| 45 | + :param revision_author Initials of the author to use for revisions.If you set this parameter and then make some changes to the document programmatically, save the document and later open the document in MS Word you will see these changes as revisions. |
| 46 | + :param revision_date_time The date and time to use for revisions. |
| 47 | + """ |
| 48 | + |
| 49 | + def __init__(self, document, index, node_path=None, load_encoding=None, password=None, encrypted_password=None, dest_file_name=None, revision_author=None, revision_date_time=None): |
| 50 | + self.document = document |
| 51 | + self.index = index |
| 52 | + self.node_path = node_path |
| 53 | + self.load_encoding = load_encoding |
| 54 | + self.password = password |
| 55 | + self.encrypted_password = encrypted_password |
| 56 | + self.dest_file_name = dest_file_name |
| 57 | + self.revision_author = revision_author |
| 58 | + self.revision_date_time = revision_date_time |
| 59 | + |
| 60 | + def create_http_request(self, api_client): |
| 61 | + # verify the required parameter 'document' is set |
| 62 | + if self.document is None: |
| 63 | + raise ValueError("Missing the required parameter `document` when calling `delete_structured_document_tag_online`") # noqa: E501 |
| 64 | + # verify the required parameter 'index' is set |
| 65 | + if self.index is None: |
| 66 | + raise ValueError("Missing the required parameter `index` when calling `delete_structured_document_tag_online`") # noqa: E501 |
| 67 | + |
| 68 | + path = '/v4.0/words/online/delete/{nodePath}/sdt/{index}' |
| 69 | + path_params = {} |
| 70 | + if self.index is not None: |
| 71 | + path_params['index'] = self.index # noqa: E501 |
| 72 | + else: |
| 73 | + path_params['index'] = '' # noqa: E501 |
| 74 | + if self.node_path is not None: |
| 75 | + path_params['nodePath'] = self.node_path # noqa: E501 |
| 76 | + else: |
| 77 | + path_params['nodePath'] = '' # noqa: E501 |
| 78 | + |
| 79 | + # path parameters |
| 80 | + collection_formats = {} |
| 81 | + if path_params: |
| 82 | + path_params = api_client.sanitize_for_serialization(path_params) |
| 83 | + path_params = api_client.parameters_to_tuples(path_params, collection_formats) |
| 84 | + for k, v in path_params: |
| 85 | + # specified safe chars, encode everything |
| 86 | + path = path.replace( |
| 87 | + '{%s}' % k, |
| 88 | + quote(str(v), safe=api_client.configuration.safe_chars_for_path_param) |
| 89 | + ) |
| 90 | + |
| 91 | + # remove optional path parameters |
| 92 | + path = path.replace('//', '/') |
| 93 | + |
| 94 | + query_params = [] |
| 95 | + if self.load_encoding is not None: |
| 96 | + query_params.append(('loadEncoding', self.load_encoding)) # noqa: E501 |
| 97 | + if self.password is not None: |
| 98 | + query_params.append(('password', self.password)) # noqa: E501 |
| 99 | + if self.encrypted_password is not None: |
| 100 | + query_params.append(('encryptedPassword', self.encrypted_password)) # noqa: E501 |
| 101 | + if self.dest_file_name is not None: |
| 102 | + query_params.append(('destFileName', self.dest_file_name)) # noqa: E501 |
| 103 | + if self.revision_author is not None: |
| 104 | + query_params.append(('revisionAuthor', self.revision_author)) # noqa: E501 |
| 105 | + if self.revision_date_time is not None: |
| 106 | + query_params.append(('revisionDateTime', self.revision_date_time)) # noqa: E501 |
| 107 | + |
| 108 | + header_params = {} |
| 109 | + # HTTP header `Content-Type` |
| 110 | + header_params['Content-Type'] = api_client.select_header_content_type( # noqa: E501 |
| 111 | + ['multipart/form-data']) # noqa: E501 |
| 112 | + |
| 113 | + file_content_params = [] |
| 114 | + form_params = [] |
| 115 | + if self.document is not None: |
| 116 | + form_params.append(['document', self.document, 'file']) # noqa: E501 |
| 117 | + |
| 118 | + for file_content_value in file_content_params: |
| 119 | + form_params.append([file_content_value.reference, file_content_value.content, 'file']) # noqa: E501 |
| 120 | + |
| 121 | + return { |
| 122 | + "method": "PUT", |
| 123 | + "path": path, |
| 124 | + "body": None, |
| 125 | + "query_params": query_params, |
| 126 | + "header_params": header_params, |
| 127 | + "form_params": form_params, |
| 128 | + "collection_formats": collection_formats, |
| 129 | + "response_type": 'files_collection' # noqa: E501 |
| 130 | + } |
| 131 | + |
| 132 | + def get_response_type(self): |
| 133 | + return 'files_collection' # noqa: E501 |
| 134 | + |
| 135 | + def deserialize_response(self, api_client, response): |
| 136 | + return api_client.deserialize_files_collection(response.data, response.getheaders()) |
0 commit comments