Skip to content

Commit 39694a8

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents 2abe85a + 3e5282f commit 39694a8

File tree

9 files changed

+203
-1
lines changed

9 files changed

+203
-1
lines changed

include/aspose_words_cloud.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@
580580
#include "./aspose_words_cloud/requests/insert_watermark_text_online_request.h"
581581
#include "./aspose_words_cloud/requests/link_header_footers_to_previous_request.h"
582582
#include "./aspose_words_cloud/requests/load_web_document_request.h"
583+
#include "./aspose_words_cloud/requests/load_web_document_online_request.h"
583584
#include "./aspose_words_cloud/requests/merge_with_next_request.h"
584585
#include "./aspose_words_cloud/requests/merge_with_next_online_request.h"
585586
#include "./aspose_words_cloud/requests/move_file_request.h"
@@ -927,6 +928,7 @@
927928
#include "./aspose_words_cloud/responses/insert_watermark_text_online_response.h"
928929
#include "./aspose_words_cloud/responses/link_header_footers_to_previous_response.h"
929930
#include "./aspose_words_cloud/responses/load_web_document_response.h"
931+
#include "./aspose_words_cloud/responses/load_web_document_online_response.h"
930932
#include "./aspose_words_cloud/responses/merge_with_next_response.h"
931933
#include "./aspose_words_cloud/responses/merge_with_next_online_response.h"
932934
#include "./aspose_words_cloud/responses/move_file_response.h"

