Mobrovac has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/364786 )

Change subject: Add domain parameter
......................................................................


Add domain parameter

Bug: T170439
Change-Id: I7bc0d4099863ed411c0961350f4aab14c1726c6b
---
M routes/translation.js
M spec.yaml
2 files changed, 20 insertions(+), 18 deletions(-)

Approvals:
  Mobrovac: Verified; Looks good to me, approved



diff --git a/routes/translation.js b/routes/translation.js
index ae10527..158c6fd 100644
--- a/routes/translation.js
+++ b/routes/translation.js
@@ -42,20 +42,22 @@
 
 
 /**
- * GET /articles/{source}/{target}
- * Gets the articles existing in source but missing in target.
+ * GET /articles/{source}
+ * Gets the articles existing in source but missing in domain.
  */
-router.get('/articles/:source/:target', (req, res) => {
-    return recommend(req, res, req.params.source, req.params.target);
+router.get('/articles/:source', (req, res) => {
+    const target = req.params.domain.split('.', 0);
+    return recommend(req, res, req.params.source, target);
 });
 
 
 /**
- * GET /articles/{source}/{target}/{seed}
- * Gets the articles existing in source but missing in target based on seed.
+ * GET /articles/{source}/{seed}
+ * Gets the articles existing in source but missing in domain based on seed.
  */
-router.get('/articles/:source/:target/:seed', (req, res) => {
-    return recommend(req, res, req.params.source, req.params.target, 
req.params.seed);
+router.get('/articles/:source/:seed', (req, res) => {
+    const target = req.params.domain.split('.', 0);
+    return recommend(req, res, req.params.source, target, req.params.seed);
 });
 
 
@@ -65,7 +67,7 @@
 
     return {
         path: '/translation',
-        skip_domain: true,
+        api_version: 1,
         router
     };
 
diff --git a/spec.yaml b/spec.yaml
index 5ea4ec0..ffc925a 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -54,14 +54,14 @@
           response:
             status: 404
   # from routes/translation.js
-  /translation/articles/{source}/{target}{/seed}:
+  /{domain}/v1/translation/articles/{source}{/seed}:
     get:
       tags:
         - Recommend
       summary: Recommend missing articles
       description: |
         Recommends articles to be translated from the source
-        to the target language.
+        to the domain language.
         Stability: 
[unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable)
       produces:
         - applicaiton/json
@@ -71,9 +71,9 @@
           description: The source language code
           type: string
           required: true
-        - name: target
+        - name: domain
           in: path
-          description: The target language code
+          description: The target domain
           type: string
           required: true
         - name: seed
@@ -92,7 +92,7 @@
           request:
             params:
               source: en
-              target: de
+              domain: de.wikipedia.org
           response:
             status: 200
             headers:
@@ -101,7 +101,7 @@
           request:
             params:
               source: en
-              target: de
+              domain: de.wikipedia.org
               seed: Apple
           response:
             status: 200
@@ -111,7 +111,7 @@
           request:
             params:
               source: qqq
-              target: de
+              domain: de.wikipedia.org
           response:
             status: 504
             headers:
@@ -120,7 +120,7 @@
           request:
             params:
               source: en
-              target: de
+              domain: de.wikipedia.org
               seed: thishsouldnotreturnanyresultsfromthesearchapi
           response:
             status: 404
@@ -130,7 +130,7 @@
           request:
             params:
               source: en
-              target: de
+              domain: de.wikipedia.org
             query:
               count: -123
           response:

-- 
To view, visit https://gerrit.wikimedia.org/r/364786
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7bc0d4099863ed411c0961350f4aab14c1726c6b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/recommendation-api
Gerrit-Branch: master
Gerrit-Owner: Nschaaf <nsch...@wikimedia.org>
Gerrit-Reviewer: Mobrovac <mobro...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to