Skip to content

Commit 1cdaa49

Browse files
SDK regenerated by CI server [ci skip]
1 parent 0abe6e8 commit 1cdaa49

File tree

5 files changed

+556
-1
lines changed

5 files changed

+556
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This repository contains Aspose.Words Cloud SDK for Swift source code. This SDK
1616
## Enhancements in Version 23.12
1717

1818
- Properties Name, Text, StartRange, EndRange marked as required for InsertBookmark operation.
19+
- Implemented DeleteOfficeMathObjects operation to delete all office math objects from document.
1920

2021

2122
## Enhancements in Version 23.11

Sources/AsposeWordsCloud/Api/WordsAPI.swift

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3307,6 +3307,101 @@ public class WordsAPI : Encryptor {
33073307
return responseObject!;
33083308
}
33093309

3310+
// Async representation of deleteOfficeMathObjects method
3311+
// Removes all office math objects from the document.
3312+
public func deleteOfficeMathObjects(request : DeleteOfficeMathObjectsRequest, callback : @escaping (_ error : Error?) -> ()) {
3313+
do {
3314+
if (self.apiInvoker == nil) {
3315+
#if os(Linux)
3316+
self.apiInvoker = ApiInvoker(configuration: configuration);
3317+
#else
3318+
self.apiInvoker = ApiInvoker(configuration: configuration, encryptor: self);
3319+
#endif
3320+
}
3321+
3322+
apiInvoker!.invoke(
3323+
apiRequestData: try request.createApiRequestData(apiInvoker: self.apiInvoker!, configuration: self.configuration),
3324+
callback: { response, headers, error in
3325+
callback(error);
3326+
}
3327+
);
3328+
}
3329+
catch let error {
3330+
callback(error);
3331+
}
3332+
}
3333+
3334+
// Sync representation of deleteOfficeMathObjects method
3335+
// Removes all office math objects from the document.
3336+
public func deleteOfficeMathObjects(request : DeleteOfficeMathObjectsRequest) throws {
3337+
let semaphore = DispatchSemaphore(value: 0);
3338+
var responseError : Error? = nil;
3339+
self.deleteOfficeMathObjects(request : request, callback: { error in
3340+
responseError = error;
3341+
semaphore.signal();
3342+
});
3343+
3344+
_ = semaphore.wait();
3345+
3346+
if (responseError != nil) {
3347+
throw responseError!;
3348+
}
3349+
}
3350+
3351+
// Async representation of deleteOfficeMathObjectsOnline method
3352+
// Removes all office math objects from the document.
3353+
public func deleteOfficeMathObjectsOnline(request : DeleteOfficeMathObjectsOnlineRequest, callback : @escaping (_ response : [String: Data]?, _ error : Error?) -> ()) {
3354+
do {
3355+
if (self.apiInvoker == nil) {
3356+
#if os(Linux)
3357+
self.apiInvoker = ApiInvoker(configuration: configuration);
3358+
#else
3359+
self.apiInvoker = ApiInvoker(configuration: configuration, encryptor: self);
3360+
#endif
3361+
}
3362+
3363+
apiInvoker!.invoke(
3364+
apiRequestData: try request.createApiRequestData(apiInvoker: self.apiInvoker!, configuration: self.configuration),
3365+
callback: { response, headers, error in
3366+
if (error != nil) {
3367+
callback(nil, error);
3368+
}
3369+
else {
3370+
do {
3371+
callback(try request.deserializeResponse(data: response!, headers: headers) as? [String: Data], nil);
3372+
}
3373+
catch let deserializeError {
3374+
callback(nil, deserializeError);
3375+
}
3376+
}
3377+
}
3378+
);
3379+
}
3380+
catch let error {
3381+
callback(nil, error);
3382+
}
3383+
}
3384+
3385+
// Sync representation of deleteOfficeMathObjectsOnline method
3386+
// Removes all office math objects from the document.
3387+
public func deleteOfficeMathObjectsOnline(request : DeleteOfficeMathObjectsOnlineRequest) throws -> [String: Data] {
3388+
let semaphore = DispatchSemaphore(value: 0);
3389+
var responseObject : [String: Data]? = nil;
3390+
var responseError : Error? = nil;
3391+
self.deleteOfficeMathObjectsOnline(request : request, callback: { response, error in
3392+
responseObject = response;
3393+
responseError = error;
3394+
semaphore.signal();
3395+
});
3396+
3397+
_ = semaphore.wait();
3398+
3399+
if (responseError != nil) {
3400+
throw responseError!;
3401+
}
3402+
return responseObject!;
3403+
}
3404+
33103405
// Async representation of deleteParagraph method
33113406
// Removes a paragraph from the document node.
33123407
public func deleteParagraph(request : DeleteParagraphRequest, callback : @escaping (_ error : Error?) -> ()) {
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="DeleteOfficeMathObjectsOnlineRequest.swift">
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+
*/
27+
28+
import Foundation
29+
30+
// Request model for deleteOfficeMathObjectsOnline operation.
31+
@available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *)
32+
public class DeleteOfficeMathObjectsOnlineRequest : WordsApiRequest {
33+
private let document : InputStream;
34+
private let loadEncoding : String?;
35+
private let password : String?;
36+
private let encryptedPassword : String?;
37+
private let destFileName : String?;
38+
private let revisionAuthor : String?;
39+
private let revisionDateTime : String?;
40+
41+
private enum CodingKeys: String, CodingKey {
42+
case document;
43+
case loadEncoding;
44+
case password;
45+
case encryptedPassword;
46+
case destFileName;
47+
case revisionAuthor;
48+
case revisionDateTime;
49+
case invalidCodingKey;
50+
}
51+
52+
// Initializes a new instance of the DeleteOfficeMathObjectsOnlineRequest class.
53+
public init(document : InputStream, loadEncoding : String? = nil, password : String? = nil, encryptedPassword : String? = nil, destFileName : String? = nil, revisionAuthor : String? = nil, revisionDateTime : String? = nil) {
54+
self.document = document;
55+
self.loadEncoding = loadEncoding;
56+
self.password = password;
57+
self.encryptedPassword = encryptedPassword;
58+
self.destFileName = destFileName;
59+
self.revisionAuthor = revisionAuthor;
60+
self.revisionDateTime = revisionDateTime;
61+
}
62+
63+
// The document.
64+
public func getDocument() -> InputStream {
65+
return self.document;
66+
}
67+
68+
// Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
69+
public func getLoadEncoding() -> String? {
70+
return self.loadEncoding;
71+
}
72+
73+
// 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.
74+
public func getPassword() -> String? {
75+
return self.password;
76+
}
77+
78+
// Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
79+
public func getEncryptedPassword() -> String? {
80+
return self.encryptedPassword;
81+
}
82+
83+
// 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.
84+
public func getDestFileName() -> String? {
85+
return self.destFileName;
86+
}
87+
88+
// 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.
89+
public func getRevisionAuthor() -> String? {
90+
return self.revisionAuthor;
91+
}
92+
93+
// The date and time to use for revisions.
94+
public func getRevisionDateTime() -> String? {
95+
return self.revisionDateTime;
96+
}
97+
98+
// Creates the api request data
99+
public func createApiRequestData(apiInvoker : ApiInvoker, configuration : Configuration) throws -> WordsApiRequestData {
100+
var rawPath = "/words/online/delete/OfficeMathObjects";
101+
rawPath = rawPath.replacingOccurrences(of: "//", with: "/");
102+
103+
let urlPath = (try configuration.getApiRootUrl()).appendingPathComponent(rawPath);
104+
var urlBuilder = URLComponents(url: urlPath, resolvingAgainstBaseURL: false)!;
105+
var queryItems : [URLQueryItem] = [];
106+
if (self.getLoadEncoding() != nil) {
107+
108+
#if os(Linux)
109+
queryItems.append(URLQueryItem(name: "loadEncoding", value: try ObjectSerializer.serializeToString(value: self.getLoadEncoding()!)));
110+
111+
#else
112+
queryItems.append(URLQueryItem(name: "loadEncoding", value: try ObjectSerializer.serializeToString(value: self.getLoadEncoding()!)));
113+
114+
#endif
115+
}
116+
117+
118+
if (self.getPassword() != nil) {
119+
120+
#if os(Linux)
121+
queryItems.append(URLQueryItem(name: "password", value: try ObjectSerializer.serializeToString(value: self.getPassword()!)));
122+
123+
#else
124+
queryItems.append(URLQueryItem(name: "encryptedPassword", value: try apiInvoker.encryptString(value: self.getPassword()!)));
125+
126+
#endif
127+
}
128+
129+
130+
if (self.getEncryptedPassword() != nil) {
131+
132+
#if os(Linux)
133+
queryItems.append(URLQueryItem(name: "encryptedPassword", value: try ObjectSerializer.serializeToString(value: self.getEncryptedPassword()!)));
134+
135+
#else
136+
queryItems.append(URLQueryItem(name: "encryptedPassword", value: try ObjectSerializer.serializeToString(value: self.getEncryptedPassword()!)));
137+
138+
#endif
139+
}
140+
141+
142+
if (self.getDestFileName() != nil) {
143+
144+
#if os(Linux)
145+
queryItems.append(URLQueryItem(name: "destFileName", value: try ObjectSerializer.serializeToString(value: self.getDestFileName()!)));
146+
147+
#else
148+
queryItems.append(URLQueryItem(name: "destFileName", value: try ObjectSerializer.serializeToString(value: self.getDestFileName()!)));
149+
150+
#endif
151+
}
152+
153+
154+
if (self.getRevisionAuthor() != nil) {
155+
156+
#if os(Linux)
157+
queryItems.append(URLQueryItem(name: "revisionAuthor", value: try ObjectSerializer.serializeToString(value: self.getRevisionAuthor()!)));
158+
159+
#else
160+
queryItems.append(URLQueryItem(name: "revisionAuthor", value: try ObjectSerializer.serializeToString(value: self.getRevisionAuthor()!)));
161+
162+
#endif
163+
}
164+
165+
166+
if (self.getRevisionDateTime() != nil) {
167+
168+
#if os(Linux)
169+
queryItems.append(URLQueryItem(name: "revisionDateTime", value: try ObjectSerializer.serializeToString(value: self.getRevisionDateTime()!)));
170+
171+
#else
172+
queryItems.append(URLQueryItem(name: "revisionDateTime", value: try ObjectSerializer.serializeToString(value: self.getRevisionDateTime()!)));
173+
174+
#endif
175+
}
176+
177+
if (queryItems.count > 0) {
178+
urlBuilder.queryItems = queryItems;
179+
}
180+
var formParams = [RequestFormParam]();
181+
var requestFilesContent = [FileReference]();
182+
apiInvoker.prepareFilesContent(&requestFilesContent);
183+
formParams.append(RequestFormParam(name: "document", body: try ObjectSerializer.serializeFile(value: self.getDocument()), contentType: "application/octet-stream"));
184+
185+
for requestFileReference in requestFilesContent {
186+
formParams.append(RequestFormParam(name: requestFileReference.reference, body: try ObjectSerializer.serializeFile(value: requestFileReference.content), contentType: "application/octet-stream"));
187+
}
188+
189+
var result = WordsApiRequestData(url: urlBuilder.url!, method: "PUT");
190+
if (formParams.count > 0) {
191+
result.setBody(formParams: formParams);
192+
}
193+
return result;
194+
}
195+
196+
// Deserialize response of this request
197+
public func deserializeResponse(data : Data, headers : [String: String]) throws -> Any? {
198+
return try ObjectSerializer.parseFilesCollection(data: data, headers: headers);
199+
}
200+
}

0 commit comments

Comments
 (0)