|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + Brevo API |
| 5 | +
|
| 6 | + Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | # noqa: E501 |
| 7 | +
|
| 8 | + OpenAPI spec version: 3.0.0 |
| 9 | + Contact: contact@brevo.com |
| 10 | + Generated by: https://github.com/swagger-api/swagger-codegen.git |
| 11 | +""" |
| 12 | + |
| 13 | + |
| 14 | +from __future__ import absolute_import |
| 15 | + |
| 16 | +import re # noqa: F401 |
| 17 | + |
| 18 | +# python 2 and python 3 compatibility library |
| 19 | +import six |
| 20 | + |
| 21 | +from brevo_python.api_client import ApiClient |
| 22 | + |
| 23 | + |
| 24 | +class AccountApi(object): |
| 25 | + """NOTE: This class is auto generated by the swagger code generator program. |
| 26 | +
|
| 27 | + Do not edit the class manually. |
| 28 | + Ref: https://github.com/swagger-api/swagger-codegen |
| 29 | + """ |
| 30 | + |
| 31 | + def __init__(self, api_client=None): |
| 32 | + if api_client is None: |
| 33 | + api_client = ApiClient() |
| 34 | + self.api_client = api_client |
| 35 | + |
| 36 | + def get_account(self, **kwargs): # noqa: E501 |
| 37 | + """Get your account information, plan and credits details # noqa: E501 |
| 38 | +
|
| 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_account(async_req=True) |
| 42 | + >>> result = thread.get() |
| 43 | +
|
| 44 | + :param async_req bool |
| 45 | + :return: GetAccount |
| 46 | + If the method is called asynchronously, |
| 47 | + returns the request thread. |
| 48 | + """ |
| 49 | + kwargs['_return_http_data_only'] = True |
| 50 | + if kwargs.get('async_req'): |
| 51 | + return self.get_account_with_http_info(**kwargs) # noqa: E501 |
| 52 | + else: |
| 53 | + (data) = self.get_account_with_http_info(**kwargs) # noqa: E501 |
| 54 | + return data |
| 55 | + |
| 56 | + def get_account_with_http_info(self, **kwargs): # noqa: E501 |
| 57 | + """Get your account information, plan and credits details # noqa: E501 |
| 58 | +
|
| 59 | + This method makes a synchronous HTTP request by default. To make an |
| 60 | + asynchronous HTTP request, please pass async_req=True |
| 61 | + >>> thread = api.get_account_with_http_info(async_req=True) |
| 62 | + >>> result = thread.get() |
| 63 | +
|
| 64 | + :param async_req bool |
| 65 | + :return: GetAccount |
| 66 | + If the method is called asynchronously, |
| 67 | + returns the request thread. |
| 68 | + """ |
| 69 | + |
| 70 | + all_params = [] # noqa: E501 |
| 71 | + all_params.append('async_req') |
| 72 | + all_params.append('_return_http_data_only') |
| 73 | + all_params.append('_preload_content') |
| 74 | + all_params.append('_request_timeout') |
| 75 | + |
| 76 | + params = locals() |
| 77 | + for key, val in six.iteritems(params['kwargs']): |
| 78 | + if key not in all_params: |
| 79 | + raise TypeError( |
| 80 | + "Got an unexpected keyword argument '%s'" |
| 81 | + " to method get_account" % key |
| 82 | + ) |
| 83 | + params[key] = val |
| 84 | + del params['kwargs'] |
| 85 | + |
| 86 | + collection_formats = {} |
| 87 | + |
| 88 | + path_params = {} |
| 89 | + |
| 90 | + query_params = [] |
| 91 | + |
| 92 | + header_params = {} |
| 93 | + |
| 94 | + form_params = [] |
| 95 | + local_var_files = {} |
| 96 | + |
| 97 | + body_params = None |
| 98 | + # HTTP header `Accept` |
| 99 | + header_params['Accept'] = self.api_client.select_header_accept( |
| 100 | + ['application/json']) # noqa: E501 |
| 101 | + |
| 102 | + # HTTP header `Content-Type` |
| 103 | + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 |
| 104 | + ['application/json']) # noqa: E501 |
| 105 | + |
| 106 | + # Authentication setting |
| 107 | + auth_settings = ['api-key', 'partner-key'] # noqa: E501 |
| 108 | + |
| 109 | + return self.api_client.call_api( |
| 110 | + '/account', 'GET', |
| 111 | + path_params, |
| 112 | + query_params, |
| 113 | + header_params, |
| 114 | + body=body_params, |
| 115 | + post_params=form_params, |
| 116 | + files=local_var_files, |
| 117 | + response_type='GetAccount', # noqa: E501 |
| 118 | + auth_settings=auth_settings, |
| 119 | + async_req=params.get('async_req'), |
| 120 | + _return_http_data_only=params.get('_return_http_data_only'), |
| 121 | + _preload_content=params.get('_preload_content', True), |
| 122 | + _request_timeout=params.get('_request_timeout'), |
| 123 | + collection_formats=collection_formats) |
| 124 | + |
| 125 | + def get_account_activity(self, **kwargs): # noqa: E501 |
| 126 | + """Get user activity logs # noqa: E501 |
| 127 | +
|
| 128 | + This method makes a synchronous HTTP request by default. To make an |
| 129 | + asynchronous HTTP request, please pass async_req=True |
| 130 | + >>> thread = api.get_account_activity(async_req=True) |
| 131 | + >>> result = thread.get() |
| 132 | +
|
| 133 | + :param async_req bool |
| 134 | + :param str start_date: Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. |
| 135 | + :param str end_date: Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. |
| 136 | + :param int limit: Number of documents per page |
| 137 | + :param int offset: Index of the first document in the page. |
| 138 | + :return: GetAccountActivity |
| 139 | + If the method is called asynchronously, |
| 140 | + returns the request thread. |
| 141 | + """ |
| 142 | + kwargs['_return_http_data_only'] = True |
| 143 | + if kwargs.get('async_req'): |
| 144 | + return self.get_account_activity_with_http_info(**kwargs) # noqa: E501 |
| 145 | + else: |
| 146 | + (data) = self.get_account_activity_with_http_info(**kwargs) # noqa: E501 |
| 147 | + return data |
| 148 | + |
| 149 | + def get_account_activity_with_http_info(self, **kwargs): # noqa: E501 |
| 150 | + """Get user activity logs # noqa: E501 |
| 151 | +
|
| 152 | + This method makes a synchronous HTTP request by default. To make an |
| 153 | + asynchronous HTTP request, please pass async_req=True |
| 154 | + >>> thread = api.get_account_activity_with_http_info(async_req=True) |
| 155 | + >>> result = thread.get() |
| 156 | +
|
| 157 | + :param async_req bool |
| 158 | + :param str start_date: Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. |
| 159 | + :param str end_date: Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. |
| 160 | + :param int limit: Number of documents per page |
| 161 | + :param int offset: Index of the first document in the page. |
| 162 | + :return: GetAccountActivity |
| 163 | + If the method is called asynchronously, |
| 164 | + returns the request thread. |
| 165 | + """ |
| 166 | + |
| 167 | + all_params = ['start_date', 'end_date', 'limit', 'offset'] # noqa: E501 |
| 168 | + all_params.append('async_req') |
| 169 | + all_params.append('_return_http_data_only') |
| 170 | + all_params.append('_preload_content') |
| 171 | + all_params.append('_request_timeout') |
| 172 | + |
| 173 | + params = locals() |
| 174 | + for key, val in six.iteritems(params['kwargs']): |
| 175 | + if key not in all_params: |
| 176 | + raise TypeError( |
| 177 | + "Got an unexpected keyword argument '%s'" |
| 178 | + " to method get_account_activity" % key |
| 179 | + ) |
| 180 | + params[key] = val |
| 181 | + del params['kwargs'] |
| 182 | + |
| 183 | + if 'limit' in params and params['limit'] > 100: # noqa: E501 |
| 184 | + raise ValueError("Invalid value for parameter `limit` when calling `get_account_activity`, must be a value less than or equal to `100`") # noqa: E501 |
| 185 | + if 'limit' in params and params['limit'] < 1: # noqa: E501 |
| 186 | + raise ValueError("Invalid value for parameter `limit` when calling `get_account_activity`, must be a value greater than or equal to `1`") # noqa: E501 |
| 187 | + collection_formats = {} |
| 188 | + |
| 189 | + path_params = {} |
| 190 | + |
| 191 | + query_params = [] |
| 192 | + if 'start_date' in params: |
| 193 | + query_params.append(('startDate', params['start_date'])) # noqa: E501 |
| 194 | + if 'end_date' in params: |
| 195 | + query_params.append(('endDate', params['end_date'])) # noqa: E501 |
| 196 | + if 'limit' in params: |
| 197 | + query_params.append(('limit', params['limit'])) # noqa: E501 |
| 198 | + if 'offset' in params: |
| 199 | + query_params.append(('offset', params['offset'])) # noqa: E501 |
| 200 | + |
| 201 | + header_params = {} |
| 202 | + |
| 203 | + form_params = [] |
| 204 | + local_var_files = {} |
| 205 | + |
| 206 | + body_params = None |
| 207 | + # HTTP header `Accept` |
| 208 | + header_params['Accept'] = self.api_client.select_header_accept( |
| 209 | + ['application/json']) # noqa: E501 |
| 210 | + |
| 211 | + # HTTP header `Content-Type` |
| 212 | + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 |
| 213 | + ['application/json']) # noqa: E501 |
| 214 | + |
| 215 | + # Authentication setting |
| 216 | + auth_settings = ['api-key', 'partner-key'] # noqa: E501 |
| 217 | + |
| 218 | + return self.api_client.call_api( |
| 219 | + '/organization/activities', 'GET', |
| 220 | + path_params, |
| 221 | + query_params, |
| 222 | + header_params, |
| 223 | + body=body_params, |
| 224 | + post_params=form_params, |
| 225 | + files=local_var_files, |
| 226 | + response_type='GetAccountActivity', # noqa: E501 |
| 227 | + auth_settings=auth_settings, |
| 228 | + async_req=params.get('async_req'), |
| 229 | + _return_http_data_only=params.get('_return_http_data_only'), |
| 230 | + _preload_content=params.get('_preload_content', True), |
| 231 | + _request_timeout=params.get('_request_timeout'), |
| 232 | + collection_formats=collection_formats) |
0 commit comments