"""
Academic Observatory API
The REST API for accessing data from academic-observatory-workflows. # noqa: E501
The version of the OpenAPI document: 1.0.0
Contact: agent@observatory.academy
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from academic_observatory_api.client.api_client import ApiClient, Endpoint as _Endpoint
from academic_observatory_api.client.model_utils import ( # noqa: F401
check_allowed_values,
check_validations,
date,
datetime,
file_type,
none_type,
validate_and_convert_types
)
from academic_observatory_api.client.model.pit_response import PitResponse
from academic_observatory_api.client.model.query_response import QueryResponse
[docs]class AcademicObservatoryApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
self.pit_id_agg_endpoint = _Endpoint(
settings={
'response_type': (PitResponse,),
'auth': [
'api_key'
],
'endpoint_path': '/v1/{agg}/pit',
'operation_id': 'pit_id_agg',
'http_method': 'GET',
'servers': None,
},
params_map={
'all': [
'agg',
'index_date',
'keep_alive',
],
'required': [
'agg',
],
'nullable': [
],
'enum': [
'agg',
],
'validation': [
'keep_alive',
]
},
root_map={
'validations': {
('keep_alive',): {
'inclusive_maximum': 5,
'inclusive_minimum': 1,
},
},
'allowed_values': {
('agg',): {
"AUTHOR": "author",
"COUNTRY": "country",
"FUNDER": "funder",
"GROUP": "group",
"INSTITUTION": "institution",
"JOURNAL": "journal",
"PUBLISHER": "publisher",
"REGION": "region",
"SUBREGION": "subregion"
},
},
'openapi_types': {
'agg':
(str,),
'index_date':
(date,),
'keep_alive':
(int,),
},
'attribute_map': {
'agg': 'agg',
'index_date': 'index_date',
'keep_alive': 'keep_alive',
},
'location_map': {
'agg': 'path',
'index_date': 'query',
'keep_alive': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json'
],
'content_type': [],
},
api_client=api_client
)
self.pit_id_subagg_endpoint = _Endpoint(
settings={
'response_type': (PitResponse,),
'auth': [
'api_key'
],
'endpoint_path': '/v1/{agg}/{subagg}/pit',
'operation_id': 'pit_id_subagg',
'http_method': 'GET',
'servers': None,
},
params_map={
'all': [
'agg',
'subagg',
'index_date',
'keep_alive',
],
'required': [
'agg',
'subagg',
],
'nullable': [
],
'enum': [
'agg',
'subagg',
],
'validation': [
'keep_alive',
]
},
root_map={
'validations': {
('keep_alive',): {
'inclusive_maximum': 5,
'inclusive_minimum': 1,
},
},
'allowed_values': {
('agg',): {
"AUTHOR": "author",
"COUNTRY": "country",
"FUNDER": "funder",
"GROUP": "group",
"INSTITUTION": "institution",
"JOURNAL": "journal",
"PUBLISHER": "publisher",
"REGION": "region",
"SUBREGION": "subregion"
},
('subagg',): {
"ACCESS-TYPES": "access-types",
"COUNTRIES": "countries",
"DISCIPLINES": "disciplines",
"EVENTS": "events",
"FUNDERS": "funders",
"GROUPINGS": "groupings",
"INSTITUTIONS": "institutions",
"JOURNALS": "journals",
"MEMBERS": "members",
"METRICS": "metrics",
"OUTPUT-TYPES": "output-types",
"PUBLISHERS": "publishers"
},
},
'openapi_types': {
'agg':
(str,),
'subagg':
(str,),
'index_date':
(date,),
'keep_alive':
(int,),
},
'attribute_map': {
'agg': 'agg',
'subagg': 'subagg',
'index_date': 'index_date',
'keep_alive': 'keep_alive',
},
'location_map': {
'agg': 'path',
'subagg': 'path',
'index_date': 'query',
'keep_alive': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json'
],
'content_type': [],
},
api_client=api_client
)
self.query_agg_endpoint = _Endpoint(
settings={
'response_type': (QueryResponse,),
'auth': [
'api_key'
],
'endpoint_path': '/v1/{agg}',
'operation_id': 'query_agg',
'http_method': 'GET',
'servers': None,
},
params_map={
'all': [
'agg',
'agg_id',
'index_date',
'_from',
'to',
'limit',
'search_after',
'pit',
'pretty',
],
'required': [
'agg',
],
'nullable': [
],
'enum': [
'agg',
],
'validation': [
'_from',
'to',
'limit',
]
},
root_map={
'validations': {
('_from',): {
'regex': {
'pattern': r'^([0-9]{4}$)', # noqa: E501
},
},
('to',): {
'regex': {
'pattern': r'^([0-9]{4}$)', # noqa: E501
},
},
('limit',): {
'inclusive_maximum': 10000,
'inclusive_minimum': 1,
},
},
'allowed_values': {
('agg',): {
"AUTHOR": "author",
"COUNTRY": "country",
"FUNDER": "funder",
"GROUP": "group",
"INSTITUTION": "institution",
"JOURNAL": "journal",
"PUBLISHER": "publisher",
"REGION": "region",
"SUBREGION": "subregion"
},
},
'openapi_types': {
'agg':
(str,),
'agg_id':
([str],),
'index_date':
(date,),
'_from':
(date,),
'to':
(date,),
'limit':
(int,),
'search_after':
(str,),
'pit':
(str,),
'pretty':
(bool,),
},
'attribute_map': {
'agg': 'agg',
'agg_id': 'agg_id',
'index_date': 'index_date',
'_from': 'from',
'to': 'to',
'limit': 'limit',
'search_after': 'search_after',
'pit': 'pit',
'pretty': 'pretty',
},
'location_map': {
'agg': 'path',
'agg_id': 'query',
'index_date': 'query',
'_from': 'query',
'to': 'query',
'limit': 'query',
'search_after': 'query',
'pit': 'query',
'pretty': 'query',
},
'collection_format_map': {
'agg_id': 'multi',
}
},
headers_map={
'accept': [
'application/json'
],
'content_type': [],
},
api_client=api_client
)
self.query_subagg_endpoint = _Endpoint(
settings={
'response_type': (QueryResponse,),
'auth': [
'api_key'
],
'endpoint_path': '/v1/{agg}/{subagg}',
'operation_id': 'query_subagg',
'http_method': 'GET',
'servers': None,
},
params_map={
'all': [
'agg',
'subagg',
'agg_id',
'subagg_id',
'index_date',
'_from',
'to',
'limit',
'search_after',
'pit',
'pretty',
],
'required': [
'agg',
'subagg',
],
'nullable': [
],
'enum': [
'agg',
'subagg',
],
'validation': [
'_from',
'to',
'limit',
]
},
root_map={
'validations': {
('_from',): {
'regex': {
'pattern': r'^([0-9]{4}$)', # noqa: E501
},
},
('to',): {
'regex': {
'pattern': r'^([0-9]{4}$)', # noqa: E501
},
},
('limit',): {
'inclusive_maximum': 10000,
'inclusive_minimum': 1,
},
},
'allowed_values': {
('agg',): {
"AUTHOR": "author",
"COUNTRY": "country",
"FUNDER": "funder",
"GROUP": "group",
"INSTITUTION": "institution",
"JOURNAL": "journal",
"PUBLISHER": "publisher",
"REGION": "region",
"SUBREGION": "subregion"
},
('subagg',): {
"ACCESS-TYPES": "access-types",
"COUNTRIES": "countries",
"DISCIPLINES": "disciplines",
"EVENTS": "events",
"FUNDERS": "funders",
"GROUPINGS": "groupings",
"INSTITUTIONS": "institutions",
"JOURNALS": "journals",
"MEMBERS": "members",
"METRICS": "metrics",
"OUTPUT-TYPES": "output-types",
"PUBLISHERS": "publishers"
},
},
'openapi_types': {
'agg':
(str,),
'subagg':
(str,),
'agg_id':
([str],),
'subagg_id':
([str],),
'index_date':
(date,),
'_from':
(date,),
'to':
(date,),
'limit':
(int,),
'search_after':
(str,),
'pit':
(str,),
'pretty':
(bool,),
},
'attribute_map': {
'agg': 'agg',
'subagg': 'subagg',
'agg_id': 'agg_id',
'subagg_id': 'subagg_id',
'index_date': 'index_date',
'_from': 'from',
'to': 'to',
'limit': 'limit',
'search_after': 'search_after',
'pit': 'pit',
'pretty': 'pretty',
},
'location_map': {
'agg': 'path',
'subagg': 'path',
'agg_id': 'query',
'subagg_id': 'query',
'index_date': 'query',
'_from': 'query',
'to': 'query',
'limit': 'query',
'search_after': 'query',
'pit': 'query',
'pretty': 'query',
},
'collection_format_map': {
'agg_id': 'multi',
'subagg_id': 'multi',
}
},
headers_map={
'accept': [
'application/json'
],
'content_type': [],
},
api_client=api_client
)
[docs] def pit_id_agg(
self,
agg,
**kwargs
):
"""pit_id_agg # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.pit_id_agg(agg, async_req=True)
>>> result = thread.get()
Args:
agg (str): The aggregate.
Keyword Args:
index_date (date): Index date, defaults to latest. [optional]
keep_alive (int): How long to keep the point in time id alive (in minutes) . [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
PitResponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['agg'] = \
agg
return self.pit_id_agg_endpoint.call_with_http_info(**kwargs)
[docs] def pit_id_subagg(
self,
agg,
subagg,
**kwargs
):
"""pit_id_subagg # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.pit_id_subagg(agg, subagg, async_req=True)
>>> result = thread.get()
Args:
agg (str): The aggregate.
subagg (str): The sub-aggregate.
Keyword Args:
index_date (date): Index date, defaults to latest. [optional]
keep_alive (int): How long to keep the point in time id alive (in minutes) . [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
PitResponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['agg'] = \
agg
kwargs['subagg'] = \
subagg
return self.pit_id_subagg_endpoint.call_with_http_info(**kwargs)
[docs] def query_agg(
self,
agg,
**kwargs
):
"""query_agg # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.query_agg(agg, async_req=True)
>>> result = thread.get()
Args:
agg (str): The aggregate.
Keyword Args:
agg_id ([str]): Filter on aggregates with this id, if multiple values are given the results are filtered on whether there are aggregates with one of the given values. . [optional]
index_date (date): Index date, defaults to latest. [optional]
_from (date): Start year (included). [optional]
to (date): End year (included). [optional]
limit (int): Limit number of results (max 10000). [optional]
search_after (str): The sort value of the last item from the previous search, used to paginate. The results are sorted by _shard_doc when a PIT is used and by document id (_id) without a PIT. . [optional]
pit (str): The pit id. [optional]
pretty (bool): If true, the endpoint returns only the user metadata.. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
QueryResponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['agg'] = \
agg
return self.query_agg_endpoint.call_with_http_info(**kwargs)
[docs] def query_subagg(
self,
agg,
subagg,
**kwargs
):
"""query_subagg # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.query_subagg(agg, subagg, async_req=True)
>>> result = thread.get()
Args:
agg (str): The aggregate.
subagg (str): The sub-aggregate.
Keyword Args:
agg_id ([str]): Filter on aggregates with this id, if multiple values are given the results are filtered on whether there are aggregates with one of the given values. . [optional]
subagg_id ([str]): Filter on subaggregates with this id, if multiple values are given the results are filtered on whether there are subaggregates with one of the given values. . [optional]
index_date (date): Index date, defaults to latest. [optional]
_from (date): Start year (included). [optional]
to (date): End year (included). [optional]
limit (int): Limit number of results (max 10000). [optional]
search_after (str): The sort value of the last item from the previous search, used to paginate. The results are sorted by _shard_doc when a PIT is used and by document id (_id) without a PIT. . [optional]
pit (str): The pit id. [optional]
pretty (bool): If true, the endpoint returns only the user metadata.. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
QueryResponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['agg'] = \
agg
kwargs['subagg'] = \
subagg
return self.query_subagg_endpoint.call_with_http_info(**kwargs)