include/aspose_words_cloud/api/words_api.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,8 @@
545545
#include "aspose_words_cloud/responses/link_header_footers_to_previous_response.h"
546546
#include "aspose_words_cloud/requests/load_web_document_request.h"
547547
#include "aspose_words_cloud/responses/load_web_document_response.h"
548+
#include "aspose_words_cloud/requests/load_web_document_online_request.h"
549+
#include "aspose_words_cloud/responses/load_web_document_online_response.h"
548550
#include "aspose_words_cloud/requests/merge_with_next_request.h"
549551
#include "aspose_words_cloud/responses/merge_with_next_response.h"
550552
#include "aspose_words_cloud/requests/merge_with_next_online_request.h"
@@ -4223,6 +4225,12 @@ namespace aspose::words::cloud::api {
42234225
/// <param name="storage">Original document storage.</param>
42244226
ASPOSE_WORDS_CLOUD_EXPORT std::shared_ptr< aspose::words::cloud::models::SaveResponse > loadWebDocument(std::shared_ptr<aspose::words::cloud::requests::LoadWebDocumentRequest> request);
42254227

4228+
/// <summary>
4229+
/// Downloads a document from the Web using URL and saves it to cloud storage in the specified format.
4230+
/// </summary>
4231+
/// <param name="data">The properties of data downloading.</param>
4232+
ASPOSE_WORDS_CLOUD_EXPORT std::shared_ptr<aspose::words::cloud::responses::LoadWebDocumentOnlineResponse> loadWebDocumentOnline(std::shared_ptr<aspose::words::cloud::requests::LoadWebDocumentOnlineRequest> request);
4233+
42264234
/// <summary>
42274235
/// Merge the section with the next one.
42284236
/// </summary>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/** --------------------------------------------------------------------------------------------------------------------
2+
* <copyright company="Aspose" file="load_web_document_online_request.h">
3+
* Copyright (c) 2025 Aspose.Words for Cloud
4+
* </copyright>
5+
* <summary>
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
* </summary>
24+
-------------------------------------------------------------------------------------------------------------------- **/
25+
26+
#pragma once
27+
#include "./request_model_base.h"
28+
#include "aspose_words_cloud/models/load_web_document_data.h"
29+
30+
namespace aspose::words::cloud::requests {
31+
class LoadWebDocumentOnlineRequest : public RequestModelBase {
32+
public:
33+
ASPOSE_WORDS_CLOUD_EXPORT LoadWebDocumentOnlineRequest(
34+
const std::shared_ptr< aspose::words::cloud::models::LoadWebDocumentData > data
35+
);
36+
37+
ASPOSE_WORDS_CLOUD_EXPORT const std::shared_ptr< aspose::words::cloud::models::LoadWebDocumentData > getData() const;
38+
39+
ASPOSE_WORDS_CLOUD_EXPORT virtual std::shared_ptr< aspose::words::cloud::HttpRequestData > createHttpRequest(ApiClient* apiClient) const override;
40+
ASPOSE_WORDS_CLOUD_EXPORT virtual std::shared_ptr< aspose::words::cloud::responses::ResponseModelBase > createResponse() const override;
41+
42+
private:
43+
const std::shared_ptr< aspose::words::cloud::models::LoadWebDocumentData > m_Data;
44+
};
45+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/** --------------------------------------------------------------------------------------------------------------------
2+
* <copyright company="Aspose" file="load_web_document_online_response.h">
3+
* Copyright (c) 2025 Aspose.Words for Cloud
4+
* </copyright>
5+
* <summary>
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
* </summary>
24+
-------------------------------------------------------------------------------------------------------------------- **/
25+
26+
#pragma once
27+
#include "./response_model_base.h"
28+
#include "aspose_words_cloud/models/save_response.h"
29+
30+
namespace aspose::words::cloud::responses {
31+
class LoadWebDocumentOnlineResponse : public ResponseModelBase {
32+
public:
33+
ASPOSE_WORDS_CLOUD_EXPORT virtual ~LoadWebDocumentOnlineResponse() = default;
34+
35+
ASPOSE_WORDS_CLOUD_EXPORT std::shared_ptr< aspose::words::cloud::models::SaveResponse > getModel() const;
36+
ASPOSE_WORDS_CLOUD_EXPORT std::shared_ptr< std::map<std::wstring, std::shared_ptr<std::istream>> > getDocument() const;
37+
38+
ASPOSE_WORDS_CLOUD_EXPORT virtual void deserialize(const std::string& contentType, const std::string_view& response) override;
39+
private:
40+
std::shared_ptr< aspose::words::cloud::models::SaveResponse > m_Model;
41+
std::shared_ptr< std::map<std::wstring, std::shared_ptr<std::istream>> > m_Document;
42+
};
43+
}

src/api_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ namespace aspose::words::cloud {
168168

169169
::httplib::Headers headers;
170170
headers.emplace("Authorization", m_AccessToken);
171-
headers.emplace("x-aspose-client-version", "25.9");
171+
headers.emplace("x-aspose-client-version", "25.10");
172172
headers.emplace("x-aspose-client", "C++ SDK");
173173

174174
for (auto& pair : httpRequest->getHeaders()) {

src/requests.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27513,6 +27513,52 @@ namespace aspose::words::cloud::requests {
2751327513
);
2751427514
}
2751527515

27516+
/*
27517+
* LoadWebDocumentOnline request implementation
27518+
*/
27519+
LoadWebDocumentOnlineRequest::LoadWebDocumentOnlineRequest(
27520+
const std::shared_ptr< aspose::words::cloud::models::LoadWebDocumentData > data
27521+
) :
27522+
m_Data(data)
27523+
{
27524+
}
27525+
27526+
const std::shared_ptr< aspose::words::cloud::models::LoadWebDocumentData > LoadWebDocumentOnlineRequest::getData() const
27527+
{
27528+
return m_Data;
27529+
}
27530+
27531+
std::shared_ptr< aspose::words::cloud::HttpRequestData > LoadWebDocumentOnlineRequest::createHttpRequest(ApiClient* apiClient) const
27532+
{
27533+
std::vector<models::FileReference*> additionalFilesContent;
27534+
auto result = std::make_shared<HttpRequestData>();
27535+
result->setMethod(HttpRequestMethod::HttpPUT);
27536+
result->setPath(L"/words/online/put/loadWebDocument");
27537+
if (m_Data)
27538+
{
27539+
result->addFormDataParam(L"data", *m_Data);
27540+
m_Data->validate();}
27541+
else throw aspose::words::cloud::ApiException(400, L"Parameter 'Data' is required.");
27542+
27543+
for (models::FileReference* additionalFileContent : additionalFilesContent)
27544+
{
27545+
if (additionalFileContent != nullptr)
27546+
{
27547+
additionalFileContent->encryptPassword(apiClient);
27548+
result->addFormDataParam(additionalFileContent);
27549+
}
27550+
}
27551+
27552+
return result;
27553+
}
27554+
27555+
std::shared_ptr< aspose::words::cloud::responses::ResponseModelBase > LoadWebDocumentOnlineRequest::createResponse() const
27556+
{
27557+
return std::shared_ptr< aspose::words::cloud::responses::ResponseModelBase >(
27558+
new aspose::words::cloud::responses::LoadWebDocumentOnlineResponse()
27559+
);
27560+
}
27561+
2751627562
/*
2751727563
* MergeWithNext request implementation
2751827564
*/

src/responses.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4017,6 +4017,34 @@ namespace aspose::words::cloud::responses {
40174017
m_Model = createModelInstance< aspose::words::cloud::models::SaveResponse >(L"SaveResponse, _", response);
40184018
}
40194019

4020+
/*
4021+
* LoadWebDocumentOnline request implementation
4022+
*/
4023+
std::shared_ptr< aspose::words::cloud::models::SaveResponse > LoadWebDocumentOnlineResponse::getModel() const
4024+
{
4025+
return m_Model;
4026+
}
4027+
4028+
std::shared_ptr< std::map<std::wstring, std::shared_ptr<std::istream>> > LoadWebDocumentOnlineResponse::getDocument() const
4029+
{
4030+
return m_Document;
4031+
}
4032+
4033+
void LoadWebDocumentOnlineResponse::deserialize(const std::string& contentType, const std::string_view& response)
4034+
{
4035+
std::unordered_map<std::string, std::tuple<std::string, std::string, std::string_view> > parts;
4036+
parseMultipart(response, parts);
4037+
if (parts.find("Model") != parts.end()) {
4038+
const auto& part = parts.at("Model");
4039+
auto json = ::nlohmann::json::parse(std::get<2>(part));
4040+
m_Model = createModelInstance< aspose::words::cloud::models::SaveResponse >(L"SaveResponse, _", std::get<2>(part));
4041+
}
4042+
if (parts.find("Document") != parts.end()) {
4043+
const auto& part = parts.at("Document");
4044+
m_Document = parseFilesCollection(part);
4045+
}
4046+
}
4047+
40204048
/*
40214049
* MergeWithNext request implementation
40224050
*/

src/words_api.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2805,6 +2805,17 @@ namespace aspose::words::cloud::api {
28052805
return response->getModel();
28062806
}
28072807

2808+
std::shared_ptr<aspose::words::cloud::responses::LoadWebDocumentOnlineResponse> WordsApi::loadWebDocumentOnline(std::shared_ptr<aspose::words::cloud::requests::LoadWebDocumentOnlineRequest> request)
2809+
{
2810+
auto response = std::make_shared< aspose::words::cloud::responses::LoadWebDocumentOnlineResponse >();
2811+
m_ApiClient->call( request->createHttpRequest(m_ApiClient.get()), *response);
2812+
if (response->getStatusCode() != 200) {
2813+
throw aspose::words::cloud::ApiException(response->getStatusCode(), response->getErrorMessage());
2814+
}
2815+
2816+
return response;
2817+
}
2818+
28082819
void WordsApi::mergeWithNext(std::shared_ptr<aspose::words::cloud::requests::MergeWithNextRequest> request)
28092820
{
28102821
auto response = std::make_shared< aspose::words::cloud::responses::MergeWithNextResponse >();

tests/api/load_web_document_test.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,22 @@ TEST_F(LoadWebDocumentTests, TestLoadWebDocument) {
5555
ASSERT_TRUE(actual->getSaveResult()->getDestDocument() != nullptr);
5656
ASSERT_TRUE(actual->getSaveResult()->getDestDocument()->getHref()->compare(L"google.doc") == 0);
5757
}
58+
59+
/// <summary>
60+
/// Test for loading web document online.
61+
/// </summary>
62+
TEST_F(LoadWebDocumentTests, TestLoadWebDocumentOnline) {
63+
auto requestDataSaveOptions = std::make_shared< aspose::words::cloud::models::DocSaveOptionsData >();
64+
requestDataSaveOptions->setFileName(std::make_shared< std::wstring >(L"google.doc"));
65+
requestDataSaveOptions->setDmlEffectsRenderingMode(std::make_shared< aspose::words::cloud::models::SaveOptionsData::DmlEffectsRenderingMode >(aspose::words::cloud::models::SaveOptionsData::DmlEffectsRenderingMode::NONE));
66+
requestDataSaveOptions->setDmlRenderingMode(std::make_shared< aspose::words::cloud::models::SaveOptionsData::DmlRenderingMode >(aspose::words::cloud::models::SaveOptionsData::DmlRenderingMode::DRAWING_ML));
67+
requestDataSaveOptions->setZipOutput(std::make_shared< bool >(false));
68+
auto requestData = std::make_shared< aspose::words::cloud::models::LoadWebDocumentData >();
69+
requestData->setLoadingDocumentUrl(std::make_shared< std::wstring >(L"http://google.com"));
70+
requestData->setSaveOptions(requestDataSaveOptions);
71+
std::shared_ptr<requests::LoadWebDocumentOnlineRequest> request(new requests::LoadWebDocumentOnlineRequest(
72+
requestData
73+
));
74+
75+
auto actual = getApi()->loadWebDocumentOnline(request);
76+
}

0 commit comments

Comments
 (0)