|
21 | 21 |
|
22 | 22 |
|
23 | 23 | class BatchAPIApi(object): |
24 | | - """NOTE: This class is auto generated by the swagger code generator program. |
| 24 | +"""NOTE: This class is auto generated by the swagger code generator program. |
25 | 25 |
|
26 | | - Do not edit the class manually. |
27 | | - Ref: https://github.com/swagger-api/swagger-codegen |
| 26 | +Do not edit the class manually. |
| 27 | +Ref: https://github.com/swagger-api/swagger-codegen |
| 28 | +""" |
| 29 | + |
| 30 | +def __init__(self, api_client=None): |
| 31 | + if api_client is None: |
| 32 | + api_client = ApiClient() |
| 33 | + self.api_client = api_client |
| 34 | + |
| 35 | +def create_batch_request(self, body, **kwargs): # noqa: E501 |
| 36 | + """Submit parallel requests # noqa: E501 |
| 37 | +
|
| 38 | + Make multiple requests in parallel to Asana's API. # noqa: E501 |
| 39 | + This method makes a synchronous HTTP request by default. To make an |
| 40 | + asynchronous HTTP request, please pass async_req=True |
| 41 | + >>> thread = api.create_batch_request(body, async_req=True) |
| 42 | + >>> result = thread.get() |
| 43 | +
|
| 44 | + :param async_req bool |
| 45 | + :param BatchBody body: The requests to batch together via the Batch API. (required) |
| 46 | + :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. |
| 47 | + :return: BatchResponseArray |
| 48 | + If the method is called asynchronously, |
| 49 | + returns the request thread. |
| 50 | + """ |
| 51 | + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) |
| 52 | + if kwargs.get('async_req'): |
| 53 | + return self.create_batch_request_with_http_info(body, **kwargs) # noqa: E501 |
| 54 | + else: |
| 55 | + (data) = self.create_batch_request_with_http_info(body, **kwargs) # noqa: E501 |
| 56 | + return data |
| 57 | + |
| 58 | +def create_batch_request_with_http_info(self, body, **kwargs): # noqa: E501 |
| 59 | + """Submit parallel requests # noqa: E501 |
| 60 | +
|
| 61 | + Make multiple requests in parallel to Asana's API. # noqa: E501 |
| 62 | + This method makes a synchronous HTTP request by default. To make an |
| 63 | + asynchronous HTTP request, please pass async_req=True |
| 64 | + >>> thread = api.create_batch_request_with_http_info(body, async_req=True) |
| 65 | + >>> result = thread.get() |
| 66 | +
|
| 67 | + :param async_req bool |
| 68 | + :param BatchBody body: The requests to batch together via the Batch API. (required) |
| 69 | + :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. |
| 70 | + :return: BatchResponseArray |
| 71 | + If the method is called asynchronously, |
| 72 | + returns the request thread. |
28 | 73 | """ |
29 | 74 |
|
30 | | - def __init__(self, api_client=None): |
31 | | - if api_client is None: |
32 | | - api_client = ApiClient() |
33 | | - self.api_client = api_client |
34 | | - |
35 | | - def create_batch_request(self, body, **kwargs): # noqa: E501 |
36 | | - """Submit parallel requests # noqa: E501 |
37 | | -
|
38 | | - Make multiple requests in parallel to Asana's API. # noqa: E501 |
39 | | - This method makes a synchronous HTTP request by default. To make an |
40 | | - asynchronous HTTP request, please pass async_req=True |
41 | | - >>> thread = api.create_batch_request(body, async_req=True) |
42 | | - >>> result = thread.get() |
43 | | -
|
44 | | - :param async_req bool |
45 | | - :param BatchBody body: The requests to batch together via the Batch API. (required) |
46 | | - :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. |
47 | | - :return: BatchResponseArray |
48 | | - If the method is called asynchronously, |
49 | | - returns the request thread. |
50 | | - """ |
51 | | - kwargs['_return_http_data_only'] = True |
52 | | - if kwargs.get('async_req'): |
53 | | - return self.create_batch_request_with_http_info(body, **kwargs) # noqa: E501 |
54 | | - else: |
55 | | - (data) = self.create_batch_request_with_http_info(body, **kwargs) # noqa: E501 |
56 | | - return data |
57 | | - |
58 | | - def create_batch_request_with_http_info(self, body, **kwargs): # noqa: E501 |
59 | | - """Submit parallel requests # noqa: E501 |
60 | | -
|
61 | | - Make multiple requests in parallel to Asana's API. # noqa: E501 |
62 | | - This method makes a synchronous HTTP request by default. To make an |
63 | | - asynchronous HTTP request, please pass async_req=True |
64 | | - >>> thread = api.create_batch_request_with_http_info(body, async_req=True) |
65 | | - >>> result = thread.get() |
66 | | -
|
67 | | - :param async_req bool |
68 | | - :param BatchBody body: The requests to batch together via the Batch API. (required) |
69 | | - :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. |
70 | | - :return: BatchResponseArray |
71 | | - If the method is called asynchronously, |
72 | | - returns the request thread. |
73 | | - """ |
74 | | - |
75 | | - all_params = ['body', 'opt_fields'] # noqa: E501 |
76 | | - all_params.append('async_req') |
77 | | - all_params.append('_return_http_data_only') |
78 | | - all_params.append('_preload_content') |
79 | | - all_params.append('_request_timeout') |
80 | | - |
81 | | - params = locals() |
82 | | - for key, val in six.iteritems(params['kwargs']): |
83 | | - if key not in all_params: |
84 | | - raise TypeError( |
85 | | - "Got an unexpected keyword argument '%s'" |
86 | | - " to method create_batch_request" % key |
87 | | - ) |
88 | | - params[key] = val |
89 | | - del params['kwargs'] |
90 | | - # verify the required parameter 'body' is set |
91 | | - if ('body' not in params or |
92 | | - params['body'] is None): |
93 | | - raise ValueError("Missing the required parameter `body` when calling `create_batch_request`") # noqa: E501 |
94 | | - |
95 | | - collection_formats = {} |
96 | | - |
97 | | - path_params = {} |
98 | | - |
99 | | - query_params = [] |
100 | | - if 'opt_fields' in params: |
101 | | - query_params.append(('opt_fields', params['opt_fields'])) # noqa: E501 |
102 | | - collection_formats['opt_fields'] = 'csv' # noqa: E501 |
103 | | - |
104 | | - header_params = {} |
105 | | - |
106 | | - form_params = [] |
107 | | - local_var_files = {} |
108 | | - |
109 | | - body_params = None |
110 | | - if 'body' in params: |
111 | | - body_params = params['body'] |
112 | | - # HTTP header `Accept` |
113 | | - header_params['Accept'] = self.api_client.select_header_accept( |
114 | | - ['application/json; charset=UTF-8']) # noqa: E501 |
115 | | - |
116 | | - # HTTP header `Content-Type` |
117 | | - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 |
118 | | - ['application/json; charset=UTF-8']) # noqa: E501 |
119 | | - |
120 | | - # Authentication setting |
121 | | - auth_settings = ['oauth2'] # noqa: E501 |
122 | | - |
123 | | - return self.api_client.call_api( |
124 | | - '/batch', 'POST', |
125 | | - path_params, |
126 | | - query_params, |
127 | | - header_params, |
128 | | - body=body_params, |
129 | | - post_params=form_params, |
130 | | - files=local_var_files, |
131 | | - response_type='BatchResponseArray', # noqa: E501 |
132 | | - auth_settings=auth_settings, |
133 | | - async_req=params.get('async_req'), |
134 | | - _return_http_data_only=params.get('_return_http_data_only'), |
135 | | - _preload_content=params.get('_preload_content', True), |
136 | | - _request_timeout=params.get('_request_timeout'), |
137 | | - collection_formats=collection_formats) |
| 75 | + all_params = ['body', 'opt_fields'] # noqa: E501 |
| 76 | + all_params.append('async_req') |
| 77 | + all_params.append('header_params') |
| 78 | + all_params.append('_return_http_data_only') |
| 79 | + all_params.append('_preload_content') |
| 80 | + all_params.append('_request_timeout') |
| 81 | + |
| 82 | + params = locals() |
| 83 | + for key, val in six.iteritems(params['kwargs']): |
| 84 | + if key not in all_params: |
| 85 | + raise TypeError( |
| 86 | + "Got an unexpected keyword argument '%s'" |
| 87 | + " to method create_batch_request" % key |
| 88 | + ) |
| 89 | + params[key] = val |
| 90 | + del params['kwargs'] |
| 91 | + # verify the required parameter 'body' is set |
| 92 | + if ('body' not in params or |
| 93 | + params['body'] is None): |
| 94 | + raise ValueError("Missing the required parameter `body` when calling `create_batch_request`") # noqa: E501 |
| 95 | + |
| 96 | + collection_formats = {} |
| 97 | + |
| 98 | + path_params = {} |
| 99 | + |
| 100 | + query_params = [] |
| 101 | + if 'opt_fields' in params: |
| 102 | + query_params.append(('opt_fields', params['opt_fields'])) # noqa: E501 |
| 103 | + collection_formats['opt_fields'] = 'csv' # noqa: E501 |
| 104 | + |
| 105 | + header_params = kwargs.get("header_params", {}) |
| 106 | + |
| 107 | + form_params = [] |
| 108 | + local_var_files = {} |
| 109 | + |
| 110 | + body_params = None |
| 111 | + if 'body' in params: |
| 112 | + body_params = params['body'] |
| 113 | + # HTTP header `Accept` |
| 114 | + header_params['Accept'] = self.api_client.select_header_accept( |
| 115 | + ['application/json; charset=UTF-8']) # noqa: E501 |
| 116 | + |
| 117 | + # HTTP header `Content-Type` |
| 118 | + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 |
| 119 | + ['application/json; charset=UTF-8']) # noqa: E501 |
| 120 | + |
| 121 | + # Authentication setting |
| 122 | + auth_settings = ['oauth2'] # noqa: E501 |
| 123 | + |
| 124 | + return self.api_client.call_api( |
| 125 | + '/batch', 'POST', |
| 126 | + path_params, |
| 127 | + query_params, |
| 128 | + header_params, |
| 129 | + body=body_params, |
| 130 | + post_params=form_params, |
| 131 | + files=local_var_files, |
| 132 | + response_type='BatchResponseArray', # noqa: E501 |
| 133 | + auth_settings=auth_settings, |
| 134 | + async_req=params.get('async_req'), |
| 135 | + _return_http_data_only=params.get('_return_http_data_only'), |
| 136 | + _preload_content=params.get('_preload_content', True), |
| 137 | + _request_timeout=params.get('_request_timeout'), |
| 138 | + collection_formats=collection_formats) |
0 commit comments