nitweb: serve routes for ini commands
authorAlexandre Terrasa <alexandre@moz-code.org>
Wed, 2 May 2018 23:41:03 +0000 (19:41 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Tue, 8 May 2018 19:48:00 +0000 (15:48 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/doc/api/api_base.nit
src/doc/api/api_model.nit

index 00f48af..08406a2 100644 (file)
@@ -254,3 +254,19 @@ redef class MVirtualType
        redef var web_url = mproperty.web_url is lazy
        redef var api_url = mproperty.api_url is lazy
 end
+
+redef class CmdLicenseFile
+       redef var file_url is lazy do
+               var mentity = self.mentity
+               if mentity == null then return super
+               return "{mentity.web_url}/license"
+       end
+end
+
+redef class CmdContribFile
+       redef var file_url is lazy do
+               var mentity = self.mentity
+               if mentity == null then return super
+               return "{mentity.web_url}/contrib"
+       end
+end
index e2b3473..5c92817 100644 (file)
@@ -48,6 +48,18 @@ redef class APIRouter
                use("/catalog/person/:pid", new APICatalogPerson(config))
                use("/catalog/person/:pid/maintaining", new APICatalogMaintaining(config))
                use("/catalog/person/:pid/contributing", new APICatalogContributing(config))
+
+               use("/ini/desc/:id", new APIIniDesc(config))
+               use("/ini/git/:id", new APIIniGit(config))
+               use("/ini/clone/:id", new APIIniClone(config))
+               use("/ini/issues/:id", new APIIniIssues(config))
+               use("/ini/maintainer/:id", new APIIniMaintainer(config))
+               use("/ini/contributors/:id", new APIIniContributors(config))
+               use("/ini/license/:id", new APIIniLicense(config))
+               use("/ini/license-file/:id", new APIIniLicenseFile(config))
+               use("/ini/license-content/:id", new APIIniLicenseFileContent(config))
+               use("/ini/contrib-file/:id", new APIIniContribFile(config))
+               use("/ini/contrib-content/:id", new APIIniContribFileContent(config))
        end
 end
 
@@ -299,3 +311,104 @@ class APICatalogContributing
 
        redef fun command do return new CmdCatalogContributing(config.view, config.catalog)
 end
+
+# CmdIni
+
+# Get the package description from the ini file
+#
+# `GET /ini/desc/:pid`: return the package description
+class APIIniDesc
+       super APICommand
+
+       redef fun command do return new CmdIniDescription(config.view)
+end
+
+# Get the package Git URL from the ini file
+#
+# `GET /ini/git/:pid`: return the package Git URL
+class APIIniGit
+       super APICommand
+
+       redef fun command do return new CmdIniGitUrl(config.view)
+end
+
+# Get the package Git clone command from the ini file
+#
+# `GET /ini/clone/:pid`: return the package Git clone command
+class APIIniClone
+       super APICommand
+
+       redef fun command do return new CmdIniCloneCommand(config.view)
+end
+
+# Get the package issues URL from the ini file
+#
+# `GET /ini/issues/:pid`: return the package issues URL
+class APIIniIssues
+       super APICommand
+
+       redef fun command do return new CmdIniIssuesUrl(config.view)
+end
+
+# Get the package maintainer from the ini file
+#
+# `GET /ini/maintainer/:pid`: return the package maintainer
+class APIIniMaintainer
+       super APICommand
+
+       redef fun command do return new CmdIniMaintainer(config.view)
+end
+
+# Get the package contributors from the ini file
+#
+# `GET /ini/clone/:pid`: return the package contributors
+class APIIniContributors
+       super APICommand
+
+       redef fun command do return new CmdIniContributors(config.view)
+end
+
+# Get the package license from the ini file
+#
+# `GET /ini/clone/:pid`: return the package license
+class APIIniLicense
+       super APICommand
+
+       redef fun command do return new CmdIniLicense(config.view)
+end
+
+# Get the package license file
+#
+# `GET /ini/license-file/:pid`: return the package license file
+class APIIniLicenseFile
+       super APICommand
+
+       redef fun command do return new CmdLicenseFile(config.view)
+end
+
+# Get the package contrib file
+#
+# `GET /ini/contrib-file/:pid`: return the package contrib file
+class APIIniContribFile
+       super APICommand
+
+       redef fun command do return new CmdContribFile(config.view)
+end
+
+# Get the package license file content
+#
+# `GET /ini/license-file/:pid`: return the package license file content
+class APIIniLicenseFileContent
+       super APICommand
+
+       redef fun command do return new CmdLicenseFileContent(config.view)
+end
+
+# Get the package contrib file content
+#
+# `GET /ini/contrib-file/:pid`: return the package contrib file content
+class APIIniContribFileContent
+       super APICommand
+
+       redef fun command do return new CmdContribFileContent(config.view)
+end