From c5fb3dc56e69a1606cc579398ccafe4dcadd9a05 Mon Sep 17 00:00:00 2001 From: Sunayana Ghosh Date: Sat, 28 Aug 2021 10:10:27 +0200 Subject: [PATCH] #3 : Updates the current work on openapi v3 for eonet. Cleans up retrieve_category used primarily for testing. --- apps/retrieve_category.py | 4 +- openapi/eonet-v3.yaml | 98 +++++++++++++++++++++++++++++---------- 2 files changed, 75 insertions(+), 27 deletions(-) diff --git a/apps/retrieve_category.py b/apps/retrieve_category.py index 97d3684..35e04a2 100644 --- a/apps/retrieve_category.py +++ b/apps/retrieve_category.py @@ -1,11 +1,11 @@ import swagger_client from swagger_client.api.default_api import DefaultApi -from swagger_client.rest import ApiException +from swagger_client.models import CategoryResponse def main(): api = DefaultApi() - wildfire_response = api.categories_category_id_get("wildfires") + wildfire_response: CategoryResponse = api.categories_category_id_get("wildfires") print(wildfire_response) diff --git a/openapi/eonet-v3.yaml b/openapi/eonet-v3.yaml index 0b6da24..58bfee3 100644 --- a/openapi/eonet-v3.yaml +++ b/openapi/eonet-v3.yaml @@ -5,41 +5,89 @@ info: servers: - url: https://eonet.sci.gsfc.nasa.gov/api/v3 - url: http://eonet.sci.gsfc.nasa.gov/api/v3 + paths: - /categories/{categoryId}: + /categories/{categoryId}: # ../categories get: - tags: - - categories - summary: Categories are the types of events by which individual events are cataloged - description: Returns a single category - operationId: getCategoryById + summary: Returns a json object of categories. + description: "" parameters: - - name: categoryId - in: path - description: ID of category to return - required: true - schema: - type: integer - format: int64 - minimum: 1 + - name: categoryId + in: path + required: true + description: Filter the events by the Category. + schema: + type: string + - name: source + in: query + required: false + description: Filter the topically-constrained events by the Source. Multiple sources can be included in the parameter, comma separated, operates as a boolean OR. + schema: + type : string + - name: status + in: query + required: false + description: Events that have ended are assigned a closed date and the existence of that date will allow you to filter for only-open or only-closed events. Omitting the status parameter will return only the currently open events. + schema: + type: string + default: open + enum: + - open + - closed + - name: limit + in: query + required: false + description: Limits the number of events returned. + schema: + type: integer + format: int64 + - name: days + in: query + required: false + description: Limit the number of prior days (including today) from which events will be returned. + schema: + type: integer + format: int64 + - name: start + in: query + required: false + description: Select a starting date for the events. To be used together with end parameter. + schema: + type: string + - name: end + in: query + required: false + description: Select an ending date for the events. To be used together with start parameter for defining a range. + schema: + type: string + responses: - 200: - description: successful operation + 200: #status code + description: A JSON object upon successful operation content: application/json: schema: - $ref: '#/components/schemas/Category' - 400: - description: Invalid ID supplied - content: {} - 404: - description: Category not found - content: {} + $ref: '#/components/schemas/CategoryResponse' components: schemas: Category: type: object properties: id: - type: integer - format: int64 + type: string + title: + type: string + description: + type: string + link: + type: string + CategoryResponse: + type: object + properties: + title: + type: string + description: + type: string + link: + type: string +