package com.khoubyari.example.api.rest;

import com.khoubyari.example.domain.Status;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by ann on 5/8/15.
 */
@RestController
@RequestMapping(value = "/github")
@Api(value = "github", description = "Destination for a github web hook for when a repository has had a push event.")
public class GithubHookController {


    @RequestMapping(value = "",
            method = RequestMethod.POST,
            produces = {"application/json", "application/xml"})
    @ResponseStatus(HttpStatus.OK)
    @ApiOperation(value = "Check if an update is needed.", notes = "Returns the Status of the scripts:  update or no update.")
    //TODO Does github require a response?
    public
    void checkStatus(HttpServletRequest request, HttpServletResponse response) {

        System.out.println("\n\n\n\n\n\n\n*******************************************\n: ");
        System.out.println("Request: " + request);
        System.out.println("\n\n\n\n\n\n\n*******************************************\n: ");
    }
}

@@ -604,16 +604,44 @@
 troller 
+extends AbstractRestHandler 
 %7B%0A%0A%0A    
@@ -709,16 +709,80 @@
 d.POST,%0A
+            consumes = %7B%22application/json%22, %22application/xml%22%7D,%0A
         
@@ -1056,29 +1056,23 @@
 blic
-%0A   
  void 
-checkStatus
+pushEvent
 (Htt

add consumes/produces.