Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

#include "tlpp-core.th"
#include "tlpp-rest.th"

Class classPatchExamples

   Public Method New()

   @Patch("examples/class/patch/path/user/:user")
   Public Method methodExamplePatchPath()

   @Patch("examples/class/patch/query/user")
   Public Method methodExamplePatchQuery()

EndClass

Method New() class classPatchExamples

Return self

/* ------------------------------------------- */
@Patch("examples/class/patch/path/user/:user")
Method methodExamplesPatchPath() class classPatchExamples

   Local cJson := ""
   Local cBody := ""
   Local jPath

   jPath := JsonObject():New()
   jPath := oRest:getPathParamsRequest()
   cBody := oRest:getBodyRequest()

   If (jPath <> Nil)
       cJson := '[ {"description": "examplesMethodPatchPath successfully executed, parameter received: ' + jPath['user'] + '" , "body received":"'+ cBody + '"} ]'
   Endif
Return oRest:setResponse(cJson)

/* ------------------------------------------- */
@Patch("examples/class/patch/query/user")
Method methodExamplesPatchQuery() class classPatchExamples
   Local cJson := ""
   Local cBody := ""
   Local jQuery

   jQuery := JsonObject():New()
   jQuery := oRest:getQueryRequest()
   cBody   := oRest:getBodyRequest()

   If (jQuery <> Nil)
       cJson := '[ {"description": "examplesMethodPatchQuery successfully executed, parameter received: ' + jQuery['user'] + '" , "body received":"'+ cBody + '"} ]'
   Endif
Return oRest:setResponse(cJson)