forked from loafle/openapi-generator-original
* [Slim] Decouple Api files into separated PHP Classes This enhancement required for modular testing and code coverage generating. * [Slim] Define all app routes in SlimRouter PHP Class. Generate new samples
167 lines
5.7 KiB
PHP
167 lines
5.7 KiB
PHP
<?php
|
|
/**
|
|
* UserApi
|
|
*
|
|
* PHP version 5
|
|
*
|
|
* @category Class
|
|
* @package OpenAPIServer\Api
|
|
* @author OpenAPI Generator team
|
|
* @link https://github.com/openapitools/openapi-generator
|
|
*/
|
|
|
|
/**
|
|
* OpenAPI Petstore
|
|
*
|
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
|
* OpenAPI spec version: 1.0.0
|
|
* Generated by: https://github.com/openapitools/openapi-generator.git
|
|
*/
|
|
|
|
/**
|
|
* NOTE: This class is auto generated by the openapi generator program.
|
|
* https://github.com/openapitools/openapi-generator
|
|
* Do not edit the class manually.
|
|
*/
|
|
namespace OpenAPIServer\Api;
|
|
|
|
use OpenAPIServer\AbstractApiController;
|
|
|
|
/**
|
|
* UserApi Class Doc Comment
|
|
*
|
|
* PHP version 5
|
|
*
|
|
* @category Class
|
|
* @package OpenAPIServer\Api
|
|
* @author OpenAPI Generator team
|
|
* @link https://github.com/openapitools/openapi-generator
|
|
*/
|
|
class UserApi extends AbstractApiController {
|
|
|
|
/**
|
|
* POST createUser
|
|
* Summary: Create user
|
|
* Notes: This can only be done by the logged in user.
|
|
*
|
|
* @param \Psr\Http\Message\ServerRequestInterface $request Request
|
|
* @param \Psr\Http\Message\ResponseInterface $response Response
|
|
* @param array|null $args Path arguments
|
|
*/
|
|
public function createUser($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:
|
|
*
|
|
* @param \Psr\Http\Message\ServerRequestInterface $request Request
|
|
* @param \Psr\Http\Message\ResponseInterface $response Response
|
|
* @param array|null $args Path arguments
|
|
*/
|
|
public function createUsersWithArrayInput($request, $response, $args) {
|
|
$body = $request->getParsedBody();
|
|
$response->write('How about implementing createUsersWithArrayInput as a POST method ?');
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* POST createUsersWithListInput
|
|
* Summary: Creates list of users with given input array
|
|
* Notes:
|
|
*
|
|
* @param \Psr\Http\Message\ServerRequestInterface $request Request
|
|
* @param \Psr\Http\Message\ResponseInterface $response Response
|
|
* @param array|null $args Path arguments
|
|
*/
|
|
public function createUsersWithListInput($request, $response, $args) {
|
|
$body = $request->getParsedBody();
|
|
$response->write('How about implementing createUsersWithListInput as a POST method ?');
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* DELETE deleteUser
|
|
* Summary: Delete user
|
|
* Notes: This can only be done by the logged in user.
|
|
*
|
|
* @param \Psr\Http\Message\ServerRequestInterface $request Request
|
|
* @param \Psr\Http\Message\ResponseInterface $response Response
|
|
* @param array|null $args Path arguments
|
|
*/
|
|
public function deleteUser($request, $response, $args) {
|
|
$username = $args['username'];
|
|
$response->write('How about implementing deleteUser as a DELETE method ?');
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* GET getUserByName
|
|
* Summary: Get user by user name
|
|
* Notes:
|
|
* Output-Formats: [application/xml, application/json]
|
|
*
|
|
* @param \Psr\Http\Message\ServerRequestInterface $request Request
|
|
* @param \Psr\Http\Message\ResponseInterface $response Response
|
|
* @param array|null $args Path arguments
|
|
*/
|
|
public function getUserByName($request, $response, $args) {
|
|
$username = $args['username'];
|
|
$response->write('How about implementing getUserByName as a GET method ?');
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* GET loginUser
|
|
* Summary: Logs user into the system
|
|
* Notes:
|
|
* Output-Formats: [application/xml, application/json]
|
|
*
|
|
* @param \Psr\Http\Message\ServerRequestInterface $request Request
|
|
* @param \Psr\Http\Message\ResponseInterface $response Response
|
|
* @param array|null $args Path arguments
|
|
*/
|
|
public function loginUser($request, $response, $args) {
|
|
$queryParams = $request->getQueryParams();
|
|
$username = $request->getQueryParam('username');
|
|
$password = $request->getQueryParam('password');
|
|
$response->write('How about implementing loginUser as a GET method ?');
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* GET logoutUser
|
|
* Summary: Logs out current logged in user session
|
|
* Notes:
|
|
*
|
|
* @param \Psr\Http\Message\ServerRequestInterface $request Request
|
|
* @param \Psr\Http\Message\ResponseInterface $response Response
|
|
* @param array|null $args Path arguments
|
|
*/
|
|
public function logoutUser($request, $response, $args) {
|
|
$response->write('How about implementing logoutUser as a GET method ?');
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* PUT updateUser
|
|
* Summary: Updated user
|
|
* Notes: This can only be done by the logged in user.
|
|
*
|
|
* @param \Psr\Http\Message\ServerRequestInterface $request Request
|
|
* @param \Psr\Http\Message\ResponseInterface $response Response
|
|
* @param array|null $args Path arguments
|
|
*/
|
|
public function updateUser($request, $response, $args) {
|
|
$username = $args['username'];
|
|
$body = $request->getParsedBody();
|
|
$response->write('How about implementing updateUser as a PUT method ?');
|
|
return $response;
|
|
}
|
|
|
|
}
|