Skip to content

Commit

Permalink
Updated Python SDK: v5.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
asana-publish-client-libraries[bot] committed Mar 25, 2024
1 parent f66170e commit eb1d034
Show file tree
Hide file tree
Showing 17 changed files with 1,670 additions and 248 deletions.
380 changes: 193 additions & 187 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions asana/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from __future__ import absolute_import

# import apis into sdk package
from asana.api.allocations_api import AllocationsApi
from asana.api.attachments_api import AttachmentsApi
from asana.api.audit_log_api_api import AuditLogAPIApi
from asana.api.batch_api_api import BatchAPIApi
Expand Down
1 change: 1 addition & 0 deletions asana/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# flake8: noqa

# import apis into api package
from asana.api.allocations_api import AllocationsApi
from asana.api.attachments_api import AttachmentsApi
from asana.api.audit_log_api_api import AuditLogAPIApi
from asana.api.batch_api_api import BatchAPIApi
Expand Down
744 changes: 744 additions & 0 deletions asana/api/allocations_api.py

Large diffs are not rendered by default.

190 changes: 166 additions & 24 deletions asana/api/memberships_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def create_membership(self, opts, **kwargs): # noqa: E501
:param async_req bool
:param dict body: The updated fields for the membership.
:return: MembershipResponseArray
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
Expand All @@ -65,7 +65,7 @@ def create_membership_with_http_info(self, opts, **kwargs): # noqa: E501
:param async_req bool
:param dict body: The updated fields for the membership.
:return: MembershipResponseArray
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
Expand Down Expand Up @@ -133,28 +133,25 @@ def create_membership_with_http_info(self, opts, **kwargs): # noqa: E501
collection_formats=collection_formats
)
elif self.api_client.configuration.return_page_iterator:
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
return PageIterator(
self.api_client,
{
"resource_path": '/memberships',
"method": 'POST',
"path_params": path_params,
"query_params": query_params,
"header_params": header_params,
"body": body_params,
"post_params": form_params,
"files": local_var_files,
"response_type": object,
"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
},
**kwargs
).items()
(data) = self.api_client.call_api(
'/memberships', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # 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
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/memberships', 'POST',
Expand Down Expand Up @@ -590,3 +587,148 @@ def get_memberships_with_http_info(self, opts, **kwargs): # noqa: E501
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

def update_membership(self, body, membership_gid, **kwargs): # noqa: E501
"""Update a membership # noqa: E501
An existing membership 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. Memberships on `goals` and `projects` can be updated. Returns the full record of the updated membership. # 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_membership(body, membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The membership to update. (required)
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: MembershipResponseData
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_membership_with_http_info(body, membership_gid, **kwargs) # noqa: E501
else:
(data) = self.update_membership_with_http_info(body, membership_gid, **kwargs) # noqa: E501
return data

def update_membership_with_http_info(self, body, membership_gid, **kwargs): # noqa: E501
"""Update a membership # noqa: E501
An existing membership 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. Memberships on `goals` and `projects` can be updated. Returns the full record of the updated membership. # 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_membership_with_http_info(body, membership_gid, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict body: The membership to update. (required)
:param str membership_gid: Globally unique identifier for the membership. (required)
:return: MembershipResponseData
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
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')
all_params.append('full_payload')
all_params.append('item_limit')

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_membership" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if (body is None):
raise ValueError("Missing the required parameter `body` when calling `update_membership`") # noqa: E501
# verify the required parameter 'membership_gid' is set
if (membership_gid is None):
raise ValueError("Missing the required parameter `membership_gid` when calling `update_membership`") # noqa: E501

collection_formats = {}

path_params = {}
path_params['membership_gid'] = membership_gid # noqa: E501

query_params = {}


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

form_params = []
local_var_files = {}

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

# hard checking for True boolean value because user can provide full_payload or async_req with any data type
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
return self.api_client.call_api(
'/memberships/{membership_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # 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
)
elif self.api_client.configuration.return_page_iterator:
(data) = self.api_client.call_api(
'/memberships/{membership_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # 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
)
if params.get('_return_http_data_only') == False:
return data
return data["data"] if data else data
else:
return self.api_client.call_api(
'/memberships/{membership_gid}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=object, # 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)
4 changes: 2 additions & 2 deletions asana/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'Swagger-Codegen/5.0.5/python'
self.user_agent = 'Swagger-Codegen/5.0.6/python'
# Add custom header
self.default_headers['X-Asana-Client-Lib'] = urlencode(
{
'language': 'Python',
'version': '5.0.5',
'version': '5.0.6',
'language_version': platform.python_version(),
'os': platform.system(),
'os_version': platform.release()
Expand Down
2 changes: 1 addition & 1 deletion asana/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,5 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 1.0\n"\
"SDK Package Version: 5.0.5".\
"SDK Package Version: 5.0.6".\
format(env=sys.platform, pyversion=sys.version)
Loading

0 comments on commit eb1d034

Please sign in to comment.