Skip to content

Commit eb1d034

Browse files
Updated Python SDK: v5.0.6
1 parent f66170e commit eb1d034

17 files changed

+1670
-248
lines changed

README.md

Lines changed: 193 additions & 187 deletions
Large diffs are not rendered by default.

asana/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from __future__ import absolute_import
1616

1717
# import apis into sdk package
18+
from asana.api.allocations_api import AllocationsApi
1819
from asana.api.attachments_api import AttachmentsApi
1920
from asana.api.audit_log_api_api import AuditLogAPIApi
2021
from asana.api.batch_api_api import BatchAPIApi

asana/api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# flake8: noqa
44

55
# import apis into api package
6+
from asana.api.allocations_api import AllocationsApi
67
from asana.api.attachments_api import AttachmentsApi
78
from asana.api.audit_log_api_api import AuditLogAPIApi
89
from asana.api.batch_api_api import BatchAPIApi

asana/api/allocations_api.py

Lines changed: 744 additions & 0 deletions
Large diffs are not rendered by default.

asana/api/memberships_api.py

Lines changed: 166 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def create_membership(self, opts, **kwargs): # noqa: E501
4343
4444
:param async_req bool
4545
:param dict body: The updated fields for the membership.
46-
:return: MembershipResponseArray
46+
:return: MembershipResponseData
4747
If the method is called asynchronously,
4848
returns the request thread.
4949
"""
@@ -65,7 +65,7 @@ def create_membership_with_http_info(self, opts, **kwargs): # noqa: E501
6565
6666
:param async_req bool
6767
:param dict body: The updated fields for the membership.
68-
:return: MembershipResponseArray
68+
:return: MembershipResponseData
6969
If the method is called asynchronously,
7070
returns the request thread.
7171
"""
@@ -133,28 +133,25 @@ def create_membership_with_http_info(self, opts, **kwargs): # noqa: E501
133133
collection_formats=collection_formats
134134
)
135135
elif self.api_client.configuration.return_page_iterator:
136-
query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit)
137-
return PageIterator(
138-
self.api_client,
139-
{
140-
"resource_path": '/memberships',
141-
"method": 'POST',
142-
"path_params": path_params,
143-
"query_params": query_params,
144-
"header_params": header_params,
145-
"body": body_params,
146-
"post_params": form_params,
147-
"files": local_var_files,
148-
"response_type": object,
149-
"auth_settings": auth_settings,
150-
"async_req": params.get('async_req'),
151-
"_return_http_data_only": params.get('_return_http_data_only'),
152-
"_preload_content": params.get('_preload_content', True),
153-
"_request_timeout": params.get('_request_timeout'),
154-
"collection_formats": collection_formats
155-
},
156-
**kwargs
157-
).items()
136+
(data) = self.api_client.call_api(
137+
'/memberships', 'POST',
138+
path_params,
139+
query_params,
140+
header_params,
141+
body=body_params,
142+
post_params=form_params,
143+
files=local_var_files,
144+
response_type=object, # noqa: E501
145+
auth_settings=auth_settings,
146+
async_req=params.get('async_req'),
147+
_return_http_data_only=params.get('_return_http_data_only'),
148+
_preload_content=params.get('_preload_content', True),
149+
_request_timeout=params.get('_request_timeout'),
150+
collection_formats=collection_formats
151+
)
152+
if params.get('_return_http_data_only') == False:
153+
return data
154+
return data["data"] if data else data
158155
else:
159156
return self.api_client.call_api(
160157
'/memberships', 'POST',
@@ -590,3 +587,148 @@ def get_memberships_with_http_info(self, opts, **kwargs): # noqa: E501
590587
_preload_content=params.get('_preload_content', True),
591588
_request_timeout=params.get('_request_timeout'),
592589
collection_formats=collection_formats)
590+
591+
def update_membership(self, body, membership_gid, **kwargs): # noqa: E501
592+
"""Update a membership # noqa: E501
593+
594+
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
595+
This method makes a synchronous HTTP request by default. To make an
596+
asynchronous HTTP request, please pass async_req=True
597+
>>> thread = api.update_membership(body, membership_gid, async_req=True)
598+
>>> result = thread.get()
599+
600+
:param async_req bool
601+
:param dict body: The membership to update. (required)
602+
:param str membership_gid: Globally unique identifier for the membership. (required)
603+
:return: MembershipResponseData
604+
If the method is called asynchronously,
605+
returns the request thread.
606+
"""
607+
kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True)
608+
if kwargs.get('async_req'):
609+
return self.update_membership_with_http_info(body, membership_gid, **kwargs) # noqa: E501
610+
else:
611+
(data) = self.update_membership_with_http_info(body, membership_gid, **kwargs) # noqa: E501
612+
return data
613+
614+
def update_membership_with_http_info(self, body, membership_gid, **kwargs): # noqa: E501
615+
"""Update a membership # noqa: E501
616+
617+
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
618+
This method makes a synchronous HTTP request by default. To make an
619+
asynchronous HTTP request, please pass async_req=True
620+
>>> thread = api.update_membership_with_http_info(body, membership_gid, async_req=True)
621+
>>> result = thread.get()
622+
623+
:param async_req bool
624+
:param dict body: The membership to update. (required)
625+
:param str membership_gid: Globally unique identifier for the membership. (required)
626+
:return: MembershipResponseData
627+
If the method is called asynchronously,
628+
returns the request thread.
629+
"""
630+
all_params = []
631+
all_params.append('async_req')
632+
all_params.append('header_params')
633+
all_params.append('_return_http_data_only')
634+
all_params.append('_preload_content')
635+
all_params.append('_request_timeout')
636+
all_params.append('full_payload')
637+
all_params.append('item_limit')
638+
639+
params = locals()
640+
for key, val in six.iteritems(params['kwargs']):
641+
if key not in all_params:
642+
raise TypeError(
643+
"Got an unexpected keyword argument '%s'"
644+
" to method update_membership" % key
645+
)
646+
params[key] = val
647+
del params['kwargs']
648+
# verify the required parameter 'body' is set
649+
if (body is None):
650+
raise ValueError("Missing the required parameter `body` when calling `update_membership`") # noqa: E501
651+
# verify the required parameter 'membership_gid' is set
652+
if (membership_gid is None):
653+
raise ValueError("Missing the required parameter `membership_gid` when calling `update_membership`") # noqa: E501
654+
655+
collection_formats = {}
656+
657+
path_params = {}
658+
path_params['membership_gid'] = membership_gid # noqa: E501
659+
660+
query_params = {}
661+
662+
663+
header_params = kwargs.get("header_params", {})
664+
665+
form_params = []
666+
local_var_files = {}
667+
668+
body_params = body
669+
670+
# HTTP header `Accept`
671+
header_params['Accept'] = self.api_client.select_header_accept(
672+
['application/json; charset=UTF-8']) # noqa: E501
673+
674+
# HTTP header `Content-Type`
675+
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
676+
['application/json; charset=UTF-8']) # noqa: E501
677+
678+
# Authentication setting
679+
auth_settings = ['personalAccessToken'] # noqa: E501
680+
681+
# hard checking for True boolean value because user can provide full_payload or async_req with any data type
682+
if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True:
683+
return self.api_client.call_api(
684+
'/memberships/{membership_gid}', 'PUT',
685+
path_params,
686+
query_params,
687+
header_params,
688+
body=body_params,
689+
post_params=form_params,
690+
files=local_var_files,
691+
response_type=object, # noqa: E501
692+
auth_settings=auth_settings,
693+
async_req=params.get('async_req'),
694+
_return_http_data_only=params.get('_return_http_data_only'),
695+
_preload_content=params.get('_preload_content', True),
696+
_request_timeout=params.get('_request_timeout'),
697+
collection_formats=collection_formats
698+
)
699+
elif self.api_client.configuration.return_page_iterator:
700+
(data) = self.api_client.call_api(
701+
'/memberships/{membership_gid}', 'PUT',
702+
path_params,
703+
query_params,
704+
header_params,
705+
body=body_params,
706+
post_params=form_params,
707+
files=local_var_files,
708+
response_type=object, # noqa: E501
709+
auth_settings=auth_settings,
710+
async_req=params.get('async_req'),
711+
_return_http_data_only=params.get('_return_http_data_only'),
712+
_preload_content=params.get('_preload_content', True),
713+
_request_timeout=params.get('_request_timeout'),
714+
collection_formats=collection_formats
715+
)
716+
if params.get('_return_http_data_only') == False:
717+
return data
718+
return data["data"] if data else data
719+
else:
720+
return self.api_client.call_api(
721+
'/memberships/{membership_gid}', 'PUT',
722+
path_params,
723+
query_params,
724+
header_params,
725+
body=body_params,
726+
post_params=form_params,
727+
files=local_var_files,
728+
response_type=object, # noqa: E501
729+
auth_settings=auth_settings,
730+
async_req=params.get('async_req'),
731+
_return_http_data_only=params.get('_return_http_data_only'),
732+
_preload_content=params.get('_preload_content', True),
733+
_request_timeout=params.get('_request_timeout'),
734+
collection_formats=collection_formats)

asana/api_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
7878
self.default_headers[header_name] = header_value
7979
self.cookie = cookie
8080
# Set default User-Agent.
81-
self.user_agent = 'Swagger-Codegen/5.0.5/python'
81+
self.user_agent = 'Swagger-Codegen/5.0.6/python'
8282
# Add custom header
8383
self.default_headers['X-Asana-Client-Lib'] = urlencode(
8484
{
8585
'language': 'Python',
86-
'version': '5.0.5',
86+
'version': '5.0.6',
8787
'language_version': platform.python_version(),
8888
'os': platform.system(),
8989
'os_version': platform.release()

asana/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,5 +258,5 @@ def to_debug_report(self):
258258
"OS: {env}\n"\
259259
"Python Version: {pyversion}\n"\
260260
"Version of the API: 1.0\n"\
261-
"SDK Package Version: 5.0.5".\
261+
"SDK Package Version: 5.0.6".\
262262
format(env=sys.platform, pyversion=sys.version)

0 commit comments

Comments
 (0)