Package com.nelioalves.cursomc.resources
Class PedidoResource
- java.lang.Object
-
- com.nelioalves.cursomc.resources.PedidoResource
-
@RestController @RequestMapping("/pedidos") public class PedidoResource extends ObjectClasse REST API para endpoints /pedidos- Author:
- José Henrique
-
-
Constructor Summary
Constructors Constructor Description PedidoResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<Pedido>find(Integer id)Procura um Pedido por um idorg.springframework.http.ResponseEntity<org.springframework.data.domain.Page<Pedido>>finPage(Integer page, Integer linesPerPage, String direction, String orderBy)Procura pedidos e os retornam em uma página(Page)org.springframework.http.ResponseEntity<Void>insert(Pedido pedido)Insere um Pedido
-
-
-
Method Detail
-
find
@RequestMapping(value="/{id}", method=GET) public org.springframework.http.ResponseEntity<Pedido> find(@PathVariable Integer id)Procura um Pedido por um id- Parameters:
id- id do Pedido a ser procurado- Returns:
- Um JSON de resposta(ResponseEntity) com o Pedido no corpo com status HTTP ok(200)
-
insert
@RequestMapping(method=POST) public org.springframework.http.ResponseEntity<Void> insert(@RequestBody Pedido pedido)
Insere um Pedido- Parameters:
pedido- Pedido a ser inserido- Returns:
- Um JSON de resposta(ResponseEntity) com corpo vazio mais com header contendo a URL do Pedido inserido! Usa o status HTTP created(201)
-
finPage
@RequestMapping(value="/pages", method=GET) public org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<Pedido>> finPage(@RequestParam(value="page",defaultValue="0") Integer page, @RequestParam(value="linesPerPage",defaultValue="24") Integer linesPerPage, @RequestParam(value="direction",defaultValue="DESC") String direction, @RequestParam(value="orderBy",defaultValue="instante") String orderBy)Procura pedidos e os retornam em uma página(Page)- Parameters:
page- Número da página - valor padrão: "0"linesPerPage- Quantidade de linhas da página - valor padrão: "24"direction- Direção da página - valor padrão: "DESC"orderBy- Ordem da página - valor padrão: "instante"- Returns:
- Um JSON como resposta(ResponseEntity) com a página no corpo e com status HTTP ok(200)
-
-