Git Product home page Git Product logo

Comments (3)

arreche avatar arreche commented on July 19, 2024

This API will be consumed by two different clients

  1. Web UI
  2. Bot

And It will provide access to the core AsyncVoter functionality. i.e.

  • Vote's descriptions will only displayed after receive 3 casts.

Therefore I think this is not a regular CRUD API so it would be also useful to specify the JSON messages in each case.

from asyncvoter-api.

Zsuark avatar Zsuark commented on July 19, 2024

@arreche Feel free to post an update REST API including messages

from asyncvoter-api.

arreche avatar arreche commented on July 19, 2024

Start a voting session

Request

POST /stories

{
 "name": "REST API",
 "link": "https://github.com/AgileVentures/AsyncVoter/issues/53"
}

Response

201 Created

{
 "id": "abc123...",
 "name": "REST API",
 "link": "https://github.com/AgileVentures/AsyncVoter/issues/53",
 "status": "ready" //Waiting for votes
} 

Register a vote

Request

POST /stories/abc123.../votes

{
 "voter": "arreche", //Could be guessed from the auth in the future
 "vote": "3"
}

Response

201 Created

{"id": "def456...",
 "story": "abc123...", //Nesting the story JSON here maybe useful
 "voter": "arreche",
 "vote": 1}

Finish voting session

  • Finished automatically after receiving 3 votes
  • The system reacts sending a notification to clients (web/bot)

Request

POST /webhook/stories

Response on consensus

201 Created

{
 "id": "abc123...",
 "name": "REST API",
 "link": "https://github.com/AgileVentures/AsyncVoter/issues/53",
 "status": "consensus",
 "points": "1",
 "votes": [{"arreche": 1}, {"Zsuark": 1}, {"joaopapereira": 1}]
}

Response on disagreement

{
 "id": "abc123...",
 "name": "REST API",
 "link": "https://github.com/AgileVentures/AsyncVoter/issues/53",
 "status": "disagreement",
 "votes": [{"arreche": 3}, {"Zsuark": 1}, {"joaopapereira": 1}]
}

Get a voting session

Request

GET /stories/abc123...

Response

200 OK

{
 "id": "abc123...",
 "name": "REST API",
 "link": "https://github.com/AgileVentures/AsyncVoter/issues/53",
 "status": "consensus",
 "points": "1",
 "votes": [{"arreche": 1}, {"Zsuark": 1}, {"joaopapereira": 1}]
}

List voting sessions

  • Optionally it allows filtering vote sessions by status

Request

GET /stories?status=(ready | consensus | disagreement)

Response

200 OK

[{
 "id": "abc123...",
 "name": "REST API",
 "link": "https://github.com/AgileVentures/AsyncVoter/issues/53",
 "status": "consensus",
 "points": "1",
 "votes": [{"arreche": 1}, {"Zsuark": 1}, {"joaopapereira": 1}]
}]

from asyncvoter-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.