All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springdoc.sample1.ItemController Maven / Gradle / Ivy

There is a newer version: 3.1.2
Show newest version
package org.springdoc.sample1;

import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import javax.validation.Valid;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

import io.swagger.v3.oas.annotations.tags.Tag;

@RestController
@Tag(name = "items")
public class ItemController {

	@GetMapping("/items")
	public List showItems(@RequestParam("cusID") final String customerID) {
		return new ArrayList();
	}
   
	@PostMapping("/items")
	public ResponseEntity addItem(@Valid @RequestBody final ItemLightDTO itemDTO) {
		final URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}")
				.buildAndExpand(UUID.randomUUID()).toUri();
		return ResponseEntity.created(location).build();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy