# coding: utf-8

"""
    Asana

    This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_oas.yaml).  # noqa: E501

    OpenAPI spec version: 1.0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from asana.api_client import ApiClient


class GoalsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.

Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""

def __init__(self, api_client=None):
    if api_client is None:
        api_client = ApiClient()
    self.api_client = api_client

def add_followers(self, body, goal_gid, **kwargs):  # noqa: E501
    """Add a collaborator to a goal  # noqa: E501

    Adds followers to a goal. Returns the goal the followers were added to. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above.  # noqa: E501
    This method makes a synchronous HTTP request by default. To make an
    asynchronous HTTP request, please pass async_req=True
    >>> thread = api.add_followers(body, goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalGidAddFollowersBody body: The followers to be added as collaborators (required)
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """
    kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
    if kwargs.get('async_req'):
        return self.add_followers_with_http_info(body, goal_gid, **kwargs)  # noqa: E501
    else:
        (data) = self.add_followers_with_http_info(body, goal_gid, **kwargs)  # noqa: E501
        return data

def add_followers_with_http_info(self, body, goal_gid, **kwargs):  # noqa: E501
    """Add a collaborator to a goal  # noqa: E501

    Adds followers to a goal. Returns the goal the followers were added to. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above.  # noqa: E501
    This method makes a synchronous HTTP request by default. To make an
    asynchronous HTTP request, please pass async_req=True
    >>> thread = api.add_followers_with_http_info(body, goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalGidAddFollowersBody body: The followers to be added as collaborators (required)
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """

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

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

    collection_formats = {}

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

    query_params = []
    if 'opt_fields' in params:
        query_params.append(('opt_fields', params['opt_fields']))  # noqa: E501
        collection_formats['opt_fields'] = 'csv'  # noqa: E501

    header_params = kwargs.get("header_params", {})

    form_params = []
    local_var_files = {}

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

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

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

    return self.api_client.call_api(
        '/goals/{goal_gid}/addFollowers', 'POST',
        path_params,
        query_params,
        header_params,
        body=body_params,
        post_params=form_params,
        files=local_var_files,
        response_type='GoalResponseData',  # noqa: E501
        auth_settings=auth_settings,
        async_req=params.get('async_req'),
        _return_http_data_only=params.get('_return_http_data_only'),
        _preload_content=params.get('_preload_content', True),
        _request_timeout=params.get('_request_timeout'),
        collection_formats=collection_formats)

def create_goal(self, body, **kwargs):  # noqa: E501
    """Create a goal  # noqa: E501

    Creates a new goal in a workspace or team.  Returns the full record of the newly created goal.  # 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_goal(body, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalsBody body: The goal to create. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """
    kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
    if kwargs.get('async_req'):
        return self.create_goal_with_http_info(body, **kwargs)  # noqa: E501
    else:
        (data) = self.create_goal_with_http_info(body, **kwargs)  # noqa: E501
        return data

def create_goal_with_http_info(self, body, **kwargs):  # noqa: E501
    """Create a goal  # noqa: E501

    Creates a new goal in a workspace or team.  Returns the full record of the newly created goal.  # 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_goal_with_http_info(body, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalsBody body: The goal to create. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """

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

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

    collection_formats = {}

    path_params = {}

    query_params = []
    if 'opt_fields' in params:
        query_params.append(('opt_fields', params['opt_fields']))  # noqa: E501
        collection_formats['opt_fields'] = 'csv'  # noqa: E501

    header_params = kwargs.get("header_params", {})

    form_params = []
    local_var_files = {}

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

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

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

    return self.api_client.call_api(
        '/goals', 'POST',
        path_params,
        query_params,
        header_params,
        body=body_params,
        post_params=form_params,
        files=local_var_files,
        response_type='GoalResponseData',  # noqa: E501
        auth_settings=auth_settings,
        async_req=params.get('async_req'),
        _return_http_data_only=params.get('_return_http_data_only'),
        _preload_content=params.get('_preload_content', True),
        _request_timeout=params.get('_request_timeout'),
        collection_formats=collection_formats)

def create_goal_metric(self, body, goal_gid, **kwargs):  # noqa: E501
    """Create a goal metric  # noqa: E501

    Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists.  # 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_goal_metric(body, goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalGidSetMetricBody body: The goal metric to create. (required)
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """
    kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
    if kwargs.get('async_req'):
        return self.create_goal_metric_with_http_info(body, goal_gid, **kwargs)  # noqa: E501
    else:
        (data) = self.create_goal_metric_with_http_info(body, goal_gid, **kwargs)  # noqa: E501
        return data

def create_goal_metric_with_http_info(self, body, goal_gid, **kwargs):  # noqa: E501
    """Create a goal metric  # noqa: E501

    Creates and adds a goal metric to a specified goal. Note that this replaces an existing goal metric if one already exists.  # 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_goal_metric_with_http_info(body, goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalGidSetMetricBody body: The goal metric to create. (required)
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """

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

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

    collection_formats = {}

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

    query_params = []
    if 'opt_fields' in params:
        query_params.append(('opt_fields', params['opt_fields']))  # noqa: E501
        collection_formats['opt_fields'] = 'csv'  # noqa: E501

    header_params = kwargs.get("header_params", {})

    form_params = []
    local_var_files = {}

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

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

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

    return self.api_client.call_api(
        '/goals/{goal_gid}/setMetric', 'POST',
        path_params,
        query_params,
        header_params,
        body=body_params,
        post_params=form_params,
        files=local_var_files,
        response_type='GoalResponseData',  # noqa: E501
        auth_settings=auth_settings,
        async_req=params.get('async_req'),
        _return_http_data_only=params.get('_return_http_data_only'),
        _preload_content=params.get('_preload_content', True),
        _request_timeout=params.get('_request_timeout'),
        collection_formats=collection_formats)

def delete_goal(self, goal_gid, **kwargs):  # noqa: E501
    """Delete a goal  # noqa: E501

    A specific, existing goal can be deleted by making a DELETE request on the URL for that goal.  Returns an empty data record.  # 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_goal(goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :return: EmptyResponseData
                If the method is called asynchronously,
                returns the request thread.
    """
    kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
    if kwargs.get('async_req'):
        return self.delete_goal_with_http_info(goal_gid, **kwargs)  # noqa: E501
    else:
        (data) = self.delete_goal_with_http_info(goal_gid, **kwargs)  # noqa: E501
        return data

def delete_goal_with_http_info(self, goal_gid, **kwargs):  # noqa: E501
    """Delete a goal  # noqa: E501

    A specific, existing goal can be deleted by making a DELETE request on the URL for that goal.  Returns an empty data record.  # 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_goal_with_http_info(goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :return: EmptyResponseData
                If the method is called asynchronously,
                returns the request thread.
    """

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

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

    collection_formats = {}

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

    query_params = []

    header_params = kwargs.get("header_params", {})

    form_params = []
    local_var_files = {}

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

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

    return self.api_client.call_api(
        '/goals/{goal_gid}', 'DELETE',
        path_params,
        query_params,
        header_params,
        body=body_params,
        post_params=form_params,
        files=local_var_files,
        response_type='EmptyResponseData',  # noqa: E501
        auth_settings=auth_settings,
        async_req=params.get('async_req'),
        _return_http_data_only=params.get('_return_http_data_only'),
        _preload_content=params.get('_preload_content', True),
        _request_timeout=params.get('_request_timeout'),
        collection_formats=collection_formats)

def get_goal(self, goal_gid, **kwargs):  # noqa: E501
    """Get a goal  # noqa: E501

    Returns the complete goal record for a single goal.  # 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_goal(goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """
    kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
    if kwargs.get('async_req'):
        return self.get_goal_with_http_info(goal_gid, **kwargs)  # noqa: E501
    else:
        (data) = self.get_goal_with_http_info(goal_gid, **kwargs)  # noqa: E501
        return data

def get_goal_with_http_info(self, goal_gid, **kwargs):  # noqa: E501
    """Get a goal  # noqa: E501

    Returns the complete goal record for a single goal.  # 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_goal_with_http_info(goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """

    all_params = ['goal_gid', 'opt_fields']  # noqa: E501
    all_params.append('async_req')
    all_params.append('header_params')
    all_params.append('_return_http_data_only')
    all_params.append('_preload_content')
    all_params.append('_request_timeout')

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

    collection_formats = {}

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

    query_params = []
    if 'opt_fields' in params:
        query_params.append(('opt_fields', params['opt_fields']))  # noqa: E501
        collection_formats['opt_fields'] = 'csv'  # noqa: E501

    header_params = kwargs.get("header_params", {})

    form_params = []
    local_var_files = {}

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

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

    return self.api_client.call_api(
        '/goals/{goal_gid}', 'GET',
        path_params,
        query_params,
        header_params,
        body=body_params,
        post_params=form_params,
        files=local_var_files,
        response_type='GoalResponseData',  # noqa: E501
        auth_settings=auth_settings,
        async_req=params.get('async_req'),
        _return_http_data_only=params.get('_return_http_data_only'),
        _preload_content=params.get('_preload_content', True),
        _request_timeout=params.get('_request_timeout'),
        collection_formats=collection_formats)

def get_goals(self, **kwargs):  # noqa: E501
    """Get goals  # noqa: E501

    Returns compact goal records.  # 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_goals(async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param str portfolio: Globally unique identifier for supporting portfolio.
    :param str project: Globally unique identifier for supporting project.
    :param bool is_workspace_level: Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter.
    :param str team: Globally unique identifier for the team.
    :param str workspace: Globally unique identifier for the workspace.
    :param list[str] time_periods: Globally unique identifiers for the time periods.
    :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
    :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseArray
                If the method is called asynchronously,
                returns the request thread.
    """
    kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
    if kwargs.get('async_req'):
        return self.get_goals_with_http_info(**kwargs)  # noqa: E501
    else:
        (data) = self.get_goals_with_http_info(**kwargs)  # noqa: E501
        return data

def get_goals_with_http_info(self, **kwargs):  # noqa: E501
    """Get goals  # noqa: E501

    Returns compact goal records.  # 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_goals_with_http_info(async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param str portfolio: Globally unique identifier for supporting portfolio.
    :param str project: Globally unique identifier for supporting project.
    :param bool is_workspace_level: Filter to goals with is_workspace_level set to query value. Must be used with the workspace parameter.
    :param str team: Globally unique identifier for the team.
    :param str workspace: Globally unique identifier for the workspace.
    :param list[str] time_periods: Globally unique identifiers for the time periods.
    :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100.
    :param str offset: Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. 'Note: You can only pass in an offset that was returned to you via a previously paginated request.'
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseArray
                If the method is called asynchronously,
                returns the request thread.
    """

    all_params = ['portfolio', 'project', 'is_workspace_level', 'team', 'workspace', 'time_periods', 'limit', 'offset', 'opt_fields']  # noqa: E501
    all_params.append('async_req')
    all_params.append('header_params')
    all_params.append('_return_http_data_only')
    all_params.append('_preload_content')
    all_params.append('_request_timeout')

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

    collection_formats = {}

    path_params = {}

    query_params = []
    if 'portfolio' in params:
        query_params.append(('portfolio', params['portfolio']))  # noqa: E501
    if 'project' in params:
        query_params.append(('project', params['project']))  # noqa: E501
    if 'is_workspace_level' in params:
        query_params.append(('is_workspace_level', params['is_workspace_level']))  # noqa: E501
    if 'team' in params:
        query_params.append(('team', params['team']))  # noqa: E501
    if 'workspace' in params:
        query_params.append(('workspace', params['workspace']))  # noqa: E501
    if 'time_periods' in params:
        query_params.append(('time_periods', params['time_periods']))  # noqa: E501
        collection_formats['time_periods'] = 'multi'  # noqa: E501
    if 'limit' in params:
        query_params.append(('limit', params['limit']))  # noqa: E501
    if 'offset' in params:
        query_params.append(('offset', params['offset']))  # noqa: E501
    if 'opt_fields' in params:
        query_params.append(('opt_fields', params['opt_fields']))  # noqa: E501
        collection_formats['opt_fields'] = 'csv'  # noqa: E501

    header_params = kwargs.get("header_params", {})

    form_params = []
    local_var_files = {}

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

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

    return self.api_client.call_api(
        '/goals', 'GET',
        path_params,
        query_params,
        header_params,
        body=body_params,
        post_params=form_params,
        files=local_var_files,
        response_type='GoalResponseArray',  # noqa: E501
        auth_settings=auth_settings,
        async_req=params.get('async_req'),
        _return_http_data_only=params.get('_return_http_data_only'),
        _preload_content=params.get('_preload_content', True),
        _request_timeout=params.get('_request_timeout'),
        collection_formats=collection_formats)

def get_parent_goals_for_goal(self, goal_gid, **kwargs):  # noqa: E501
    """Get parent goals from a goal  # noqa: E501

    Returns a compact representation of all of the parent goals of a goal.  # 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_parent_goals_for_goal(goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseArray
                If the method is called asynchronously,
                returns the request thread.
    """
    kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
    if kwargs.get('async_req'):
        return self.get_parent_goals_for_goal_with_http_info(goal_gid, **kwargs)  # noqa: E501
    else:
        (data) = self.get_parent_goals_for_goal_with_http_info(goal_gid, **kwargs)  # noqa: E501
        return data

def get_parent_goals_for_goal_with_http_info(self, goal_gid, **kwargs):  # noqa: E501
    """Get parent goals from a goal  # noqa: E501

    Returns a compact representation of all of the parent goals of a goal.  # 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_parent_goals_for_goal_with_http_info(goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseArray
                If the method is called asynchronously,
                returns the request thread.
    """

    all_params = ['goal_gid', 'opt_fields']  # noqa: E501
    all_params.append('async_req')
    all_params.append('header_params')
    all_params.append('_return_http_data_only')
    all_params.append('_preload_content')
    all_params.append('_request_timeout')

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

    collection_formats = {}

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

    query_params = []
    if 'opt_fields' in params:
        query_params.append(('opt_fields', params['opt_fields']))  # noqa: E501
        collection_formats['opt_fields'] = 'csv'  # noqa: E501

    header_params = kwargs.get("header_params", {})

    form_params = []
    local_var_files = {}

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

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

    return self.api_client.call_api(
        '/goals/{goal_gid}/parentGoals', 'GET',
        path_params,
        query_params,
        header_params,
        body=body_params,
        post_params=form_params,
        files=local_var_files,
        response_type='GoalResponseArray',  # noqa: E501
        auth_settings=auth_settings,
        async_req=params.get('async_req'),
        _return_http_data_only=params.get('_return_http_data_only'),
        _preload_content=params.get('_preload_content', True),
        _request_timeout=params.get('_request_timeout'),
        collection_formats=collection_formats)

def remove_followers(self, body, goal_gid, **kwargs):  # noqa: E501
    """Remove a collaborator from a goal  # noqa: E501

    Removes followers from a goal. Returns the goal the followers were removed from. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above.  # noqa: E501
    This method makes a synchronous HTTP request by default. To make an
    asynchronous HTTP request, please pass async_req=True
    >>> thread = api.remove_followers(body, goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalGidRemoveFollowersBody body: The followers to be removed as collaborators (required)
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """
    kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
    if kwargs.get('async_req'):
        return self.remove_followers_with_http_info(body, goal_gid, **kwargs)  # noqa: E501
    else:
        (data) = self.remove_followers_with_http_info(body, goal_gid, **kwargs)  # noqa: E501
        return data

def remove_followers_with_http_info(self, body, goal_gid, **kwargs):  # noqa: E501
    """Remove a collaborator from a goal  # noqa: E501

    Removes followers from a goal. Returns the goal the followers were removed from. Each goal can be associated with zero or more followers in the system. Requests to add/remove followers, if successful, will return the complete updated goal record, described above.  # noqa: E501
    This method makes a synchronous HTTP request by default. To make an
    asynchronous HTTP request, please pass async_req=True
    >>> thread = api.remove_followers_with_http_info(body, goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalGidRemoveFollowersBody body: The followers to be removed as collaborators (required)
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """

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

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

    collection_formats = {}

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

    query_params = []
    if 'opt_fields' in params:
        query_params.append(('opt_fields', params['opt_fields']))  # noqa: E501
        collection_formats['opt_fields'] = 'csv'  # noqa: E501

    header_params = kwargs.get("header_params", {})

    form_params = []
    local_var_files = {}

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

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

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

    return self.api_client.call_api(
        '/goals/{goal_gid}/removeFollowers', 'POST',
        path_params,
        query_params,
        header_params,
        body=body_params,
        post_params=form_params,
        files=local_var_files,
        response_type='GoalResponseData',  # noqa: E501
        auth_settings=auth_settings,
        async_req=params.get('async_req'),
        _return_http_data_only=params.get('_return_http_data_only'),
        _preload_content=params.get('_preload_content', True),
        _request_timeout=params.get('_request_timeout'),
        collection_formats=collection_formats)

def update_goal(self, body, goal_gid, **kwargs):  # noqa: E501
    """Update a goal  # noqa: E501

    An existing goal can be updated by making a PUT request on the URL for that goal. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged.  Returns the complete updated goal record.  # 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_goal(body, goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalsGoalGidBody body: The updated fields for the goal. (required)
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """
    kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
    if kwargs.get('async_req'):
        return self.update_goal_with_http_info(body, goal_gid, **kwargs)  # noqa: E501
    else:
        (data) = self.update_goal_with_http_info(body, goal_gid, **kwargs)  # noqa: E501
        return data

def update_goal_with_http_info(self, body, goal_gid, **kwargs):  # noqa: E501
    """Update a goal  # noqa: E501

    An existing goal can be updated by making a PUT request on the URL for that goal. Only the fields provided in the `data` block will be updated; any unspecified fields will remain unchanged.  Returns the complete updated goal record.  # 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_goal_with_http_info(body, goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalsGoalGidBody body: The updated fields for the goal. (required)
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """

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

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

    collection_formats = {}

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

    query_params = []
    if 'opt_fields' in params:
        query_params.append(('opt_fields', params['opt_fields']))  # noqa: E501
        collection_formats['opt_fields'] = 'csv'  # noqa: E501

    header_params = kwargs.get("header_params", {})

    form_params = []
    local_var_files = {}

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

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

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

    return self.api_client.call_api(
        '/goals/{goal_gid}', 'PUT',
        path_params,
        query_params,
        header_params,
        body=body_params,
        post_params=form_params,
        files=local_var_files,
        response_type='GoalResponseData',  # noqa: E501
        auth_settings=auth_settings,
        async_req=params.get('async_req'),
        _return_http_data_only=params.get('_return_http_data_only'),
        _preload_content=params.get('_preload_content', True),
        _request_timeout=params.get('_request_timeout'),
        collection_formats=collection_formats)

def update_goal_metric(self, body, goal_gid, **kwargs):  # noqa: E501
    """Update a goal metric  # noqa: E501

    Updates a goal's existing metric's `current_number_value` if one exists, otherwise responds with a 400 status code.  Returns the complete updated goal metric record.  # 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_goal_metric(body, goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalGidSetMetricCurrentValueBody body: The updated fields for the goal metric. (required)
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """
    kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
    if kwargs.get('async_req'):
        return self.update_goal_metric_with_http_info(body, goal_gid, **kwargs)  # noqa: E501
    else:
        (data) = self.update_goal_metric_with_http_info(body, goal_gid, **kwargs)  # noqa: E501
        return data

def update_goal_metric_with_http_info(self, body, goal_gid, **kwargs):  # noqa: E501
    """Update a goal metric  # noqa: E501

    Updates a goal's existing metric's `current_number_value` if one exists, otherwise responds with a 400 status code.  Returns the complete updated goal metric record.  # 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_goal_metric_with_http_info(body, goal_gid, async_req=True)
    >>> result = thread.get()

    :param async_req bool
    :param GoalGidSetMetricCurrentValueBody body: The updated fields for the goal metric. (required)
    :param str goal_gid: Globally unique identifier for the goal. (required)
    :param list[str] opt_fields: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
    :return: GoalResponseData
                If the method is called asynchronously,
                returns the request thread.
    """

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

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

    collection_formats = {}

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

    query_params = []
    if 'opt_fields' in params:
        query_params.append(('opt_fields', params['opt_fields']))  # noqa: E501
        collection_formats['opt_fields'] = 'csv'  # noqa: E501

    header_params = kwargs.get("header_params", {})

    form_params = []
    local_var_files = {}

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

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

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

    return self.api_client.call_api(
        '/goals/{goal_gid}/setMetricCurrentValue', 'POST',
        path_params,
        query_params,
        header_params,
        body=body_params,
        post_params=form_params,
        files=local_var_files,
        response_type='GoalResponseData',  # noqa: E501
        auth_settings=auth_settings,
        async_req=params.get('async_req'),
        _return_http_data_only=params.get('_return_http_data_only'),
        _preload_content=params.get('_preload_content', True),
        _request_timeout=params.get('_request_timeout'),
        collection_formats=collection_formats)
