Code Monkey home page Code Monkey logo

invoice-api's Introduction

📝 Documentação da Invoice API

🔥 Introdução

Uma API RESTful para gerenciamento de faturas e consulta de usuários.

📦 Tecnologias usadas:

  • Laravel
  • Docker
  • Swagger

Base url: https://api-invoice.online

Authentication Endpoints

Efetuar login

  • Endpoint: /api/v1/login

  • Method: POST

  • Description: Efetuar login de um usuário.

  • Request Body:

    {
        "email": "[email protected]",
        "password": "password"
    }
  • Response

    • Status: 200 OK
    • Content:
    {
        "message": "Authorized",
        "status": 200,
        "data": {
            "token": "dklfjakjdajfkdj@*kdfalkdjfka" //exemplo de token
        }
    }
  • Response Error

    • Status: 403 FORBIDDEN
    • Content:
    {
        "message": "Not Authorized",
        "status": 403,
        "data": []
    }

Efetuar logout

  • Endpoint: /api/v1/logout
  • Method: POST
  • Description: Efetuar o logout de um usuário.
  • Response
    • Status: 200 OK
    • Content:
    {
        "message": "Token Revoked",
        "status": 200,
        "data": []
    }

Usuário Endpoints

Lista de todos usuários

  • Endpoint: /api/v1/users
  • Method: GET
  • Description: Lista de todos os usuários.
  • Response
    • Status: 200 OK
    • Content:
    {
        "data": [
            {
                "first_name": "Example",
                "last_name": "One",
                "full_name": "Example One",
                "email": "[email protected]"
            },
            {
                "first_name": "Example",
                "last_name": "Two",
                "full_name": "Example Two",
                "email": "[email protected]"
            },
            {
                "first_name": "Example",
                "last_name": "Three",
                "full_name": "Example Three",
                "email": "[email protected]"
            },
        ]
    }

Pegar um usuário

  • Endpoint: /api/v1/users/{user_id}
  • Method: GET
  • Description: Pegar um usuário específico.
  • Request Body
    user_id => integer
  • Response
    • Status: 200 OK
    • Content:
    {
        "data": {
            "first_name": "Example",
            "last_name": "Two",
            "full_name": "Example Two",
            "email": "[email protected]"
        }
    }

Invoice Endpoints

Lista de todas as faturas

  • Endpoint: /api/v1/invoices
  • Method: GET
  • Description: Retorna uma lista de todas as faturas.
  • Params:
    • Content:
          'gt'  // greater than
          'gte', // greter than equal
          'lt', // less than
          'lte', // less than equal
          'eq', // equal
          'ne', // not equal
          'in', // in
  • Example:
    • Endpoint: api/v1/invoices?paid[eq]=1 /** pagamento igual a 1 (todas as faturas pagas) **/
    • Content: /** Repare que todo 'paid' está como 'Pago' **/
          {
          "data": [
              {
                  "user": {
                      "firstName": "Kraig",
                      "lastName": "Predovic",
                      "fullName": "Kraig Predovic",
                      "email": "[email protected]"
                  },
                  "type": "Boleto",
                  "value": "R$ 9,918.00",
                  "paid": "Pago",
                  "paymentDate": "30\/11\/2023 08:59:47",
                  "paymentSince": "há 2 semanas"
              },
              {
                  "user": {
                      "firstName": "Kraig",
                      "lastName": "Predovic",
                      "fullName": "Kraig Predovic",
                      "email": "[email protected]"
                  },
                  "type": "Cartão",
                  "value": "R$ 3,128.00",
                  "paid": "Pago",
                  "paymentDate": "15\/11\/2023 23:22:48",
                  "paymentSince": "há 4 semanas"
              },
          ]
      }
  • Response:
    • Status: 200 OK
    • Content:
          {
              "data": [
                  {
                      "user": {
                          "firstName": "Example",
                          "lastName": "One",
                          "fullName": "Example One",
                          "email": "[email protected]"
                      },
                      "type": "Pix",
                      "value": "R$ 12,000.00",
                      "paid": "Não Pago",
                      "paymentDate": null,
                      "paymentSince": null
                  },
                  {
                      "user": {
                          "firstName": "Example",
                          "lastName": "Two",
                          "fullName": "Example Two",
                          "email": "[email protected]"
                      },
                      "type": "Boleto",
                      "value": "R$ 9,918.00",
                      "paid": "Pago",
                      "paymentDate": "30/11/2023 08:59:47",
                      "paymentSince": "há 2 semanas"
                  },
                  {
                      "user": {
                          "firstName": "Example",
                          "lastName": "Three",
                          "fullName": "Example Three",
                          "email": "[email protected]"
                      },
                      "type": "Cartão",
                      "value": "R$ 9,918.00",
                      "paid": "Pago",
                      "paymentDate": "30/11/2023 08:59:47",
                      "paymentSince": "há 2 semanas"
                  },
              ]
          }

