From 14946eb0efc59fce2d72ae48b0882e04d09b0700 Mon Sep 17 00:00:00 2001 From: bytedream Date: Sun, 12 Dec 2021 01:40:06 +0100 Subject: [PATCH] Added search endpoint --- api.yaml | 61 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/api.yaml b/api.yaml index 7dbcb1c..e977ec8 100644 --- a/api.yaml +++ b/api.yaml @@ -6,7 +6,7 @@ info: servers: - url: 'https://localhost:8080' paths: - /recent: + /api/recent: get: summary: Get recent articles parameters: @@ -21,17 +21,48 @@ paths: content: application/json: schema: - type: object - properties: - title: - type: string - description: Title of the article - summary: - type: string - description: A short overview summary of the article - image: - type: string - description: Link to a preview image - link: - type: string - description: Link to the article itself + $ref: '#/components/schemas/ArticleSummary' + + /api/search: + get: + summary: Search all articles + parameters: + - in: query + name: q + schema: + type: string + description: Name of the article to search + - in: query + name: from + schema: + type: string + description: A RFC3339 formatted date to start searching when articles are older than specified + - in: query + name: to + schema: + type: string + description: A RFC3339 formatted date to stop searching when articles are older than specified + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ArticleSummary' +components: + schemas: + ArticleSummary: + type: object + properties: + title: + type: string + description: Title of the article + summary: + type: string + description: A short overview summary of the article + image: + type: string + description: Link to a preview image + link: + type: string + description: Link to the article itself