def request(self, method, url, query_params=None, headers=None,
             post_params=None, body=None, _preload_content=True,
             _request_timeout=None):
     """Makes the HTTP request using RESTClient."""
     if method == "GET":
         return self.rest_client.GET(url,
                                     query_params=query_params,
                                     _preload_content=_preload_content,
                                     _request_timeout=_request_timeout,
                                     headers=headers)
     elif method == "HEAD":
         return self.rest_client.HEAD(url,
                                      query_params=query_params,
                                      _preload_content=_preload_content,
                                      _request_timeout=_request_timeout,
                                      headers=headers)
     elif method == "OPTIONS":
         return self.rest_client.OPTIONS(url,
                                         query_params=query_params,
                                         headers=headers,
                                         post_params=post_params,
                                         _preload_content=_preload_content,
                                         _request_timeout=_request_timeout,
                                         body=body)
     elif method == "POST":
         return self.rest_client.POST(url,
                                      query_params=query_params,
                                      headers=headers,
                                      post_params=post_params,
                                      _preload_content=_preload_content,
                                      _request_timeout=_request_timeout,
                                      body=body)
     elif method == "PUT":
         return self.rest_client.PUT(url,
                                     query_params=query_params,
                                     headers=headers,
                                     post_params=post_params,
                                     _preload_content=_preload_content,
                                     _request_timeout=_request_timeout,
                                     body=body)
     elif method == "PATCH":
         return self.rest_client.PATCH(url,
                                       query_params=query_params,
                                       headers=headers,
                                       post_params=post_params,
                                       _preload_content=_preload_content,
                                       _request_timeout=_request_timeout,
                                       body=body)
     elif method == "DELETE":
         return self.rest_client.DELETE(url,
                                        query_params=query_params,
                                        headers=headers,
                                        _preload_content=_preload_content,
                                        _request_timeout=_request_timeout,
                                        body=body)
     else:
         raise ApiValueError(
             "http method must be `GET`, `HEAD`, `OPTIONS`,"
             " `POST`, `PATCH`, `PUT` or `DELETE`."
         )
    def update_params_for_auth(self, headers, querys, auth_settings):
        """Updates header and query params based on authentication setting.

        :param headers: Header parameters dict to be updated.
        :param querys: Query parameters tuple list to be updated.
        :param auth_settings: Authentication setting identifiers list.
        """
        if not auth_settings:
            return

        for auth in auth_settings:
            auth_setting = self.configuration.auth_settings().get(auth)
            if auth_setting:
                if not auth_setting['value']:
                    continue
                elif auth_setting['in'] == 'cookie':
                    headers['Cookie'] = auth_setting['value']
                elif auth_setting['in'] == 'header':
                    headers[auth_setting['key']] = auth_setting['value']
                elif auth_setting['in'] == 'query':
                    querys.append((auth_setting['key'], auth_setting['value']))
                else:
                    raise ApiValueError(
                        'Authentication token must be in `query` or `header`'
                    )
Example #3
0
 def __setattr__(self, name, value):
     object.__setattr__(self, name, value)
     if name == 'disabled_client_side_validations':
         s = set(filter(None, value.split(',')))
         for v in s:
             if v not in JSON_SCHEMA_VALIDATION_KEYWORDS:
                 raise ApiValueError("Invalid keyword: '{0}''".format(v))
         self._disabled_client_side_validations = s
Example #4
0
    def _apply_auth_params(self, headers, querys, auth_setting):
        """Updates the request parameters based on a single auth_setting

        :param headers: Header parameters dict to be updated.
        :param querys: Query parameters tuple list to be updated.
        :param auth_setting: auth settings for the endpoint
        """
        if auth_setting['in'] == 'cookie':
            headers['Cookie'] = auth_setting['value']
        elif auth_setting['in'] == 'header':
            headers[auth_setting['key']] = auth_setting['value']
        elif auth_setting['in'] == 'query':
            querys.append((auth_setting['key'], auth_setting['value']))
        else:
            raise ApiValueError(
                'Authentication token must be in `query` or `header`')