Criar uma nova fatura

  • Endpoint: /api/v1/invoices

  • Method: POST

  • Description: Cria uma nova fatura.

  • Request Body:

      {
          "user_id": 1,
          "type": "P", //P: pix, B: boleto, C: cartão
          "paid": 1, // 0 para 'não pago' e 1 para 'pago'
          "value": 9000.00
      }
  • Response:

    • Status: 200 OK
    • Content:
        {
            "message": "Invoice created",
            "status": 200,
            "data": {
                {
                    "user": {
                        "firstName": "Example",
                        "lastName": "One",
                        "fullName": "Example One",
                        "email": "[email protected]"
                    },
                    "type": "Pix",
                    "value": "R$ 12,000.00",
                    "paid": "Não Pago",
                    "paymentDate": null,
                    "paymentSince": null
                }
            }
        }
  • Response Error:

    • Status: 400 BAD REQUEST
    • Content:
          {
              "message": "Invoice not created",
              "status": 400,
              "data": []
          }
      

Pegar uma fatura

  • Endpoint: /api/v1/invoices/{invoice_id}
  • Method: GET
  • Description: Pegar uma fatura específica.
  • Params:
      invoice_id => integer
  • Response:
    • Status: 200 OK
    • Content:
          {
              "data": {
                  "user": {
                      "firstName": "Delta",
                      "lastName": "Heaney",
                      "fullName": "Delta Heaney",
                      "email": "[email protected]"
                  },
                  "type": "Pix",
                  "value": "R$ 12,000.00",
                  "paid": "Não Pago",
                  "paymentDate": null,
                  "paymentSince": null
              }
          }

Atuaizar uma fatura

  • Endpoint: /api/v1/invoices/{invoice_id}

  • Method: PUT/PATCH

  • Description: Atuaizar uma fatura específica.

  • Request Body:

      {
          "user_id": 1,
          "type": "P", //P: pix, B: boleto, C: cartão
          "paid": 1, // 0 para 'não pago' e 1 para 'pago'
          "value": 9000.00
      }
  • Response:

    • Status: 200 OK
    • Content:
          {
              "message": "Invoice updated",
              "status": 200,
              "data": {
                  {
                      "user": {
                          "firstName": "Example",
                          "lastName": "One",
                          "fullName": "Example One",
                          "email": "[email protected]"
                      },
                      "type": "Pix",
                      "value": "R$ 12,000.00",
                      "paid": "Não Pago",
                      "paymentDate": null,
                      "paymentSince": null
                  }
              }
          }
  • Response Error:

    • Status: 400 BAD REQUEST
    • Content:
          {
              "message": "Invoice not updated",
              "status": 400,
              "data": []
          }

Deletar uma fatura

  • Endpoint: /api/v1/invoices/{invoice_id}
  • Method: DELETE
  • Description: Deletar uma fatura específica.
  • Params:
      invoice_id => integer
  • Response:
    • Status: 200 OK
    • Content:
          {
              "message": "Invoice deleted",
              "status": 200,
              "data": []
          }
  • Response Error:
    • Status: 400 BAD REQUEST
    • Content:
          {
              "message": "Invoice not deleted",
              "status": 400,
              "data": []
          }
      

💡 Expressões de gratidão

invoice-api's People

Contributors

lucas-dantas10 avatar

Watchers

 avatar

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.