BearND has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376139 )

Change subject: Add swagger spec for summary endpoint
......................................................................

Add swagger spec for summary endpoint

Bug: T174808
Change-Id: I976a2997507240dd162196e6f1ba86e171d9e98b
---
M spec.yaml
1 file changed, 124 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps 
refs/changes/39/376139/1

diff --git a/spec.yaml b/spec.yaml
index 164553d..c68b319 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -605,6 +605,65 @@
             body: /.+/
 
   # from routes/mobile-sections.js
+  /{domain}/v1/page/summary/{title}/{revision}:
+    get:
+      tags:
+        - Page content
+      summary: Get a text extract of a page.
+      description: |
+        The summary response includes an extract of the first paragraph the 
page in plain text
+        and HTML as well as a type of page. This is useful for page previews.
+
+        Stability: 
[unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable)
+      produces:
+        - application/json; charset=utf-8; 
profile="https://www.mediawiki.org/wiki/Specs/Summary/1.2.0";
+      parameters:
+        - name: title
+          in: path
+          description: "Page title. Use underscores instead of spaces. 
Example: `Main_Page`."
+          type: string
+          required: true
+        - name: revision
+          in: path
+          description: "Revision of page content"
+          type: integer
+          required: false
+      responses:
+        '200':
+          description: The summary for the given page
+          schema:
+            $ref: '#/definitions/summary'
+          headers:
+            ETag:
+              description: >
+                Syntax: "{revision}/{tid}".
+                Example: "701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc"
+        '404':
+          description: Unknown page title
+          schema:
+            $ref: '#/definitions/problem'
+        default:
+          description: Error
+          schema:
+            $ref: '#/definitions/problem'
+      x-amples:
+        - title: Get summary for Barack Obama
+          request:
+            params:
+              domain: en.wikipedia.org
+              title: Barack_Obama
+          response:
+            status: 200
+            headers:
+              etag: /.+/
+              content-type: /^application\/json/
+            body:
+              type: standard
+              revision: /.+/
+              extract: /.+/
+              extract_html: /.+/
+
+  # from routes/mobile-sections.js
   /{domain}/v1/page/mobile-sections/{title}:
     get:
       tags:
@@ -742,6 +801,71 @@
       - width
       - height
 
+  # see also RB v1/common_schemas.yaml
+  summary:
+    type: object
+    properties:
+#      title:
+#        type: string
+#        description: The page title
+#      displaytitle:
+#        type: string
+#        description: The page title how it should be shown to the user
+#      pageid:
+#        type: integer
+#        description: The page ID
+      type:
+        type: string
+        description: Type of page summary
+        enum:
+          - standard
+      revision:
+        type: string
+        description: The revision of the page when the summary was produced
+      #timestamp:
+      #  type: string
+      #  format: date-time
+      #  description: The ISO timestamp of a page revision
+      extract:
+        type: string
+        description: First several sentences of an article in plain text
+      extract_html:
+        type: string
+        description: First several sentences of an article in simple HTML 
format
+#      thumbnail:
+#        $ref: '#/definitions/thumbnail'
+#      originalimage:
+#        $ref: '#/definitions/originalimage'
+#      lang:
+#        type: string
+#        description: The page language code
+#        example: en
+#      dir:
+#        type: string
+#        description: The page language direction code
+#        example: ltr
+#      timestamp:
+#        type: string
+#        description: The time when the page was last editted in the [ISO 
8601](https://en.wikipedia.org/wiki/ISO_8601) format
+#        example: '1970-01-01T00:00:00.000Z'
+#      description:
+#        type: string
+#        description: Wikidata description for the page
+#        example: American poet
+#      coordinates:
+#        type: object
+#        description: The coordinates of the item
+#        properties:
+#          lat:
+#            type: number
+#            description: The latitude
+#          lon:
+#            type: number
+#            description: The longitude
+#        requiredProperties: [ 'lat', 'lon' ]
+#    required: ['title', 'extract', 'lang', 'dir']
+    required: ['type', 'revision', 'extract', 'extract_html']
+
   dated_pageview:
     type: object
     date:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I976a2997507240dd162196e6f1ba86e171d9e98b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: BearND <bsitzm...@wikimedia.org>

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

Reply via email to