PluginProbe
MailerLite – WooCommerce integration / 3.1.27
MailerLite – WooCommerce integration v3.1.27
3.1.27 3.1.25 3.1.26 3.1.24 3.1.23 3.1.22 3.1.21 3.1.20 3.1.19 3.1.18 3.1.17 3.1.16 3.1.15 1.8.7 1.8.8 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 All 148 releases
woo-mailerlite / includes / api / WooMailerLiteClassicApi.php

WooMailerLiteClassicApi.php in MailerLite – WooCommerce integration 3.1.27, at includes/api/WooMailerLiteClassicApi.php

139 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class WooMailerLiteClassicApi extends WooMailerLiteApi
4 {
5 const BASE_URL = 'https://api.mailerlite.com/api/v2';
6
7 public function __construct()
8 {
9 parent::__construct(self::BASE_URL);
10 }
11
12 public function validateKey($key)
13 {
14 $this->setApiKey($key);
15 return $this->get('/');
16 }
17
18 public function getGroups($params = [])
19 {
20 return $this->get('/groups', $params);
21 }
22
23 public function getGroupById($id)
24 {
25 return $this->get("/groups/$id");
26 }
27
28 public function setConsumerData($data)
29 {
30 return $this->post('/woocommerce/consumer_data', $data);
31 }
32
33 public function createGroup($group)
34 {
35 return $this->post('/groups', ['name' => $group]);
36 }
37
38 public function sendCart($shop, $cartData)
39 {
40
41 return $this->post('/woocommerce/save_cart', [
42 'cart_data' => $cartData,
43 'shop' => $shop
44 ]);
45 }
46
47 public function sendOrderProcessing($data)
48 {
49 return $this->post('/woocommerce/order_processing', ['data' => $data]);
50 }
51
52 public function getFields()
53 {
54 return $this->get('/fields');
55 }
56
57 public function ping()
58 {
59 return $this->get('/');
60 }
61
62 public function syncProduct()
63 {
64 return $this->successResponse();
65 }
66
67 public function syncCategory()
68 {
69 return $this->successResponse();
70 }
71
72 public function deleteProduct()
73 {
74 return $this->successResponse();
75 }
76
77 public function syncCustomers($data)
78 {
79 return $this->post('/woocommerce/sync_customer', $data);
80 }
81
82 public function importCategories()
83 {
84 return $this->successResponse();
85 }
86
87 public function importProducts()
88 {
89 return $this->successResponse();
90 }
91
92 public function createField($params)
93 {
94 return $this->post('/fields', $params);
95 }
96
97 public function getDoubleOptin()
98 {
99 return $this->get('/settings/double_optin');
100 }
101
102 public function setDoubleOptin($enable)
103 {
104
105 return $this->post('/settings/double_optin', ['enable' => $enable]);
106 }
107
108 public function syncOrder($shop, $orderData)
109 {
110 return $this->post('/woocommerce/alternative_save_order', [
111 'order_data' => $orderData,
112 'shop' => $shop
113 ]);
114 }
115
116 public function sendSubscriberData($data)
117 {
118 return $this->post('/woocommerce/save_subscriber', ['data' => $data]);
119 }
120
121 public function processOrder($data)
122 {
123 return $this->post('/woocommerce/order_processing', ['data' => $data]);
124 }
125
126 public function toggleShop($shop, $state = true)
127 {
128 return $this->post('/woocommerce/toggle_shop_connection', [
129 'active_state' => $state,
130 'shop' => $shop
131 ]);
132 }
133
134 public function searchSubscriber($email)
135 {
136 return $this->get('/subscribers/' . $email);
137 }
138 }
139