Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Create svm web api #4

Open
paulbouwer opened this issue Aug 31, 2014 · 2 comments
Open

Create svm web api #4

paulbouwer opened this issue Aug 31, 2014 · 2 comments

Comments

@paulbouwer
Copy link
Contributor

This api will return available versions based on the platform requesting the details.

API

  1. Return list. This should include last 5 versions for specific platform and include last 5 nightly builds for next release after latest stable release. This would probably include: version, publish date, latest version flag
  2. Return detailed install info for a selected version. This can include: version, latest version flag, publish date, download url, package hash algorithm, package hash.

Using an api to manage version information will allow this information to be tailored for the platform, information cached for speed, and management of multiple sources of installs (stable & nightly).

This will keep the svm complexity down around obtaining scriptcs version details.

@paulbouwer paulbouwer added this to the v0.3.0 milestone Aug 31, 2014
@paulbouwer paulbouwer assigned paulbouwer and unassigned paulbouwer Aug 31, 2014
@paulbouwer
Copy link
Contributor Author

taken by @paulbouwer

@paulbouwer paulbouwer modified the milestone: v0.3.0 Oct 10, 2014
@paulbouwer paulbouwer added this to the v0.4.0 milestone Nov 23, 2014
@paulbouwer
Copy link
Contributor Author

This is an initial attempt at the api.

GET / HTTP/1.1
Content-Type: application/json-home

{
  "profile": { 
    "href": "http://api.svm-scriptcs.net/profile#home",
    "hints": { "allow": ["GET"], "formats": { "application/alps+xml" } }
  },

  "list-installers": { 
    "href": "http://api.svm-scriptcs.net/installers",
    "hints": { "allow": ["GET"], "formats": { "application/vnd.collection+json" }  }
  },

  "list-versions": {
    "href": "http://api.svm-scriptcs.net/versions",
    "hints": { "allow": ["GET"], "formats": { "application/vnd.collection+json" }  }
  }
}
GET /profile HTTP/1.1
Content-Type: application/alps+xml

<?xml version="1.0"?>
<alps version="1.0">
  <link rel="self" href="http://api.svm-scriptcs.net/profile" />
  <doc format="text">Describes the hypermedia elements for the scriptcs version manager api.</doc>

  <descriptor id="list-installers" type="safe">
    <doc>A link to the readonly collection of installers.</doc>
  </descriptor>

  <descriptor id="list-versions" type="safe">
    <doc>A link to the read-only collection of versions.</doc>
  </descriptor>

  <descriptor id="home" type="semantic">
    <doc>A collection of links supported by this API to manage installers and scriptcs versions.</doc>
    <descriptor href="#list-installers" />
    <descriptor href="#list-versions" />
  </descriptor>

  <descriptor id="installer-data" name="installer" type="semantic">
    <doc>A container element for a svm installer.</doc>
    <descriptor href="#platform" />
    <descriptor href="#shell" />
    <descriptor href="#environment" />
    <descriptor href="#download" />
  </descriptor>

  <descriptor id="version-data" name="version" type="semantic">
    <doc>A container element for a scriptcs version. Versions represented by this container element will be limited to 0.10.0 and above. This ensures only cross-platform versions of scriptcs are included and greatly simplifies the version representation and implementation.</doc>
    <descriptor href="#version" />
    <descriptor href="#type" />
    <descriptor href="#sLatest" />
    <descriptor href="#publishedDate" />
    <descriptor href="#download" />
  </descriptor>

  <descriptor id="platform" type="semantic">
    <doc>The target operating system platform.</doc>
  </descriptor>

  <descriptor id="shell" type="semantic">
    <doc>The shell to use to execute the installer on the target platform.</doc>
  </descriptor>

  <descriptor id="environment" type="semantic">
    <doc>The environment variables to configure as part of the installation on the target platform.</doc>
  </descriptor>

  <descriptor id="version" type="semantic">
    <doc>The version of scriptcs.</doc>
  </descriptor>

  <descriptor id="type" type="semantic">
    <doc>The type of scriptcs version (nightly|stable).</doc>
  </descriptor>

  <descriptor id="isLatest" type="semantic">
    <doc>Whether or not the scriptcs version is the latest version for the given type (nightly|stable).</doc>
  </descriptor>

  <descriptor id="publishedDate" type="semantic">
    <doc>The date that the scriptcs version was published.</doc>
  </descriptor>

  <descriptor id="download" type="safe">
    <doc>A link to download the specfied resource.</doc>
  </descriptor>

</alps>
GET /installers HTTP/1.1
Content-Type: application/vnd.collection+json

