Git Product home page Git Product logo

go-events-state's Introduction

Как запустить

APP_DEBUG= APP_INTERRUPTED_LIFETIME=10 APP_SERVER_PORT=8081 go run cmd/main.go

Где:

  • APP_DEBUG - включит логгирование http запросов
  • APP_INTERRUPTED_LIFETIME - время жизни трансялции в статусе interrupted, в сек
  • APP_SERVER_PORT - порт для http сервера

Методы Api

Список событий
GET /api/v1/events
{
  "data": [
    {
      "type": "stream",
      "id": "a23626f1-8db6-4e73-86b2-fc10903bdd08",
      "attributes": {
        "created": "2020-06-11T00:51:01.553117+03:00",
        "state": "finished"
      }
    }
  ]
}
Получить одно событие
POST /api/v1/event/a23626f1-8db6-4e73-86b2-fc10903bdd08
{
  "data": {
    "type": "stream",
    "id": "06d606b6-661a-458f-9553-a7046ef68f1d",
    "attributes": {
      "created": "2020-06-11T01:05:16.935298+03:00",
      "state": "created"
    }
  }
}
Добавить событие
POST /api/v1/event
{
  "data": [
    {
      "type": "stream",
      "id": "a23626f1-8db6-4e73-86b2-fc10903bdd08",
      "attributes": {
        "created": "2020-06-11T00:51:01.553117+03:00",
        "state": "created"
      }
    }
  ]
}
Обновить стейт события
PUT /api/v1/event/a23626f1-8db6-4e73-86b2-fc10903bdd08
{
	"state": "interrupted"
}
{
  "data": [
    {
      "type": "stream",
      "id": "a23626f1-8db6-4e73-86b2-fc10903bdd08",
      "attributes": {
        "created": "2020-06-11T00:51:01.553117+03:00",
        "state": "interrupted"
      }
    }
  ]
}
Удалить событие
DELETE /api/v1/event/a23626f1-8db6-4e73-86b2-fc10903bdd08
No Content

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.