# coding: utf-8

"""
    Statuspage API

    # Code of Conduct Please don't abuse the API, and please report all feature requests and issues to https://support.atlassian.com/contact  # Rate Limiting Each API token is limited to 1 request / second as measured on a 60 second rolling window. To get this limit increased, please contact us at https://support.atlassian.com/contact  Error codes 420 or 429 indicate that you have exceeded the rate limit and the request has been rejected.  # Basics  ## HTTPS It's required  ## URL Prefix In order to maintain version integrity into the future, the API is versioned. All calls currently begin with the following prefix:    https://api.statuspage.io/v1/  ## RESTful Interface Wherever possible, the API seeks to implement repeatable patterns with logical, representative URLs and descriptive HTTP verbs. Below are some examples and conventions you will see throughout the documentation.  * Collections are buckets: https://api.statuspage.io/v1/pages/asdf123/incidents.json * Elements have unique IDs: https://api.statuspage.io/v1/pages/asdf123/incidents/jklm456.json * GET will retrieve information about a collection/element * POST will create an element in a collection * PATCH will update a single element * PUT will replace a single element in a collection (rarely used) * DELETE will destroy a single element  ## Sending Data Information can be sent in the body as form urlencoded or JSON, but make sure the Content-Type header matches the body structure or the server gremlins will be angry.  All examples are provided in JSON format, however they can easily be converted to form encoding if required.  Some examples of how to convert things are below:      // JSON     {       \"incident\": {         \"name\": \"test incident\",         \"components\": [\"8kbf7d35c070\", \"vtnh60py4yd7\"]       }     }      // Form Encoded (using curl as an example):     curl -X POST https://api.statuspage.io/v1/example \\       -d \"incident[name]=test incident\" \\       -d \"incident[components][]=8kbf7d35c070\" \\       -d \"incident[components][]=vtnh60py4yd7\"  # Authentication  <!-- ReDoc-Inject: <security-definitions> -->  # noqa: E501

    OpenAPI spec version: 1.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 atlassian_statuspage.api_client import ApiClient


class MetricProvidersApi(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 delete_pages_page_id_metrics_providers_metrics_provider_id(self, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """Delete a metric provider  # noqa: E501

        Delete a metric provider  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_pages_page_id_metrics_providers_metrics_provider_id(page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :return: MetricsProvider
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.delete_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(page_id, metrics_provider_id, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(page_id, metrics_provider_id, **kwargs)  # noqa: E501
            return data

    def delete_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(self, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """Delete a metric provider  # noqa: E501

        Delete a metric provider  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :return: MetricsProvider
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['page_id', 'metrics_provider_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 delete_pages_page_id_metrics_providers_metrics_provider_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'page_id' is set
        if ('page_id' not in params or
                params['page_id'] is None):
            raise ValueError("Missing the required parameter `page_id` when calling `delete_pages_page_id_metrics_providers_metrics_provider_id`")  # noqa: E501
        # verify the required parameter 'metrics_provider_id' is set
        if ('metrics_provider_id' not in params or
                params['metrics_provider_id'] is None):
            raise ValueError("Missing the required parameter `metrics_provider_id` when calling `delete_pages_page_id_metrics_providers_metrics_provider_id`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'page_id' in params:
            path_params['page_id'] = params['page_id']  # noqa: E501
        if 'metrics_provider_id' in params:
            path_params['metrics_provider_id'] = params['metrics_provider_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 = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/pages/{page_id}/metrics_providers/{metrics_provider_id}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='MetricsProvider',  # 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)

    def get_pages_page_id_metrics_providers(self, page_id, **kwargs):  # noqa: E501
        """Get a list of metric providers  # noqa: E501

        Get a list of metric providers  # 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_pages_page_id_metrics_providers(page_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str page_id: Page identifier (required)
        :return: list[MetricsProvider]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_pages_page_id_metrics_providers_with_http_info(page_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_pages_page_id_metrics_providers_with_http_info(page_id, **kwargs)  # noqa: E501
            return data

    def get_pages_page_id_metrics_providers_with_http_info(self, page_id, **kwargs):  # noqa: E501
        """Get a list of metric providers  # noqa: E501

        Get a list of metric providers  # 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_pages_page_id_metrics_providers_with_http_info(page_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str page_id: Page identifier (required)
        :return: list[MetricsProvider]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['page_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_pages_page_id_metrics_providers" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'page_id' is set
        if ('page_id' not in params or
                params['page_id'] is None):
            raise ValueError("Missing the required parameter `page_id` when calling `get_pages_page_id_metrics_providers`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'page_id' in params:
            path_params['page_id'] = params['page_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 = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/pages/{page_id}/metrics_providers', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[MetricsProvider]',  # 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)

    def get_pages_page_id_metrics_providers_metrics_provider_id(self, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """Get a metric provider  # noqa: E501

        Get a metric provider  # 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_pages_page_id_metrics_providers_metrics_provider_id(page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :return: MetricsProvider
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(page_id, metrics_provider_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(page_id, metrics_provider_id, **kwargs)  # noqa: E501
            return data

    def get_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(self, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """Get a metric provider  # noqa: E501

        Get a metric provider  # 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_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :return: MetricsProvider
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['page_id', 'metrics_provider_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_pages_page_id_metrics_providers_metrics_provider_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'page_id' is set
        if ('page_id' not in params or
                params['page_id'] is None):
            raise ValueError("Missing the required parameter `page_id` when calling `get_pages_page_id_metrics_providers_metrics_provider_id`")  # noqa: E501
        # verify the required parameter 'metrics_provider_id' is set
        if ('metrics_provider_id' not in params or
                params['metrics_provider_id'] is None):
            raise ValueError("Missing the required parameter `metrics_provider_id` when calling `get_pages_page_id_metrics_providers_metrics_provider_id`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'page_id' in params:
            path_params['page_id'] = params['page_id']  # noqa: E501
        if 'metrics_provider_id' in params:
            path_params['metrics_provider_id'] = params['metrics_provider_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 = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/pages/{page_id}/metrics_providers/{metrics_provider_id}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='MetricsProvider',  # 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)

    def get_pages_page_id_metrics_providers_metrics_provider_id_metrics(self, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """List metrics for a metric provider  # noqa: E501

        List metrics for a metric provider  # 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_pages_page_id_metrics_providers_metrics_provider_id_metrics(page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :param int page: Page offset to fetch. Beginning February 28, 2023, this endpoint will return paginated data even if this query parameter is not provided.
        :param int per_page: Number of results to return per page. Beginning February 28, 2023, a default and maximum limit of 100 will be imposed and this endpoint will return paginated data even if this query parameter is not provided.
        :return: Metric
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_pages_page_id_metrics_providers_metrics_provider_id_metrics_with_http_info(page_id, metrics_provider_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_pages_page_id_metrics_providers_metrics_provider_id_metrics_with_http_info(page_id, metrics_provider_id, **kwargs)  # noqa: E501
            return data

    def get_pages_page_id_metrics_providers_metrics_provider_id_metrics_with_http_info(self, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """List metrics for a metric provider  # noqa: E501

        List metrics for a metric provider  # 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_pages_page_id_metrics_providers_metrics_provider_id_metrics_with_http_info(page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :param int page: Page offset to fetch. Beginning February 28, 2023, this endpoint will return paginated data even if this query parameter is not provided.
        :param int per_page: Number of results to return per page. Beginning February 28, 2023, a default and maximum limit of 100 will be imposed and this endpoint will return paginated data even if this query parameter is not provided.
        :return: Metric
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['page_id', 'metrics_provider_id', 'page', 'per_page']  # 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_pages_page_id_metrics_providers_metrics_provider_id_metrics" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'page_id' is set
        if ('page_id' not in params or
                params['page_id'] is None):
            raise ValueError("Missing the required parameter `page_id` when calling `get_pages_page_id_metrics_providers_metrics_provider_id_metrics`")  # noqa: E501
        # verify the required parameter 'metrics_provider_id' is set
        if ('metrics_provider_id' not in params or
                params['metrics_provider_id'] is None):
            raise ValueError("Missing the required parameter `metrics_provider_id` when calling `get_pages_page_id_metrics_providers_metrics_provider_id_metrics`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'page_id' in params:
            path_params['page_id'] = params['page_id']  # noqa: E501
        if 'metrics_provider_id' in params:
            path_params['metrics_provider_id'] = params['metrics_provider_id']  # noqa: E501

        query_params = []
        if 'page' in params:
            query_params.append(('page', params['page']))  # noqa: E501
        if 'per_page' in params:
            query_params.append(('per_page', params['per_page']))  # noqa: E501

        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 = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/pages/{page_id}/metrics_providers/{metrics_provider_id}/metrics', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Metric',  # 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)

    def patch_pages_page_id_metrics_providers_metrics_provider_id(self, body, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """Update a metric provider  # noqa: E501

        Update a metric provider  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.patch_pages_page_id_metrics_providers_metrics_provider_id(body, page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param PatchPagesPageIdMetricsProviders body: (required)
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :return: MetricsProvider
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.patch_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(body, page_id, metrics_provider_id, **kwargs)  # noqa: E501
        else:
            (data) = self.patch_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(body, page_id, metrics_provider_id, **kwargs)  # noqa: E501
            return data

    def patch_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(self, body, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """Update a metric provider  # noqa: E501

        Update a metric provider  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.patch_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(body, page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param PatchPagesPageIdMetricsProviders body: (required)
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :return: MetricsProvider
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body', 'page_id', 'metrics_provider_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 patch_pages_page_id_metrics_providers_metrics_provider_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `patch_pages_page_id_metrics_providers_metrics_provider_id`")  # noqa: E501
        # verify the required parameter 'page_id' is set
        if ('page_id' not in params or
                params['page_id'] is None):
            raise ValueError("Missing the required parameter `page_id` when calling `patch_pages_page_id_metrics_providers_metrics_provider_id`")  # noqa: E501
        # verify the required parameter 'metrics_provider_id' is set
        if ('metrics_provider_id' not in params or
                params['metrics_provider_id'] is None):
            raise ValueError("Missing the required parameter `metrics_provider_id` when calling `patch_pages_page_id_metrics_providers_metrics_provider_id`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'page_id' in params:
            path_params['page_id'] = params['page_id']  # noqa: E501
        if 'metrics_provider_id' in params:
            path_params['metrics_provider_id'] = params['metrics_provider_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/pages/{page_id}/metrics_providers/{metrics_provider_id}', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='MetricsProvider',  # 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)

    def post_pages_page_id_metrics_providers(self, body, page_id, **kwargs):  # noqa: E501
        """Create a metric provider  # noqa: E501

        Create a metric provider  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.post_pages_page_id_metrics_providers(body, page_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param PostPagesPageIdMetricsProviders body: (required)
        :param str page_id: Page identifier (required)
        :return: MetricsProvider
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.post_pages_page_id_metrics_providers_with_http_info(body, page_id, **kwargs)  # noqa: E501
        else:
            (data) = self.post_pages_page_id_metrics_providers_with_http_info(body, page_id, **kwargs)  # noqa: E501
            return data

    def post_pages_page_id_metrics_providers_with_http_info(self, body, page_id, **kwargs):  # noqa: E501
        """Create a metric provider  # noqa: E501

        Create a metric provider  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.post_pages_page_id_metrics_providers_with_http_info(body, page_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param PostPagesPageIdMetricsProviders body: (required)
        :param str page_id: Page identifier (required)
        :return: MetricsProvider
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body', 'page_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 post_pages_page_id_metrics_providers" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `post_pages_page_id_metrics_providers`")  # noqa: E501
        # verify the required parameter 'page_id' is set
        if ('page_id' not in params or
                params['page_id'] is None):
            raise ValueError("Missing the required parameter `page_id` when calling `post_pages_page_id_metrics_providers`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'page_id' in params:
            path_params['page_id'] = params['page_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/pages/{page_id}/metrics_providers', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='MetricsProvider',  # 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)

    def post_pages_page_id_metrics_providers_metrics_provider_id_metrics(self, body, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """Create a metric for a metric provider  # noqa: E501

        Create a metric for a metric provider  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.post_pages_page_id_metrics_providers_metrics_provider_id_metrics(body, page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param PostPagesPageIdMetricsProvidersMetricsProviderIdMetrics body: (required)
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :return: Metric
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.post_pages_page_id_metrics_providers_metrics_provider_id_metrics_with_http_info(body, page_id, metrics_provider_id, **kwargs)  # noqa: E501
        else:
            (data) = self.post_pages_page_id_metrics_providers_metrics_provider_id_metrics_with_http_info(body, page_id, metrics_provider_id, **kwargs)  # noqa: E501
            return data

    def post_pages_page_id_metrics_providers_metrics_provider_id_metrics_with_http_info(self, body, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """Create a metric for a metric provider  # noqa: E501

        Create a metric for a metric provider  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.post_pages_page_id_metrics_providers_metrics_provider_id_metrics_with_http_info(body, page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param PostPagesPageIdMetricsProvidersMetricsProviderIdMetrics body: (required)
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :return: Metric
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body', 'page_id', 'metrics_provider_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 post_pages_page_id_metrics_providers_metrics_provider_id_metrics" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `post_pages_page_id_metrics_providers_metrics_provider_id_metrics`")  # noqa: E501
        # verify the required parameter 'page_id' is set
        if ('page_id' not in params or
                params['page_id'] is None):
            raise ValueError("Missing the required parameter `page_id` when calling `post_pages_page_id_metrics_providers_metrics_provider_id_metrics`")  # noqa: E501
        # verify the required parameter 'metrics_provider_id' is set
        if ('metrics_provider_id' not in params or
                params['metrics_provider_id'] is None):
            raise ValueError("Missing the required parameter `metrics_provider_id` when calling `post_pages_page_id_metrics_providers_metrics_provider_id_metrics`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'page_id' in params:
            path_params['page_id'] = params['page_id']  # noqa: E501
        if 'metrics_provider_id' in params:
            path_params['metrics_provider_id'] = params['metrics_provider_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/pages/{page_id}/metrics_providers/{metrics_provider_id}/metrics', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Metric',  # 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)

    def put_pages_page_id_metrics_providers_metrics_provider_id(self, body, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """Update a metric provider  # noqa: E501

        Update a metric provider  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.put_pages_page_id_metrics_providers_metrics_provider_id(body, page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param PutPagesPageIdMetricsProviders body: (required)
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :return: MetricsProvider
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.put_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(body, page_id, metrics_provider_id, **kwargs)  # noqa: E501
        else:
            (data) = self.put_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(body, page_id, metrics_provider_id, **kwargs)  # noqa: E501
            return data

    def put_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(self, body, page_id, metrics_provider_id, **kwargs):  # noqa: E501
        """Update a metric provider  # noqa: E501

        Update a metric provider  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.put_pages_page_id_metrics_providers_metrics_provider_id_with_http_info(body, page_id, metrics_provider_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param PutPagesPageIdMetricsProviders body: (required)
        :param str page_id: Page identifier (required)
        :param str metrics_provider_id: Metric Provider Identifier (required)
        :return: MetricsProvider
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body', 'page_id', 'metrics_provider_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 put_pages_page_id_metrics_providers_metrics_provider_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `put_pages_page_id_metrics_providers_metrics_provider_id`")  # noqa: E501
        # verify the required parameter 'page_id' is set
        if ('page_id' not in params or
                params['page_id'] is None):
            raise ValueError("Missing the required parameter `page_id` when calling `put_pages_page_id_metrics_providers_metrics_provider_id`")  # noqa: E501
        # verify the required parameter 'metrics_provider_id' is set
        if ('metrics_provider_id' not in params or
                params['metrics_provider_id'] is None):
            raise ValueError("Missing the required parameter `metrics_provider_id` when calling `put_pages_page_id_metrics_providers_metrics_provider_id`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'page_id' in params:
            path_params['page_id'] = params['page_id']  # noqa: E501
        if 'metrics_provider_id' in params:
            path_params['metrics_provider_id'] = params['metrics_provider_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['api_key']  # noqa: E501

        return self.api_client.call_api(
            '/pages/{page_id}/metrics_providers/{metrics_provider_id}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='MetricsProvider',  # 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)
