cybercog / laravel-paket

Composer GUI. Manage Laravel dependencies from web interface without switching to command line!

Home Page:https://komarev.com/sources/laravel-paket

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Revise jobs & requirements HTTP API

antonkomarev opened this issue · comments

Current API

To install requirement we can send POST /requirements request:

{
  name: "cybercog/laravel-love",
  version: "^7.1",
  isDevelopment: false
}

To uninstall requirement we can send DELETE /requirements/{uid} request, where {uid} is base64 encoded package name.

New API

But in fact we are not creating requirement. We are asking server to create a job to install this requirement. It might be better to have unified API endpoint to create all types of jobs.

To install requirement we will send POST /jobs request:

{
  type: "RequirementInstall",
  requirement: {
    name: "cybercog/laravel-love",
    version: "^7.1",
    isDevelopment: false
  },
}

To uninstall requirement we will send POST /jobs request:

{
  type: "RequirementUninstall",
  requirement: {
    name: "cybercog/laravel-love",
    version: null,
    isDevelopment: false
  },
}

Because this changes has completely new interaction way - there is need to refactor Requirement events, listeners & queue jobs. They should be located in Job namespace.

Rename events:

  • RequirementHasBeenInstalled
  • RequirementHasBeenUninstalled

Merge framework queue jobs:

  • InstallRequirement
  • UninstallRequirement