From f1ee1cbe2eb7b482e0cc08bc13ad0ef46bd7b6c0 Mon Sep 17 00:00:00 2001 From: Samuel Kahn <48932506+Kahncode@users.noreply.github.com> Date: Wed, 9 Jun 2021 09:45:45 +0200 Subject: [PATCH] [cpp-ue4] Updated generator to return the http request so that it can be canceled or further manipulated. (#9693) --- .../src/main/resources/cpp-ue4/api-header.mustache | 2 +- .../src/main/resources/cpp-ue4/api-source.mustache | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-ue4/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-ue4/api-header.mustache index 17b42e942ea..b6059901809 100644 --- a/modules/openapi-generator/src/main/resources/cpp-ue4/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-ue4/api-header.mustache @@ -35,7 +35,7 @@ public: {{#operations}}{{#operation}}DECLARE_DELEGATE_OneParam(F{{operationIdCamelCase}}Delegate, const {{operationIdCamelCase}}Response&); {{/operation}}{{/operations}} {{#operations}}{{#operation}}{{#description}}/* {{{description}}} */ - {{/description}}bool {{operationIdCamelCase}}(const {{operationIdCamelCase}}Request& Request, const F{{operationIdCamelCase}}Delegate& Delegate = F{{operationIdCamelCase}}Delegate()) const; + {{/description}}FHttpRequestPtr {{operationIdCamelCase}}(const {{operationIdCamelCase}}Request& Request, const F{{operationIdCamelCase}}Delegate& Delegate = F{{operationIdCamelCase}}Delegate()) const; {{/operation}}{{/operations}} private: {{#operations}}{{#operation}}void On{{operationIdCamelCase}}Response(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, F{{operationIdCamelCase}}Delegate Delegate) const; diff --git a/modules/openapi-generator/src/main/resources/cpp-ue4/api-source.mustache b/modules/openapi-generator/src/main/resources/cpp-ue4/api-source.mustache index 9bd9f3b87bd..2ab5b0db9cd 100644 --- a/modules/openapi-generator/src/main/resources/cpp-ue4/api-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-ue4/api-source.mustache @@ -125,10 +125,10 @@ void {{classname}}::HandleResponse(FHttpResponsePtr HttpResponse, bool bSucceede {{#operations}} {{#operation}} -bool {{classname}}::{{operationIdCamelCase}}(const {{operationIdCamelCase}}Request& Request, const F{{operationIdCamelCase}}Delegate& Delegate /*= F{{operationIdCamelCase}}Delegate()*/) const +FHttpRequestPtr {{classname}}::{{operationIdCamelCase}}(const {{operationIdCamelCase}}Request& Request, const F{{operationIdCamelCase}}Delegate& Delegate /*= F{{operationIdCamelCase}}Delegate()*/) const { if (!IsValid()) - return false; + return nullptr; FHttpRequestRef HttpRequest = CreateHttpRequest(Request); HttpRequest->SetURL(*(Url + Request.ComputePath())); @@ -141,7 +141,8 @@ bool {{classname}}::{{operationIdCamelCase}}(const {{operationIdCamelCase}}Reque Request.SetupHttpRequest(HttpRequest); HttpRequest->OnProcessRequestComplete().BindRaw(this, &{{classname}}::On{{operationIdCamelCase}}Response, Delegate); - return HttpRequest->ProcessRequest(); + HttpRequest->ProcessRequest(); + return HttpRequest; } void {{classname}}::On{{operationIdCamelCase}}Response(FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded, F{{operationIdCamelCase}}Delegate Delegate) const