Skip to content
This repository was archived by the owner on May 18, 2020. It is now read-only.

Commit 0ab4e26

Browse files
committed
MAIL-468: Converting Api wrapper to Object based
1 parent 52dcb76 commit 0ab4e26

File tree

12 files changed

+2139
-821
lines changed

12 files changed

+2139
-821
lines changed

V2.0/Mailin.php

Lines changed: 876 additions & 263 deletions
Large diffs are not rendered by default.

V2.0/README.md

Lines changed: 82 additions & 71 deletions
Large diffs are not rendered by default.

V2.0/examples/README.md

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
* tutorial1.php - Sending a transactional email
44
* tutorial2.php - Get all campaigns
5-
* tutorial3.php - Send an SMS
5+
* tutorial3.php - Send a transactional SMS
66

77
## Available functions
88

@@ -13,73 +13,73 @@ List of API calls that you can make, you can click to read more about it. Please
1313

1414
* [get_account](https://apidocs.sendinblue.com/account/#1)() - Get your account information
1515
* [get_smtp_details](https://apidocs.sendinblue.com/account/#7)() - Get your SMTP account information
16-
* [create_child_account](https://apidocs.sendinblue.com/account/#2)($email,$password,$company_org,$first_name,$last_name,$credits,$associate_ip) - Create a Reseller child account
17-
* [update_child_account](https://apidocs.sendinblue.com/account/#3)($child_authkey,$company_org,$first_name,$last_name,$password,$associate_ip,$disassociate_ip) - Update a Reseller child account
18-
* [delete_child_account](https://apidocs.sendinblue.com/account/#4)($child_authkey) - Delete a Reseller child account
19-
* [get_reseller_child](https://apidocs.sendinblue.com/account/#5)($child_authkey) - Get Reseller child accounts
20-
* [add_remove_child_credits](https://apidocs.sendinblue.com/account/#6)($childauthkey,$add_credits,$remove_credits) - Add/Remove Reseller child credits
21-
* [get_campaigns_v2](https://apidocs.sendinblue.com/campaign/#1)($type,$status,$page,$page_limit) - Get list of all campaigns or of specific type or status or both
22-
* [get_campaign_v2](https://apidocs.sendinblue.com/campaign/#1)($id) - Get specific campaign object
23-
* [create_campaign](https://apidocs.sendinblue.com/campaign/#2)($category,$from_name,$name,$bat_sent,$html_content,$html_url,$listid,$scheduled_date,$subject,$from_email,$reply_to,$to_field,$exclude_list,$attachmentUrl,$inline_image) - Create a campaign
24-
* [delete_campaign](https://apidocs.sendinblue.com/campaign/#3)($id) - Delete a campaign
25-
* [update_campaign](https://apidocs.sendinblue.com/campaign/#4)($id,$category,$from_name,$name,$bat_sent,$html_content,$html_url,$listid,$scheduled_date,$subject,$from_email,$reply_to,$to_field,$exclude_list,$attachmentUrl,$inline_image) - Update campaign information
26-
* [campaign_report_email](https://apidocs.sendinblue.com/campaign/#5)($id,$lang,$email_subject,$email_to,$email_content_type,$email_bcc,$email_cc,$email_body) - Sending reports to specific emails
27-
* [campaign_recipients_export](https://apidocs.sendinblue.com/campaign/#6)($id,$notify_url,$type) - Export recipients of a campaign
28-
* [send_bat_email](https://apidocs.sendinblue.com/campaign/#7)($campid,$email_to) - Send a test Email (bat)
29-
* [create_trigger_campaign](https://apidocs.sendinblue.com/campaign/#8)($category,$from_name,$name,$bat_sent,$html_content,$html_url,$listid,$scheduled_date,$subject,$from_email,$reply_to,$to_field,$exclude_list,$recurring,$attachmentUrl,$inline_image) - Create a trigger campaign
30-
* [update_trigger_campaign](https://apidocs.sendinblue.com/campaign/#9)($id,$category,$from_name,$name,$bat_sent,$html_content,$html_url,$listid,$scheduled_date,$subject,$from_email,$reply_to,$to_field,$exclude_list,$recurring,$attachmentUrl,$inline_image) - Update trigger campaign information
31-
* [share_campaign](https://apidocs.sendinblue.com/campaign/#10)($campaign_ids) - Get campaign share link
32-
* [update_campaign_status](https://apidocs.sendinblue.com/campaign/#11)($id,$status) - Modify a campaign status
33-
* [get_folders](https://apidocs.sendinblue.com/folder/#1)($page,$page_limit) - Get list of all the folder details.
34-
* [get_folder](https://apidocs.sendinblue.com/folder/#2)($id) - Get all the folder details for folder with id <id>
35-
* [create_folder](https://apidocs.sendinblue.com/folder/#3)($name) - Create a folder
36-
* [delete_folder](https://apidocs.sendinblue.com/folder/#4)($id) - Delete folder with folder id <id>
37-
* [update_folder](https://apidocs.sendinblue.com/folder/#5)($id,$name) - Update folder with folder id <id>
38-
* [get_lists](https://apidocs.sendinblue.com/list/#1)($page,$page_limit) - Get all the lists
39-
* [get_list](https://apidocs.sendinblue.com/list/#2)($id) - Get information about a list
40-
* [create_list](https://apidocs.sendinblue.com/list/#3)($list_name,$list_parent) - Create a list
41-
* [delete_list](https://apidocs.sendinblue.com/list/#4)($id) - Delete a list
42-
* [update_list](https://apidocs.sendinblue.com/list/#5)($id,$list_name,$list_parent) - Updating a list
43-
* [display_list_users](https://apidocs.sendinblue.com/list/#8)($listids,$page,$page_limit) - Display details of all users for the given lists
44-
* [add_users_list](https://apidocs.sendinblue.com/list/#6)($id,$users) - Add users to a list
45-
* [delete_users_list](https://apidocs.sendinblue.com/list/#7)($id,$users) - Delete users from a list
16+
* [create_child_account](https://apidocs.sendinblue.com/account/#2)($data) - Create a Reseller child account
17+
* [update_child_account](https://apidocs.sendinblue.com/account/#3)($data) - Update a Reseller child account
18+
* [delete_child_account](https://apidocs.sendinblue.com/account/#4)($data) - Delete a Reseller child account
19+
* [get_reseller_child](https://apidocs.sendinblue.com/account/#5)($data) - Get Reseller child accounts
20+
* [add_remove_child_credits](https://apidocs.sendinblue.com/account/#6)($data) - Add/Remove Reseller child credits
21+
* [get_campaigns_v2](https://apidocs.sendinblue.com/campaign/#1)($data) - Get list of all campaigns or of specific type or status or both
22+
* [get_campaign_v2](https://apidocs.sendinblue.com/campaign/#1)($data) - Get specific campaign object
23+
* [create_campaign](https://apidocs.sendinblue.com/campaign/#2)($data) - Create a campaign
24+
* [delete_campaign](https://apidocs.sendinblue.com/campaign/#3)($data) - Delete a campaign
25+
* [update_campaign](https://apidocs.sendinblue.com/campaign/#4)($data) - Update campaign information
26+
* [campaign_report_email](https://apidocs.sendinblue.com/campaign/#5)($data) - Sending reports to specific emails
27+
* [campaign_recipients_export](https://apidocs.sendinblue.com/campaign/#6)($data) - Export recipients of a campaign
28+
* [send_bat_email](https://apidocs.sendinblue.com/campaign/#7)($data) - Send a test Email (bat)
29+
* [create_trigger_campaign](https://apidocs.sendinblue.com/campaign/#8)($data) - Create a trigger campaign
30+
* [update_trigger_campaign](https://apidocs.sendinblue.com/campaign/#9)($data) - Update trigger campaign information
31+
* [share_campaign](https://apidocs.sendinblue.com/campaign/#10)($data) - Get campaign share link
32+
* [update_campaign_status](https://apidocs.sendinblue.com/campaign/#11)($data) - Modify a campaign status
33+
* [get_folders](https://apidocs.sendinblue.com/folder/#1)($data) - Get list of all the folder details.
34+
* [get_folder](https://apidocs.sendinblue.com/folder/#2)($data) - Get all the folder details for folder with id <id>
35+
* [create_folder](https://apidocs.sendinblue.com/folder/#3)($data) - Create a folder
36+
* [delete_folder](https://apidocs.sendinblue.com/folder/#4)($data) - Delete folder with folder id <id>
37+
* [update_folder](https://apidocs.sendinblue.com/folder/#5)($data) - Update folder with folder id <id>
38+
* [get_lists](https://apidocs.sendinblue.com/list/#1)($data) - Get all the lists
39+
* [get_list](https://apidocs.sendinblue.com/list/#2)($data) - Get information about a list
40+
* [create_list](https://apidocs.sendinblue.com/list/#3)($data) - Create a list
41+
* [delete_list](https://apidocs.sendinblue.com/list/#4)($data) - Delete a list
42+
* [update_list](https://apidocs.sendinblue.com/list/#5)($data) - Updating a list
43+
* [display_list_users](https://apidocs.sendinblue.com/list/#8)($data) - Display details of all users for the given lists
44+
* [add_users_list](https://apidocs.sendinblue.com/list/#6)($data) - Add users to a list
45+
* [delete_users_list](https://apidocs.sendinblue.com/list/#7)($data) - Delete users from a list
4646
* [get_attributes](https://apidocs.sendinblue.com/attribute/#1)() - Listing all attributes
47-
* [get_attribute](https://apidocs.sendinblue.com/attribute/#2)($type) - Listing a certain type attributes
48-
* [create_attribute](https://apidocs.sendinblue.com/attribute/#3)($type,$data) - Creating attributes
49-
* [delete_attribute](https://apidocs.sendinblue.com/attribute/#4)($type,$data) - Deleting attributes of the given type
50-
* [get_user](https://apidocs.sendinblue.com/user/#2)($email) - Get information about a user/email
51-
* [create_update_user](https://apidocs.sendinblue.com/user/#1)($email,$attributes,$blacklisted,$listid,$listid_unlink,$blacklisted_sms) - Create/Update a user information
52-
* [delete_user](https://apidocs.sendinblue.com/user/#3)($email) - Deleting user from db is not permitted but this action will unlink him from all lists
53-
* [import_users](https://apidocs.sendinblue.com/user/#4)($url,$listids,$notify_url,$name,$folder_id) - Import users/emails
54-
* [export_users](https://apidocs.sendinblue.com/user/#5)($export_attrib,$filter,$notify_url) - Export users/emails
55-
* [get_processes](https://apidocs.sendinblue.com/process/#1)($page,$page_limit) - Get information about all background processes
56-
* [get_process](https://apidocs.sendinblue.com/process/#2)($id) - Get information about a specific process
57-
* [get_senders](https://apidocs.sendinblue.com/sender-management/#1)($option) - Get information about all/specific senders
58-
* [create_sender](https://apidocs.sendinblue.com/sender-management/#2)($sender_name,$sender_email,$ip_domain) - Create a sender
59-
* [delete_sender](https://apidocs.sendinblue.com/sender-management/#3)($id) - Delete a sender
60-
* [update_sender](https://apidocs.sendinblue.com/sender-management/#4)($id,$sender_name,$sender_email,$ip_domain) - Update a sender
47+
* [get_attribute](https://apidocs.sendinblue.com/attribute/#2)($data) - Listing a certain type attributes
48+
* [create_attribute](https://apidocs.sendinblue.com/attribute/#3)($data) - Creating attributes
49+
* [delete_attribute](https://apidocs.sendinblue.com/attribute/#4)($data) - Deleting attributes of the given type
50+
* [get_user](https://apidocs.sendinblue.com/user/#2)($data) - Get information about a user/email
51+
* [create_update_user](https://apidocs.sendinblue.com/user/#1)($data) - Create/Update a user information
52+
* [delete_user](https://apidocs.sendinblue.com/user/#3)($data) - Deleting user from db is not permitted but this action will unlink him from all lists
53+
* [import_users](https://apidocs.sendinblue.com/user/#4)($data) - Import users/emails
54+
* [export_users](https://apidocs.sendinblue.com/user/#5)($data) - Export users/emails
55+
* [get_processes](https://apidocs.sendinblue.com/process/#1)($data) - Get information about all background processes
56+
* [get_process](https://apidocs.sendinblue.com/process/#2)($data) - Get information about a specific process
57+
* [get_senders](https://apidocs.sendinblue.com/sender-management/#1)($data) - Get information about all/specific senders
58+
* [create_sender](https://apidocs.sendinblue.com/sender-management/#2)($data) - Create a sender
59+
* [delete_sender](https://apidocs.sendinblue.com/sender-management/#3)($data) - Delete a sender
60+
* [update_sender](https://apidocs.sendinblue.com/sender-management/#4)($data) - Update a sender
6161

6262
### SMTP calls
6363

64-
* [get_report](https://apidocs.sendinblue.com/report/)($limit,$start_date,$end_date,$offset,$date,$days,$email) - Retrieve information for all report events
65-
* [get_statistics](https://apidocs.sendinblue.com/statistics/)($aggregate,$tag,$days,$end_date,$start_date) - Get aggregate statistics about emails sent
66-
* [get_webhooks](https://apidocs.sendinblue.com/webhooks/#1)($is_plat) - Get list of all registered webhooks or of specific type
67-
* [get_webhook](https://apidocs.sendinblue.com/webhooks/#2)($id) - Get information about a webhook
68-
* [create_webhook](https://apidocs.sendinblue.com/webhooks/#3)($url,$description,$events,$is_plat) - Registering a webhook
69-
* [delete_webhook](https://apidocs.sendinblue.com/webhooks/#5)($id) - Deleting a webhook
70-
* [update_webhook](https://apidocs.sendinblue.com/webhooks/#4)($id,$url,$description,$events) - Editing a webhook
71-
* [delete_bounces](https://apidocs.sendinblue.com/bounces/)($start_date,$end_date,$email) - Deleting bounces
72-
* [send_email](https://apidocs.sendinblue.com/tutorial-sending-transactional-email/)($to,$subject,$from,$html,$text,$cc,$bcc,$replyto,$attachment,$headers) - Sending out a transactional email
73-
* [send_transactional_template](https://apidocs.sendinblue.com/template/)($id,$to,$cc,$bcc,$attr,$attachmentUrl,$attachment) - Send templates created on SendinBlue, through SendinBlue smtp.
74-
* [create_template](https://apidocs.sendinblue.com/template/#2)($from_name,$name,$bat_sent,$html_content,$html_url,$subject,$from_email,$reply_to,$to_field,$status,$attach) - Create a template
75-
* [update_template](https://apidocs.sendinblue.com/template/#3)($id,$from_name,$name,$bat_sent,$html_content,$html_url,$subject,$from_email,$reply_to,$to_field,$status,$attach) - Update template information
64+
* [get_report](https://apidocs.sendinblue.com/report/)($data) - Retrieve information for all report events
65+
* [get_statistics](https://apidocs.sendinblue.com/statistics/)($data) - Get aggregate statistics about emails sent
66+
* [get_webhooks](https://apidocs.sendinblue.com/webhooks/#1)($data) - Get list of all registered webhooks or of specific type
67+
* [get_webhook](https://apidocs.sendinblue.com/webhooks/#2)($data) - Get information about a webhook
68+
* [create_webhook](https://apidocs.sendinblue.com/webhooks/#3)($data) - Registering a webhook
69+
* [delete_webhook](https://apidocs.sendinblue.com/webhooks/#5)($data) - Deleting a webhook
70+
* [update_webhook](https://apidocs.sendinblue.com/webhooks/#4)($data) - Editing a webhook
71+
* [delete_bounces](https://apidocs.sendinblue.com/bounces/)($data) - Deleting bounces
72+
* [send_email](https://apidocs.sendinblue.com/tutorial-sending-transactional-email/)($data) - Sending out a transactional email
73+
* [send_transactional_template](https://apidocs.sendinblue.com/template/)($data) - Send templates created on SendinBlue, through SendinBlue smtp.
74+
* [create_template](https://apidocs.sendinblue.com/template/#2)($data) - Create a template
75+
* [update_template](https://apidocs.sendinblue.com/template/#3)($data) - Update template information
7676

7777
### SMS call
7878

79-
* [send_sms](https://apidocs.sendinblue.com/mailin-sms/#1)($to,$from,$text,$web_url,$tag,$type) - Sending a SMS
80-
* [create_sms_campaign](https://apidocs.sendinblue.com/mailin-sms/#2)($camp_name,$sender,$content,$bat_sent,$listids,$exclude_list,$scheduled_date) - Create a SMS campaign
81-
* [update_sms_campaign](https://apidocs.sendinblue.com/mailin-sms/#3)($id,$camp_name,$sender,$content,$bat_sent,$listids,$exclude_list,$scheduled_date) - Update a SMS campaign
82-
* [send_bat_sms](https://apidocs.sendinblue.com/mailin-sms/#4)($campid,$mobilephone) - Send a test SMS campaign
79+
* [send_sms](https://apidocs.sendinblue.com/mailin-sms/#1)($data) - Sending a SMS
80+
* [create_sms_campaign](https://apidocs.sendinblue.com/mailin-sms/#2)($data) - Create a SMS campaign
81+
* [update_sms_campaign](https://apidocs.sendinblue.com/mailin-sms/#3)($data) - Update a SMS campaign
82+
* [send_bat_sms](https://apidocs.sendinblue.com/mailin-sms/#4)($data) - Send a test SMS campaign
8383

8484
####Recommendation:
8585

V2.0/examples/tutorial1.php

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,33 @@
77
*/
88
$mailin = new Mailin('https://api.sendinblue.com/v2.0','Your access key');
99

10+
/*
11+
* This will send a transactional email
12+
*
13+
*/
1014
/** Prepare variables for easy use **/
1115

12-
$to = array("[email protected]"=>"to whom!"); //mandatory
13-
$subject = "My subject"; //mandatory
14-
$from = array("[email protected]","from email!"); //mandatory
15-
$html = "This is the <h1>HTML</h1>"; //mandatory
16-
$text = "This is the text";
17-
$cc = array("[email protected]"=>"cc whom!");
18-
$bcc = array("[email protected]"=>"bcc whom!");
19-
$replyto = array("[email protected]","reply to!");
20-
$attachment = array(); //provide the absolute url of the attachment/s
21-
$headers = array("Content-Type"=> "text/html; charset=iso-8859-1","X-Ewiufkdsjfhn"=> "hello","X-Custom" => "Custom");
16+
$data = array( "to" => array("[email protected]"=>"to whom!"),
17+
"cc" => array("[email protected]"=>"cc whom!"),
18+
"bcc" =>array("[email protected]"=>"bcc whom!"),
19+
"from" => array("[email protected]","from email!"),
20+
"replyto" => array("[email protected]","reply to!"),
21+
"subject" => "My subject",
22+
"text" => "This is the text",
23+
"html" => "This is the <h1>HTML</h1><br/>
24+
This is inline image 1.<br/>
25+
<img src=\"{myinlineimage1.png}\" alt=\"image1\" border=\"0\"><br/>
26+
Some text<br/>
27+
This is inline image 2.<br/>
28+
<img src=\"{myinlineimage2.jpg}\" alt=\"image2\" border=\"0\"><br/>
29+
Some more text<br/>
30+
Re-used inline image 1.<br/>
31+
<img src=\"{myinlineimage1.png}\" alt=\"image3\" border=\"0\">",
32+
"attachment" => array(),
33+
"headers" => array("Content-Type"=> "text/html; charset=iso-8859-1","X-param1"=> "value1", "X-param2"=> "value2","X-Mailin-custom"=>"my custom value", "X-Mailin-IP"=> "102.102.1.2", "X-Mailin-Tag" => "My tag"),
34+
"inline_image" => array('myinlineimage1.png' => "your_png_files_base64_encoded_chunk_data",'myinlineimage2.jpg' => "your_jpg_files_base64_encoded_chunk_data")
35+
);
36+
37+
var_dump($mailin->send_email($data));
2238

23-
var_dump($mailin->send_email($to,$subject,$from,$html,$text,$cc,$bcc,$replyto,$attachment,$headers));
39+
?>

V2.0/examples/tutorial2.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@
66
*
77
*/
88
$mailin = new Mailin('https://api.sendinblue.com/v2.0','Your access key');
9+
910
/*
1011
* This will get all your campaigns
1112
*
1213
*/
13-
var_dump($mailin->get_campaigns_v2());
14+
/** Prepare variables for easy use **/
15+
16+
$data = array( "type"=>"classic",
17+
"status"=>"queued",
18+
"page"=>1,
19+
"page_limit"=>10
20+
);
21+
22+
var_dump($mailin->get_campaigns_v2($data));
1423

15-
?>
24+
?>

V2.0/examples/tutorial3.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,21 @@
66
*
77
*/
88
$mailin = new Mailin('https://api.sendinblue.com/v2.0','Your access key');
9+
910
/*
10-
* This will send an SMS
11+
* This will send a transactional SMS
1112
*
1213
*/
13-
var_dump($mailin->send_sms("1231231313","From!","This is a test","http://example.com","tag1"));
14+
/** Prepare variables for easy use **/
15+
16+
$data = array( "to" => "+331234567890",
17+
"from" => "From",
18+
"text" => "Good morning - test",
19+
"web_url" => "http://example.com",
20+
"tag" => "Tag1",
21+
"type" => ""
22+
);
23+
24+
var_dump($mailin->send_sms($data));
1425

15-
?>
26+
?>

0 commit comments

Comments
 (0)