diff --git a/swagger_client/api/categories_api.py b/swagger_client/api/categories_api.py new file mode 100644 index 0000000..d28c4f8 --- /dev/null +++ b/swagger_client/api/categories_api.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + The Earth Observatory Natural Event Tracker ([EONET](https://eonet.sci.gsfc.nasa.gov/what-is-eonet)) + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: 3.0.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from swagger_client.api_client import ApiClient + + +class CategoriesApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_category_by_id(self, category_id, **kwargs): # noqa: E501 + """Categories are the types of events by which individual events are cataloged # noqa: E501 + + Returns a single category # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_category_by_id(category_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int category_id: ID of category to return (required) + :return: Category + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_category_by_id_with_http_info(category_id, **kwargs) # noqa: E501 + else: + (data) = self.get_category_by_id_with_http_info(category_id, **kwargs) # noqa: E501 + return data + + def get_category_by_id_with_http_info(self, category_id, **kwargs): # noqa: E501 + """Categories are the types of events by which individual events are cataloged # noqa: E501 + + Returns a single category # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_category_by_id_with_http_info(category_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int category_id: ID of category to return (required) + :return: Category + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['category_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_category_by_id" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'category_id' is set + if ('category_id' not in params or + params['category_id'] is None): + raise ValueError("Missing the required parameter `category_id` when calling `get_category_by_id`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'category_id' in params: + path_params['categoryId'] = params['category_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/categories/{categoryId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Category', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/swagger_client/models/__init__.py b/swagger_client/models/__init__.py index 7e6b521..68ef2b2 100644 --- a/swagger_client/models/__init__.py +++ b/swagger_client/models/__init__.py @@ -15,11 +15,3 @@ # import models into model package from swagger_client.models.category import Category -from swagger_client.models.category_response import CategoryResponse -from swagger_client.models.event import Event -from swagger_client.models.geometry import Geometry -from swagger_client.models.one_of_category_response_events_items import OneOfCategoryResponseEventsItems -from swagger_client.models.one_of_event_categories_items import OneOfEventCategoriesItems -from swagger_client.models.one_of_event_geometry_items import OneOfEventGeometryItems -from swagger_client.models.one_of_event_sources_items import OneOfEventSourcesItems -from swagger_client.models.source import Source diff --git a/swagger_client/models/category.py b/swagger_client/models/category.py index ff76dc9..1d33d92 100644 --- a/swagger_client/models/category.py +++ b/swagger_client/models/category.py @@ -15,11 +15,13 @@ import six + class Category(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ + """ Attributes: swagger_types (dict): The key is attribute name @@ -27,18 +29,13 @@ class Category(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = { - 'id': 'str', - 'title': 'str', - 'description': 'str', - 'link': 'str' - } + swagger_types = {"id": "str", "title": "str", "description": "str", "link": "str"} attribute_map = { - 'id': 'id', - 'title': 'title', - 'description': 'description', - 'link': 'link' + "id": "id", + "title": "title", + "description": "description", + "link": "link", } def __init__(self, id=None, title=None, description=None, link=None): # noqa: E501 @@ -148,18 +145,20 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) + ) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") + else item, + value.items(), + ) + ) else: result[attr] = value if issubclass(Category, dict):