|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + Asana |
| 5 | +
|
| 6 | + 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 |
| 7 | +
|
| 8 | + OpenAPI spec version: 1.0 |
| 9 | + |
| 10 | + Generated by: https://github.com/swagger-api/swagger-codegen.git |
| 11 | +""" |
| 12 | + |
| 13 | +from __future__ import absolute_import |
| 14 | + |
| 15 | +import re # noqa: F401 |
| 16 | + |
| 17 | +# python 2 and python 3 compatibility library |
| 18 | +import six |
| 19 | +from asana.api_client import ApiClient |
| 20 | +from asana.pagination.event_iterator import EventIterator |
| 21 | +from asana.pagination.page_iterator import PageIterator |
| 22 | + |
| 23 | +class ReactionsApi(object): |
| 24 | + """NOTE: This class is auto generated by the swagger code generator program. |
| 25 | +
|
| 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 get_reactions_on_object(self, target, emoji_base, opts, **kwargs): # noqa: E501 |
| 36 | + """Get reactions with an emoji base on an object. # noqa: E501 |
| 37 | +
|
| 38 | + Returns the reactions with a specified emoji base character on the object. # 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.get_reactions_on_object(target, emoji_base, async_req=True) |
| 42 | + >>> result = thread.get() |
| 43 | +
|
| 44 | + :param async_req bool |
| 45 | + :param str target: Globally unique identifier for object to fetch reactions from. Must be a GID for a status update or story. (required) |
| 46 | + :param str emoji_base: Only return reactions with this emoji base character. (required) |
| 47 | + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. |
| 48 | + :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.* |
| 49 | + :return: ReactionCompactArray |
| 50 | + If the method is called asynchronously, |
| 51 | + returns the request thread. |
| 52 | + """ |
| 53 | + kwargs['_return_http_data_only'] = kwargs.get("_return_http_data_only", True) |
| 54 | + if kwargs.get('async_req'): |
| 55 | + return self.get_reactions_on_object_with_http_info(target, emoji_base, opts, **kwargs) # noqa: E501 |
| 56 | + else: |
| 57 | + (data) = self.get_reactions_on_object_with_http_info(target, emoji_base, opts, **kwargs) # noqa: E501 |
| 58 | + return data |
| 59 | + |
| 60 | + def get_reactions_on_object_with_http_info(self, target, emoji_base, opts, **kwargs): # noqa: E501 |
| 61 | + """Get reactions with an emoji base on an object. # noqa: E501 |
| 62 | +
|
| 63 | + Returns the reactions with a specified emoji base character on the object. # noqa: E501 |
| 64 | + This method makes a synchronous HTTP request by default. To make an |
| 65 | + asynchronous HTTP request, please pass async_req=True |
| 66 | + >>> thread = api.get_reactions_on_object_with_http_info(target, emoji_base, async_req=True) |
| 67 | + >>> result = thread.get() |
| 68 | +
|
| 69 | + :param async_req bool |
| 70 | + :param str target: Globally unique identifier for object to fetch reactions from. Must be a GID for a status update or story. (required) |
| 71 | + :param str emoji_base: Only return reactions with this emoji base character. (required) |
| 72 | + :param int limit: Results per page. The number of objects to return per page. The value must be between 1 and 100. |
| 73 | + :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.* |
| 74 | + :return: ReactionCompactArray |
| 75 | + If the method is called asynchronously, |
| 76 | + returns the request thread. |
| 77 | + """ |
| 78 | + all_params = [] |
| 79 | + all_params.append('async_req') |
| 80 | + all_params.append('header_params') |
| 81 | + all_params.append('_return_http_data_only') |
| 82 | + all_params.append('_preload_content') |
| 83 | + all_params.append('_request_timeout') |
| 84 | + all_params.append('full_payload') |
| 85 | + all_params.append('item_limit') |
| 86 | + |
| 87 | + params = locals() |
| 88 | + for key, val in six.iteritems(params['kwargs']): |
| 89 | + if key not in all_params: |
| 90 | + raise TypeError( |
| 91 | + "Got an unexpected keyword argument '%s'" |
| 92 | + " to method get_reactions_on_object" % key |
| 93 | + ) |
| 94 | + params[key] = val |
| 95 | + del params['kwargs'] |
| 96 | + # verify the required parameter 'target' is set |
| 97 | + if (target is None): |
| 98 | + raise ValueError("Missing the required parameter `target` when calling `get_reactions_on_object`") # noqa: E501 |
| 99 | + # verify the required parameter 'emoji_base' is set |
| 100 | + if (emoji_base is None): |
| 101 | + raise ValueError("Missing the required parameter `emoji_base` when calling `get_reactions_on_object`") # noqa: E501 |
| 102 | + |
| 103 | + collection_formats = {} |
| 104 | + |
| 105 | + path_params = {} |
| 106 | + |
| 107 | + query_params = {} |
| 108 | + query_params = opts |
| 109 | + query_params['target'] = target |
| 110 | + query_params['emoji_base'] = emoji_base |
| 111 | + |
| 112 | + |
| 113 | + header_params = kwargs.get("header_params", {}) |
| 114 | + |
| 115 | + form_params = [] |
| 116 | + local_var_files = {} |
| 117 | + |
| 118 | + body_params = None |
| 119 | + |
| 120 | + # HTTP header `Accept` |
| 121 | + header_params['Accept'] = self.api_client.select_header_accept( |
| 122 | + ['application/json; charset=UTF-8']) # noqa: E501 |
| 123 | + |
| 124 | + # Authentication setting |
| 125 | + auth_settings = ['personalAccessToken'] # noqa: E501 |
| 126 | + |
| 127 | + # hard checking for True boolean value because user can provide full_payload or async_req with any data type |
| 128 | + if kwargs.get("full_payload", False) is True or kwargs.get('async_req', False) is True: |
| 129 | + return self.api_client.call_api( |
| 130 | + '/reactions', 'GET', |
| 131 | + path_params, |
| 132 | + query_params, |
| 133 | + header_params, |
| 134 | + body=body_params, |
| 135 | + post_params=form_params, |
| 136 | + files=local_var_files, |
| 137 | + response_type=object, # noqa: E501 |
| 138 | + auth_settings=auth_settings, |
| 139 | + async_req=params.get('async_req'), |
| 140 | + _return_http_data_only=params.get('_return_http_data_only'), |
| 141 | + _preload_content=params.get('_preload_content', True), |
| 142 | + _request_timeout=params.get('_request_timeout'), |
| 143 | + collection_formats=collection_formats |
| 144 | + ) |
| 145 | + elif self.api_client.configuration.return_page_iterator: |
| 146 | + query_params["limit"] = query_params.get("limit", self.api_client.configuration.page_limit) |
| 147 | + return PageIterator( |
| 148 | + self.api_client, |
| 149 | + { |
| 150 | + "resource_path": '/reactions', |
| 151 | + "method": 'GET', |
| 152 | + "path_params": path_params, |
| 153 | + "query_params": query_params, |
| 154 | + "header_params": header_params, |
| 155 | + "body": body_params, |
| 156 | + "post_params": form_params, |
| 157 | + "files": local_var_files, |
| 158 | + "response_type": object, |
| 159 | + "auth_settings": auth_settings, |
| 160 | + "async_req": params.get('async_req'), |
| 161 | + "_return_http_data_only": params.get('_return_http_data_only'), |
| 162 | + "_preload_content": params.get('_preload_content', True), |
| 163 | + "_request_timeout": params.get('_request_timeout'), |
| 164 | + "collection_formats": collection_formats |
| 165 | + }, |
| 166 | + **kwargs |
| 167 | + ).items() |
| 168 | + else: |
| 169 | + return self.api_client.call_api( |
| 170 | + '/reactions', 'GET', |
| 171 | + path_params, |
| 172 | + query_params, |
| 173 | + header_params, |
| 174 | + body=body_params, |
| 175 | + post_params=form_params, |
| 176 | + files=local_var_files, |
| 177 | + response_type=object, # noqa: E501 |
| 178 | + auth_settings=auth_settings, |
| 179 | + async_req=params.get('async_req'), |
| 180 | + _return_http_data_only=params.get('_return_http_data_only'), |
| 181 | + _preload_content=params.get('_preload_content', True), |
| 182 | + _request_timeout=params.get('_request_timeout'), |
| 183 | + collection_formats=collection_formats) |
0 commit comments