Skip to content

Commit 69c262c

Browse files
authored
Merge pull request #41 from sendinblue/feature_spec-mixed-updates
Delete single contact method added + get account response fix for reseller
2 parents 4886771 + 003957e commit 69c262c

File tree

8 files changed

+200
-15
lines changed

8 files changed

+200
-15
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Class | Method | HTTP request | Description
9696
*ContactsApi* | [**createFolder**](docs/Api/ContactsApi.md#createfolder) | **POST** /contacts/folders | Create a folder
9797
*ContactsApi* | [**createList**](docs/Api/ContactsApi.md#createlist) | **POST** /contacts/lists | Create a list
9898
*ContactsApi* | [**deleteAttribute**](docs/Api/ContactsApi.md#deleteattribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Deletes an attribute
99+
*ContactsApi* | [**deleteContact**](docs/Api/ContactsApi.md#deletecontact) | **DELETE** /contacts/{email} | Deletes a contact
99100
*ContactsApi* | [**deleteFolder**](docs/Api/ContactsApi.md#deletefolder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists)
100101
*ContactsApi* | [**deleteList**](docs/Api/ContactsApi.md#deletelist) | **DELETE** /contacts/lists/{listId} | Delete a list
101102
*ContactsApi* | [**getAttributes**](docs/Api/ContactsApi.md#getattributes) | **GET** /contacts/attributes | Lists all attributes

docs/Api/ContactsApi.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Method | HTTP request | Description
1010
[**createFolder**](ContactsApi.md#createFolder) | **POST** /contacts/folders | Create a folder
1111
[**createList**](ContactsApi.md#createList) | **POST** /contacts/lists | Create a list
1212
[**deleteAttribute**](ContactsApi.md#deleteAttribute) | **DELETE** /contacts/attributes/{attributeCategory}/{attributeName} | Deletes an attribute
13+
[**deleteContact**](ContactsApi.md#deleteContact) | **DELETE** /contacts/{email} | Deletes a contact
1314
[**deleteFolder**](ContactsApi.md#deleteFolder) | **DELETE** /contacts/folders/{folderId} | Delete a folder (and all its lists)
1415
[**deleteList**](ContactsApi.md#deleteList) | **DELETE** /contacts/lists/{listId} | Delete a list
1516
[**getAttributes**](ContactsApi.md#getAttributes) | **GET** /contacts/attributes | Lists all attributes
@@ -325,6 +326,53 @@ void (empty response body)
325326

326327
[[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)
327328

329+
# **deleteContact**
330+
> deleteContact($email)
331+
332+
Deletes a contact
333+
334+
### Example
335+
```php
336+
<?php
337+
require_once(__DIR__ . '/vendor/autoload.php');
338+
339+
// Configure API key authorization: api-key
340+
SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
341+
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
342+
// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
343+
344+
$api_instance = new SendinBlue\Client\Api\ContactsApi();
345+
$email = "email_example"; // string | Email (urlencoded) of the contact
346+
347+
try {
348+
$api_instance->deleteContact($email);
349+
} catch (Exception $e) {
350+
echo 'Exception when calling ContactsApi->deleteContact: ', $e->getMessage(), PHP_EOL;
351+
}
352+
?>
353+
```
354+
355+
### Parameters
356+
357+
Name | Type | Description | Notes
358+
------------- | ------------- | ------------- | -------------
359+
**email** | **string**| Email (urlencoded) of the contact |
360+
361+
### Return type
362+
363+
void (empty response body)
364+
365+
### Authorization
366+
367+
[api-key](../../README.md#api-key)
368+
369+
### HTTP request headers
370+
371+
- **Content-Type**: application/json
372+
- **Accept**: application/json
373+
374+
[[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)
375+
328376
# **deleteFolder**
329377
> deleteFolder($folderId)
330378

docs/Model/GetAccountPlan.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
66
**type** | **string** | Displays the plan type of the user |
7-
**creditsType** | **string** | This is the type of the credit, \&quot;User Limit\&quot; or \&quot;Send Limit\&quot; are two possible types of credit of a user. \&quot;User Limit\&quot; implies the total number of subscribers you can add to your account, and \&quot;Send Limit\&quot; 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 \&quot;User Limit\&quot; or \&quot;Send Limit\&quot; depending on the plan. |
7+
**creditsType** | **string** | This is the type of the credit, \&quot;Send Limit\&quot; is one of the possible types of credit of a user. \&quot;Send Limit\&quot; implies the total number of emails you can send to the subscribers in your account. |
8+
**credits** | **float** | Remaining credits of the user
99
**startDate** | **\DateTime** | Date of the period from which the plan will start (only available for \&quot;subscription\&quot;, \&quot;unlimited\&quot; and \&quot;reseller\&quot; plan type) | [optional]
1010
**endDate** | **\DateTime** | Date of the period from which the plan will end (only available for \&quot;subscription\&quot;, \&quot;unlimited\&quot; and \&quot;reseller\&quot; plan type) | [optional]
11+
**userLimit** | **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

docs/Model/SendSmtpEmail.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ Name | Type | Description | Notes
77
**to** | [**\SendinBlue\Client\Model\SendSmtpEmailTo[]**](SendSmtpEmailTo.md) | Email addresses and names of the recipients |
88
**bcc** | [**\SendinBlue\Client\Model\SendSmtpEmailBcc[]**](SendSmtpEmailBcc.md) | Email addresses and names of the recipients in bcc | [optional]
99
**cc** | [**\SendinBlue\Client\Model\SendSmtpEmailCc[]**](SendSmtpEmailCc.md) | Email addresses and names of the recipients in cc | [optional]
10-
**htmlContent** | **string** | HTML body of the message |
11-
**textContent** | **string** | Plain Text body of the message | [optional]
12-
**subject** | **string** | Subject of the message |
10+
**htmlContent** | **string** | HTML body of the message ( Mandatory if &#39;templateId&#39; is not passed, ignored if &#39;templateId&#39; is passed ) | [optional]
11+
**textContent** | **string** | Plain Text body of the message ( Ignored if &#39;templateId&#39; is passed ) | [optional]
12+
**subject** | **string** | Subject of the message. Mandatory if &#39;templateId&#39; is not passed | [optional]
1313
**replyTo** | [**\SendinBlue\Client\Model\SendSmtpEmailReplyTo**](SendSmtpEmailReplyTo.md) | | [optional]
14-
**attachment** | [**\SendinBlue\Client\Model\SendSmtpEmailAttachment[]**](SendSmtpEmailAttachment.md) | Pass the absolute URL (no local file) or the base64 content of the attachment. Name can be used in both cases to define the attachment name. It is mandatory in case of content. Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps | [optional]
14+
**attachment** | [**\SendinBlue\Client\Model\SendSmtpEmailAttachment[]**](SendSmtpEmailAttachment.md) | Pass the absolute URL (no local file) or the base64 content of the attachment. Name can be used in both cases to define the attachment name. It is mandatory in case of content. Extension allowed: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps ( Ignored if &#39;templateId&#39; is passed ) | [optional]
1515
**headers** | **map[string,string]** | | [optional]
16+
**templateId** | **int** | Id of the template | [optional]
17+
**params** | **map[string,string]** | | [optional]
1618

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

lib/Api/ContactsApi.php

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,97 @@ public function deleteAttributeWithHttpInfo($attributeCategory, $attributeName)
674674
}
675675
}
676676

677+
/**
678+
* Operation deleteContact
679+
*
680+
* Deletes a contact
681+
*
682+
* @param string $email Email (urlencoded) of the contact (required)
683+
* @throws \SendinBlue\Client\ApiException on non-2xx response
684+
* @return void
685+
*/
686+
public function deleteContact($email)
687+
{
688+
list($response) = $this->deleteContactWithHttpInfo($email);
689+
return $response;
690+
}
691+
692+
/**
693+
* Operation deleteContactWithHttpInfo
694+
*
695+
* Deletes a contact
696+
*
697+
* @param string $email Email (urlencoded) of the contact (required)
698+
* @throws \SendinBlue\Client\ApiException on non-2xx response
699+
* @return array of null, HTTP status code, HTTP response headers (array of strings)
700+
*/
701+
public function deleteContactWithHttpInfo($email)
702+
{
703+
// verify the required parameter 'email' is set
704+
if ($email === null) {
705+
throw new \InvalidArgumentException('Missing the required parameter $email when calling deleteContact');
706+
}
707+
// parse inputs
708+
$resourcePath = "/contacts/{email}";
709+
$httpBody = '';
710+
$queryParams = [];
711+
$headerParams = [];
712+
$formParams = [];
713+
$_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
714+
if (!is_null($_header_accept)) {
715+
$headerParams['Accept'] = $_header_accept;
716+
}
717+
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);
718+
719+
// path params
720+
if ($email !== null) {
721+
$resourcePath = str_replace(
722+
"{" . "email" . "}",
723+
$this->apiClient->getSerializer()->toPathValue($email),
724+
$resourcePath
725+
);
726+
}
727+
728+
// for model (json/xml)
729+
if (isset($_tempBody)) {
730+
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
731+
} elseif (count($formParams) > 0) {
732+
$httpBody = $formParams; // for HTTP post (form)
733+
}
734+
// this endpoint requires API key authentication
735+
$apiKey = $this->apiClient->getApiKeyWithPrefix('api-key');
736+
if (strlen($apiKey) !== 0) {
737+
$headerParams['api-key'] = $apiKey;
738+
}
739+
// make the API Call
740+
try {
741+
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
742+
$resourcePath,
743+
'DELETE',
744+
$queryParams,
745+
$httpBody,
746+
$headerParams,
747+
null,
748+
'/contacts/{email}'
749+
);
750+
751+
return [null, $statusCode, $httpHeader];
752+
} catch (ApiException $e) {
753+
switch ($e->getCode()) {
754+
case 400:
755+
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
756+
$e->setResponseObject($data);
757+
break;
758+
case 404:
759+
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SendinBlue\Client\Model\ErrorModel', $e->getResponseHeaders());
760+
$e->setResponseObject($data);
761+
break;
762+
}
763+
764+
throw $e;
765+
}
766+
}
767+
677768
/**
678769
* Operation deleteFolder
679770
*

lib/Model/GetAccountPlan.php

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ class GetAccountPlan implements ArrayAccess
5858
'creditsType' => 'string',
5959
'credits' => 'float',
6060
'startDate' => '\DateTime',
61-
'endDate' => '\DateTime'
61+
'endDate' => '\DateTime',
62+
'userLimit' => 'int'
6263
];
6364

6465
/**
@@ -70,7 +71,8 @@ class GetAccountPlan implements ArrayAccess
7071
'creditsType' => null,
7172
'credits' => 'float',
7273
'startDate' => 'date',
73-
'endDate' => 'date'
74+
'endDate' => 'date',
75+
'userLimit' => null
7476
];
7577

7678
public static function swaggerTypes()
@@ -92,7 +94,8 @@ public static function swaggerFormats()
9294
'creditsType' => 'creditsType',
9395
'credits' => 'credits',
9496
'startDate' => 'startDate',
95-
'endDate' => 'endDate'
97+
'endDate' => 'endDate',
98+
'userLimit' => 'userLimit'
9699
];
97100

98101

@@ -105,7 +108,8 @@ public static function swaggerFormats()
105108
'creditsType' => 'setCreditsType',
106109
'credits' => 'setCredits',
107110
'startDate' => 'setStartDate',
108-
'endDate' => 'setEndDate'
111+
'endDate' => 'setEndDate',
112+
'userLimit' => 'setUserLimit'
109113
];
110114

111115

@@ -118,7 +122,8 @@ public static function swaggerFormats()
118122
'creditsType' => 'getCreditsType',
119123
'credits' => 'getCredits',
120124
'startDate' => 'getStartDate',
121-
'endDate' => 'getEndDate'
125+
'endDate' => 'getEndDate',
126+
'userLimit' => 'getUserLimit'
122127
];
123128

124129
public static function attributeMap()
@@ -142,7 +147,6 @@ public static function getters()
142147
const TYPE_SUBSCRIPTION = 'subscription';
143148
const TYPE_SMS = 'sms';
144149
const TYPE_RESELLER = 'reseller';
145-
const CREDITS_TYPE_USER_LIMIT = 'userLimit';
146150
const CREDITS_TYPE_SEND_LIMIT = 'sendLimit';
147151

148152

@@ -170,7 +174,6 @@ public function getTypeAllowableValues()
170174
public function getCreditsTypeAllowableValues()
171175
{
172176
return [
173-
self::CREDITS_TYPE_USER_LIMIT,
174177
self::CREDITS_TYPE_SEND_LIMIT,
175178
];
176179
}
@@ -193,6 +196,7 @@ public function __construct(array $data = null)
193196
$this->container['credits'] = isset($data['credits']) ? $data['credits'] : null;
194197
$this->container['startDate'] = isset($data['startDate']) ? $data['startDate'] : null;
195198
$this->container['endDate'] = isset($data['endDate']) ? $data['endDate'] : null;
199+
$this->container['userLimit'] = isset($data['userLimit']) ? $data['userLimit'] : null;
196200
}
197201

198202
/**
@@ -303,7 +307,7 @@ public function getCreditsType()
303307

304308
/**
305309
* Sets creditsType
306-
* @param string $creditsType 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.
310+
* @param string $creditsType 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.
307311
* @return $this
308312
*/
309313
public function setCreditsType($creditsType)
@@ -333,7 +337,7 @@ public function getCredits()
333337

334338
/**
335339
* Sets credits
336-
* @param float $credits Remaining credits of the user. This can either be \"User Limit\" or \"Send Limit\" depending on the plan.
340+
* @param float $credits Remaining credits of the user
337341
* @return $this
338342
*/
339343
public function setCredits($credits)
@@ -384,6 +388,27 @@ public function setEndDate($endDate)
384388

385389
return $this;
386390
}
391+
392+
/**
393+
* Gets userLimit
394+
* @return int
395+
*/
396+
public function getUserLimit()
397+
{
398+
return $this->container['userLimit'];
399+
}
400+
401+
/**
402+
* Sets userLimit
403+
* @param int $userLimit Only in case of reseller account. It implies the total number of child accounts you can add to your account.
404+
* @return $this
405+
*/
406+
public function setUserLimit($userLimit)
407+
{
408+
$this->container['userLimit'] = $userLimit;
409+
410+
return $this;
411+
}
387412
/**
388413
* Returns true if offset exists. False otherwise.
389414
* @param integer $offset Offset

test/Api/ContactsApiTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ public function testDeleteAttribute()
132132
{
133133
}
134134

135+
/**
136+
* Test case for deleteContact
137+
*
138+
* Deletes a contact.
139+
*
140+
*/
141+
public function testDeleteContact()
142+
{
143+
}
144+
135145
/**
136146
* Test case for deleteFolder
137147
*

test/Model/GetAccountPlanTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,11 @@ public function testPropertyStartDate()
111111
public function testPropertyEndDate()
112112
{
113113
}
114+
115+
/**
116+
* Test attribute "userLimit"
117+
*/
118+
public function testPropertyUserLimit()
119+
{
120+
}
114121
}

0 commit comments

Comments
 (0)