mirror of
https://github.com/Permissionless-Software-Foundation/x402-base-facilitator.git
synced 2026-09-21 16:52:01 -07:00
fix(docs): Adding first api doc for JSON RPC
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"sampleUrl": null
|
||||
|
||||
}
|
||||
@@ -20,14 +20,15 @@ class UserController {
|
||||
* @api {post} /users Create a new user
|
||||
* @apiPermission user
|
||||
* @apiName CreateUser
|
||||
* @apiGroup Users
|
||||
* @apiGroup REST Users
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -H "Content-Type: application/json" -X POST -d '{ "user": { "email": "email@format.com", "password": "secretpasas" } }' localhost:5001/users
|
||||
* curl -H "Content-Type: application/json" -X POST -d '{ "user": { "email": "email@format.com", "name": "my name", "password": "secretpasas" } }' localhost:5001/users
|
||||
*
|
||||
* @apiParam {Object} user User object (required)
|
||||
* @apiParam {String} user.email Email.
|
||||
* @apiParam {String} user.password Password.
|
||||
* @apiParam {String} user.email Email
|
||||
* @apiParam {String} user.password Password
|
||||
* @apiParam {String} user.name name or handle
|
||||
*
|
||||
* @apiSuccess {Object} users User object
|
||||
* @apiSuccess {ObjectId} users._id User id
|
||||
@@ -42,7 +43,8 @@ class UserController {
|
||||
* "user": {
|
||||
* "_id": "56bd1da600a526986cf65c80"
|
||||
* "name": "John Doe"
|
||||
* "email": "email@format.com"
|
||||
* "email": "email@format.com",
|
||||
* "password": "somestrongpassword"
|
||||
* }
|
||||
* }
|
||||
*
|
||||
@@ -79,7 +81,7 @@ class UserController {
|
||||
* @api {get} /users Get all users
|
||||
* @apiPermission user
|
||||
* @apiName GetUsers
|
||||
* @apiGroup Users
|
||||
* @apiGroup REST Users
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -H "Content-Type: application/json" -X GET localhost:5000/users
|
||||
@@ -118,7 +120,7 @@ class UserController {
|
||||
* @api {get} /users/:id Get user by id
|
||||
* @apiPermission user
|
||||
* @apiName GetUser
|
||||
* @apiGroup Users
|
||||
* @apiGroup REST Users
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -H "Content-Type: application/json" -X GET localhost:5000/users/56bd1da600a526986cf65c80
|
||||
@@ -162,14 +164,15 @@ class UserController {
|
||||
* @api {put} /users/:id Update a user
|
||||
* @apiPermission user
|
||||
* @apiName UpdateUser
|
||||
* @apiGroup Users
|
||||
* @apiGroup REST Users
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -H "Content-Type: application/json" -X PUT -d '{ "user": { "name": "Cool new Name" } }' localhost:5000/users/56bd1da600a526986cf65c80
|
||||
*
|
||||
* @apiParam {Object} user User object (required)
|
||||
* @apiParam {String} user.name Name.
|
||||
* @apiParam {String} user.email Email.
|
||||
* @apiParam {String} user.email Email.
|
||||
* @apiParam {String} user.password Password. (optional)
|
||||
*
|
||||
* @apiSuccess {Object} users User object
|
||||
* @apiSuccess {ObjectId} users._id User id
|
||||
@@ -218,7 +221,7 @@ class UserController {
|
||||
* @api {delete} /users/:id Delete a user
|
||||
* @apiPermission user
|
||||
* @apiName DeleteUser
|
||||
* @apiGroup Users
|
||||
* @apiGroup REST Users
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -H "Content-Type: application/json" -X DELETE localhost:5000/users/56bd1da600a526986cf65c80
|
||||
|
||||
+40
-1
@@ -62,7 +62,46 @@ class UserRPC {
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new user
|
||||
/**
|
||||
* @api {JSON} /users Create a new user
|
||||
* @apiPermission public
|
||||
* @apiName CreateUser
|
||||
* @apiGroup JSON Users
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* {"jsonrpc":"2.0","id":"555","method":"users","params":{ "endpoint": "createUser", "email": "test555@test.com", "name": "testy tester", "password": "password"}}
|
||||
*
|
||||
* @apiParam {Object} user User object (required)
|
||||
* @apiParam {String} user.email Email.
|
||||
* @apiParam {String} user.password Password.
|
||||
* @apiParam {String} user.name name or handle
|
||||
*
|
||||
* @apiSuccess {Object} users User object
|
||||
* @apiSuccess {ObjectId} users._id User id
|
||||
* @apiSuccess {String} user.type User type (admin or user)
|
||||
* @apiSuccess {String} users.name User name
|
||||
* @apiSuccess {String} users.username User username
|
||||
* @apiSuccess {String} users.email User email
|
||||
*
|
||||
* @apiSuccessExample {json} Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
* {
|
||||
* "user": {
|
||||
* "_id": "56bd1da600a526986cf65c80"
|
||||
* "name": "John Doe"
|
||||
* "email": "email@format.com"
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @apiError UnprocessableEntity Missing required parameters
|
||||
*
|
||||
* @apiErrorExample {json} Error-Response:
|
||||
* HTTP/1.1 422 Unprocessable Entity
|
||||
* {
|
||||
* "status": 422,
|
||||
* "error": "Unprocessable Entity"
|
||||
* }
|
||||
*/
|
||||
async createUser (rpcData) {
|
||||
try {
|
||||
// console.log('createUser rpcData: ', rpcData)
|
||||
|
||||
Reference in New Issue
Block a user