Example #5
0
    def list_orders_with_http_info(self, **kwargs):  # noqa: E501
        """[EARLY ACCESS] ListOrders: List Orders  # noqa: E501

        Fetch the last pre-AsAt date version of each order in scope (does not fetch the entire history).  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_orders_with_http_info(async_req=True)
        >>> result = thread.get()

        :param as_at: The asAt datetime at which to retrieve the order. Defaults to return the latest version of the order if not specified.
        :type as_at: datetime
        :param page: The pagination token to use to continue listing orders from a previous call to list orders.              This value is returned from the previous call. If a pagination token is provided the sortBy, filter, effectiveAt, and asAt fields              must not have changed since the original request. Also, if set, a start value cannot be provided.
        :type page: str
        :param sort_by: Order the results by these fields. Use use the '-' sign to denote descending order e.g. -MyFieldName.
        :type sort_by: list[str]
        :param start: When paginating, skip this number of results.
        :type start: int
        :param limit: When paginating, limit the number of returned results to this many.
        :type limit: int
        :param filter: Expression to filter the result set. Read more about filtering results from LUSID here:              https://support.lusid.com/filtering-results-from-lusid.
        :type filter: str
        :param property_keys: A list of property keys from the \"Orders\" domain to decorate onto each order.                  These take the format {domain}/{scope}/{code} e.g. \"Orders/system/Name\".
        :type property_keys: list[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: 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.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object, the HTTP status code, and the headers.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: (PagedResourceListOfOrder, int, HTTPHeaderDict)
        """

        local_var_params = locals()

        all_params = [
            'as_at', 'page', 'sort_by', 'start', 'limit', 'filter',
            'property_keys'
        ]
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout', '_request_auth', '_headers'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method list_orders" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if self.api_client.client_side_validation and (
                'page' in local_var_params and  # noqa: E501
                len(local_var_params['page']) > 500):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `page` when calling `list_orders`, length must be less than or equal to `500`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'page' in local_var_params and  # noqa: E501
                len(local_var_params['page']) < 1):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `page` when calling `list_orders`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'page' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\+\/]*={0,3}$',
                local_var_params['page']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `page` when calling `list_orders`, must conform to the pattern `/^[a-zA-Z0-9\+\/]*={0,3}$/`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params[
                'limit'] > 5000:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `limit` when calling `list_orders`, must be a value less than or equal to `5000`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params[
                'limit'] < 1:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `limit` when calling `list_orders`, must be a value greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'filter' in local_var_params and  # noqa: E501
                len(local_var_params['filter']) > 16384):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `list_orders`, length must be less than or equal to `16384`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'filter' in local_var_params and  # noqa: E501
                len(local_var_params['filter']) < 0):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `list_orders`, length must be greater than or equal to `0`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'filter' in local_var_params and not re.search(
                r'^[\s\S]*$', local_var_params['filter']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `list_orders`, must conform to the pattern `/^[\s\S]*$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}

        query_params = []
        if 'as_at' in local_var_params and local_var_params[
                'as_at'] is not None:  # noqa: E501
            query_params.append(
                ('asAt', local_var_params['as_at']))  # noqa: E501
        if 'page' in local_var_params and local_var_params[
                'page'] is not None:  # noqa: E501
            query_params.append(
                ('page', local_var_params['page']))  # noqa: E501
        if 'sort_by' in local_var_params and local_var_params[
                'sort_by'] is not None:  # noqa: E501
            query_params.append(
                ('sortBy', local_var_params['sort_by']))  # noqa: E501
            collection_formats['sortBy'] = 'multi'  # noqa: E501
        if 'start' in local_var_params and local_var_params[
                'start'] is not None:  # noqa: E501
            query_params.append(
                ('start', local_var_params['start']))  # noqa: E501
        if 'limit' in local_var_params and local_var_params[
                'limit'] is not None:  # noqa: E501
            query_params.append(
                ('limit', local_var_params['limit']))  # noqa: E501
        if 'filter' in local_var_params and local_var_params[
                'filter'] is not None:  # noqa: E501
            query_params.append(
                ('filter', local_var_params['filter']))  # noqa: E501
        if 'property_keys' in local_var_params and local_var_params[
                'property_keys'] is not None:  # noqa: E501
            query_params.append(
                ('propertyKeys',
                 local_var_params['property_keys']))  # noqa: E501
            collection_formats['propertyKeys'] = 'multi'  # noqa: E501

        header_params = dict(local_var_params.get('_headers', {}))

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.4385'

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

        response_types_map = {
            200: "PagedResourceListOfOrder",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/orders',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))
Example #6
0
    def list_scopes_with_http_info(self, **kwargs):  # noqa: E501
        """ListScopes: List Scopes  # noqa: E501

        List all the scopes that contain data.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_scopes_with_http_info(async_req=True)
        >>> result = thread.get()

        :param filter: Expression to filter the result set.              For example, to filter on the Scope, use \"scope eq 'string'\"              Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
        :type filter: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: 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.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object, the HTTP status code, and the headers.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: (ResourceListOfScopeDefinition, int, HTTPHeaderDict)
        """

        local_var_params = locals()

        all_params = ['filter']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout', '_request_auth', '_headers'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method list_scopes" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if self.api_client.client_side_validation and (
                'filter' in local_var_params and  # noqa: E501
                len(local_var_params['filter']) > 16384):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `list_scopes`, length must be less than or equal to `16384`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'filter' in local_var_params and  # noqa: E501
                len(local_var_params['filter']) < 0):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `list_scopes`, length must be greater than or equal to `0`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'filter' in local_var_params and not re.search(
                r'^[\s\S]*$', local_var_params['filter']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `list_scopes`, must conform to the pattern `/^[\s\S]*$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}

        query_params = []
        if 'filter' in local_var_params and local_var_params[
                'filter'] is not None:  # noqa: E501
            query_params.append(
                ('filter', local_var_params['filter']))  # noqa: E501

        header_params = dict(local_var_params.get('_headers', {}))

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.4385'

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

        response_types_map = {
            200: "ResourceListOfScopeDefinition",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/scopes',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))
Example #7
0
    def create_derived_portfolio_with_http_info(self, scope, **kwargs):  # noqa: E501
        """CreateDerivedPortfolio: Create derived portfolio  # noqa: E501

        Create a derived transaction portfolio from a parent transaction portfolio (which may itself be derived).  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.create_derived_portfolio_with_http_info(scope, async_req=True)
        >>> result = thread.get()

        :param scope: The scope in which to create the derived transaction portfolio. (required)
        :type scope: str
        :param create_derived_transaction_portfolio_request: The definition of the derived transaction portfolio.
        :type create_derived_transaction_portfolio_request: CreateDerivedTransactionPortfolioRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: 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.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object, the HTTP status code, and the headers.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: (Portfolio, int, HTTPHeaderDict)
        """

        local_var_params = locals()

        all_params = [
            'scope',
            'create_derived_transaction_portfolio_request'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_headers'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method create_derived_portfolio" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        if self.api_client.client_side_validation and ('scope' in local_var_params and  # noqa: E501
                                                        len(local_var_params['scope']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `scope` when calling `create_derived_portfolio`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('scope' in local_var_params and  # noqa: E501
                                                        len(local_var_params['scope']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `scope` when calling `create_derived_portfolio`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `scope` when calling `create_derived_portfolio`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501

        query_params = []

        header_params = dict(local_var_params.get('_headers', {}))

        form_params = []
        local_var_files = {}

        body_params = None
        if 'create_derived_transaction_portfolio_request' in local_var_params:
            body_params = local_var_params['create_derived_transaction_portfolio_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.4385'

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

        response_types_map = {
            201: "Portfolio",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/derivedtransactionportfolios/{scope}', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))
    def get_entity_schema_with_http_info(self, entity, **kwargs):  # noqa: E501
        """[BETA] Get schema  # noqa: E501

        Gets the schema and meta-data for a given entity  # 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_entity_schema_with_http_info(entity, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str entity: The name of a valid entity (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(Schema, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['entity']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method get_entity_schema" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if ('entity' in local_var_params
                and len(local_var_params['entity']) > 6000):
            raise ApiValueError(
                "Invalid value for parameter `entity` when calling `get_entity_schema`, length must be less than or equal to `6000`"
            )  # noqa: E501
        if ('entity' in local_var_params
                and len(local_var_params['entity']) < 0):
            raise ApiValueError(
                "Invalid value for parameter `entity` when calling `get_entity_schema`, length must be greater than or equal to `0`"
            )  # noqa: E501
        if 'entity' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$',
                local_var_params['entity']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `entity` when calling `get_entity_schema`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'entity' in local_var_params:
            path_params['entity'] = local_var_params['entity']  # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2863'

        return self.api_client.call_api(
            '/api/schemas/entities/{entity}',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Schema',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #9
0
    def request(self,
                method,
                url,
                query_params=None,
                headers=None,
                body=None,
                post_params=None,
                _preload_content=True,
                _request_timeout=None):
        """Perform requests.

        :param method: http request method
        :param url: http request url
        :param query_params: query parameters in the url
        :param headers: http request headers
        :param body: request json body, for `application/json`
        :param post_params: request post parameters,
                            `application/x-www-form-urlencoded`
                            and `multipart/form-data`
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        """
        method = method.upper()
        assert method in [
            'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'
        ]

        if post_params and body:
            raise ApiValueError(
                "body parameter cannot be used with post_params parameter.")

        post_params = post_params or {}
        headers = headers or {}

        timeout = None
        if _request_timeout:
            if isinstance(_request_timeout, (int, ) if six.PY3 else
                          (int, long)):  # noqa: E501,F821
                timeout = urllib3.Timeout(total=_request_timeout)
            elif (isinstance(_request_timeout, tuple)
                  and len(_request_timeout) == 2):
                timeout = urllib3.Timeout(connect=_request_timeout[0],
                                          read=_request_timeout[1])

        if 'Content-Type' not in headers:
            headers['Content-Type'] = 'application/json'

        try:
            # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
            if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
                if query_params:
                    url += '?' + urlencode(query_params)
                if re.search('json', headers['Content-Type'], re.IGNORECASE):
                    request_body = None
                    if body is not None:
                        request_body = json.dumps(body)
                    r = self.pool_manager.request(
                        method,
                        url,
                        body=request_body,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                elif headers[
                        'Content-Type'] == 'application/x-www-form-urlencoded':  # noqa: E501
                    r = self.pool_manager.request(
                        method,
                        url,
                        fields=post_params,
                        encode_multipart=False,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                elif headers['Content-Type'] == 'multipart/form-data':
                    # must del headers['Content-Type'], or the correct
                    # Content-Type which generated by urllib3 will be
                    # overwritten.
                    del headers['Content-Type']
                    r = self.pool_manager.request(
                        method,
                        url,
                        fields=post_params,
                        encode_multipart=True,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                # Pass a `string` parameter directly in the body to support
                # other content types than Json when `body` argument is
                # provided in serialized form
                elif isinstance(body, str) or isinstance(body, bytes):
                    request_body = body
                    r = self.pool_manager.request(
                        method,
                        url,
                        body=request_body,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                else:
                    # Cannot generate the request from given parameters
                    msg = """Cannot prepare a request message for provided
                             arguments. Please check that your arguments match
                             declared content type."""
                    raise ApiException(status=0, reason=msg)
            # For `GET`, `HEAD`
            else:
                r = self.pool_manager.request(method,
                                              url,
                                              fields=query_params,
                                              preload_content=_preload_content,
                                              timeout=timeout,
                                              headers=headers)
        except urllib3.exceptions.SSLError as e:
            msg = "{0}\n{1}".format(type(e).__name__, str(e))
            raise ApiException(status=0, reason=msg)

        if _preload_content:
            r = RESTResponse(r)

            # log response body
            logger.debug("response body: %s", r.data)

        if not 200 <= r.status <= 299:
            raise ApiException(http_resp=r)

        return r
    def get_relation_definition_with_http_info(self, scope, code,
                                               **kwargs):  # noqa: E501
        """[DEPRECATED] Get relation definition  # noqa: E501

        Retrieve the definition of a specified relation.  # 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_relation_definition_with_http_info(scope, code, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str scope: The scope of the specified relation. (required)
        :param str code: The code of the specified relation. Together with the domain and scope this uniquely              identifies the relation. (required)
        :param datetime as_at: The asAt datetime at which to retrieve the relation definition. Defaults to return              the latest version of the definition if not specified.
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(RelationDefinition, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['scope', 'code', 'as_at']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method get_relation_definition" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if ('scope' in local_var_params
                and len(local_var_params['scope']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_relation_definition`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('scope' in local_var_params
                and len(local_var_params['scope']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_relation_definition`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_relation_definition`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if ('code' in local_var_params and len(local_var_params['code']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_relation_definition`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('code' in local_var_params and len(local_var_params['code']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_relation_definition`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'code' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_relation_definition`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []
        if 'as_at' in local_var_params:
            query_params.append(
                ('asAt', local_var_params['as_at']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2808'

        return self.api_client.call_api(
            '/api/relationdefinitions/{scope}/{code}',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RelationDefinition',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #11
0
    def get_structured_result_data_with_http_info(self, scope, request_body,
                                                  **kwargs):  # noqa: E501
        """[EXPERIMENTAL] Get structured result data  # noqa: E501

        Get one or more items of structured result data from a single scope.                Each item can be identified by its time invariant structured result data identifier.                For each id LUSID will return the most recent matched item with respect to the provided (or default) effective datetime.                 An optional maximum age range window can be specified which defines how far back to look back for data from the specified effective datetime.  LUSID will return the most recent item within this window.                In the request each structured result data id must be keyed by a unique correlation id. This id is ephemeral and is not stored by LUSID.  It serves only as a way to easily identify each item in the response.                The response will return three collections. One, the successfully retrieved structured result data. Two, those that had a  valid identifier but could not be found. Three, those that failed because LUSID could not construct a valid identifier from the request.    For the ids that failed to resolve or could not be found a reason will be provided explaining why that is the case.                It is important to always check the failed and not found sets for any unsuccessful results.  # 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_structured_result_data_with_http_info(scope, request_body, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str scope: The scope of the structured result data to retrieve. (required)
        :param dict(str, StructuredResultDataId) request_body: The time invariant set of structured data identifiers to retrieve the data for. These need to be               keyed by a unique correlation id allowing the retrieved item to be identified in the response. (required)
        :param datetime as_at: The asAt datetime at which to retrieve the structured result data. Defaults to return the latest version if not specified.
        :param str max_age: The duration of the look back window in an ISO8601 time interval format e.g. P1Y2M3DT4H30M (1 year, 2 months, 3 days, 4 hours and 30 minutes).               This is subtracted from the provided effectiveAt datetime to generate a effective datetime window inside which a structured result data item must exist to be retrieved.
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(GetStructuredResultDataResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['scope', 'request_body', 'as_at',
                      'max_age']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method get_structured_result_data" %
                                   key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'scope' is set
        if ('scope' not in local_var_params
                or local_var_params['scope'] is None):
            raise ApiValueError(
                "Missing the required parameter `scope` when calling `get_structured_result_data`"
            )  # noqa: E501
        # verify the required parameter 'request_body' is set
        if ('request_body' not in local_var_params
                or local_var_params['request_body'] is None):
            raise ApiValueError(
                "Missing the required parameter `request_body` when calling `get_structured_result_data`"
            )  # noqa: E501

        if ('scope' in local_var_params
                and len(local_var_params['scope']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_structured_result_data`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('scope' in local_var_params
                and len(local_var_params['scope']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_structured_result_data`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_structured_result_data`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501

        query_params = []
        if 'as_at' in local_var_params:
            query_params.append(
                ('asAt', local_var_params['as_at']))  # noqa: E501
        if 'max_age' in local_var_params:
            query_params.append(
                ('maxAge', local_var_params['max_age']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'request_body' in local_var_params:
            body_params = local_var_params['request_body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2863'

        return self.api_client.call_api(
            '/api/unitresults/{scope}/$get',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='GetStructuredResultDataResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def list_data_types_with_http_info(self, scope, **kwargs):  # noqa: E501
        """[EARLY ACCESS] List data types  # noqa: E501

        List all data types in a specified scope  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_data_types_with_http_info(scope, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str scope: The requested scope of the data types (required)
        :param datetime as_at: The as at of the requested data types
        :param bool include_system: Whether to additionally include those data types in the \"system\" scope
        :param list[str] sort_by: Optional. Order the results by these fields. Use use the '-' sign to denote descending order e.g. -MyFieldName
        :param int start: Optional. When paginating, skip this number of results
        :param int limit: Optional. When paginating, limit the number of returned results to this many.
        :param str filter: Optional. Expression to filter the result set.              For example, to filter on the Display Name, use \"displayName eq 'string'\"              Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(ResourceListOfDataType, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'scope', 'as_at', 'include_system', 'sort_by', 'start', 'limit',
            'filter'
        ]  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method list_data_types" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if ('scope' in local_var_params
                and len(local_var_params['scope']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `list_data_types`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('scope' in local_var_params
                and len(local_var_params['scope']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `list_data_types`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `list_data_types`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if ('filter' in local_var_params
                and len(local_var_params['filter']) > 2147483647):
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `list_data_types`, length must be less than or equal to `2147483647`"
            )  # noqa: E501
        if ('filter' in local_var_params
                and len(local_var_params['filter']) < 0):
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `list_data_types`, length must be greater than or equal to `0`"
            )  # noqa: E501
        if 'filter' in local_var_params and not re.search(
                r'(?s).*', local_var_params['filter']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `list_data_types`, must conform to the pattern `/(?s).*/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501

        query_params = []
        if 'as_at' in local_var_params:
            query_params.append(
                ('asAt', local_var_params['as_at']))  # noqa: E501
        if 'include_system' in local_var_params:
            query_params.append(
                ('includeSystem',
                 local_var_params['include_system']))  # noqa: E501
        if 'sort_by' in local_var_params:
            query_params.append(
                ('sortBy', local_var_params['sort_by']))  # noqa: E501
            collection_formats['sortBy'] = 'multi'  # noqa: E501
        if 'start' in local_var_params:
            query_params.append(
                ('start', local_var_params['start']))  # noqa: E501
        if 'limit' in local_var_params:
            query_params.append(
                ('limit', local_var_params['limit']))  # noqa: E501
        if 'filter' in local_var_params:
            query_params.append(
                ('filter', local_var_params['filter']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2808'

        return self.api_client.call_api(
            '/api/datatypes/{scope}',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ResourceListOfDataType',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def get_units_from_data_type_with_http_info(self, scope, code,
                                                **kwargs):  # noqa: E501
        """[EARLY ACCESS] Get units from data type  # noqa: E501

        Get the definitions of the specified units associated bound to a specific data type  # 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_units_from_data_type_with_http_info(scope, code, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str scope: The scope of the data type (required)
        :param str code: The code of the data type (required)
        :param list[str] units: One or more unit identifiers for which the definition is being requested
        :param str filter: Optional. Expression to filter the result set.               For example, to filter on the Schema, use \"schema eq 'string'\"              Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
        :param datetime as_at: Optional. The as at of the requested data type
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(ResourceListOfIUnitDefinitionDto, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['scope', 'code', 'units', 'filter',
                      'as_at']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method get_units_from_data_type" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if ('scope' in local_var_params
                and len(local_var_params['scope']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_units_from_data_type`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('scope' in local_var_params
                and len(local_var_params['scope']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_units_from_data_type`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_units_from_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if ('code' in local_var_params and len(local_var_params['code']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_units_from_data_type`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('code' in local_var_params and len(local_var_params['code']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_units_from_data_type`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'code' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_units_from_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if ('filter' in local_var_params
                and len(local_var_params['filter']) > 2147483647):
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `get_units_from_data_type`, length must be less than or equal to `2147483647`"
            )  # noqa: E501
        if ('filter' in local_var_params
                and len(local_var_params['filter']) < 0):
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `get_units_from_data_type`, length must be greater than or equal to `0`"
            )  # noqa: E501
        if 'filter' in local_var_params and not re.search(
                r'(?s).*', local_var_params['filter']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `filter` when calling `get_units_from_data_type`, must conform to the pattern `/(?s).*/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []
        if 'units' in local_var_params:
            query_params.append(
                ('units', local_var_params['units']))  # noqa: E501
            collection_formats['units'] = 'multi'  # noqa: E501
        if 'filter' in local_var_params:
            query_params.append(
                ('filter', local_var_params['filter']))  # noqa: E501
        if 'as_at' in local_var_params:
            query_params.append(
                ('asAt', local_var_params['as_at']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2808'

        return self.api_client.call_api(
            '/api/datatypes/{scope}/{code}/units',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ResourceListOfIUnitDefinitionDto',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def delete_structured_market_data_with_http_info(self, scope, structured_data_ids, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] Delete one or more items of structured market data, assuming they are present.  # noqa: E501

        Delete one or more specified structured market data items from a single scope. Each item is identified by a unique id which includes  information about its type as well as the exact effective datetime (to the microsecond) at which it entered the system (became valid).                In the request each market data item must be keyed by a unique correlation id. This id is ephemeral and is not stored by LUSID.  It serves only as a way to easily identify each quote in the response.                The response will return both the collection of successfully deleted market data items, as well as those that failed.  For the failures a reason will be provided explaining why the it could not be deleted.                It is important to always check the failed set for any unsuccessful results.  # 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_structured_market_data_with_http_info(scope, structured_data_ids, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str scope: The scope of the structured market data to delete. (required)
        :param dict(str, StructuredMarketDataId) structured_data_ids: The structured market data Ids to delete, each keyed by a unique correlation id. (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(AnnulStructuredDataResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['scope', 'structured_data_ids']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_structured_market_data" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'scope' is set
        if ('scope' not in local_var_params or
                local_var_params['scope'] is None):
            raise ApiValueError("Missing the required parameter `scope` when calling `delete_structured_market_data`")  # noqa: E501
        # verify the required parameter 'structured_data_ids' is set
        if ('structured_data_ids' not in local_var_params or
                local_var_params['structured_data_ids'] is None):
            raise ApiValueError("Missing the required parameter `structured_data_ids` when calling `delete_structured_market_data`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'structured_data_ids' in local_var_params:
            body_params = local_var_params['structured_data_ids']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501


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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.10.739'

        return self.api_client.call_api(
            '/api/structured/{scope}/$delete', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='AnnulStructuredDataResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #15
0
    def portfolio_groups_search_with_http_info(self, body,
                                               **kwargs):  # noqa: E501
        """[DEPRECATED] Portfolio groups search  # noqa: E501

        Search across all portfolio groups across all scopes.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.portfolio_groups_search_with_http_info(body, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param object body: The search query to use. Read more about search queries in LUSID here https://support.lusid.com/constructing-a-search-request. (required)
        :param str filter: Expression to filter the result set. Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(ResourceListOfPortfolioGroup, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['body', 'filter']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method portfolio_groups_search" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in local_var_params
                or local_var_params['body'] is None):
            raise ApiValueError(
                "Missing the required parameter `body` when calling `portfolio_groups_search`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'filter' in local_var_params:
            query_params.append(
                ('filter', local_var_params['filter']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2321'

        return self.api_client.call_api(
            '/api/search/portfoliogroups',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ResourceListOfPortfolioGroup',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #16
0
    def delete_derived_portfolio_details_with_http_info(
            self, scope, code, **kwargs):  # noqa: E501
        """[EARLY ACCESS] Delete portfolio details  # noqa: E501

        Deletes the portfolio details for the specified derived transaction portfolio  # 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_derived_portfolio_details_with_http_info(scope, code, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str scope: The scope of the portfolio (required)
        :param str code: The code of the portfolio (required)
        :param str effective_at: The effective date of the change
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(DeletedEntityResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['scope', 'code', 'effective_at']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_derived_portfolio_details" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if ('scope' in local_var_params
                and len(local_var_params['scope']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `delete_derived_portfolio_details`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('scope' in local_var_params
                and len(local_var_params['scope']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `delete_derived_portfolio_details`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `delete_derived_portfolio_details`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if ('code' in local_var_params and len(local_var_params['code']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `delete_derived_portfolio_details`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('code' in local_var_params and len(local_var_params['code']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `delete_derived_portfolio_details`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'code' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `delete_derived_portfolio_details`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if ('effective_at' in local_var_params
                and len(local_var_params['effective_at']) > 256):
            raise ApiValueError(
                "Invalid value for parameter `effective_at` when calling `delete_derived_portfolio_details`, length must be less than or equal to `256`"
            )  # noqa: E501
        if ('effective_at' in local_var_params
                and len(local_var_params['effective_at']) < 0):
            raise ApiValueError(
                "Invalid value for parameter `effective_at` when calling `delete_derived_portfolio_details`, length must be greater than or equal to `0`"
            )  # noqa: E501
        if 'effective_at' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_\+:\.]+$',
                local_var_params['effective_at']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `effective_at` when calling `delete_derived_portfolio_details`, must conform to the pattern `/^[a-zA-Z0-9\-_\+:\.]+$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []
        if 'effective_at' in local_var_params:
            query_params.append(
                ('effectiveAt',
                 local_var_params['effective_at']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2808'

        return self.api_client.call_api(
            '/api/derivedtransactionportfolios/{scope}/{code}/details',
            'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeletedEntityResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #17
0
    def create_derived_portfolio_with_http_info(self, scope,
                                                **kwargs):  # noqa: E501
        """[EARLY ACCESS] Create derived transaction portfolio  # noqa: E501

        Creates a transaction portfolio that derives from an existing transaction portfolio. In a derived portfolio, parts of the portfolio can either be specific to this portfolio, or can be inherited from a \"parent\". Different parts of the portfolio (e.g. transactions or properties) are combined in different ways. The portfolio details are either overridden in entirety, or not at all. The same is true for properties. Transactions on a derived portfolio are merged with its parent portfolio's transactions. If the parent portfolio is itself a derived portfolio, transactions from that parent are also merged (and that parent's portfolio's, if it is also a derived portfolio, and so on).  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_derived_portfolio_with_http_info(scope, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str scope: The scope into which to create the new derived portfolio (required)
        :param CreateDerivedTransactionPortfolioRequest create_derived_transaction_portfolio_request: The root object of the new derived portfolio, containing a populated reference portfolio id and reference scope
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(Portfolio, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['scope', 'create_derived_transaction_portfolio_request'
                      ]  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method create_derived_portfolio" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if ('scope' in local_var_params
                and len(local_var_params['scope']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `create_derived_portfolio`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('scope' in local_var_params
                and len(local_var_params['scope']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `create_derived_portfolio`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `create_derived_portfolio`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'create_derived_transaction_portfolio_request' in local_var_params:
            body_params = local_var_params[
                'create_derived_transaction_portfolio_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2808'

        return self.api_client.call_api(
            '/api/derivedtransactionportfolios/{scope}',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Portfolio',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #18
0
    def upsert_structured_result_data_with_http_info(self, scope, request_body,
                                                     **kwargs):  # noqa: E501
        """[EXPERIMENTAL] Upsert a set of structured result data items. This creates or updates the data in Lusid.  # noqa: E501

        Update or insert one or more structured result data items in a single scope. An item will be updated if it already exists  and inserted if it does not.                In the request each structured result data item must be keyed by a unique correlation id. This id is ephemeral and is not stored by LUSID.  It serves only as a way to easily identify each structured result data in the response.                The response will return both the collection of successfully updated or inserted structured result data, as well as those that failed.  For the failures a reason will be provided explaining why the item could not be updated or inserted.                It is important to always check the failed set for any unsuccessful results.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.upsert_structured_result_data_with_http_info(scope, request_body, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str scope: The scope to use when updating or inserting the structured result data. (required)
        :param dict(str, UpsertStructuredResultDataRequest) request_body: The set of structured result data items to update or insert keyed by a unique correlation id. (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(UpsertStructuredDataResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['scope', 'request_body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method upsert_structured_result_data" %
                                   key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'scope' is set
        if ('scope' not in local_var_params
                or local_var_params['scope'] is None):
            raise ApiValueError(
                "Missing the required parameter `scope` when calling `upsert_structured_result_data`"
            )  # noqa: E501
        # verify the required parameter 'request_body' is set
        if ('request_body' not in local_var_params
                or local_var_params['request_body'] is None):
            raise ApiValueError(
                "Missing the required parameter `request_body` when calling `upsert_structured_result_data`"
            )  # noqa: E501

        if ('scope' in local_var_params
                and len(local_var_params['scope']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `upsert_structured_result_data`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('scope' in local_var_params
                and len(local_var_params['scope']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `upsert_structured_result_data`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `upsert_structured_result_data`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'request_body' in local_var_params:
            body_params = local_var_params['request_body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2863'

        return self.api_client.call_api(
            '/api/unitresults/{scope}',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='UpsertStructuredDataResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def create_relation_definition_with_http_info(
            self, create_relation_definition_request, **kwargs):  # noqa: E501
        """[DEPRECATED] Create a relation definition  # noqa: E501

        Define a new relation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_relation_definition_with_http_info(create_relation_definition_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param CreateRelationDefinitionRequest create_relation_definition_request: The definition of the new relation. (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(RelationDefinition, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['create_relation_definition_request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method create_relation_definition" %
                                   key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'create_relation_definition_request' is set
        if ('create_relation_definition_request' not in local_var_params
                or local_var_params['create_relation_definition_request'] is
                None):
            raise ApiValueError(
                "Missing the required parameter `create_relation_definition_request` when calling `create_relation_definition`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'create_relation_definition_request' in local_var_params:
            body_params = local_var_params[
                'create_relation_definition_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2808'

        return self.api_client.call_api(
            '/api/relationdefinitions',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RelationDefinition',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def next_with_http_info(self, scope, code, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] Next: Get next values from sequence  # noqa: E501

        Get the next set of values from a specified sequence  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.next_with_http_info(scope, code, async_req=True)
        >>> result = thread.get()

        :param scope: Scope of the sequence. (required)
        :type scope: str
        :param code: Code of the sequence. This together with stated scope uniquely              identifies the sequence. (required)
        :type code: str
        :param batch: Number of sequences items to return for the specified sequence. Default to 1 if not specified.
        :type batch: int
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: 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.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object, the HTTP status code, and the headers.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: (NextValueInSequenceResponse, int, HTTPHeaderDict)
        """

        local_var_params = locals()

        all_params = ['scope', 'code', 'batch']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout', '_request_auth'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method next" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if self.api_client.client_side_validation and (
                'scope' in local_var_params and  # noqa: E501
                len(local_var_params['scope']) > 64):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `next`, length must be less than or equal to `64`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'scope' in local_var_params and  # noqa: E501
                len(local_var_params['scope']) < 1):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `next`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `next`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'code' in local_var_params and  # noqa: E501
                len(local_var_params['code']) > 64):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `next`, length must be less than or equal to `64`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'code' in local_var_params and  # noqa: E501
                len(local_var_params['code']) < 1):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `next`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `next`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'batch' in local_var_params and local_var_params[
                'batch'] > 5000:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `batch` when calling `next`, must be a value less than or equal to `5000`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'batch' in local_var_params and local_var_params[
                'batch'] < 1:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `batch` when calling `next`, must be a value greater than or equal to `1`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []
        if 'batch' in local_var_params and local_var_params[
                'batch'] is not None:  # noqa: E501
            query_params.append(
                ('batch', local_var_params['batch']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.3906'

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

        response_types_map = {
            200: "NextValueInSequenceResponse",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/sequences/{scope}/{code}/next',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))
Example #21
0
    def list_constituents_adjustments_with_http_info(self, scope, code,
                                                     from_effective_at,
                                                     to_effective_at,
                                                     **kwargs):  # noqa: E501
        """ListConstituentsAdjustments: List constituents adjustments  # noqa: E501

        List adjustments made to constituents in a reference portfolio.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_constituents_adjustments_with_http_info(scope, code, from_effective_at, to_effective_at, async_req=True)
        >>> result = thread.get()

        :param scope: The scope of the reference portfolio. (required)
        :type scope: str
        :param code: The code of the reference portfolio. Together with the scope this uniquely identifies              the reference portfolio. (required)
        :type code: str
        :param from_effective_at: Events between this time (inclusive) and the toEffectiveAt are returned. (required)
        :type from_effective_at: str
        :param to_effective_at: Events between this time (inclusive) and the fromEffectiveAt are returned. (required)
        :type to_effective_at: str
        :param as_at_time: The asAt time for which the result is valid.
        :type as_at_time: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: 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.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object, the HTTP status code, and the headers.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: (ResourceListOfConstituentsAdjustmentHeader, int, HTTPHeaderDict)
        """

        local_var_params = locals()

        all_params = [
            'scope', 'code', 'from_effective_at', 'to_effective_at',
            'as_at_time'
        ]
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout', '_request_auth'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method list_constituents_adjustments" %
                                   key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'from_effective_at' is set
        if self.api_client.client_side_validation and (
                'from_effective_at' not in local_var_params or  # noqa: E501
                local_var_params['from_effective_at'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `from_effective_at` when calling `list_constituents_adjustments`"
            )  # noqa: E501
        # verify the required parameter 'to_effective_at' is set
        if self.api_client.client_side_validation and (
                'to_effective_at' not in local_var_params or  # noqa: E501
                local_var_params['to_effective_at'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `to_effective_at` when calling `list_constituents_adjustments`"
            )  # noqa: E501

        if self.api_client.client_side_validation and (
                'scope' in local_var_params and  # noqa: E501
                len(local_var_params['scope']) > 64):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `list_constituents_adjustments`, length must be less than or equal to `64`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'scope' in local_var_params and  # noqa: E501
                len(local_var_params['scope']) < 1):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `list_constituents_adjustments`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `list_constituents_adjustments`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'code' in local_var_params and  # noqa: E501
                len(local_var_params['code']) > 64):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `list_constituents_adjustments`, length must be less than or equal to `64`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'code' in local_var_params and  # noqa: E501
                len(local_var_params['code']) < 1):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `list_constituents_adjustments`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `list_constituents_adjustments`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []
        if 'from_effective_at' in local_var_params and local_var_params[
                'from_effective_at'] is not None:  # noqa: E501
            query_params.append(
                ('fromEffectiveAt',
                 local_var_params['from_effective_at']))  # noqa: E501
        if 'to_effective_at' in local_var_params and local_var_params[
                'to_effective_at'] is not None:  # noqa: E501
            query_params.append(
                ('toEffectiveAt',
                 local_var_params['to_effective_at']))  # noqa: E501
        if 'as_at_time' in local_var_params and local_var_params[
                'as_at_time'] is not None:  # noqa: E501
            query_params.append(
                ('asAtTime', local_var_params['as_at_time']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.3906'

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

        response_types_map = {
            200: "ResourceListOfConstituentsAdjustmentHeader",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/referenceportfolios/{scope}/{code}/constituentsadjustments',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))
    def update_cut_label_definition_with_http_info(self, code, **kwargs):  # noqa: E501
        """[EARLY ACCESS] Update a Cut Label  # noqa: E501

        Update a specified cut label  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_cut_label_definition_with_http_info(code, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str code: The Code of the Cut Label that is being updated (required)
        :param UpdateCutLabelDefinitionRequest update_cut_label_definition_request: The cut label update definition
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(CutLabelDefinition, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['code', 'update_cut_label_definition_request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_cut_label_definition" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        if ('code' in local_var_params and
                len(local_var_params['code']) > 64):
            raise ApiValueError("Invalid value for parameter `code` when calling `update_cut_label_definition`, length must be less than or equal to `64`")  # noqa: E501
        if ('code' in local_var_params and
                len(local_var_params['code']) < 1):
            raise ApiValueError("Invalid value for parameter `code` when calling `update_cut_label_definition`, length must be greater than or equal to `1`")  # noqa: E501
        if 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `update_cut_label_definition`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'update_cut_label_definition_request' in local_var_params:
            body_params = local_var_params['update_cut_label_definition_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2342'

        return self.api_client.call_api(
            '/api/systemconfiguration/cutlabels/{code}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CutLabelDefinition',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def get_results_with_http_info(self, entity_scope, entity_code,
                                   calculation_scope, calculation_code,
                                   effective_at, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] Retrieve a page of results all keyed by the provided parameters. The result store is not bi-temporal; a single date  addressed the market effectiveAt.  # noqa: E501

        Retrieve pre-calculated results that have been stored in LUSID.  # 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_results_with_http_info(entity_scope, entity_code, calculation_scope, calculation_code, effective_at, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str entity_scope: The scope of the data or entity being stored (required)
        :param str entity_code: The identifier for the data or results entity being stored (required)
        :param str calculation_scope: The identifying scope for the calculation that produced the result (required)
        :param str calculation_code: The identifying calculation name for the results (required)
        :param datetime effective_at: The market date for which the data is stored (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(Results, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'entity_scope', 'entity_code', 'calculation_scope',
            'calculation_code', 'effective_at'
        ]  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method get_results" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'entity_scope' is set
        if ('entity_scope' not in local_var_params
                or local_var_params['entity_scope'] is None):
            raise ApiValueError(
                "Missing the required parameter `entity_scope` when calling `get_results`"
            )  # noqa: E501
        # verify the required parameter 'entity_code' is set
        if ('entity_code' not in local_var_params
                or local_var_params['entity_code'] is None):
            raise ApiValueError(
                "Missing the required parameter `entity_code` when calling `get_results`"
            )  # noqa: E501
        # verify the required parameter 'calculation_scope' is set
        if ('calculation_scope' not in local_var_params
                or local_var_params['calculation_scope'] is None):
            raise ApiValueError(
                "Missing the required parameter `calculation_scope` when calling `get_results`"
            )  # noqa: E501
        # verify the required parameter 'calculation_code' is set
        if ('calculation_code' not in local_var_params
                or local_var_params['calculation_code'] is None):
            raise ApiValueError(
                "Missing the required parameter `calculation_code` when calling `get_results`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'entity_scope' in local_var_params:
            path_params['entityScope'] = local_var_params[
                'entity_scope']  # noqa: E501
        if 'entity_code' in local_var_params:
            path_params['entityCode'] = local_var_params[
                'entity_code']  # noqa: E501
        if 'calculation_scope' in local_var_params:
            path_params['calculationScope'] = local_var_params[
                'calculation_scope']  # noqa: E501
        if 'calculation_code' in local_var_params:
            path_params['calculationCode'] = local_var_params[
                'calculation_code']  # noqa: E501
        if 'effective_at' in local_var_params:
            path_params['effectiveAt'] = local_var_params[
                'effective_at']  # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.10.1327'

        return self.api_client.call_api(
            '/api/results/{entityScope}/{entityCode}/{calculationScope}/{calculationCode}/{effectiveAt}',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Results',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def get_allocation_with_http_info(self, scope, code,
                                      **kwargs):  # noqa: E501
        """[EXPERIMENTAL] Fetch a given allocation.  # 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_allocation_with_http_info(scope, code, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str scope: The scope to which the allocation belongs. (required)
        :param str code: The allocation's unique identifier. (required)
        :param datetime as_at: The asAt datetime at which to retrieve the allocation. Defaults to return the latest version of the allocation if not specified.
        :param list[str] property_keys: A list of property keys from the \"Allocations\" domain to decorate onto the allocation.              These take the format {domain}/{scope}/{code} e.g. \"Allocations/system/Name\".
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(Allocation, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['scope', 'code', 'as_at', 'property_keys']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method get_allocation" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'scope' is set
        if ('scope' not in local_var_params
                or local_var_params['scope'] is None):
            raise ApiValueError(
                "Missing the required parameter `scope` when calling `get_allocation`"
            )  # noqa: E501
        # verify the required parameter 'code' is set
        if ('code' not in local_var_params
                or local_var_params['code'] is None):
            raise ApiValueError(
                "Missing the required parameter `code` when calling `get_allocation`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []
        if 'as_at' in local_var_params:
            query_params.append(
                ('asAt', local_var_params['as_at']))  # noqa: E501
        if 'property_keys' in local_var_params:
            query_params.append(
                ('propertyKeys',
                 local_var_params['property_keys']))  # noqa: E501
            collection_formats['propertyKeys'] = 'multi'  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.10.1327'

        return self.api_client.call_api(
            '/api/allocations/{scope}/{code}',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Allocation',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #25
0
    def get_package_with_http_info(self, scope, code, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] GetPackage: Get Package  # noqa: E501

        Fetch a Package that matches the specified identifier  # 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_package_with_http_info(scope, code, async_req=True)
        >>> result = thread.get()

        :param scope: The scope to which the package belongs. (required)
        :type scope: str
        :param code: The package's unique identifier. (required)
        :type code: str
        :param as_at: The asAt datetime at which to retrieve the package. Defaults to return the latest version of the package if not specified.
        :type as_at: datetime
        :param property_keys: A list of property keys from the \"Package\" domain to decorate onto the package.              These take the format {domain}/{scope}/{code} e.g. \"Package/system/Name\".
        :type property_keys: list[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: 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.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object, the HTTP status code, and the headers.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: (Package, int, HTTPHeaderDict)
        """

        local_var_params = locals()

        all_params = ['scope', 'code', 'as_at', 'property_keys']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout', '_request_auth'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method get_package" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if self.api_client.client_side_validation and (
                'scope' in local_var_params and  # noqa: E501
                len(local_var_params['scope']) > 64):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_package`, length must be less than or equal to `64`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'scope' in local_var_params and  # noqa: E501
                len(local_var_params['scope']) < 1):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_package`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_package`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'code' in local_var_params and  # noqa: E501
                len(local_var_params['code']) > 64):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_package`, length must be less than or equal to `64`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'code' in local_var_params and  # noqa: E501
                len(local_var_params['code']) < 1):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_package`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_package`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []
        if 'as_at' in local_var_params and local_var_params[
                'as_at'] is not None:  # noqa: E501
            query_params.append(
                ('asAt', local_var_params['as_at']))  # noqa: E501
        if 'property_keys' in local_var_params and local_var_params[
                'property_keys'] is not None:  # noqa: E501
            query_params.append(
                ('propertyKeys',
                 local_var_params['property_keys']))  # noqa: E501
            collection_formats['propertyKeys'] = 'multi'  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.3906'

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

        response_types_map = {
            200: "Package",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/packages/{scope}/{code}',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))
Example #26
0
    def get_saml_identity_provider_id_with_http_info(self, domain, **kwargs):  # noqa: E501
        """Get SAML Identity Provider  # noqa: E501

        Get the unique identifier for the SAML 2.0 Identity Provider to be used for domain.  # 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_saml_identity_provider_id_with_http_info(domain, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str domain: The domain that the user will be logging in to (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(str, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['domain']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_saml_identity_provider_id" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'domain' is set
        if ('domain' not in local_var_params or
                local_var_params['domain'] is None):
            raise ApiValueError("Missing the required parameter `domain` when calling `get_saml_identity_provider_id`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'domain' in local_var_params:
            path_params['domain'] = local_var_params['domain']  # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501


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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.10.672'

        return self.api_client.call_api(
            '/api/login/saml/{domain}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='str',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #27
0
    def get_person_relations_with_http_info(self, id_type_scope, id_type_code,
                                            code, **kwargs):  # noqa: E501
        """[DEPRECATED] Get Relations for Person  # noqa: E501

        Get relations for the specified person.  # 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_person_relations_with_http_info(id_type_scope, id_type_code, code, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str id_type_scope: Scope of the person identifier type. (required)
        :param str id_type_code: Code of the person identifier type. (required)
        :param str code: Code of the person under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the person. (required)
        :param str effective_at: The effective datetime or cut label at which to get relations. Defaults to the current LUSID system datetime if not specified.
        :param datetime as_at: The asAt datetime at which to retrieve the person's relations. Defaults to return the latest LUSID AsAt time if not specified.
        :param str filter: Expression to filter the relations. Users should provide null or empty string for this field until further notice.
        :param list[str] identifier_types: Identifiers types (as property keys) used for referencing Persons or Legal Entities. These take the format              {domain}/{scope}/{code} e.g. \"Person/CompanyDetails/Role\". They must be from the \"Person\" or \"LegalEntity\" domain.              Only identifier types stated will be used to look up relevant entities in relations. If not applicable, provide an empty array.
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(ResourceListOfRelation, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'id_type_scope', 'id_type_code', 'code', 'effective_at', 'as_at',
            'filter', 'identifier_types'
        ]  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method get_person_relations" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if ('code' in local_var_params and len(local_var_params['code']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_person_relations`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('code' in local_var_params and len(local_var_params['code']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_person_relations`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'code' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `get_person_relations`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'id_type_scope' in local_var_params:
            path_params['idTypeScope'] = local_var_params[
                'id_type_scope']  # noqa: E501
        if 'id_type_code' in local_var_params:
            path_params['idTypeCode'] = local_var_params[
                'id_type_code']  # noqa: E501
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []
        if 'effective_at' in local_var_params:
            query_params.append(
                ('effectiveAt',
                 local_var_params['effective_at']))  # noqa: E501
        if 'as_at' in local_var_params:
            query_params.append(
                ('asAt', local_var_params['as_at']))  # noqa: E501
        if 'filter' in local_var_params:
            query_params.append(
                ('filter', local_var_params['filter']))  # noqa: E501
        if 'identifier_types' in local_var_params:
            query_params.append(
                ('identifierTypes',
                 local_var_params['identifier_types']))  # noqa: E501
            collection_formats['identifierTypes'] = 'multi'  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2808'

        return self.api_client.call_api(
            '/api/persons/{idTypeScope}/{idTypeCode}/{code}/relations',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ResourceListOfRelation',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def get_portfolio_changes_with_http_info(self, scope, effective_at,
                                             **kwargs):  # noqa: E501
        """[EARLY ACCESS] Get the next change to each portfolio in a scope.  # noqa: E501

        Gets the time of the next (earliest effective at) modification (correction and/or amendment) to each portfolio in a scope relative to a point in bitemporal time.  Includes changes from parent portfolios in different scopes.  Excludes changes from subcriptions (e.g corporate actions).  # 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_portfolio_changes_with_http_info(scope, effective_at, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str scope: The scope (required)
        :param str effective_at: The effective date of the origin. (required)
        :param datetime as_at: The as-at date of the origin.
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: 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.
        :return: tuple(ResourceListOfChange, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['scope', 'effective_at', 'as_at']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method get_portfolio_changes" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'scope' is set
        if ('scope' not in local_var_params
                or local_var_params['scope'] is None):
            raise ApiValueError(
                "Missing the required parameter `scope` when calling `get_portfolio_changes`"
            )  # noqa: E501
        # verify the required parameter 'effective_at' is set
        if ('effective_at' not in local_var_params
                or local_var_params['effective_at'] is None):
            raise ApiValueError(
                "Missing the required parameter `effective_at` when calling `get_portfolio_changes`"
            )  # noqa: E501

        if ('scope' in local_var_params
                and len(local_var_params['scope']) > 64):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_portfolio_changes`, length must be less than or equal to `64`"
            )  # noqa: E501
        if ('scope' in local_var_params
                and len(local_var_params['scope']) < 1):
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_portfolio_changes`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `get_portfolio_changes`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if ('effective_at' in local_var_params
                and len(local_var_params['effective_at']) > 256):
            raise ApiValueError(
                "Invalid value for parameter `effective_at` when calling `get_portfolio_changes`, length must be less than or equal to `256`"
            )  # noqa: E501
        if ('effective_at' in local_var_params
                and len(local_var_params['effective_at']) < 0):
            raise ApiValueError(
                "Invalid value for parameter `effective_at` when calling `get_portfolio_changes`, length must be greater than or equal to `0`"
            )  # noqa: E501
        if 'effective_at' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_\+:\.]+$',
                local_var_params['effective_at']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `effective_at` when calling `get_portfolio_changes`, must conform to the pattern `/^[a-zA-Z0-9\-_\+:\.]+$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}

        query_params = []
        if 'scope' in local_var_params:
            query_params.append(
                ('scope', local_var_params['scope']))  # noqa: E501
        if 'effective_at' in local_var_params:
            query_params.append(
                ('effectiveAt',
                 local_var_params['effective_at']))  # noqa: E501
        if 'as_at' in local_var_params:
            query_params.append(
                ('asAt', local_var_params['as_at']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.2863'

        return self.api_client.call_api(
            '/api/entities/changes/portfolios',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ResourceListOfChange',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #29
0
    def delete_order_with_http_info(self, scope, code, **kwargs):  # noqa: E501
        """[EARLY ACCESS] DeleteOrder: Delete order  # noqa: E501

        Delete an order. Deletion will be valid from the order's creation datetime.  This means that the order will no longer exist at any effective datetime from the asAt datetime of deletion.  # 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_order_with_http_info(scope, code, async_req=True)
        >>> result = thread.get()

        :param scope: The order scope. (required)
        :type scope: str
        :param code: The order's code. This, together with the scope uniquely identifies the order to delete. (required)
        :type code: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: 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.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object, the HTTP status code, and the headers.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: (DeletedEntityResponse, int, HTTPHeaderDict)
        """

        local_var_params = locals()

        all_params = ['scope', 'code']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout', '_request_auth', '_headers'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method delete_order" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'scope' is set
        if self.api_client.client_side_validation and (
                'scope' not in local_var_params or  # noqa: E501
                local_var_params['scope'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `scope` when calling `delete_order`"
            )  # noqa: E501
        # verify the required parameter 'code' is set
        if self.api_client.client_side_validation and (
                'code' not in local_var_params or  # noqa: E501
                local_var_params['code'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `code` when calling `delete_order`"
            )  # noqa: E501

        if self.api_client.client_side_validation and (
                'scope' in local_var_params and  # noqa: E501
                len(local_var_params['scope']) > 64):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `delete_order`, length must be less than or equal to `64`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'scope' in local_var_params and  # noqa: E501
                len(local_var_params['scope']) < 1):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `delete_order`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `scope` when calling `delete_order`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'code' in local_var_params and  # noqa: E501
                len(local_var_params['code']) > 64):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `delete_order`, length must be less than or equal to `64`"
            )  # noqa: E501
        if self.api_client.client_side_validation and (
                'code' in local_var_params and  # noqa: E501
                len(local_var_params['code']) < 1):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `delete_order`, length must be greater than or equal to `1`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(
                r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `code` when calling `delete_order`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'scope' in local_var_params:
            path_params['scope'] = local_var_params['scope']  # noqa: E501
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []

        header_params = dict(local_var_params.get('_headers', {}))

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.4385'

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

        response_types_map = {
            200: "DeletedEntityResponse",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/orders/{scope}/{code}',
            'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))
    def upsert_configuration_recipe_with_http_info(self, upsert_recipe_request, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] UpsertConfigurationRecipe: Upsert a Configuration Recipe. This creates or updates the data in Lusid.  # noqa: E501

        Update or insert one Configuration Recipe in a single scope. An item will be updated if it already exists  and inserted if it does not.                The response will return the successfully updated or inserted Configuration Recipe or failure message if unsuccessful                It is important to always check to verify success (or failure).  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.upsert_configuration_recipe_with_http_info(upsert_recipe_request, async_req=True)
        >>> result = thread.get()

        :param upsert_recipe_request: The Configuration Recipe to update or insert (required)
        :type upsert_recipe_request: UpsertRecipeRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: 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.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object, the HTTP status code, and the headers.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: (UpsertSingleStructuredDataResponse, int, HTTPHeaderDict)
        """

        local_var_params = locals()

        all_params = [
            'upsert_recipe_request'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method upsert_configuration_recipe" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'upsert_recipe_request' is set
        if self.api_client.client_side_validation and ('upsert_recipe_request' not in local_var_params or  # noqa: E501
                                                        local_var_params['upsert_recipe_request'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `upsert_recipe_request` when calling `upsert_configuration_recipe`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'upsert_recipe_request' in local_var_params:
            body_params = local_var_params['upsert_recipe_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.3906'

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501
        
        response_types_map = {
            200: "UpsertSingleStructuredDataResponse",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/recipes', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))