Skip to content

Commit 07df6f9

Browse files
Merge pull request #16 from sendinblue/feature_updated_swagger_sync
Delete contact api added
2 parents c07feac + a621518 commit 07df6f9

File tree

7 files changed

+209
-22
lines changed

7 files changed

+209
-22
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,20 @@ from sib_api_v3_sdk.rest import ApiException
5858
from pprint import pprint
5959

6060
# Configure API key authorization: api-key
61-
sib_api_v3_sdk.configuration.api_key['api-key'] = 'YOUR_API_KEY'
61+
configuration = sib_api_v3_sdk.Configuration()
62+
configuration.api_key['api-key'] = 'YOUR_API_KEY'
6263
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
63-
# sib_api_v3_sdk.configuration.api_key_prefix['api-key'] = 'Bearer'
64+
# configuration.api_key_prefix['api-key'] = 'Bearer'
65+
6466
# create an instance of the API class
65-
api_instance = sib_api_v3_sdk.AccountApi()
67+
api_instance = sib_api_v3_sdk.AccountApi(sib_api_v3_sdk.ApiClient(configuration))
6668

6769
try:
6870
# Get your account informations, plans and credits details
6971
api_response = api_instance.get_account()
7072
pprint(api_response)
7173
except ApiException as e:
7274
print("Exception when calling AccountApi->get_account: %s\n" % e)
73-
7475
```
7576

7677
## Documentation for API Endpoints
@@ -90,6 +91,7 @@ Class | Method | HTTP request | Description
9091
*ContactsApi* | [**create_folder**](docs/ContactsApi.md#create_folder) | **POST** /contacts/folders | Create a folder
9192
*ContactsApi* | [**create_list**](docs/ContactsApi.md#create_list) | **POST** /contacts/lists | Create a list
9293
*ContactsApi* | [**delete_attribute**](docs/ContactsApi.md#delete_attribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Deletes an attribute
94+
*ContactsApi* | [**delete_contact**](docs/ContactsApi.md#delete_contact) | **DELETE** /contacts/{email} | Deletes a contact
9395
*ContactsApi* | [**delete_folder**](docs/ContactsApi.md#delete_folder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists)
9496
*ContactsApi* | [**delete_list**](docs/ContactsApi.md#delete_list) | **DELETE** /contacts/lists/{listId} | Delete a list
9597
*ContactsApi* | [**get_attributes**](docs/ContactsApi.md#get_attributes) | **GET** /contacts/attributes | Lists all attributes

docs/ContactsApi.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Method | HTTP request | Description
1010
[**create_folder**](ContactsApi.md#create_folder) | **POST** /contacts/folders | Create a folder
1111
[**create_list**](ContactsApi.md#create_list) | **POST** /contacts/lists | Create a list
1212
[**delete_attribute**](ContactsApi.md#delete_attribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Deletes an attribute
13+
[**delete_contact**](ContactsApi.md#delete_contact) | **DELETE** /contacts/{email} | Deletes a contact
1314
[**delete_folder**](ContactsApi.md#delete_folder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists)
1415
[**delete_list**](ContactsApi.md#delete_list) | **DELETE** /contacts/lists/{listId} | Delete a list
1516
[**get_attributes**](ContactsApi.md#get_attributes) | **GET** /contacts/attributes | Lists all attributes
@@ -349,6 +350,57 @@ void (empty response body)
349350

350351
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
351352

353+
# **delete_contact**
354+
> delete_contact(email)
355+
356+
Deletes a contact
357+
358+
### Example
359+
```python
360+
from __future__ import print_function
361+
import time
362+
import sib_api_v3_sdk
363+
from sib_api_v3_sdk.rest import ApiException
364+
from pprint import pprint
365+
366+
# Configure API key authorization: api-key
367+
configuration = sib_api_v3_sdk.Configuration()
368+
configuration.api_key['api-key'] = 'YOUR_API_KEY'
369+
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
370+
# configuration.api_key_prefix['api-key'] = 'Bearer'
371+
372+
# create an instance of the API class
373+
api_instance = sib_api_v3_sdk.ContactsApi(sib_api_v3_sdk.ApiClient(configuration))
374+
email = 'email_example' # str | Email (urlencoded) of the contact
375+
376+
try:
377+
# Deletes a contact
378+
api_instance.delete_contact(email)
379+
except ApiException as e:
380+
print("Exception when calling ContactsApi->delete_contact: %s\n" % e)
381+
```
382+
383+
### Parameters
384+
385+
Name | Type | Description | Notes
386+
------------- | ------------- | ------------- | -------------
387+
**email** | **str**| Email (urlencoded) of the contact |
388+
389+
### Return type
390+
391+
void (empty response body)
392+
393+
### Authorization
394+
395+
[api-key](../README.md#api-key)
396+
397+
### HTTP request headers
398+
399+
- **Content-Type**: application/json
400+
- **Accept**: application/json
401+
402+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
403+
352404
# **delete_folder**
353405
> delete_folder(folder_id)
354406

docs/GetAccountPlan.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
66
**type** | **str** | Displays the plan type of the user |
7-
**credits_type** | **str** | This is the type of the credit, \"User Limit\" or \"Send Limit\" are two possible types of credit of a user. \"User Limit\" implies the total number of subscribers you can add to your account, and \"Send Limit\" implies the total number of emails you can send to the subscribers in your account. |
8-
**credits** | **float** | Remaining credits of the user. This can either be \"User Limit\" or \"Send Limit\" depending on the plan. |
9-
**start_date** | **date** | Date of the period from which the plan will start (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) | [optional]
10-
**end_date** | **date** | Date of the period from which the plan will end (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) | [optional]
7+
**credits_type** | **str** | This is the type of the credit, \"Send Limit\" is one of the possible types of credit of a user. \"Send Limit\" implies the total number of emails you can send to the subscribers in your account. |
8+
**credits** | **float** | Remaining credits of the user |
9+
**start_date** | **date** | Date of the period from which the plan will start (only available for \"subscription\" and \"reseller\" plan type) | [optional]
10+
**end_date** | **date** | Date of the period from which the plan will end (only available for \"subscription\" and \"reseller\" plan type) | [optional]
11+
**user_limit** | **int** | Only in case of reseller account. It implies the total number of child accounts you can add to your account. | [optional]
1112

1213
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1314

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from setuptools import setup, find_packages
1616

1717
NAME = "sib-api-v3-sdk"
18-
VERSION = "3.0.0"
18+
VERSION = "3.0.1"
1919
# To install the library, run the following
2020
#
2121
# python setup.py install

sib_api_v3_sdk/api/contacts_api.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,103 @@ def delete_attribute_with_http_info(self, attribute_category, attribute_name, **
647647
_request_timeout=params.get('_request_timeout'),
648648
collection_formats=collection_formats)
649649

650+
def delete_contact(self, email, **kwargs): # noqa: E501
651+
"""Deletes a contact # noqa: E501
652+
653+
This method makes a synchronous HTTP request by default. To make an
654+
asynchronous HTTP request, please pass async=True
655+
>>> thread = api.delete_contact(email, async=True)
656+
>>> result = thread.get()
657+
658+
:param async bool
659+
:param str email: Email (urlencoded) of the contact (required)
660+
:return: None
661+
If the method is called asynchronously,
662+
returns the request thread.
663+
"""
664+
kwargs['_return_http_data_only'] = True
665+
if kwargs.get('async'):
666+
return self.delete_contact_with_http_info(email, **kwargs) # noqa: E501
667+
else:
668+
(data) = self.delete_contact_with_http_info(email, **kwargs) # noqa: E501
669+
return data
670+
671+
def delete_contact_with_http_info(self, email, **kwargs): # noqa: E501
672+
"""Deletes a contact # noqa: E501
673+
674+
This method makes a synchronous HTTP request by default. To make an
675+
asynchronous HTTP request, please pass async=True
676+
>>> thread = api.delete_contact_with_http_info(email, async=True)
677+
>>> result = thread.get()
678+
679+
:param async bool
680+
:param str email: Email (urlencoded) of the contact (required)
681+
:return: None
682+
If the method is called asynchronously,
683+
returns the request thread.
684+
"""
685+
686+
all_params = ['email'] # noqa: E501
687+
all_params.append('async')
688+
all_params.append('_return_http_data_only')
689+
all_params.append('_preload_content')
690+
all_params.append('_request_timeout')
691+
692+
params = locals()
693+
for key, val in six.iteritems(params['kwargs']):
694+
if key not in all_params:
695+
raise TypeError(
696+
"Got an unexpected keyword argument '%s'"
697+
" to method delete_contact" % key
698+
)
699+
params[key] = val
700+
del params['kwargs']
701+
# verify the required parameter 'email' is set
702+
if ('email' not in params or
703+
params['email'] is None):
704+
raise ValueError("Missing the required parameter `email` when calling `delete_contact`") # noqa: E501
705+
706+
collection_formats = {}
707+
708+
path_params = {}
709+
if 'email' in params:
710+
path_params['email'] = params['email'] # noqa: E501
711+
712+
query_params = []
713+
714+
header_params = {}
715+
716+
form_params = []
717+
local_var_files = {}
718+
719+
body_params = None
720+
# HTTP header `Accept`
721+
header_params['Accept'] = self.api_client.select_header_accept(
722+
['application/json']) # noqa: E501
723+
724+
# HTTP header `Content-Type`
725+
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
726+
['application/json']) # noqa: E501
727+
728+
# Authentication setting
729+
auth_settings = ['api-key'] # noqa: E501
730+
731+
return self.api_client.call_api(
732+
'/contacts/{email}', 'DELETE',
733+
path_params,
734+
query_params,
735+
header_params,
736+
body=body_params,
737+
post_params=form_params,
738+
files=local_var_files,
739+
response_type=None, # noqa: E501
740+
auth_settings=auth_settings,
741+
async=params.get('async'),
742+
_return_http_data_only=params.get('_return_http_data_only'),
743+
_preload_content=params.get('_preload_content', True),
744+
_request_timeout=params.get('_request_timeout'),
745+
collection_formats=collection_formats)
746+
650747
def delete_folder(self, folder_id, **kwargs): # noqa: E501
651748
"""Delete a folder (and all its lists) # noqa: E501
652749

sib_api_v3_sdk/models/get_account_plan.py

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,28 @@ class GetAccountPlan(object):
3535
'credits_type': 'str',
3636
'credits': 'float',
3737
'start_date': 'date',
38-
'end_date': 'date'
38+
'end_date': 'date',
39+
'user_limit': 'int'
3940
}
4041

4142
attribute_map = {
4243
'type': 'type',
4344
'credits_type': 'creditsType',
4445
'credits': 'credits',
4546
'start_date': 'startDate',
46-
'end_date': 'endDate'
47+
'end_date': 'endDate',
48+
'user_limit': 'userLimit'
4749
}
4850

49-
def __init__(self, type=None, credits_type=None, credits=None, start_date=None, end_date=None): # noqa: E501
51+
def __init__(self, type=None, credits_type=None, credits=None, start_date=None, end_date=None, user_limit=None): # noqa: E501
5052
"""GetAccountPlan - a model defined in Swagger""" # noqa: E501
5153

5254
self._type = None
5355
self._credits_type = None
5456
self._credits = None
5557
self._start_date = None
5658
self._end_date = None
59+
self._user_limit = None
5760
self.discriminator = None
5861

5962
self.type = type
@@ -63,6 +66,8 @@ def __init__(self, type=None, credits_type=None, credits=None, start_date=None,
6366
self.start_date = start_date
6467
if end_date is not None:
6568
self.end_date = end_date
69+
if user_limit is not None:
70+
self.user_limit = user_limit
6671

6772
@property
6873
def type(self):
@@ -86,7 +91,7 @@ def type(self, type):
8691
"""
8792
if type is None:
8893
raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501
89-
allowed_values = ["payAsYouGo", "unlimited", "free", "subscription", "sms", "reseller"] # noqa: E501
94+
allowed_values = ["payAsYouGo", "free", "subscription", "sms", "reseller"] # noqa: E501
9095
if type not in allowed_values:
9196
raise ValueError(
9297
"Invalid value for `type` ({0}), must be one of {1}" # noqa: E501
@@ -99,7 +104,7 @@ def type(self, type):
99104
def credits_type(self):
100105
"""Gets the credits_type of this GetAccountPlan. # noqa: E501
101106
102-
This is the type of the credit, \"User Limit\" or \"Send Limit\" are two possible types of credit of a user. \"User Limit\" implies the total number of subscribers you can add to your account, and \"Send Limit\" implies the total number of emails you can send to the subscribers in your account. # noqa: E501
107+
This is the type of the credit, \"Send Limit\" is one of the possible types of credit of a user. \"Send Limit\" implies the total number of emails you can send to the subscribers in your account. # noqa: E501
103108
104109
:return: The credits_type of this GetAccountPlan. # noqa: E501
105110
:rtype: str
@@ -110,14 +115,14 @@ def credits_type(self):
110115
def credits_type(self, credits_type):
111116
"""Sets the credits_type of this GetAccountPlan.
112117
113-
This is the type of the credit, \"User Limit\" or \"Send Limit\" are two possible types of credit of a user. \"User Limit\" implies the total number of subscribers you can add to your account, and \"Send Limit\" implies the total number of emails you can send to the subscribers in your account. # noqa: E501
118+
This is the type of the credit, \"Send Limit\" is one of the possible types of credit of a user. \"Send Limit\" implies the total number of emails you can send to the subscribers in your account. # noqa: E501
114119
115120
:param credits_type: The credits_type of this GetAccountPlan. # noqa: E501
116121
:type: str
117122
"""
118123
if credits_type is None:
119124
raise ValueError("Invalid value for `credits_type`, must not be `None`") # noqa: E501
120-
allowed_values = ["userLimit", "sendLimit"] # noqa: E501
125+
allowed_values = ["sendLimit"] # noqa: E501
121126
if credits_type not in allowed_values:
122127
raise ValueError(
123128
"Invalid value for `credits_type` ({0}), must be one of {1}" # noqa: E501
@@ -130,7 +135,7 @@ def credits_type(self, credits_type):
130135
def credits(self):
131136
"""Gets the credits of this GetAccountPlan. # noqa: E501
132137
133-
Remaining credits of the user. This can either be \"User Limit\" or \"Send Limit\" depending on the plan. # noqa: E501
138+
Remaining credits of the user # noqa: E501
134139
135140
:return: The credits of this GetAccountPlan. # noqa: E501
136141
:rtype: float
@@ -141,7 +146,7 @@ def credits(self):
141146
def credits(self, credits):
142147
"""Sets the credits of this GetAccountPlan.
143148
144-
Remaining credits of the user. This can either be \"User Limit\" or \"Send Limit\" depending on the plan. # noqa: E501
149+
Remaining credits of the user # noqa: E501
145150
146151
:param credits: The credits of this GetAccountPlan. # noqa: E501
147152
:type: float
@@ -155,7 +160,7 @@ def credits(self, credits):
155160
def start_date(self):
156161
"""Gets the start_date of this GetAccountPlan. # noqa: E501
157162
158-
Date of the period from which the plan will start (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) # noqa: E501
163+
Date of the period from which the plan will start (only available for \"subscription\" and \"reseller\" plan type) # noqa: E501
159164
160165
:return: The start_date of this GetAccountPlan. # noqa: E501
161166
:rtype: date
@@ -166,7 +171,7 @@ def start_date(self):
166171
def start_date(self, start_date):
167172
"""Sets the start_date of this GetAccountPlan.
168173
169-
Date of the period from which the plan will start (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) # noqa: E501
174+
Date of the period from which the plan will start (only available for \"subscription\" and \"reseller\" plan type) # noqa: E501
170175
171176
:param start_date: The start_date of this GetAccountPlan. # noqa: E501
172177
:type: date
@@ -178,7 +183,7 @@ def start_date(self, start_date):
178183
def end_date(self):
179184
"""Gets the end_date of this GetAccountPlan. # noqa: E501
180185
181-
Date of the period from which the plan will end (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) # noqa: E501
186+
Date of the period from which the plan will end (only available for \"subscription\" and \"reseller\" plan type) # noqa: E501
182187
183188
:return: The end_date of this GetAccountPlan. # noqa: E501
184189
:rtype: date
@@ -189,14 +194,37 @@ def end_date(self):
189194
def end_date(self, end_date):
190195
"""Sets the end_date of this GetAccountPlan.
191196
192-
Date of the period from which the plan will end (only available for \"subscription\", \"unlimited\" and \"reseller\" plan type) # noqa: E501
197+
Date of the period from which the plan will end (only available for \"subscription\" and \"reseller\" plan type) # noqa: E501
193198
194199
:param end_date: The end_date of this GetAccountPlan. # noqa: E501
195200
:type: date
196201
"""
197202

198203
self._end_date = end_date
199204

205+
@property
206+
def user_limit(self):
207+
"""Gets the user_limit of this GetAccountPlan. # noqa: E501
208+
209+
Only in case of reseller account. It implies the total number of child accounts you can add to your account. # noqa: E501
210+
211+
:return: The user_limit of this GetAccountPlan. # noqa: E501
212+
:rtype: int
213+
"""
214+
return self._user_limit
215+
216+
@user_limit.setter
217+
def user_limit(self, user_limit):
218+
"""Sets the user_limit of this GetAccountPlan.
219+
220+
Only in case of reseller account. It implies the total number of child accounts you can add to your account. # noqa: E501
221+
222+
:param user_limit: The user_limit of this GetAccountPlan. # noqa: E501
223+
:type: int
224+
"""
225+
226+
self._user_limit = user_limit
227+
200228
def to_dict(self):
201229
"""Returns the model properties as a dict"""
202230
result = {}

0 commit comments

Comments
 (0)