{
 "collection":
  {
    "version": "1.0",
    "href": "http://api.svm-scriptcs.net/installers",
    "read-only": true,

    "links": [
      { "rel": "profile", "href": "http://api.svm-scriptcs.net/profile#installer-data"}
    ],

    "items": [
      {
        "href": "http://api.svm-scriptcs.net/installers/linux",
        "data" : [
          { "name": "platform", "value": "Linux" },
          { "name": "shell", "value": "bash" },
          { "name": "environment", "value": "PATH=\"$HOME/.svm/bin:$HOME/.svm/shims/:$PATH"\"}
        ],
        "links" : [
          { "name": "download", rel": "http://api.svm-scriptcs.net/profile#download", "render": "attachment", "href": "http://download.svm-scriptcs.net/linux/installer.sh" }
        ]
      },
      {
        "href": "http://api.svm-scriptcs.net/installers/osx",
        "data" : [
          { "name": "platform", "value": "OSX" },
          { "name": "shell", "value": "bash" },
          { "name": "environment", "value": "PATH=\"$HOME/.svm/bin:$HOME/.svm/shims/:$PATH"\"}
        ],
        "links" : [
          { "name": "download", rel": "http://api.svm-scriptcs.net/profile#download", "render": "attachment", "href": "http://download.svm-scriptcs.net/osx/installer.sh" }
        ]
      },
      {
        "href": "http://api.svm-scriptcs.net/installers/windows",
        "data" : [
          { "name": "platform", "value": "Windows" },
          { "name": "shell", "value": "powershell" },
          { "name": "environment", "value": "PATH=%HOME%\.svm\bin\;%HOME%\.svm\shims\;%PATH%"}
        ],
        "links" : [
          { "name": "download", rel": "http://api.svm-scriptcs.net/profile#download", "render": "attachment", "href": "http://download.svm-scriptcs.net/windows/installer.ps1" }
        ]
      }
    ]
  } 
}
GET /versions HTTP/1.1
Content-Type: application/vnd.collection+json

{
 "collection":
  {
    "version": "1.0",
    "href": "http://api.svm-scriptcs.net/versions",
    "read-only": true,

    "links": [
      { "rel": "profile", "href": "http://api.svm-scriptcs.net/profile#version-data"}
    ],

    "items": [
      {
        "href": "http://api.svm-scriptcs.net/versions/0.13.0-nightly-150124",
        "data" : [
          { "name": "version", "value": "0.13.0-nightly-150104" },
          { "name": "type", "value": "nightly" },
          { "name": "isLatest", "value": true },         
          { "name": "publishedDate", "value": "2015-01-04T06:02:30.536"}
        ],
        "links" : [
          { "name": "download", rel": "http://api.svm-scriptcs.net/profile#download", "render": "attachment", "href": "https://www.myget.org/F/scriptcsnightly/api/v2/package/scriptcs/0.13.0-nightly-150124" }
        ]
      },
      {
        "href": "http://api.svm-scriptcs.net/versions/0.12.0",
        "data" : [
          { "name": "version", "value": "0.12.0" },
          { "name": "type", "value": "stable" },
          { "name": "isLatest", "value": true },         
          { "name": "publishedDate", "value": "2014-12-24T19:47:22.007"}
        ],
        "links" : [
          { "name": "download", rel": "http://api.svm-scriptcs.net/profile#download", "render": "attachment", "href": "http://chocolatey.org/api/v2/package/ScriptCs/0.12.0" }
        ]
      },
      {
        "href": "http://api.svm-scriptcs.net/versions/0.11.0",
        "data" : [
          { "name": "version", "value": "0.11.0" },
          { "name": "type", "value": "stable" },
          { "name": "isLatest", "value": false },         
          { "name": "publishedDate", "value": "2014-12-11T01:36:47.487"}
        ],
        "links" : [
          { "name": "download", rel": "http://api.svm-scriptcs.net/profile#download", "render": "attachment", "href": "http://chocolatey.org/api/v2/package/ScriptCs/0.11.0" }
        ]
      },
      {
        "href": "http://api.svm-scriptcs.net/versions/0.10.2",
        "data" : [
          { "name": "version", "value": "0.10.2" },
          { "name": "type", "value": "stable" },
          { "name": "isLatest", "value": false },         
          { "name": "publishedDate", "value": "2014-08-01T02:41:53.897"}
        ],
        "links" : [
          { "name": "download", rel": "http://api.svm-scriptcs.net/profile#download", "render": "attachment", "href": "http://chocolatey.org/api/v2/package/ScriptCs/0.10.2" }
        ]
      },
      {
        "href": "http://api.svm-scriptcs.net/versions/0.10.1",
        "data" : [
          { "name": "version", "value": "0.10.1" },
          { "name": "type", "value": "stable" },
          { "name": "isLatest", "value": false },         
          { "name": "publishedDate", "value": "2014-07-30T22:24:13.010"}
        ],
        "links" : [
          { "name": "download", rel": "http://api.svm-scriptcs.net/profile#download", "render": "attachment", "href": "http://chocolatey.org/api/v2/package/ScriptCs/0.10.1" }
        ]
      },
      {
        "href": "http://api.svm-scriptcs.net/versions/0.10.0",
        "data" : [
          { "name": "version", "value": "0.10.0" },
          { "name": "type", "value": "stable" },
          { "name": "isLatest", "value": false },         
          { "name": "publishedDate", "value": "2014-07-30T02:22:35.907"}
        ],
        "links" : [
          { "name": "download", rel": "http://api.svm-scriptcs.net/profile#download", "render": "attachment", "href": "http://chocolatey.org/api/v2/package/ScriptCs/0.10.0" }
        ]
      }
    ]
  } 
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant