コード例 #1
0
    def get_user_with_http_info(self, **kwargs):  # noqa: E501
        """User info  # noqa: E501

        Returns authenticated user information  # 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_user_with_http_info(async_req=True)
        >>> result = thread.get()

        :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.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(UserResponse, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = []
        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_user" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        response_types_map = {
            200: "UserResponse",
        }

        return self.api_client.call_api(
            '/user',
            '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'))
コード例 #2
0
    def get_payee_by_id_with_http_info(self, budget_id, payee_id,
                                       **kwargs):  # noqa: E501
        """Single payee  # noqa: E501

        Returns a single payee  # 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_payee_by_id_with_http_info(budget_id, payee_id, async_req=True)
        >>> result = thread.get()

        :param budget_id: The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget). (required)
        :type budget_id: str
        :param payee_id: The id of the payee (required)
        :type payee_id: 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.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(PayeeResponse, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = ['budget_id', 'payee_id']
        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_payee_by_id" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'budget_id' is set
        if self.api_client.client_side_validation and (
                'budget_id' not in local_var_params or  # noqa: E501
                local_var_params['budget_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `budget_id` when calling `get_payee_by_id`"
            )  # noqa: E501
        # verify the required parameter 'payee_id' is set
        if self.api_client.client_side_validation and (
                'payee_id' not in local_var_params or  # noqa: E501
                local_var_params['payee_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `payee_id` when calling `get_payee_by_id`"
            )  # noqa: E501

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        response_types_map = {
            200: "PayeeResponse",
            404: "ErrorResponse",
        }

        return self.api_client.call_api(
            '/budgets/{budget_id}/payees/{payee_id}',
            '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'))
コード例 #3
0
ファイル: categories_api.py プロジェクト: idwagner/pynab
    def update_month_category_with_http_info(self, budget_id, month,
                                             category_id, data,
                                             **kwargs):  # noqa: E501
        """Update a category for a specific month  # noqa: E501

        Update a category for a specific month.  Only `budgeted` amount can be updated.  # 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_month_category_with_http_info(budget_id, month, category_id, data, async_req=True)
        >>> result = thread.get()

        :param budget_id: The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget). (required)
        :type budget_id: str
        :param month: The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) (required)
        :type month: date
        :param category_id: The id of the category (required)
        :type category_id: str
        :param data: The category to update.  Only `budgeted` amount can be updated and any other fields specified will be ignored. (required)
        :type data: SaveMonthCategoryWrapper
        :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.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(SaveCategoryResponse, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = ['budget_id', 'month', 'category_id', 'data']
        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 update_month_category" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'budget_id' is set
        if self.api_client.client_side_validation and (
                'budget_id' not in local_var_params or  # noqa: E501
                local_var_params['budget_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `budget_id` when calling `update_month_category`"
            )  # noqa: E501
        # verify the required parameter 'month' is set
        if self.api_client.client_side_validation and (
                'month' not in local_var_params or  # noqa: E501
                local_var_params['month'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `month` when calling `update_month_category`"
            )  # noqa: E501
        # verify the required parameter 'category_id' is set
        if self.api_client.client_side_validation and (
                'category_id' not in local_var_params or  # noqa: E501
                local_var_params['category_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `category_id` when calling `update_month_category`"
            )  # noqa: E501
        # verify the required parameter 'data' is set
        if self.api_client.client_side_validation and (
                'data' not in local_var_params or  # noqa: E501
                local_var_params['data'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `data` when calling `update_month_category`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'budget_id' in local_var_params:
            path_params['budget_id'] = local_var_params[
                'budget_id']  # noqa: E501
        if 'month' in local_var_params:
            path_params['month'] = local_var_params['month']  # noqa: E501
        if 'category_id' in local_var_params:
            path_params['category_id'] = local_var_params[
                'category_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        response_types_map = {
            200: "SaveCategoryResponse",
            400: "ErrorResponse",
        }

        return self.api_client.call_api(
            '/budgets/{budget_id}/months/{month}/categories/{category_id}',
            'PATCH',
            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'))