Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SAMBUMBA
pasteque-server
Commits
1ad141d1
Commit
1ad141d1
authored
Oct 03, 2017
by
philippepary
Browse files
Added user route
parent
b18ac95b
Changes
2
Hide whitespace changes
Inline
Side-by-side
bin/generate_swagger_file.php
View file @
1ad141d1
...
...
@@ -11,6 +11,7 @@ $files = [
"../src/http/routes/category.php"
,
"../src/http/routes/currency.php"
,
"../src/http/routes/product.php"
,
"../src/http/routes/user.php"
,
];
$dirs
=
[
"../src/http/routes/"
,
...
...
src/http/routes/user.php
View file @
1ad141d1
...
...
@@ -4,11 +4,12 @@ use \Pasteque\Server\System\API\APICaller;
use
\
Pasteque\Server\System\API\APIResult
;
/**
*
GET
user
G
etAll
Get
*
Summary:
*
Notes: Get a
array of
all U
ser
*
Output-Formats: [application/json]
*
@rest\endpoint /
user
/g
etAll
*
@rest\method GET Get all users
*
@rest\response 200 array(User) An
array of
u
ser
s
*
@rest\tags users
*/
//
$app
->
GET
(
'/api/user/getAll'
,
function
(
$request
,
$response
,
$args
)
{
$ptApp
=
$this
->
get
(
'settings'
)[
'ptApp'
];
return
$response
->
withApiResult
(
APICaller
::
run
(
$ptApp
,
'user'
,
'getAll'
));
...
...
@@ -16,11 +17,13 @@ $app->GET('/api/user/getAll', function ($request, $response, $args) {
/**
* GET userIdGet
* Summary:
* Notes: Get a User
* Output-Formats: [application/json]
* @rest\endpoint /user/{id}
* @rest\method GET Get an user by its ID
* @rest\path Int id ID of the user
* @rest\response 200 User The user
* @rest\tags users
*/
//
$app
->
GET
(
'/api/user/{id}'
,
function
(
$request
,
$response
,
$args
)
{
$ptApp
=
$this
->
get
(
'settings'
)[
'ptApp'
];
return
$response
->
withApiResult
(
APICaller
::
run
(
$ptApp
,
'user'
,
'get'
,
$args
[
'id'
]));
...
...
@@ -28,10 +31,12 @@ $app->GET('/api/user/{id}', function ($request, $response, $args) {
/**
* POST userPasswordPut
* Summary:
* Notes: update password of an user
* Output-Formats: [application/json]
* @rest\endpoint /user/{id}/password
* @rest\method POST Update an user's password
* @rest\path Int id ID of the user
* @rest\response 200 User The updated user
* @rest\response 404
* @rest\tags users
*/
$app
->
POST
(
'/api/user/{id}/password'
,
function
(
$request
,
$response
,
$args
)
{
$ptApp
=
$this
->
get
(
'settings'
)[
'ptApp'
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment