Skip to content

feat(server): Enable upcoming integrations endpoint #40256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.appsmith.server.controllers;

import com.appsmith.server.configurations.CloudServicesConfig;
import com.appsmith.server.constants.Url;
import com.appsmith.server.controllers.ce.PluginControllerCE;
import com.appsmith.server.plugins.base.PluginService;
Expand All @@ -11,7 +12,10 @@
@RequestMapping(Url.PLUGIN_URL)
public class PluginController extends PluginControllerCE {

public PluginController(PluginService service, PluginTriggerSolution pluginTriggerSolution) {
super(service, pluginTriggerSolution);
public PluginController(
PluginService service,
PluginTriggerSolution pluginTriggerSolution,
CloudServicesConfig cloudServicesConfig) {
super(service, pluginTriggerSolution, cloudServicesConfig);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import com.appsmith.external.models.TriggerRequestDTO;
import com.appsmith.external.models.TriggerResultDTO;
import com.appsmith.external.views.Views;
import com.appsmith.server.configurations.CloudServicesConfig;
import com.appsmith.server.constants.FieldName;
import com.appsmith.server.constants.Url;
import com.appsmith.server.domains.Plugin;
import com.appsmith.server.dtos.ResponseDTO;
import com.appsmith.server.plugins.base.PluginService;
import com.appsmith.server.plugins.solutions.PluginTriggerSolution;
import com.appsmith.util.WebClientUtils;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -28,6 +30,7 @@
import reactor.core.publisher.Mono;

import java.util.List;
import java.util.Map;

@RequestMapping(Url.PLUGIN_URL)
@RequiredArgsConstructor
Expand All @@ -38,6 +41,8 @@ public class PluginControllerCE {

private final PluginTriggerSolution pluginTriggerSolution;

private final CloudServicesConfig cloudServicesConfig;

@JsonView(Views.Public.class)
@GetMapping
public Mono<ResponseDTO<List<Plugin>>> getAll(@RequestParam String workspaceId) {
Expand Down Expand Up @@ -96,4 +101,29 @@ public Mono<ResponseDTO<TriggerResultDTO>> triggerMultipart(
serverWebExchange.getRequest().getHeaders())
.map(triggerResultDTO -> new ResponseDTO<>(HttpStatus.OK, triggerResultDTO));
}

@JsonView(Views.Public.class)
@GetMapping("/upcoming-integrations")
public Mono<ResponseDTO<List<Map<String, String>>>> getUpcomingIntegrations() {
log.debug("Fetching upcoming integrations from external API");

String apiUrl = cloudServicesConfig.getBaseUrl() + "/api/v1/config/external-saas/upcoming-integrations";

return WebClientUtils.create()
.get()
.uri(apiUrl)
.retrieve()
.bodyToMono(Map.class)
.map(response -> {
// Extract the integrations list from the response
List<Map<String, String>> integrations =
response.containsKey("data") ? (List<Map<String, String>>) response.get("data") : List.of();
return new ResponseDTO<>(HttpStatus.OK, integrations);
})
.onErrorResume(error -> {
log.warn("Error retrieving upcoming integrations from external service: {}", error.getMessage());
return Mono.just(new ResponseDTO<>(
HttpStatus.OK.value(), List.of(), "Unable to fetch upcoming integrations at this time"));
});
}
}
Loading