# -*- coding: utf-8 -*- """ flowroutenumbersandmessaging.controllers.porting_controller This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ from .base_controller import BaseController from ..api_helper import APIHelper from ..configuration import Configuration class PortingController(BaseController): """A Controller to access Endpoints in the flowroutenumbersandmessaging API.""" def checkPortability(self, numbers): """Does a POST request to /v2/portorders/portability. Args: numbers (list: comma delimited list of strings, required): Phone numbers to check Returns: mixed: Response from the API. A JSON object of the status of each number specified Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ body = { "numbers": numbers } # Prepare query URL _query_builder = Configuration.base_uri _query_builder += '/v2/portorders/portability' _query_url = APIHelper.clean_url(_query_builder) # Prepare headers _headers = { 'accept': 'application/json' } # Prepare and execute request _request = self.http_client.post(_query_url, headers=_headers, parameters=body) return self.handle_request_and_response(_request)