mirror of
https://github.com/oceanprotocol/webtasks
synced 2025-01-07 20:35:30 +01:00
remove bounties webtask
* migrated to https://github.com/oceanprotocol/bounties-api
This commit is contained in:
parent
6bafc615e4
commit
fcec0d4d09
26
README.md
26
README.md
@ -14,7 +14,6 @@
|
|||||||
- [Get Latest Posts](#get-latest-posts)
|
- [Get Latest Posts](#get-latest-posts)
|
||||||
- [Get Followers Count](#get-followers-count)
|
- [Get Followers Count](#get-followers-count)
|
||||||
- [YouTube](#youtube)
|
- [YouTube](#youtube)
|
||||||
- [Bounties](#bounties)
|
|
||||||
- [MailChimp](#mailchimp)
|
- [MailChimp](#mailchimp)
|
||||||
- [Zoho](#zoho)
|
- [Zoho](#zoho)
|
||||||
- [Campaigns API](#campaigns-api)
|
- [Campaigns API](#campaigns-api)
|
||||||
@ -101,31 +100,6 @@ If you want to get the original response returned from YouTube API, append `/raw
|
|||||||
https://TASK_URL/TASK_NAME/playlist/:youtube_playlist_id/raw
|
https://TASK_URL/TASK_NAME/playlist/:youtube_playlist_id/raw
|
||||||
```
|
```
|
||||||
|
|
||||||
### Bounties
|
|
||||||
|
|
||||||
**`webtask-bounties.js`**: Task to fetch open bounties on Gitcoin and Bounties.network in one request. Task creates a unified response from fetching both networks.
|
|
||||||
|
|
||||||
Construct your `/` request url like so, e.g. locally:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
http://localhost:8080/
|
|
||||||
|
|
||||||
# when published on webtask.io
|
|
||||||
https://TASK_URL/TASK_NAME/
|
|
||||||
```
|
|
||||||
|
|
||||||
**Response**
|
|
||||||
|
|
||||||
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,
|
|
||||||
"total": 17
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### MailChimp
|
### MailChimp
|
||||||
|
|
||||||
**`webtask-mailchimp.js`**: Task to add a new newsletter subscriber.
|
**`webtask-mailchimp.js`**: Task to add a new newsletter subscriber.
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
'use latest'
|
|
||||||
|
|
||||||
const express = require('express')
|
|
||||||
const axios = require('axios')
|
|
||||||
const webtask = require('webtask-tools')
|
|
||||||
const regeneratorRuntime = require('regenerator-runtime') // eslint-disable-line
|
|
||||||
|
|
||||||
const server = express()
|
|
||||||
|
|
||||||
async function getGitcoin() {
|
|
||||||
try {
|
|
||||||
const response = await axios.get('https://gitcoin.co/api/v0.1/bounties/')
|
|
||||||
|
|
||||||
const gitcoinBody = response.data // returns only open bounties by default
|
|
||||||
const gitcoin = gitcoinBody.filter(
|
|
||||||
// filter the response manually, no way atm to do that as API query
|
|
||||||
item => item.funding_organisation.includes('Ocean Protocol')
|
|
||||||
)
|
|
||||||
|
|
||||||
const data = { gitcoin: gitcoin.length }
|
|
||||||
|
|
||||||
return data
|
|
||||||
} catch (error) {
|
|
||||||
console.error(`Error: ${error.reason}`) // eslint-disable-line no-console
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getBountiesNetwork() {
|
|
||||||
try {
|
|
||||||
const response = await axios.get('https://api.bounties.network/bounty/?search=ocean%20protocol&bountyStage=1&platform=bounties-network')
|
|
||||||
|
|
||||||
const bountiesNetwork = response.data
|
|
||||||
const data = { bountiesNetwork: bountiesNetwork.results.length }
|
|
||||||
return data
|
|
||||||
} catch (error) {
|
|
||||||
console.error(`Error: ${error.reason}`) // eslint-disable-line no-console
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getTotal() {
|
|
||||||
try {
|
|
||||||
const response = await axios.get('https://api.bounties.network/bounty/?search=ocean%20protocol')
|
|
||||||
|
|
||||||
const allBounties = response.data
|
|
||||||
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) {
|
|
||||||
res.send(error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
module.exports = webtask.fromExpress(server)
|
|
Loading…
Reference in New Issue
Block a user