mgnipy.V2.describe module#
- class mgnipy.V2.describe.DescribeEmgapiModule(endpoint_module=None)[source]#
Bases:
object- Parameters:
endpoint_module (ModuleType | None)
- describe_endpoint(as_dict=False)[source]#
Provides a description of the endpoint from the openapi documentation i.e., https://www.ebi.ac.uk/metagenomics/api/v2/openapi.json
- property emgapi_resource: str | None #
Retrieves the name of the endpoint resource based on the endpoint module.
- Returns:
The name of the endpoint resource, or None if the endpoint module is not set.
- Return type:
str or None
- get_num_pages(num_items, page_size=None)[source]#
Calculates the total number of pages based on the total count and default page size.
- page_param_iter(num_pages)[source]#
Generates a list of parameter dictionaries for each page based on the total number of pages.
- resolve_query_string(**kwargs)[source]#
Resolves the query string for the endpoint based on the current parameters.
- Parameters:
**kwargs – Keyword arguments to validate and include in the query string.
- Returns:
The resolved query string.
- Return type:
- sub_url(**kwargs)[source]#
Constructs the sub-URL for the endpoint based on the current parameters.
- Returns:
The constructed sub-URL, or None if the endpoint module is not set.
- Return type:
str or None
- url_path(**kwargs)[source]#
Constructs the full URL path for the endpoint based on the current parameters.
- Parameters:
**kwargs – Keyword arguments to validate and include in the URL construction.
- Returns:
The constructed URL path.
- Return type:
- validate_endpoint_kwargs(**kwargs)[source]#
Validates the provided keyword arguments against the supported parameters of the endpoint module.
- Parameters:
**kwargs – Keyword arguments to validate.
- Returns:
The validated keyword arguments.
- Return type:
dict of str to Any
- Raises:
ValueError – If any provided keyword argument is not supported by the endpoint module.