Backend module for StreamersEdge application
Get profile of authorized admin
GET /api/v1/admin/profile
Success-Response:
HTTP/1.1 200 OK
{
"status": 200,
"result": {
"id": "5cc315041ec568398b99d7ca",
"username": "test",
"email": "test@email.com",
"twitchUserName": "",
"googleName": "",
"avatar": "",
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": "",
"userType": "viewer"
}
}
POST /api/v1/admin/users/ban/:userId
Success-Response:
HTTP/1.1 200 OK
{
"result": true,
"status": 200
}
GET /api/v1/admin/users/ban/:userId
Success-Response:
HTTP/1.1 200 OK
{
"status": 200
"result": {
"id": "1",
"username": "test",
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"twitchId": "42342",
"twitchLink": "https://www.twitch.tv/42342/videos",
}
}
Get profiles of all users with their ban status
GET /api/v1/admin/users
| Name | Type | Description |
|---|---|---|
| offset | Number | optional Number of rows to skip |
| limit | Number | |
| flag | String | optional Filter param to fetch users by status |
| search | String | optional Filter by username / email |
Success-Response:
HTTP/1.1 200 OK
[
{
"status": 200,
"result": {
"id": "1",
"username": "test",
"email": "test@email.com",
"isEmailVerified": true,
"twitchUserName": "",
"twitchId": "",
"googleId": "",
"googleName": "",
"avatar": "",
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": "",
"userType": "viewer",
"status": "banned",
"ban-histories.bannedById": "2"
"ban-histories.bannedAt": "2019-06-29T12:26:56.453Z"
}
}
]
GET /api/v1/auth/confirm-email/:token
POST /api/v1/auth/logout
Request-Example:
{}
Success-Response:
HTTP/1.1 200 OK
{
"status": 200,
"result": true
}
POST /api/v1/auth/sign-in
Request-Example:
{
"login": "test@test.com",
"password": "testtest"
}
POST /api/v1/auth/sign-up
Request-Example:
{
"email": "test@test.com",
"username": "test",
"password": "testtest",
"repeatPassword": "testtest"
}
POST /api/v1/auth/forgot-password
Request-Example:
{
"email": "test@test.com"
}
POST /api/v1/auth/reset-password
Request-Example:
{
"token": "fb7ce9c3913ed08a0dfd45d4bc",
"password": "testpass",
"repeatPassword": "testpass"
}
POST /api/v1/challenges
| Name | Type | Description |
|---|---|---|
| name | String | Name of challenge |
| startDate | Date | optional Date of start challenge in ISO format |
| endDate | Date | optional Date of end challenge in ISO format |
| game | String | Type of challenge game. Now can be 'pubg' only |
| accessRule | String | Type of access - anyone or invite |
| ppyAmount | Number | PPY Amount for challenge in "satoshis" |
| conditionsText | String | optional Required only if conditions is empty |
| conditions | Object[] | optional Conditions array |
| conditions.param | String | optional result_place, win_time, frags |
| conditions.operator | String | optional >, <, =, >=, <= |
| conditions.value | Number | optional Can be integer number |
| conditions.join | String | optional AND, OR or END. END can be used once |
Request-Example:
{
"name": "Test name",
"startDate": "2019-04-04T08:32:19.818Z",
"endDate": "2019-04-04T08:32:19.818Z",
"game": "pubg",
"accessRule": "anyone",
"ppyAmount": 100,
"invitedAccounts": [],
"conditionsText": [],
"conditions": [{
"param": "resultPlace",
"operator": ">",
"value": 1,
"join": "END"
}]
}
Success-Response:
HTTP/1.1 200 OK
{
"result": {
"id": 11,
"name": "test",
"createdAt": "2019-06-02T06:11:44.866Z",
"startDate": "2019-07-04T08:32:19.818Z",
"endDate": null,
"game": "pubg",
"accessRule": "anyone",
"ppyAmount": "1",
"conditionsText": "test",
"user": {
"id": 1,
"username": "username",
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": ""
},
"conditions": [{
"id": 4,
"param": "resultPlace",
"operator": ">",
"value": 1,
"join": "OR",
"createdAt": "2019-06-02T06:11:44.874Z",
"updatedAt": "2019-06-02T06:11:44.874Z",
"challengeId": 11
}, {
"id": 5,
"param": "resultPlace",
"operator": ">",
"value": 1,
"join": "END",
"createdAt": "2019-06-02T06:11:44.875Z",
"updatedAt": "2019-06-02T06:11:44.875Z",
"challengeId": 11
}],
"invitedUsers": []
},
"status": 200
}
GET /api/v1/challenges/:id
Success-Response:
HTTP/1.1 200 OK
{
"result": {
"id": 11,
"name": "test",
"createdAt": "2019-06-02T06:11:44.866Z",
"startDate": "2019-07-04T08:32:19.818Z",
"endDate": null,
"game": "pubg",
"accessRule": "anyone",
"ppyAmount": "1",
"conditionsText": "test",
"user": {
"id": 1,
"username": "username",
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": ""
},
"conditions": [{
"id": 4,
"param": "resultPlace",
"operator": ">",
"value": 1,
"join": "OR",
"createdAt": "2019-06-02T06:11:44.874Z",
"updatedAt": "2019-06-02T06:11:44.874Z",
"challengeId": 11
}, {
"id": 5,
"param": "resultPlace",
"operator": ">",
"value": 1,
"join": "END",
"createdAt": "2019-06-02T06:11:44.875Z",
"updatedAt": "2019-06-02T06:11:44.875Z",
"challengeId": 11
}],
"invitedUsers": []
},
"status": 200
}
GET /api/v1/challenges
Success-Response:
HTTP/1.1 200 OK
{
"result": {
"id": 11,
"name": "test",
"createdAt": "2019-06-02T06:11:44.866Z",
"startDate": "2019-07-04T08:32:19.818Z",
"endDate": null,
"game": "pubg",
"accessRule": "anyone",
"ppyAmount": "1",
"conditionsText": "test",
"user": {
"id": 1,
"username": "username",
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": ""
},
"conditions": [{
"id": 4,
"param": "resultPlace",
"operator": ">",
"value": 1,
"join": "OR",
"createdAt": "2019-06-02T06:11:44.874Z",
"updatedAt": "2019-06-02T06:11:44.874Z",
"challengeId": 11
}, {
"id": 5,
"param": "resultPlace",
"operator": ">",
"value": 1,
"join": "END",
"createdAt": "2019-06-02T06:11:44.875Z",
"updatedAt": "2019-06-02T06:11:44.875Z",
"challengeId": 11
}],
"invitedUsers": []
},
"status": 200
}
POST /api/v1/challenges/invite
| Name | Type | Description |
|---|---|---|
| userId | Number | Invited user Id |
| challengeId | Number | Id of of challenge |
Request-Example:
{
"userId": "6",
"challengeId": "107",
}
Success-Response:
HTTP/1.1 200 OK
{
"result": {
"id": 11,
"name": "test",
"createdAt": "2019-06-02T06:11:44.866Z",
"startDate": "2019-07-04T08:32:19.818Z",
"endDate": null,
"game": "pubg",
"accessRule": "anyone",
"ppyAmount": "1",
"conditionsText": "test",
"user": {
"id": 1,
"username": "username",
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": ""
},
"conditions": [{
"id": 4,
"param": "resultPlace",
"operator": ">",
"value": 1,
"join": "OR",
"createdAt": "2019-06-02T06:11:44.874Z",
"updatedAt": "2019-06-02T06:11:44.874Z",
"challengeId": 11
}, {
"id": 5,
"param": "resultPlace",
"operator": ">",
"value": 1,
"join": "END",
"createdAt": "2019-06-02T06:11:44.875Z",
"updatedAt": "2019-06-02T06:11:44.875Z",
"challengeId": 11
}],
"invitedUsers": []
},
"status": 200
}
POST /api/v1/challenges/join
| Name | Type | Description |
|---|---|---|
| challengeId | Number | User join to this challenge |
| tx | Object | transaction for this challenge |
Request-Example:
{
"challengeId": "107",
"tx": {
{
ref_block_num: 37792,
ref_block_prefix: 2533853773,
expiration: '2019-06-28T14:17:57',
operations:
[0,
{
fee: {amount: '2000000', asset_id: '1.3.0'},
from: '1.2.54',
to: '1.2.55',
amount: {amount: '10000', asset_id: '1.3.0'},
memo: undefined,
extensions: []
}],
extensions: [],
signatures: ['1f2baa40114f8ed62ec1d3979b5...343716bd033262']
}
}
}
Success-Response:
HTTP/1.1 200 OK
{
"result": {
"joinedAt": "2019-06-26T14:46:29.415Z",
"isPayed": false,
"id": 4,
"challengeId": 15,
"userId": 6,
"updatedAt": "2019-06-26T14:46:29.416Z",
"createdAt": "2019-06-26T14:46:29.416Z"
}
"status": 200
}
Success-Response:
HTTP/1.1 200 OK
{
"result": {
"id": 11,
"name": "test",
"createdAt": "2019-06-02T06:11:44.866Z",
"startDate": "2019-07-04T08:32:19.818Z",
"endDate": null,
"game": "pubg",
"accessRule": "anyone",
"ppyAmount": "1",
"conditionsText": "test",
"user": {
"id": 1,
"username": "username",
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": ""
},
"conditions": [{
"id": 4,
"param": "resultPlace",
"operator": ">",
"value": 1,
"join": "OR",
"createdAt": "2019-06-02T06:11:44.874Z",
"updatedAt": "2019-06-02T06:11:44.874Z",
"challengeId": 11
}, {
"id": 5,
"param": "resultPlace",
"operator": ">",
"value": 1,
"join": "END",
"createdAt": "2019-06-02T06:11:44.875Z",
"updatedAt": "2019-06-02T06:11:44.875Z",
"challengeId": 11
}],
"invitedUsers": []
},
"status": 200
}
POST /api/v1/challenges/subscribe
| Name | Type | Description |
|---|---|---|
| endpoint | String | url for user |
| expirationTime | Number | time of expiration |
| keys | Object | object |
| keys.p256dh | String | optional string in p256dh |
| keys.auth | String | optional auth string |
Request-Example:
{
endpoint: 'https://fcm.googleapis.com/...lbTgv66-WEEWWK9bxZ_ksHhV_Z49vBvnYZdeS6cL6kk',
expirationTime: null,
keys:
{
p256dh: 'BOQWqnde....j7Dk-o',
auth: 'EYFQS0dh2KaPMXx9nmVPww'
}
}
Success-Response:
HTTP/1.1 200 OK
{
"result": "BOQWqndev7VP-UCLv9QIqDtkcNwRjyu4QBPDTCymL6ILHWklqWP1XxXRLmAYywsfgGs7K8Yub_6jQKiN0j7Dk-o",
"status": 200
}
GET /api/v1/auth/facebook
GET /api/v1/auth/google
POST /api/v1/payment
POST /api/v1/profile/peerplays/create-account
Request-Example:
{
"name": "testaccount",
"activeKey": "PPY5iePa6MU4QHGyY5tk1XjngDG1j9jRWLspXxLKUqxSc4sh51ZS4",
"ownerKey": "PPY5iePa6MU4QHGyY5tk1XjngDG1j9jRWLspXxLKUqxSc4sh51ZS4",
}
Success-Response:
HTTP/1.1 200 OK
{
"status": 200,
"result": {
"id": 7,
"username": "test",
"email": "test@email.com",
"twitchUserName": "",
"googleName": "",
"youtube": "",
"facebook": "",
"twitch": "",
"peerplaysAccountName": "",
"bitcoinAddress": "",
"userType": "viewer",
"avatar": ""
}
}
DELETE /api/v1/profile/avatar
Success-Response:
HTTP/1.1 200 OK
{
"status": 200,
"result": {
"id": 7,
"username": "test",
"email": "test@email.com",
"twitchUserName": "",
"googleName": "",
"youtube": "",
"facebook": "",
"twitch": "",
"peerplaysAccountName": "",
"bitcoinAddress": "",
"userType": "viewer",
"avatar": ""
}
}
Get profile of authorized user
GET /api/v1/profile
Success-Response:
HTTP/1.1 200 OK
{
"status": 200,
"result": {
"id": 7,
"username": "test",
"email": "test@email.com",
"twitchUserName": "",
"googleName": "",
"youtube": "",
"facebook": "",
"twitch": "",
"peerplaysAccountName": "",
"bitcoinAddress": "",
"userType": "viewer",
"avatar": ""
}
}
PATCH /api/v1/profile
Request-Example:
{
"avatar": "",
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": "",
"userType": "viewer"
}
Success-Response:
HTTP/1.1 200 OK
{
"status": 200,
"result": {
"id": 7,
"username": "test",
"email": "test@email.com",
"twitchUserName": "",
"googleName": "",
"youtube": "",
"facebook": "",
"twitch": "",
"peerplaysAccountName": "",
"bitcoinAddress": "",
"userType": "viewer",
"avatar": ""
}
}
POST /api/v1/profile/avatar
Request-Example:
"file": ...file...
Success-Response:
HTTP/1.1 200 OK
{
"status": 200,
"result": {
"id": 7,
"username": "test",
"email": "test@email.com",
"twitchUserName": "",
"googleName": "",
"youtube": "",
"facebook": "",
"twitch": "",
"peerplaysAccountName": "",
"bitcoinAddress": "",
"userType": "viewer",
"avatar": ""
}
}
POST /api/v1/report
Request-Example:
{
"reportedUserId": 2,
"reason": "vulgarity-on-stream",
"description": "bad, very bad",
"videoUrl": "url"
}
Success-Response:
HTTP/1.1 200 OK
{
"result": {
"id": 2,
"reportedUserId": 2,
"reportedByUserId": 1,
"reason": "vulgarity-on-stream",
"description": "bad, very bad",
"videoUrl": "url",
"updatedAt": "2019-07-01T14:16:05.933Z",
"createdAt": "2019-07-01T14:16:05.933Z"
},
"status": 200
}
Get Stream by StreamId
GET /api/v1/stream/:id
Success-Response:
HTTP/1.1 200 OK
{
"result": {
"id": 1,
"name": "TSM chocoTaco | today's weather: thirsty",
"game": "pubg",
"sourceName": "twitch",
"embedUrl": "",
"channelId": "34608843376",
"views": 3536,
"isLive": true,
"startTime": "2019-06-21T00:09:40.000Z",
"thumbnailUrl": "https://static-cdn.jtvnw.net/previews-ttv/live_user_chocotaco-{width}x{height}.jpg",
"user": {
"id": 10,
"username": "jotprabh",
"email": "prabhjot.narula@gmail.com",
"twitchUserName": null,
"googleName": null,
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": "",
"userType": null
}
},
"status": 200
}
Get Streams
GET /api/v1/streams
Success-Response:
HTTP/1.1 200 OK
{
"result": [
{
"id": 1,
"name": "TSM chocoTaco | today's weather: thirsty",
"game": "pubg",
"sourceName": "twitch",
"embedUrl": "",
"channelId": "34608843376",
"views": 3536,
"isLive": true,
"startTime": "2019-06-21T00:09:40.000Z",
"thumbnailUrl": "https://static-cdn.jtvnw.net/previews-ttv/live_user_chocotaco-{width}x{height}.jpg",
"user": {
"id": 10,
"username": "jotprabh",
"email": "prabhjot.narula@gmail.com",
"twitchUserName": null,
"googleName": null,
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": "",
"userType": null
}
}
],
"status": 200
}
GET /api/v1/stream/populate-twitch-streams
Success-Response:
HTTP/1.1 200 OK
{
"status": 200,
"result": true
}
GET /api/v1/transactions
| Name | Type | Description |
|---|---|---|
| limit | String | |
| skip | String | optional |
Success-Response:
HTTP/1.1 200 OK
{
"status": 200
"result": [{
"id": 1,
"txId": "8ed2756c1b26883585f6259eca90ad0e44be04a2",
"blockNum": 901602,
"trxNum": 0,
"ppyAmountValue": 100,
"type": "challengeCreation",
"createdAt": "2019-07-01T07:25:33.100Z",
"updatedAt": "2019-07-01T07:25:33.100Z",
"userId": 1,
"challengeId": 3
}]
}
GET /api/v1/auth/twitch
PATCH /api/v1/users/setNotification
| Name | Type | Description |
|---|---|---|
| set | Boolean | notification for user |
Success-Response:
HTTP/1.1 200 OK
{
"result": [1],
"status": 200
}
GET /api/v1/users/:id
| Name | Type | Description |
|---|---|---|
| id | String | User id |
Success-Response:
HTTP/1.1 200 OK
{
"status": 200,
"result": {
"id": "5cc315041ec568398b99d7ca",
"username": "test",
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": ""
}
}
GET /api/v1/users
| Name | Type | Description |
|---|---|---|
| search | String | optional Filter by PeerPlays Account Name |
| limit | Number | Limit of rows |
| skip | Number | optional Number of rows to skip |
Success-Response:
HTTP/1.1 200 OK
{
"status": 200,
"result": [{
"id": "5cc315041ec568398b99d7ca",
"username": "test",
"youtube": "",
"facebook": "",
"peerplaysAccountName": "",
"bitcoinAddress": ""
}]
}