mirror of
https://github.com/oceanprotocol/webtasks
synced 2025-01-06 20:05:40 +01:00
add total bounty count to main response
This commit is contained in:
parent
4da6165842
commit
cb1e8f99e9
31
README.md
31
README.md
@ -9,20 +9,18 @@
|
||||
[![Build Status](https://travis-ci.com/oceanprotocol/webtasks.svg?token=3psqw6c8KMDqfdGQ2x6d&branch=master)](https://travis-ci.com/oceanprotocol/webtasks)
|
||||
[![js oceanprotocol](https://img.shields.io/badge/js-oceanprotocol-7b1173.svg)](https://github.com/oceanprotocol/eslint-config-oceanprotocol) [![Greenkeeper badge](https://badges.greenkeeper.io/oceanprotocol/webtasks.svg)](https://greenkeeper.io/)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Tasks](#tasks)
|
||||
- [Medium](#medium)
|
||||
- [YouTube](#youtube)
|
||||
- [Bounties](#bounties)
|
||||
- [MailChimp](#mailchimp)
|
||||
- [Zoho](#zoho)
|
||||
- [Campaigns API](#campaigns-api)
|
||||
- [CRM API](#crm-api)
|
||||
- [Development](#development)
|
||||
- [Deployment](#deployment)
|
||||
- [Authors](#authors)
|
||||
- [License](#license)
|
||||
- [Tasks](#tasks)
|
||||
- [Medium](#medium)
|
||||
- [YouTube](#youtube)
|
||||
- [Bounties](#bounties)
|
||||
- [MailChimp](#mailchimp)
|
||||
- [Zoho](#zoho)
|
||||
- [Campaigns API](#campaigns-api)
|
||||
- [CRM API](#crm-api)
|
||||
- [Development](#development)
|
||||
- [Deployment](#deployment)
|
||||
- [Authors](#authors)
|
||||
- [License](#license)
|
||||
|
||||
---
|
||||
|
||||
@ -97,12 +95,13 @@ https://TASK_URL/TASK_NAME/
|
||||
|
||||
**Response**
|
||||
|
||||
Response is structured by network and returns the count of open bounties:
|
||||
Response is structured by network and returns the count of open bounties, and a `total` number counting all active and completed bounties:
|
||||
|
||||
```json
|
||||
{
|
||||
"gitcoin": 1,
|
||||
"bountiesNetwork": 2
|
||||
"bountiesNetwork": 2,
|
||||
"total": 17
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -37,24 +37,25 @@ async function getBountiesNetwork() {
|
||||
}
|
||||
}
|
||||
|
||||
server.get('/', async (req, res) => {
|
||||
try {
|
||||
const dataGitcoin = await getGitcoin()
|
||||
const dataBountiesNetwork = await getBountiesNetwork()
|
||||
const data = Object.assign(dataGitcoin, dataBountiesNetwork)
|
||||
|
||||
res.send(data)
|
||||
} catch (error) {
|
||||
res.send(error)
|
||||
}
|
||||
})
|
||||
|
||||
server.get('/all', async (req, res) => {
|
||||
async function getTotal() {
|
||||
try {
|
||||
const response = await axios.get('https://api.bounties.network/bounty/?search=ocean%20protocol')
|
||||
|
||||
const allBounties = response.data
|
||||
const data = { count: allBounties.count }
|
||||
const data = { total: allBounties.count }
|
||||
return data
|
||||
} catch (error) {
|
||||
console.error(`Error: ${error.reason}`) // eslint-disable-line no-console
|
||||
}
|
||||
}
|
||||
|
||||
server.get('/', async (req, res) => {
|
||||
try {
|
||||
const dataGitcoin = await getGitcoin()
|
||||
const dataBountiesNetwork = await getBountiesNetwork()
|
||||
const dataTotal = await getTotal()
|
||||
|
||||
const data = Object.assign(dataGitcoin, dataBountiesNetwork, dataTotal)
|
||||
|
||||
res.send(data)
|
||||
} catch (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user