001/** 002 * Copyright (C) 2006-2025 Talend Inc. - www.talend.com 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.talend.sdk.component.server.api; 017 018import static javax.ws.rs.core.MediaType.APPLICATION_JSON; 019 020import java.util.concurrent.CompletionStage; 021 022import javax.ws.rs.Consumes; 023import javax.ws.rs.POST; 024import javax.ws.rs.Path; 025import javax.ws.rs.Produces; 026 027import org.eclipse.microprofile.openapi.annotations.Operation; 028import org.eclipse.microprofile.openapi.annotations.media.Content; 029import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody; 030import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; 031import org.eclipse.microprofile.openapi.annotations.tags.Tag; 032import org.talend.sdk.component.server.front.model.BulkRequests; 033import org.talend.sdk.component.server.front.model.BulkResponses; 034 035@Path("bulk") 036@Consumes(APPLICATION_JSON) 037@Produces(APPLICATION_JSON) 038@Tag(name = "Bulk", description = "Enables to execute multiple requests at once.") 039public interface BulkReadResource { 040 041 @POST 042 @Operation(description = "Takes a request aggregating N other endpoint requests and responds all results " 043 + "in a normalized HTTP response representation.") 044 @APIResponse(responseCode = "200", 045 description = "The request payloads.", 046 content = @Content(mediaType = APPLICATION_JSON)) 047 CompletionStage<BulkResponses> bulk(@RequestBody( 048 description = "The requests list as json objects containing a list of request objects. \n" + 049 "If your request contains multiple identifiers, you must use a list of string. \n" + 050 "Example : \n" + 051 "`{ \n" + 052 "\"requests\" : [ \n" + 053 "{ \n" + 054 " \"path\" : \"/api/v1/component/index\", \n" + 055 " \"queryParameters\" : {\"identifiers\" : [\"12345\", \"6789A\"]}, \n" + 056 " \"verb\" : \"GET\", \n" + 057 " \"headers\" : {...}, \n" + 058 "}, \n" + 059 "{ [...]} \n" + 060 "] \n" + 061 "}`", 062 required = true, 063 content = @Content(mediaType = APPLICATION_JSON)) final BulkRequests requests); 064}