Created
March 7, 2021 16:45
-
-
Save njofce/3bacca20fdd67ba2f078338a7f0e26e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping("file") | |
public interface AsyncFileApi { | |
@GetMapping("/{id}") | |
CompletableFuture<FileMetadata> getFile(@PathVariable String id); | |
@GetMapping("/search") | |
CompletableFuture<List<FileMetadata>> searchFiles(@RequestParam(name = "name") String name); | |
@PostMapping("/save") | |
CompletableFuture<String> saveFile(@RequestBody FileMetadata file); | |
@PutMapping("/update/{id}") | |
CompletableFuture<String> updateFile(@RequestBody FileMetadata file, @PathVariable String id); | |
@DeleteMapping("/delete/{id}") | |
CompletableFuture<String> updateFile(@PathVariable String id); | |
} | |
public static AsyncFileApi getAsyncFileAPI() { | |
String URL = "http://localhost:8080"; // This must be passed as an ENV variable | |
return AsyncFeign.asyncBuilder() | |
.encoder(new JacksonEncoder(apiObjectMapper())) | |
.decoder(new JacksonDecoder(apiObjectMapper())) | |
.contract(new SpringMvcContract()) | |
.target(AsyncFileApi.class, URL); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment