Exemplo n.º 1
0
/**
 * Swagger Petstore
 * @version 1.0.0
 */
require_once __DIR__ . '/vendor/autoload.php';
$app = new Slim\App();
/**
 * POST createUser
 * Summary: Create user
 * Notes: This can only be done by the logged in user.
 * Output-Formats: [application/xml, application/json]
 */
$app->POST('/user', function ($request, $response, $args) {
    $body = $request->getParsedBody();
    $response->write('How about implementing createUser as a POST method ?');
    return $response;
});
/**
 * POST createUsersWithArrayInput
 * Summary: Creates list of users with given input array
 * Notes: 
 * Output-Formats: [application/xml, application/json]
 */
$app->POST('/user/createWithArray', function ($request, $response, $args) {
    $body = $request->getParsedBody();
    $response->write('How about implementing createUsersWithArrayInput as a POST method ?');
    return $response;
});
/**
 * POST createUsersWithListInput
Exemplo n.º 2
0
 * Notes: 
 * Output-Formats: [application/json]
 */
$app->DELETE('/jobs/{jobId}?api-version=2.0', function ($request, $response, $args) {
    $response->write('How about implementing canceljob as a DELETE method ?');
    return $response;
});
/**
 * POST execute
 * Summary: Execute the web service and get a response synchronously
 * Notes: 
 * Output-Formats: [application/json]
 */
$app->POST('/execute?api-version=2.0&format=swagger', function ($request, $response, $args) {
    $body = $request->getParsedBody();
    $response->write('How about implementing execute as a POST method ?');
    return $response;
});
/**
 * GET getSwaggerDocument
 * Summary: Get swagger API document for the web service
 * Notes: 
 * Output-Formats: [application/json]
 */
$app->GET('/swagger.json', function ($request, $response, $args) {
    $queryParams = $request->getQueryParams();
    $apiVersion = $queryParams['apiVersion'];
    $response->write('How about implementing getSwaggerDocument as a GET method ?');
    return $response;
});
/**